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

react-nested-validation

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-nested-validation - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

dist/index.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-nested-validation"]=t(require("react")):e["react-nested-validation"]=t(e.react)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}({0:function(e,t,r){e.exports=r("tjUo")},Al62:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.isNil=function(e){return void 0===e||null===e||""===e},t.isFunc=function(e){return"function"==typeof e},t.capitalize=function(e){return""+e[0].toUpperCase()+e.slice(1)}},"D+7e":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r("pR90"),s=(n=u)&&n.__esModule?n:{default:n};function l(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.errors=s.default.normalizeErrors()}return o(e,[{key:"addFieldError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.default.ERROR,n=this.errors.fields[e]||[];n.push({type:r,message:t}),this.errors.fields[e]=n,this.updateCounts(r)}},{key:"addFormError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.ERROR,r=this.errors.form||[];r.push({type:t,message:e}),this.errors.form=r,this.updateCounts(t)}},{key:"updateCounts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.errors.counts[e]=(this.errors.counts[e]||0)+t}}],[{key:"merge",value:function(e,t){return{fields:i({},e.fields,t.fields),form:[].concat(l(e.form),l(t.form)),counts:this._mergeCounts(e.counts,t.counts)}}},{key:"_mergeCounts",value:function(e,t){var r=i({},e),n=!0,o=!1,u=void 0;try{for(var s,l=Object.entries(t)[Symbol.iterator]();!(n=(s=l.next()).done);n=!0){var f=s.value,c=a(f,2),v=c[0],d=c[1];r[v]=(r[v]||0)+d}}catch(e){o=!0,u=e}finally{try{!n&&l.return&&l.return()}finally{if(o)throw u}}return r}}]),e}();t.default=f},JE77:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=s(r("cDcd")),o=r("Al62"),u=s(r("yK9j"));function s(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}t.default=function(e){return function(t){var r,s,c,v=e.initialPage,d=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["initialPage"]);return(0,u.default)(d)((c=s=function(e){function r(){var e,t,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);for(var i=arguments.length,u=Array(i),s=0;s<i;s++)u[s]=arguments[s];return t=a=f(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(u))),a.state={page:(0,o.isFunc)(v)?v(a.props):v,history:[],visited:{}},a.nextPage=function(e,t,r){var i=a.state,u=i.page,s=i.visited;e&&e.validate(!0);var f=!s[u];e&&(e.state.errors.counts.error>0||e.state.errors.counts.warning>0&&f)?(r&&r(u,e),a.setState({visited:n({},s,l({},u,!0))})):(0,o.isFunc)(t)?t():a.setState({page:t,visited:n({},s,l({},u,!0)),history:[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(a.state.history),[u])})},a.previousPage=function(){var e=a.state.history;e.length>0&&a.setState({page:e[e.length-1],history:e.slice(0,e.length-1)})},a.renderPage=function(e){var t=a.state.page;return e["render"+(0,o.capitalize)(t)]()},f(a,t)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,i.default.Component),a(r,[{key:"render",value:function(){return i.default.createElement(t,n({},this.props,{nextPage:this.nextPage,previousPage:this.previousPage,finishWizard:this.finishWizard,renderPage:this.renderPage}))}}]),r}(),s.Form=e.form,r=c))||r}}},cDcd:function(t,r){t.exports=e},pR90:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a,i,o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r("D+7e"),f=(i=l)&&i.__esModule?i:{default:i},c=r("Al62");function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function h(e,t,r){var n=new e(t=s({},t,{values:s({},t.values||{},r)}));return n.validate(),n.state}var y=(a=n=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.state=e.normalize(t),this.nested={},this.fieldValidators={},this.defaultValues={}}return u(e,[{key:"parse",value:function(e,t){var r=this,n=e;if(Array.isArray(this.nested))e=(e||[]).map(function(e){return(new r.nested[0]).parse(e,t)}),e=[].concat(d(this.state.values||[]),d(e));else{e=e||{};var a=void 0;if(this.fields){a={};var i=!0,u=!1,l=void 0;try{for(var f,v=this.fields[Symbol.iterator]();!(i=(f=v.next()).done);i=!0){var h=f.value;a[h]=e[h]}}catch(e){u=!0,l=e}finally{try{!i&&v.return&&v.return()}finally{if(u)throw l}}}else a=s({},e);if(this.nested){var y=!0,p=!1,m=void 0;try{for(var b,g=Object.entries(this.nested)[Symbol.iterator]();!(y=(b=g.next()).done);y=!0){var w=b.value,O=o(w,2),j=O[0],_=O[1],k=void 0,A=this["initial"+(0,c.capitalize)(j)];k=A?A(e,j):e;var x=new _;a[j]=x.parse(k,t)}}catch(e){p=!0,m=e}finally{try{!y&&g.return&&g.return()}finally{if(p)throw m}}}e=s({},this.state.values||{},a)}return this.parseValues&&(e=this.parseValues(e)),this.state=s({},this.state,{values:e,touched:{},initial:n}),this.render(),this.validate(t),this.state}},{key:"render",value:function(){var e=this.state.values,t=void 0;if(Array.isArray(this.nested))t=e.map(function(e){return e.flat});else{if(this.fields){t={};var r=!0,n=!1,a=void 0;try{for(var i,o=this.fields[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var u=i.value;t[u]=e[u]}}catch(e){n=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw a}}}else t=s({},e);var l=!0,f=!1,v=void 0;try{for(var d,h=Object.keys(this.nested)[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var y=d.value,p=this["render"+(0,c.capitalize)(y)],m=this.state.values[y].flat;p?t=p(t,m):Array.isArray(m)?t[y]=m:t=s({},t,m)}}catch(e){f=!0,v=e}finally{try{!l&&h.return&&h.return()}finally{if(f)throw v}}}return this.state.flat=this.renderValues(t),t}},{key:"renderValues",value:function(e){return e}},{key:"validate",value:function(e){this.forceValidation=e;var t=new f.default,r=this.getValues();if(e){if(Array.isArray(r)){var n=this.nested[0];r=r.map(function(t){var r=new n(t);return r.validate(e),r.state})}else{var a=!0,i=!1,u=void 0;try{for(var l,c=Object.entries(this.nested)[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var v=l.value,d=o(v,2),h=d[0],y=d[1];if(void 0!==r[h]){var p=new y(r[h]);p.validate(e),r[h]=p.state}}}catch(e){i=!0,u=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw u}}}this.state=s({},this.state,{values:r})}if(this.validateFields(t),this.validateForm(t),Array.isArray(r)){var m=!0,b=!1,g=void 0;try{for(var w,O=r[Symbol.iterator]();!(m=(w=O.next()).done);m=!0){var j=w.value.errors,_=void 0===j?{}:j,k=!0,A=!1,x=void 0;try{for(var P,F=Object.entries(_.counts||{})[Symbol.iterator]();!(k=(P=F.next()).done);k=!0){var S=P.value,E=o(S,2),C=E[0],R=E[1];t.updateCounts(C,R)}}catch(e){A=!0,x=e}finally{try{!k&&F.return&&F.return()}finally{if(A)throw x}}}}catch(e){b=!0,g=e}finally{try{!m&&O.return&&O.return()}finally{if(b)throw g}}}else{var V=!0,M=!1,T=void 0;try{for(var z,I=Object.keys(this.nested)[Symbol.iterator]();!(V=(z=I.next()).done);V=!0){var N=(r[z.value]||{}).errors,W=void 0===N?{}:N,q=!0,D=!1,U=void 0;try{for(var G,J=Object.entries(W.counts||{})[Symbol.iterator]();!(q=(G=J.next()).done);q=!0){var K=G.value,L=o(K,2),B=L[0],H=L[1];t.updateCounts(B,H)}}catch(e){D=!0,U=e}finally{try{!q&&J.return&&J.return()}finally{if(D)throw U}}}}catch(e){M=!0,T=e}finally{try{!V&&I.return&&I.return()}finally{if(M)throw T}}}return this.state=s({},this.state,{errors:t.errors}),this.state}},{key:"validateFields",value:function(e){var t=!0,r=!1,n=void 0;try{for(var a,i=this.iterFieldValidators()[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var u=a.value,s=o(u,2),l=s[0],f=s[1];this.isTouched(l)&&f(e,l,this)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}}},{key:"validateForm",value:function(e){}},{key:"iterFieldValidators",value:regeneratorRuntime.mark(function e(){var t,r,n,a,i,u,s,l,f,c,v,d,h,y,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,r=!1,n=void 0,e.prev=3,a=Object.entries(this.fieldValidators)[Symbol.iterator]();case 5:if(t=(i=a.next()).done){e.next=39;break}u=i.value,s=o(u,2),l=s[0],f=s[1],c=!0,v=!1,d=void 0,e.prev=13,h=f[Symbol.iterator]();case 15:if(c=(y=h.next()).done){e.next=22;break}return p=y.value,e.next=19,[l,p];case 19:c=!0,e.next=15;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(13),v=!0,d=e.t0;case 28:e.prev=28,e.prev=29,!c&&h.return&&h.return();case 31:if(e.prev=31,!v){e.next=34;break}throw d;case 34:return e.finish(31);case 35:return e.finish(28);case 36:t=!0,e.next=5;break;case 39:e.next=45;break;case 41:e.prev=41,e.t1=e.catch(3),r=!0,n=e.t1;case 45:e.prev=45,e.prev=46,!t&&a.return&&a.return();case 48:if(e.prev=48,!r){e.next=51;break}throw n;case 51:return e.finish(48);case 52:return e.finish(45);case 53:case"end":return e.stop()}},e,this,[[3,41,45,53],[13,24,28,36],[29,,31,35],[46,,48,52]])})},{key:"updateIn",value:function(e,t){if(void 0===t?t=[]:Array.isArray(t)||(t=t.split(".")),t.length>0){var r=void 0,n=void 0;if(Array.isArray(this.nested))r=parseInt(t[0]),n=new(0,this.nested[0])(this.state.values[r]);else r=t[0],n=new(0,this.nested[r])(this.state.values[r]);n.updateIn(e,t.slice(1)),this.updateValue(r,n.state)}else if(Array.isArray(this.nested)&&Array.isArray(e)){var a=!0,i=!1,u=void 0;try{for(var s,l=e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value;this.updateValue(null,f)}}catch(e){i=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw u}}}else{var c=!0,d=!1,h=void 0;try{for(var y,p=Object.entries(e)[Symbol.iterator]();!(c=(y=p.next()).done);c=!0){var m=y.value,b=o(m,2),g=b[0],w=b[1];if(g.includes(".")){var O=g.split(".");this.updateIn(v({},O[O.length-1],w),O.slice(0,O.length-1))}else this.updateValue(g,w)}}catch(e){d=!0,h=e}finally{try{!c&&p.return&&p.return()}finally{if(d)throw h}}}this.render()}},{key:"updateValue",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getValues(),a=this.state.touched;if(Array.isArray(n)){var i=this.nested[0],o=void 0;o=Array.isArray(e)?e:[e];var u=!0,l=!1,f=void 0;try{for(var c,y=o[Symbol.iterator]();!(u=(c=y.next()).done);u=!0){var p=c.value;if(null===p){var m=new i;m.parse(t),n=[].concat(d(n),[m.state])}else(p=parseInt(p))>=0&&p<n.length&&(n=[].concat(d(n.slice(0,p)),[r.merge?h(this.nested[0],n[p],t):t],d(n.slice(p+1))))}}catch(e){l=!0,f=e}finally{try{!u&&y.return&&y.return()}finally{if(l)throw f}}n=n.filter(function(e){return null!==e})}else n=s({},n,v({},e,t)),a=this.updateTouched(e,t,this.state.touched);this.state=s({},this.state,{values:n,touched:a}),this.state.errors=this.validate()}},{key:"updateTouched",value:function(e,t,r){var n=this.getInitial();return r=this.getTouched(r),s({},r,v({},e,!(!r[e]&&!t&&n[e]==t)))}},{key:"isTouched",value:function(e,t){var r=this.lookupForm(e),n=o(r,2),a=n[0],i=n[1];return this.forceValidation&&(a.touched[i]=!0),a.touched[i]||!1}},{key:"getTouched",value:function(e){return this._getState(e,"touched",{})}},{key:"getInitial",value:function(e){return this._getState(e,"initial",{})}},{key:"getValues",value:function(e){return this._getState(e,"values",this.defaultValues)}},{key:"getValue",value:function(e){var t=this.lookupForm(e),r=o(t,2),n=r[0],a=r[1];return e?n.values[a]:n.values}},{key:"lookupForm",value:function(e){var t=this.state;if(e){var r=e.split("."),n=!0,a=!1,i=void 0;try{for(var o,u=r.slice(0,r.length-1)[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var s=o.value;t=t.values[s]}}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}e=r[r.length-1]}return[t,e]}},{key:"_getState",value:function(e,t,r){return void 0===e&&(e=this.state[t]||r),e}}]),e}(),n.ERROR="error",n.WARNING="warning",n.normalizeErrors=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s({fields:{},form:[],counts:{}},e)},n.normalize=function(e){return s({touched:{},errors:y.normalizeErrors(),values:{}},e)},a);t.default=y},qgJu:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.emptyWarning=t.required=void 0;var n,a=r("pR90"),i=(n=a)&&n.__esModule?n:{default:n},o=r("Al62");var u=function(e,t,r,n,a,i){var u=r.getValue(t);(0,o.isNil)(u)&&e.addFieldError(t,function(e,t,r,n){return e instanceof Function?e(t,r):e||n}(n,t,r,i),a)};(t.required=function e(t){return function(r,n,a){return u(r,n,a,t,i.default.ERROR,e.DEFAULT_MESSAGE)}}).DEFAULT_MESSAGE="This field is required.";t.emptyWarning=function(e){return function(t,r,n){return u(t,r,n,e,i.default.WARNING)}}},tjUo:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Form=t.asFormWizard=t.asForm=void 0;var n=r("qgJu");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var a=u(r("yK9j")),i=u(r("JE77")),o=u(r("pR90"));function u(e){return e&&e.__esModule?e:{default:e}}t.asForm=a.default,t.asFormWizard=i.default,t.Form=o.default},yK9j:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=s(r("cDcd")),o=s(r("pR90")),u=r("Al62");function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r,s;return s=r=function(r){function s(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,t));if(r.getFormClass=function(){return r.props.Form||e.form},r.makeForm=function(e){var t=new(r.getFormClass())(r.getFormState());return e&&t.validate(!0),t},r.getFormState=function(){var e=r.props.form,t=void 0===e?{}:e;(t||{}).values||(t=(new(r.getFormClass())).parse(r.props.initial));return o.default.normalize(n({},t))},r.handleChange2=function(e,t){var n=r.props,a=n.onChange,i=n.formPrefix;if((0,u.isNil)(i)){var o=r.makeForm();o.updateIn(e,t),o.state,a&&a({state:o.state,values:o.flat,payload:e,path:t})}else t=(0,u.isNil)(t)?i:i+"."+t,a&&a(e,t)},r.handleChange=function(e,t,n){var a=r.makeForm();a.updateValue(e,t,n);var i=r.props,o=i.onChange,s=i.formPrefix;o&&((0,u.isNil)(s)?o(a.state,e,t):o(s,a.state))},r.validate=function(e){var t=r.makeForm().validate();r.setState({errors:t})},!t.form){var a=r.makeForm();t.onChange&&t.onChange({state:a.state})}return r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(s,i.default.Component),a(s,[{key:"shouldComponentUpdate",value:function(e){return(e.form||{}).values!=(this.props.form||{}).values||(e.form||{}).errors!=(this.props.form||{}).errors}},{key:"render",value:function(){var e=this.props,r=e.form,a=(e.Form,function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["form","Form"]));return(0,u.isNil)(r)&&(r=this.makeForm(this.props.forceValidation).state),i.default.createElement(t,n({},a,{form:r,onChange:this.handleChange2}))}}]),s}(),r.Form=e.form,s}}}})});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-nested-validation"]=t(require("react")):e["react-nested-validation"]=t(e.react)}(window,function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}({0:function(e,t,r){e.exports=r("tjUo")},Al62:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.isNil=function(e){return void 0===e||null===e||""===e},t.isFunc=function(e){return"function"==typeof e},t.capitalize=function(e){return""+e[0].toUpperCase()+e.slice(1)}},"D+7e":function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r("pR90"),s=(n=u)&&n.__esModule?n:{default:n};function l(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.errors=s.default.normalizeErrors()}return o(e,[{key:"addFieldError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.default.ERROR,n=this.errors.fields[e]||[];n.push({type:r,message:t}),this.errors.fields[e]=n,this.updateCounts(r)}},{key:"addFormError",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.ERROR,r=this.errors.form||[];r.push({type:t,message:e}),this.errors.form=r,this.updateCounts(t)}},{key:"updateCounts",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.errors.counts[e]=(this.errors.counts[e]||0)+t}}],[{key:"merge",value:function(e,t){return{fields:i({},e.fields,t.fields),form:[].concat(l(e.form),l(t.form)),counts:this._mergeCounts(e.counts,t.counts)}}},{key:"_mergeCounts",value:function(e,t){var r=i({},e),n=!0,o=!1,u=void 0;try{for(var s,l=Object.entries(t)[Symbol.iterator]();!(n=(s=l.next()).done);n=!0){var f=s.value,c=a(f,2),v=c[0],d=c[1];r[v]=(r[v]||0)+d}}catch(e){o=!0,u=e}finally{try{!n&&l.return&&l.return()}finally{if(o)throw u}}return r}}]),e}();t.default=f},JE77:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=s(r("cDcd")),o=r("Al62"),u=s(r("yK9j"));function s(e){return e&&e.__esModule?e:{default:e}}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}t.default=function(e){return function(t){var r,s,c,v=e.initialPage,d=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["initialPage"]);return(0,u.default)(d)((c=s=function(e){function r(){var e,t,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);for(var i=arguments.length,u=Array(i),s=0;s<i;s++)u[s]=arguments[s];return t=a=f(this,(e=r.__proto__||Object.getPrototypeOf(r)).call.apply(e,[this].concat(u))),a.state={page:(0,o.isFunc)(v)?v(a.props):v,history:[],visited:{}},a.nextPage=function(e,t,r){var i=a.state,u=i.page,s=i.visited;e&&e.validate(!0);var f=!s[u];e&&(e.state.errors.counts.error>0||e.state.errors.counts.warning>0&&f)?(r&&r(u,e),a.setState({visited:n({},s,l({},u,!0))})):(0,o.isFunc)(t)?t():a.setState({page:t,visited:n({},s,l({},u,!0)),history:[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(a.state.history),[u])})},a.previousPage=function(){var e=a.state.history;e.length>0&&a.setState({page:e[e.length-1],history:e.slice(0,e.length-1)})},a.renderPage=function(e){var t=a.state.page;return e["render"+(0,o.capitalize)(t)]()},f(a,t)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,i.default.Component),a(r,[{key:"render",value:function(){return i.default.createElement(t,n({},this.props,{nextPage:this.nextPage,previousPage:this.previousPage,finishWizard:this.finishWizard,renderPage:this.renderPage}))}}]),r}(),s.Form=e.form,r=c))||r}}},cDcd:function(t,r){t.exports=e},pR90:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,a,i,o=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r("D+7e"),f=(i=l)&&i.__esModule?i:{default:i},c=r("Al62");function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function h(e,t,r){var n=new e(t=s({},t,{values:s({},t.values||{},r)}));return n.validate(),n.state}var y=(a=n=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.state=e.normalize(t),this.nested={},this.fieldValidators={},this.defaultValues={}}return u(e,[{key:"parse",value:function(e,t){var r=this,n=e;if(Array.isArray(this.nested))e=(e||[]).map(function(e){return(new r.nested[0]).parse(e,t)}),e=[].concat(d(this.state.values||[]),d(e));else{e=e||{};var a=void 0;if(this.fields){a={};var i=!0,u=!1,l=void 0;try{for(var f,v=this.fields[Symbol.iterator]();!(i=(f=v.next()).done);i=!0){var h=f.value;a[h]=e[h]}}catch(e){u=!0,l=e}finally{try{!i&&v.return&&v.return()}finally{if(u)throw l}}}else a=s({},e);if(this.nested){var y=!0,p=!1,m=void 0;try{for(var b,g=Object.entries(this.nested)[Symbol.iterator]();!(y=(b=g.next()).done);y=!0){var w=b.value,O=o(w,2),j=O[0],_=O[1],k=void 0,A=this["initial"+(0,c.capitalize)(j)];k=A?A(e,j):e;var x=new _;a[j]=x.parse(k,t)}}catch(e){p=!0,m=e}finally{try{!y&&g.return&&g.return()}finally{if(p)throw m}}}e=s({},this.state.values||{},a)}return this.parseValues&&(e=this.parseValues(e)),this.state=s({},this.state,{values:e,touched:{},initial:n}),this.render(),this.validate(t),this.state}},{key:"render",value:function(){var e=this.state.values,t=void 0;if(Array.isArray(this.nested))t=e.map(function(e){return e.flat});else{if(this.fields){t={};var r=!0,n=!1,a=void 0;try{for(var i,o=this.fields[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var u=i.value;t[u]=e[u]}}catch(e){n=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(n)throw a}}}else t=s({},e);var l=!0,f=!1,v=void 0;try{for(var d,h=Object.keys(this.nested)[Symbol.iterator]();!(l=(d=h.next()).done);l=!0){var y=d.value,p=this["render"+(0,c.capitalize)(y)],m=this.state.values[y].flat;p?t=p(t,m):Array.isArray(m)?t[y]=m:t=s({},t,m)}}catch(e){f=!0,v=e}finally{try{!l&&h.return&&h.return()}finally{if(f)throw v}}}return this.state.flat=this.renderValues(t),t}},{key:"renderValues",value:function(e){return e}},{key:"validate",value:function(e){this.forceValidation=e;var t=new f.default,r=this.getValues();if(e){if(Array.isArray(r)){var n=this.nested[0];r=r.map(function(t){var r=new n(t);return r.validate(e),r.state})}else{var a=!0,i=!1,u=void 0;try{for(var l,c=Object.entries(this.nested)[Symbol.iterator]();!(a=(l=c.next()).done);a=!0){var v=l.value,d=o(v,2),h=d[0],y=d[1];if(void 0!==r[h]){var p=new y(r[h]);p.validate(e),r[h]=p.state}}}catch(e){i=!0,u=e}finally{try{!a&&c.return&&c.return()}finally{if(i)throw u}}}this.state=s({},this.state,{values:r})}if(this.validateFields(t),this.validateForm(t),Array.isArray(r)){var m=!0,b=!1,g=void 0;try{for(var w,O=r[Symbol.iterator]();!(m=(w=O.next()).done);m=!0){var j=w.value.errors,_=void 0===j?{}:j,k=!0,A=!1,x=void 0;try{for(var P,F=Object.entries(_.counts||{})[Symbol.iterator]();!(k=(P=F.next()).done);k=!0){var S=P.value,E=o(S,2),C=E[0],R=E[1];t.updateCounts(C,R)}}catch(e){A=!0,x=e}finally{try{!k&&F.return&&F.return()}finally{if(A)throw x}}}}catch(e){b=!0,g=e}finally{try{!m&&O.return&&O.return()}finally{if(b)throw g}}}else{var V=!0,M=!1,T=void 0;try{for(var z,I=Object.keys(this.nested)[Symbol.iterator]();!(V=(z=I.next()).done);V=!0){var N=(r[z.value]||{}).errors,U=void 0===N?{}:N,W=!0,q=!1,D=void 0;try{for(var G,J=Object.entries(U.counts||{})[Symbol.iterator]();!(W=(G=J.next()).done);W=!0){var K=G.value,L=o(K,2),B=L[0],H=L[1];t.updateCounts(B,H)}}catch(e){q=!0,D=e}finally{try{!W&&J.return&&J.return()}finally{if(q)throw D}}}}catch(e){M=!0,T=e}finally{try{!V&&I.return&&I.return()}finally{if(M)throw T}}}return this.state=s({},this.state,{errors:t.errors}),this.state}},{key:"validateFields",value:function(e){var t=!0,r=!1,n=void 0;try{for(var a,i=this.iterFieldValidators()[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var u=a.value,s=o(u,2),l=s[0],f=s[1];this.isTouched(l)&&f(e,l,this)}}catch(e){r=!0,n=e}finally{try{!t&&i.return&&i.return()}finally{if(r)throw n}}}},{key:"validateForm",value:function(e){}},{key:"iterFieldValidators",value:regeneratorRuntime.mark(function e(){var t,r,n,a,i,u,s,l,f,c,v,d,h,y,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,r=!1,n=void 0,e.prev=3,a=Object.entries(this.fieldValidators)[Symbol.iterator]();case 5:if(t=(i=a.next()).done){e.next=39;break}u=i.value,s=o(u,2),l=s[0],f=s[1],c=!0,v=!1,d=void 0,e.prev=13,h=f[Symbol.iterator]();case 15:if(c=(y=h.next()).done){e.next=22;break}return p=y.value,e.next=19,[l,p];case 19:c=!0,e.next=15;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(13),v=!0,d=e.t0;case 28:e.prev=28,e.prev=29,!c&&h.return&&h.return();case 31:if(e.prev=31,!v){e.next=34;break}throw d;case 34:return e.finish(31);case 35:return e.finish(28);case 36:t=!0,e.next=5;break;case 39:e.next=45;break;case 41:e.prev=41,e.t1=e.catch(3),r=!0,n=e.t1;case 45:e.prev=45,e.prev=46,!t&&a.return&&a.return();case 48:if(e.prev=48,!r){e.next=51;break}throw n;case 51:return e.finish(48);case 52:return e.finish(45);case 53:case"end":return e.stop()}},e,this,[[3,41,45,53],[13,24,28,36],[29,,31,35],[46,,48,52]])})},{key:"updateIn",value:function(e,t){if(void 0===t?t=[]:Array.isArray(t)||(t=t.split(".")),t.length>0){var r=void 0,n=void 0;if(Array.isArray(this.nested))r=parseInt(t[0]),n=new(0,this.nested[0])(this.state.values[r]);else r=t[0],n=new(0,this.nested[r])(this.state.values[r]);n.updateIn(e,t.slice(1)),this.updateValue(r,n.state)}else if(Array.isArray(this.nested)&&Array.isArray(e)){var a=!0,i=!1,u=void 0;try{for(var s,l=e[Symbol.iterator]();!(a=(s=l.next()).done);a=!0){var f=s.value;this.updateValue(null,f)}}catch(e){i=!0,u=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw u}}}else{var c=!0,d=!1,h=void 0;try{for(var y,p=Object.entries(e)[Symbol.iterator]();!(c=(y=p.next()).done);c=!0){var m=y.value,b=o(m,2),g=b[0],w=b[1];if(g.includes(".")){var O=g.split(".");this.updateIn(v({},O[O.length-1],w),O.slice(0,O.length-1))}else this.updateValue(g,w)}}catch(e){d=!0,h=e}finally{try{!c&&p.return&&p.return()}finally{if(d)throw h}}}this.render()}},{key:"updateValue",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=this.getValues(),a=this.state.touched;if(Array.isArray(n)){var i=this.nested[0],o=void 0;o=Array.isArray(e)?e:[e];var u=!0,l=!1,f=void 0;try{for(var c,y=o[Symbol.iterator]();!(u=(c=y.next()).done);u=!0){var p=c.value;if(null===p){var m=new i;m.parse(t),n=[].concat(d(n),[m.state])}else(p=parseInt(p))>=0&&p<n.length&&(n=[].concat(d(n.slice(0,p)),[r.merge?h(this.nested[0],n[p],t):t],d(n.slice(p+1))))}}catch(e){l=!0,f=e}finally{try{!u&&y.return&&y.return()}finally{if(l)throw f}}n=n.filter(function(e){return null!==e})}else n=s({},n,v({},e,t)),a=this.updateTouched(e,t,this.state.touched);this.state=s({},this.state,{values:n,touched:a}),this.state.errors=this.validate()}},{key:"updateTouched",value:function(e,t,r){var n=this.getInitial();return r=this.getTouched(r),s({},r,v({},e,!(!r[e]&&!t&&n[e]==t)))}},{key:"isTouched",value:function(e,t){var r=this.lookupForm(e),n=o(r,2),a=n[0],i=n[1];return this.forceValidation&&(a.touched[i]=!0),a.touched[i]||!1}},{key:"getTouched",value:function(e){return this._getState(e,"touched",{})}},{key:"getInitial",value:function(e){return this._getState(e,"initial",{})}},{key:"getValues",value:function(e){return this._getState(e,"values",this.defaultValues)}},{key:"getValue",value:function(e){var t=this.lookupForm(e),r=o(t,2),n=r[0],a=r[1];return e?n.values[a]:n.values}},{key:"lookupForm",value:function(e){var t=this.state;if(e){var r=e.split("."),n=!0,a=!1,i=void 0;try{for(var o,u=r.slice(0,r.length-1)[Symbol.iterator]();!(n=(o=u.next()).done);n=!0){var s=o.value;t=t.values[s]}}catch(e){a=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw i}}e=r[r.length-1]}return[t,e]}},{key:"_getState",value:function(e,t,r){return void 0===e&&(e=this.state[t]||r),e}}]),e}(),n.ERROR="error",n.WARNING="warning",n.normalizeErrors=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s({fields:{},form:[],counts:{}},e)},n.normalize=function(e){return s({touched:{},errors:y.normalizeErrors(),values:{}},e)},a);t.default=y},qgJu:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.emptyWarning=t.required=void 0;var n,a=r("pR90"),i=(n=a)&&n.__esModule?n:{default:n},o=r("Al62");var u=function(e,t,r,n,a,i){var u=r.getValue(t);(0,o.isNil)(u)&&e.addFieldError(t,function(e,t,r,n){return e instanceof Function?e(t,r):e||n}(n,t,r,i),a)};(t.required=function e(t){return function(r,n,a){return u(r,n,a,t,i.default.ERROR,e.DEFAULT_MESSAGE)}}).DEFAULT_MESSAGE="This field is required.";t.emptyWarning=function(e){return function(t,r,n){return u(t,r,n,e,i.default.WARNING)}}},tjUo:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Form=t.asFormWizard=t.asForm=void 0;var n=r("qgJu");Object.keys(n).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}})});var a=u(r("yK9j")),i=u(r("JE77")),o=u(r("pR90"));function u(e){return e&&e.__esModule?e:{default:e}}t.asForm=a.default,t.asFormWizard=i.default,t.Form=o.default},yK9j:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=s(r("cDcd")),o=s(r("pR90")),u=r("Al62");function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r,s;return s=r=function(r){function s(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,t));if(r.getFormClass=function(){return r.props.Form||e.form},r.makeForm=function(e){var t=new(r.getFormClass())(r.getFormState());return e&&t.validate(!0),t},r.getFormState=function(){var e=r.props.form,t=void 0===e?{}:e;(t||{}).values||(t=(new(r.getFormClass())).parse(r.props.initial));return o.default.normalize(n({},t))},r.handleChange2=function(e,t){var n=r.props,a=n.onChange,i=n.formPrefix;if((0,u.isNil)(i)){var o=r.makeForm();o.updateIn(e,t),o.state,a&&a({state:o.state,values:o.flat,payload:e,path:t})}else t=(0,u.isNil)(t)?i:i+"."+t,a&&a(e,t)},r.handleChange=function(e,t,n){var a=r.makeForm();a.updateValue(e,t,n);var i=r.props,o=i.onChange,s=i.formPrefix;o&&((0,u.isNil)(s)?o(a.state,e,t):o(s,a.state))},r.validate=function(e){var t=r.makeForm().validate();r.setState({errors:t})},!t.form){var a=r.makeForm();t.onChange&&t.onChange({state:a.state})}return r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(s,i.default.Component),a(s,[{key:"shouldComponentUpdate",value:function(e){return(e.form||{}).values!=(this.props.form||{}).values||(e.form||{}).errors!=(this.props.form||{}).errors||this.props.shouldUpdate&&this.props.shouldUpdate(e,this.props)}},{key:"render",value:function(){var e=this.props,r=e.form,a=(e.Form,function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}(e,["form","Form"]));return(0,u.isNil)(r)&&(r=this.makeForm(this.props.forceValidation).state),i.default.createElement(t,n({},a,{form:r,onChange:this.handleChange2}))}}]),s}(),r.Form=e.form,s}}}})});
{
"name": "react-nested-validation",
"version": "0.2.1",
"version": "0.2.2",
"description": "A toolkit for performing nested validation of React forms.",

@@ -5,0 +5,0 @@ "esnext": "src/index.js",

@@ -110,3 +110,5 @@ import React from 'react'

(nextProps.form || {}).values != (this.props.form || {}).values ||
(nextProps.form || {}).errors != (this.props.form || {}).errors
(nextProps.form || {}).errors != (this.props.form || {}).errors || (
this.props.shouldUpdate && this.props.shouldUpdate(nextProps, this.props)
)
)

@@ -113,0 +115,0 @@ }

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