redux-freeform 5.1.0-beta.7 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/redux-freeform.cjs.js +89 -50
- package/dist/redux-freeform.esm.js +89 -51
- package/dist/redux-freeform.umd.js +92 -53
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
5
|
[Read the Docs!](https://citybaseinc.github.io/redux-freeform)
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ it makes no decisions for how you display the form state. As such it does not ne
|
|
|
11
11
|
React and could in theory be used with Angular or any other view library you're using with redux.
|
|
12
12
|
|
|
13
13
|
Freeform supports a functional all-in approach to Redux apps. There are many benefits to keeping _all_ your state in Redux
|
|
14
|
-
but it can be tedious to write out all the reducers and actions. By generating form reducers from simple configs we make
|
|
14
|
+
but it can be tedious to write out all the reducers and actions. By generating form reducers from simple configs we make
|
|
15
15
|
this much more manageable.
|
|
16
16
|
|
|
17
17
|
Freeform takes a form configuration object and generates a `mapStateToProps`, `mapDispatchToProps`,
|
|
@@ -9,25 +9,37 @@ const validatorToPredicate = (validatorFn, emptyCase) => (
|
|
|
9
9
|
|
|
10
10
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
14
|
-
}
|
|
12
|
+
var dayjs_min = {exports: {}};
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else{var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
18
|
-
});
|
|
14
|
+
(function (module, exports) {
|
|
15
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
16
|
+
}(dayjs_min));
|
|
19
17
|
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
}
|
|
18
|
+
var dayjs = dayjs_min.exports;
|
|
19
|
+
|
|
20
|
+
var customParseFormat$1 = {exports: {}};
|
|
21
|
+
|
|
22
|
+
(function (module, exports) {
|
|
23
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
|
|
24
|
+
}(customParseFormat$1));
|
|
25
|
+
|
|
26
|
+
var customParseFormat = customParseFormat$1.exports;
|
|
27
|
+
|
|
28
|
+
var isSameOrBefore$1 = {exports: {}};
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
(function (module, exports) {
|
|
25
31
|
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
26
|
-
});
|
|
32
|
+
}(isSameOrBefore$1));
|
|
33
|
+
|
|
34
|
+
var isSameOrBefore = isSameOrBefore$1.exports;
|
|
35
|
+
|
|
36
|
+
var isSameOrAfter$1 = {exports: {}};
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
(function (module, exports) {
|
|
29
39
|
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
30
|
-
});
|
|
40
|
+
}(isSameOrAfter$1));
|
|
41
|
+
|
|
42
|
+
var isSameOrAfter = isSameOrAfter$1.exports;
|
|
31
43
|
|
|
32
44
|
/* eslint-disable no-unused-vars */
|
|
33
45
|
|
|
@@ -37,9 +49,9 @@ const createValidator = (type, error) => {
|
|
|
37
49
|
return validator;
|
|
38
50
|
};
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
dayjs.extend(customParseFormat);
|
|
53
|
+
dayjs.extend(isSameOrBefore);
|
|
54
|
+
dayjs.extend(isSameOrAfter);
|
|
43
55
|
|
|
44
56
|
let validatorFns = {};
|
|
45
57
|
|
|
@@ -118,15 +130,14 @@ const MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
|
118
130
|
const MATCHES_FIELD_ERROR = "error/MATCHES_FIELD";
|
|
119
131
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
120
132
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (form[args[0]] === undefined) {
|
|
133
|
+
const dependentField = form[args[0]];
|
|
134
|
+
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
135
|
+
if (dependentField === undefined) {
|
|
125
136
|
throw new Error(
|
|
126
137
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
127
138
|
);
|
|
128
139
|
}
|
|
129
|
-
return value ===
|
|
140
|
+
return value === dependentFieldValue;
|
|
130
141
|
};
|
|
131
142
|
|
|
132
143
|
const validateWhenErrorMessage = type =>
|
|
@@ -269,8 +280,8 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
269
280
|
"Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
|
|
270
281
|
);
|
|
271
282
|
}
|
|
272
|
-
const now =
|
|
273
|
-
const dateValue =
|
|
283
|
+
const now = dayjs();
|
|
284
|
+
const dateValue = dayjs(value, dateFormat);
|
|
274
285
|
|
|
275
286
|
if (inclusive === true) {
|
|
276
287
|
return dateValue.isSameOrBefore(now, unit);
|
|
@@ -297,8 +308,8 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
297
308
|
"Date format and unit need to be defined for dateAfterToday, one or both are undefined"
|
|
298
309
|
);
|
|
299
310
|
}
|
|
300
|
-
const now =
|
|
301
|
-
const dateValue =
|
|
311
|
+
const now = dayjs();
|
|
312
|
+
const dateValue = dayjs(value, dateFormat);
|
|
302
313
|
|
|
303
314
|
if (inclusive === true) {
|
|
304
315
|
return dateValue.isSameOrAfter(now, unit);
|
|
@@ -306,6 +317,33 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
306
317
|
return dateValue.isAfter(now, unit);
|
|
307
318
|
};
|
|
308
319
|
|
|
320
|
+
const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
|
|
321
|
+
const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
|
|
322
|
+
const isValidMonth = createValidator(
|
|
323
|
+
IS_VALID_MONTH,
|
|
324
|
+
IS_VALID_MONTH_ERROR
|
|
325
|
+
);
|
|
326
|
+
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
327
|
+
if (value === "") {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
// Function takes one argument representing the character position
|
|
331
|
+
// In a date string to identify where the month is
|
|
332
|
+
// Eg "10/21/2021" - start position is 0
|
|
333
|
+
// Or "18/03/1990" - start position is 3
|
|
334
|
+
// Only works with two digit months (01, 02, 03, etc)
|
|
335
|
+
const monthStartPosition = parseInt(args[0]);
|
|
336
|
+
const monthEndPosition = monthStartPosition + 2;
|
|
337
|
+
if (monthStartPosition === NaN) {
|
|
338
|
+
throw new Error("Month start position has to be a valid integer string");
|
|
339
|
+
}
|
|
340
|
+
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
341
|
+
if (month === NaN) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
return month >= 1 && month <= 12;
|
|
345
|
+
};
|
|
346
|
+
|
|
309
347
|
const MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
310
348
|
const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
311
349
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
@@ -655,7 +693,7 @@ function get(state, prop) {
|
|
|
655
693
|
return value;
|
|
656
694
|
}
|
|
657
695
|
|
|
658
|
-
function set(state, prop, value) {
|
|
696
|
+
function set$1(state, prop, value) {
|
|
659
697
|
assertUnrevoked(state);
|
|
660
698
|
state.assigned[prop] = true;
|
|
661
699
|
|
|
@@ -706,8 +744,8 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
706
744
|
return get(this[DRAFT_STATE], prop);
|
|
707
745
|
},
|
|
708
746
|
|
|
709
|
-
set: function set$1(value) {
|
|
710
|
-
set(this[DRAFT_STATE], prop, value);
|
|
747
|
+
set: function set$1$1(value) {
|
|
748
|
+
set$1(this[DRAFT_STATE], prop, value);
|
|
711
749
|
}
|
|
712
750
|
|
|
713
751
|
};
|
|
@@ -888,7 +926,7 @@ var objectTraps = {
|
|
|
888
926
|
return Reflect.ownKeys(source$1(target));
|
|
889
927
|
},
|
|
890
928
|
|
|
891
|
-
set: set$1,
|
|
929
|
+
set: set$1$1,
|
|
892
930
|
deleteProperty: deleteProperty,
|
|
893
931
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
894
932
|
|
|
@@ -966,7 +1004,7 @@ function get$1(state, prop) {
|
|
|
966
1004
|
return drafts[prop] = createProxy$1(value, state);
|
|
967
1005
|
}
|
|
968
1006
|
|
|
969
|
-
function set$1(state, prop, value) {
|
|
1007
|
+
function set$1$1(state, prop, value) {
|
|
970
1008
|
if (!state.modified) {
|
|
971
1009
|
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
972
1010
|
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
@@ -1189,7 +1227,7 @@ var Immer = function Immer(config) {
|
|
|
1189
1227
|
};
|
|
1190
1228
|
|
|
1191
1229
|
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
1192
|
-
var this$1 = this;
|
|
1230
|
+
var this$1$1 = this;
|
|
1193
1231
|
|
|
1194
1232
|
// curried invocation
|
|
1195
1233
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
@@ -1197,12 +1235,12 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1197
1235
|
recipe = base;
|
|
1198
1236
|
var self = this;
|
|
1199
1237
|
return function curriedProduce(base) {
|
|
1200
|
-
var this$1 = this;
|
|
1238
|
+
var this$1$1 = this;
|
|
1201
1239
|
if ( base === void 0 ) base = defaultBase;
|
|
1202
1240
|
var args = [], len = arguments.length - 1;
|
|
1203
1241
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1204
1242
|
|
|
1205
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
|
|
1243
|
+
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
1206
1244
|
};
|
|
1207
1245
|
} // prettier-ignore
|
|
1208
1246
|
|
|
@@ -1234,7 +1272,7 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1234
1272
|
if (result instanceof Promise) {
|
|
1235
1273
|
return result.then(function (result) {
|
|
1236
1274
|
scope.usePatches(patchListener);
|
|
1237
|
-
return this$1.processResult(result, scope);
|
|
1275
|
+
return this$1$1.processResult(result, scope);
|
|
1238
1276
|
}, function (error) {
|
|
1239
1277
|
scope.revoke();
|
|
1240
1278
|
throw error;
|
|
@@ -1251,14 +1289,14 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1251
1289
|
};
|
|
1252
1290
|
|
|
1253
1291
|
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
1254
|
-
var this$1 = this;
|
|
1292
|
+
var this$1$1 = this;
|
|
1255
1293
|
|
|
1256
1294
|
if (typeof arg1 === "function") {
|
|
1257
1295
|
return function (state) {
|
|
1258
1296
|
var args = [], len = arguments.length - 1;
|
|
1259
1297
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1260
1298
|
|
|
1261
|
-
return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1299
|
+
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1262
1300
|
};
|
|
1263
1301
|
} // non-curried form
|
|
1264
1302
|
|
|
@@ -1383,7 +1421,7 @@ Immer.prototype.processResult = function processResult (result, scope) {
|
|
|
1383
1421
|
|
|
1384
1422
|
|
|
1385
1423
|
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
1386
|
-
var this$1 = this;
|
|
1424
|
+
var this$1$1 = this;
|
|
1387
1425
|
|
|
1388
1426
|
var state = draft[DRAFT_STATE];
|
|
1389
1427
|
|
|
@@ -1417,7 +1455,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
1417
1455
|
var base = state.base;
|
|
1418
1456
|
var copy = state.copy;
|
|
1419
1457
|
each(base, function (prop) {
|
|
1420
|
-
if (!has(copy, prop)) { this$1.onDelete(state, prop); }
|
|
1458
|
+
if (!has(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
1421
1459
|
});
|
|
1422
1460
|
}
|
|
1423
1461
|
}
|
|
@@ -1446,7 +1484,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
1446
1484
|
|
|
1447
1485
|
|
|
1448
1486
|
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
1449
|
-
var this$1 = this;
|
|
1487
|
+
var this$1$1 = this;
|
|
1450
1488
|
|
|
1451
1489
|
var state = root[DRAFT_STATE];
|
|
1452
1490
|
|
|
@@ -1472,7 +1510,7 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
1472
1510
|
if (isDraft(value)) {
|
|
1473
1511
|
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
1474
1512
|
|
|
1475
|
-
value = this$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1513
|
+
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1476
1514
|
|
|
1477
1515
|
if (isDraft(value)) {
|
|
1478
1516
|
scope.canAutoFreeze = false;
|
|
@@ -1497,8 +1535,8 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
1497
1535
|
each(value, finalizeProperty);
|
|
1498
1536
|
}
|
|
1499
1537
|
|
|
1500
|
-
if (isDraftProp && this$1.onAssign) {
|
|
1501
|
-
this$1.onAssign(state, prop, value);
|
|
1538
|
+
if (isDraftProp && this$1$1.onAssign) {
|
|
1539
|
+
this$1$1.onAssign(state, prop, value);
|
|
1502
1540
|
}
|
|
1503
1541
|
};
|
|
1504
1542
|
|
|
@@ -1533,14 +1571,14 @@ var produce = immer.produce;
|
|
|
1533
1571
|
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
1534
1572
|
*/
|
|
1535
1573
|
|
|
1536
|
-
|
|
1574
|
+
immer.produceWithPatches.bind(immer);
|
|
1537
1575
|
/**
|
|
1538
1576
|
* Pass true to automatically freeze all copies created by Immer.
|
|
1539
1577
|
*
|
|
1540
1578
|
* By default, auto-freezing is disabled in production.
|
|
1541
1579
|
*/
|
|
1542
1580
|
|
|
1543
|
-
|
|
1581
|
+
immer.setAutoFreeze.bind(immer);
|
|
1544
1582
|
/**
|
|
1545
1583
|
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
1546
1584
|
* always faster than using ES5 proxies.
|
|
@@ -1548,20 +1586,20 @@ var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
|
1548
1586
|
* By default, feature detection is used, so calling this is rarely necessary.
|
|
1549
1587
|
*/
|
|
1550
1588
|
|
|
1551
|
-
|
|
1589
|
+
immer.setUseProxies.bind(immer);
|
|
1552
1590
|
/**
|
|
1553
1591
|
* Apply an array of Immer patches to the first argument.
|
|
1554
1592
|
*
|
|
1555
1593
|
* This function is a producer, which means copy-on-write is in effect.
|
|
1556
1594
|
*/
|
|
1557
1595
|
|
|
1558
|
-
|
|
1596
|
+
immer.applyPatches.bind(immer);
|
|
1559
1597
|
/**
|
|
1560
1598
|
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
1561
1599
|
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
1562
1600
|
*/
|
|
1563
1601
|
|
|
1564
|
-
|
|
1602
|
+
immer.createDraft.bind(immer);
|
|
1565
1603
|
/**
|
|
1566
1604
|
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
1567
1605
|
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
@@ -1571,7 +1609,7 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
1571
1609
|
* changes that were made.
|
|
1572
1610
|
*/
|
|
1573
1611
|
|
|
1574
|
-
|
|
1612
|
+
immer.finishDraft.bind(immer);
|
|
1575
1613
|
|
|
1576
1614
|
const createInitialState = formConfig => {
|
|
1577
1615
|
let initialForm = {};
|
|
@@ -1596,7 +1634,7 @@ const createInitialState = formConfig => {
|
|
|
1596
1634
|
};
|
|
1597
1635
|
|
|
1598
1636
|
const SET = "field/SET";
|
|
1599
|
-
const set
|
|
1637
|
+
const set = fieldName => value => ({
|
|
1600
1638
|
type: SET,
|
|
1601
1639
|
payload: { fieldName, value }
|
|
1602
1640
|
});
|
|
@@ -1676,7 +1714,7 @@ const createMapDispatchToProps = formConfig => {
|
|
|
1676
1714
|
const keys = Object.keys(formConfig);
|
|
1677
1715
|
for (let fieldName of keys) {
|
|
1678
1716
|
dispatchObj.fields[fieldName] = {
|
|
1679
|
-
set: value => dispatch(set
|
|
1717
|
+
set: value => dispatch(set(fieldName)(value)),
|
|
1680
1718
|
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
1681
1719
|
};
|
|
1682
1720
|
}
|
|
@@ -1705,6 +1743,7 @@ exports.hasSpecialCharacter = hasSpecialCharacter;
|
|
|
1705
1743
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1706
1744
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1707
1745
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1746
|
+
exports.isValidMonth = isValidMonth;
|
|
1708
1747
|
exports.matchesField = matchesField;
|
|
1709
1748
|
exports.matchesRegex = matchesRegex;
|
|
1710
1749
|
exports.numberGreaterThan = numberGreaterThan;
|
|
@@ -5,25 +5,37 @@ const validatorToPredicate = (validatorFn, emptyCase) => (
|
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
10
|
-
}
|
|
8
|
+
var dayjs_min = {exports: {}};
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else{var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
14
|
-
});
|
|
10
|
+
(function (module, exports) {
|
|
11
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
12
|
+
}(dayjs_min));
|
|
15
13
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
}
|
|
14
|
+
var dayjs = dayjs_min.exports;
|
|
15
|
+
|
|
16
|
+
var customParseFormat$1 = {exports: {}};
|
|
17
|
+
|
|
18
|
+
(function (module, exports) {
|
|
19
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
|
|
20
|
+
}(customParseFormat$1));
|
|
21
|
+
|
|
22
|
+
var customParseFormat = customParseFormat$1.exports;
|
|
23
|
+
|
|
24
|
+
var isSameOrBefore$1 = {exports: {}};
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
(function (module, exports) {
|
|
21
27
|
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
22
|
-
});
|
|
28
|
+
}(isSameOrBefore$1));
|
|
29
|
+
|
|
30
|
+
var isSameOrBefore = isSameOrBefore$1.exports;
|
|
31
|
+
|
|
32
|
+
var isSameOrAfter$1 = {exports: {}};
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
(function (module, exports) {
|
|
25
35
|
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
26
|
-
});
|
|
36
|
+
}(isSameOrAfter$1));
|
|
37
|
+
|
|
38
|
+
var isSameOrAfter = isSameOrAfter$1.exports;
|
|
27
39
|
|
|
28
40
|
/* eslint-disable no-unused-vars */
|
|
29
41
|
|
|
@@ -33,9 +45,9 @@ const createValidator = (type, error) => {
|
|
|
33
45
|
return validator;
|
|
34
46
|
};
|
|
35
47
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
dayjs.extend(customParseFormat);
|
|
49
|
+
dayjs.extend(isSameOrBefore);
|
|
50
|
+
dayjs.extend(isSameOrAfter);
|
|
39
51
|
|
|
40
52
|
let validatorFns = {};
|
|
41
53
|
|
|
@@ -114,15 +126,14 @@ const MATCHES_FIELD = "validator/MATCHES_FIELD";
|
|
|
114
126
|
const MATCHES_FIELD_ERROR = "error/MATCHES_FIELD";
|
|
115
127
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
116
128
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (form[args[0]] === undefined) {
|
|
129
|
+
const dependentField = form[args[0]];
|
|
130
|
+
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
131
|
+
if (dependentField === undefined) {
|
|
121
132
|
throw new Error(
|
|
122
133
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
123
134
|
);
|
|
124
135
|
}
|
|
125
|
-
return value ===
|
|
136
|
+
return value === dependentFieldValue;
|
|
126
137
|
};
|
|
127
138
|
|
|
128
139
|
const validateWhenErrorMessage = type =>
|
|
@@ -265,8 +276,8 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
265
276
|
"Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
|
|
266
277
|
);
|
|
267
278
|
}
|
|
268
|
-
const now =
|
|
269
|
-
const dateValue =
|
|
279
|
+
const now = dayjs();
|
|
280
|
+
const dateValue = dayjs(value, dateFormat);
|
|
270
281
|
|
|
271
282
|
if (inclusive === true) {
|
|
272
283
|
return dateValue.isSameOrBefore(now, unit);
|
|
@@ -293,8 +304,8 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
293
304
|
"Date format and unit need to be defined for dateAfterToday, one or both are undefined"
|
|
294
305
|
);
|
|
295
306
|
}
|
|
296
|
-
const now =
|
|
297
|
-
const dateValue =
|
|
307
|
+
const now = dayjs();
|
|
308
|
+
const dateValue = dayjs(value, dateFormat);
|
|
298
309
|
|
|
299
310
|
if (inclusive === true) {
|
|
300
311
|
return dateValue.isSameOrAfter(now, unit);
|
|
@@ -302,6 +313,33 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
302
313
|
return dateValue.isAfter(now, unit);
|
|
303
314
|
};
|
|
304
315
|
|
|
316
|
+
const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
|
|
317
|
+
const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
|
|
318
|
+
const isValidMonth = createValidator(
|
|
319
|
+
IS_VALID_MONTH,
|
|
320
|
+
IS_VALID_MONTH_ERROR
|
|
321
|
+
);
|
|
322
|
+
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
323
|
+
if (value === "") {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
// Function takes one argument representing the character position
|
|
327
|
+
// In a date string to identify where the month is
|
|
328
|
+
// Eg "10/21/2021" - start position is 0
|
|
329
|
+
// Or "18/03/1990" - start position is 3
|
|
330
|
+
// Only works with two digit months (01, 02, 03, etc)
|
|
331
|
+
const monthStartPosition = parseInt(args[0]);
|
|
332
|
+
const monthEndPosition = monthStartPosition + 2;
|
|
333
|
+
if (monthStartPosition === NaN) {
|
|
334
|
+
throw new Error("Month start position has to be a valid integer string");
|
|
335
|
+
}
|
|
336
|
+
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
337
|
+
if (month === NaN) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
return month >= 1 && month <= 12;
|
|
341
|
+
};
|
|
342
|
+
|
|
305
343
|
const MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
306
344
|
const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
307
345
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
@@ -651,7 +689,7 @@ function get(state, prop) {
|
|
|
651
689
|
return value;
|
|
652
690
|
}
|
|
653
691
|
|
|
654
|
-
function set(state, prop, value) {
|
|
692
|
+
function set$1(state, prop, value) {
|
|
655
693
|
assertUnrevoked(state);
|
|
656
694
|
state.assigned[prop] = true;
|
|
657
695
|
|
|
@@ -702,8 +740,8 @@ function proxyProperty(draft, prop, enumerable) {
|
|
|
702
740
|
return get(this[DRAFT_STATE], prop);
|
|
703
741
|
},
|
|
704
742
|
|
|
705
|
-
set: function set$1(value) {
|
|
706
|
-
set(this[DRAFT_STATE], prop, value);
|
|
743
|
+
set: function set$1$1(value) {
|
|
744
|
+
set$1(this[DRAFT_STATE], prop, value);
|
|
707
745
|
}
|
|
708
746
|
|
|
709
747
|
};
|
|
@@ -884,7 +922,7 @@ var objectTraps = {
|
|
|
884
922
|
return Reflect.ownKeys(source$1(target));
|
|
885
923
|
},
|
|
886
924
|
|
|
887
|
-
set: set$1,
|
|
925
|
+
set: set$1$1,
|
|
888
926
|
deleteProperty: deleteProperty,
|
|
889
927
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
890
928
|
|
|
@@ -962,7 +1000,7 @@ function get$1(state, prop) {
|
|
|
962
1000
|
return drafts[prop] = createProxy$1(value, state);
|
|
963
1001
|
}
|
|
964
1002
|
|
|
965
|
-
function set$1(state, prop, value) {
|
|
1003
|
+
function set$1$1(state, prop, value) {
|
|
966
1004
|
if (!state.modified) {
|
|
967
1005
|
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
968
1006
|
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
@@ -1185,7 +1223,7 @@ var Immer = function Immer(config) {
|
|
|
1185
1223
|
};
|
|
1186
1224
|
|
|
1187
1225
|
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
1188
|
-
var this$1 = this;
|
|
1226
|
+
var this$1$1 = this;
|
|
1189
1227
|
|
|
1190
1228
|
// curried invocation
|
|
1191
1229
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
@@ -1193,12 +1231,12 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1193
1231
|
recipe = base;
|
|
1194
1232
|
var self = this;
|
|
1195
1233
|
return function curriedProduce(base) {
|
|
1196
|
-
var this$1 = this;
|
|
1234
|
+
var this$1$1 = this;
|
|
1197
1235
|
if ( base === void 0 ) base = defaultBase;
|
|
1198
1236
|
var args = [], len = arguments.length - 1;
|
|
1199
1237
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1200
1238
|
|
|
1201
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
|
|
1239
|
+
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
1202
1240
|
};
|
|
1203
1241
|
} // prettier-ignore
|
|
1204
1242
|
|
|
@@ -1230,7 +1268,7 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1230
1268
|
if (result instanceof Promise) {
|
|
1231
1269
|
return result.then(function (result) {
|
|
1232
1270
|
scope.usePatches(patchListener);
|
|
1233
|
-
return this$1.processResult(result, scope);
|
|
1271
|
+
return this$1$1.processResult(result, scope);
|
|
1234
1272
|
}, function (error) {
|
|
1235
1273
|
scope.revoke();
|
|
1236
1274
|
throw error;
|
|
@@ -1247,14 +1285,14 @@ Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
|
1247
1285
|
};
|
|
1248
1286
|
|
|
1249
1287
|
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
1250
|
-
var this$1 = this;
|
|
1288
|
+
var this$1$1 = this;
|
|
1251
1289
|
|
|
1252
1290
|
if (typeof arg1 === "function") {
|
|
1253
1291
|
return function (state) {
|
|
1254
1292
|
var args = [], len = arguments.length - 1;
|
|
1255
1293
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1256
1294
|
|
|
1257
|
-
return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1295
|
+
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1258
1296
|
};
|
|
1259
1297
|
} // non-curried form
|
|
1260
1298
|
|
|
@@ -1379,7 +1417,7 @@ Immer.prototype.processResult = function processResult (result, scope) {
|
|
|
1379
1417
|
|
|
1380
1418
|
|
|
1381
1419
|
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
1382
|
-
var this$1 = this;
|
|
1420
|
+
var this$1$1 = this;
|
|
1383
1421
|
|
|
1384
1422
|
var state = draft[DRAFT_STATE];
|
|
1385
1423
|
|
|
@@ -1413,7 +1451,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
1413
1451
|
var base = state.base;
|
|
1414
1452
|
var copy = state.copy;
|
|
1415
1453
|
each(base, function (prop) {
|
|
1416
|
-
if (!has(copy, prop)) { this$1.onDelete(state, prop); }
|
|
1454
|
+
if (!has(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
1417
1455
|
});
|
|
1418
1456
|
}
|
|
1419
1457
|
}
|
|
@@ -1442,7 +1480,7 @@ Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
|
1442
1480
|
|
|
1443
1481
|
|
|
1444
1482
|
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
1445
|
-
var this$1 = this;
|
|
1483
|
+
var this$1$1 = this;
|
|
1446
1484
|
|
|
1447
1485
|
var state = root[DRAFT_STATE];
|
|
1448
1486
|
|
|
@@ -1468,7 +1506,7 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
1468
1506
|
if (isDraft(value)) {
|
|
1469
1507
|
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
1470
1508
|
|
|
1471
|
-
value = this$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1509
|
+
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1472
1510
|
|
|
1473
1511
|
if (isDraft(value)) {
|
|
1474
1512
|
scope.canAutoFreeze = false;
|
|
@@ -1493,8 +1531,8 @@ Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
|
1493
1531
|
each(value, finalizeProperty);
|
|
1494
1532
|
}
|
|
1495
1533
|
|
|
1496
|
-
if (isDraftProp && this$1.onAssign) {
|
|
1497
|
-
this$1.onAssign(state, prop, value);
|
|
1534
|
+
if (isDraftProp && this$1$1.onAssign) {
|
|
1535
|
+
this$1$1.onAssign(state, prop, value);
|
|
1498
1536
|
}
|
|
1499
1537
|
};
|
|
1500
1538
|
|
|
@@ -1529,14 +1567,14 @@ var produce = immer.produce;
|
|
|
1529
1567
|
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
1530
1568
|
*/
|
|
1531
1569
|
|
|
1532
|
-
|
|
1570
|
+
immer.produceWithPatches.bind(immer);
|
|
1533
1571
|
/**
|
|
1534
1572
|
* Pass true to automatically freeze all copies created by Immer.
|
|
1535
1573
|
*
|
|
1536
1574
|
* By default, auto-freezing is disabled in production.
|
|
1537
1575
|
*/
|
|
1538
1576
|
|
|
1539
|
-
|
|
1577
|
+
immer.setAutoFreeze.bind(immer);
|
|
1540
1578
|
/**
|
|
1541
1579
|
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
1542
1580
|
* always faster than using ES5 proxies.
|
|
@@ -1544,20 +1582,20 @@ var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
|
1544
1582
|
* By default, feature detection is used, so calling this is rarely necessary.
|
|
1545
1583
|
*/
|
|
1546
1584
|
|
|
1547
|
-
|
|
1585
|
+
immer.setUseProxies.bind(immer);
|
|
1548
1586
|
/**
|
|
1549
1587
|
* Apply an array of Immer patches to the first argument.
|
|
1550
1588
|
*
|
|
1551
1589
|
* This function is a producer, which means copy-on-write is in effect.
|
|
1552
1590
|
*/
|
|
1553
1591
|
|
|
1554
|
-
|
|
1592
|
+
immer.applyPatches.bind(immer);
|
|
1555
1593
|
/**
|
|
1556
1594
|
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
1557
1595
|
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
1558
1596
|
*/
|
|
1559
1597
|
|
|
1560
|
-
|
|
1598
|
+
immer.createDraft.bind(immer);
|
|
1561
1599
|
/**
|
|
1562
1600
|
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
1563
1601
|
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
@@ -1567,7 +1605,7 @@ var createDraft = immer.createDraft.bind(immer);
|
|
|
1567
1605
|
* changes that were made.
|
|
1568
1606
|
*/
|
|
1569
1607
|
|
|
1570
|
-
|
|
1608
|
+
immer.finishDraft.bind(immer);
|
|
1571
1609
|
|
|
1572
1610
|
const createInitialState = formConfig => {
|
|
1573
1611
|
let initialForm = {};
|
|
@@ -1592,7 +1630,7 @@ const createInitialState = formConfig => {
|
|
|
1592
1630
|
};
|
|
1593
1631
|
|
|
1594
1632
|
const SET = "field/SET";
|
|
1595
|
-
const set
|
|
1633
|
+
const set = fieldName => value => ({
|
|
1596
1634
|
type: SET,
|
|
1597
1635
|
payload: { fieldName, value }
|
|
1598
1636
|
});
|
|
@@ -1672,7 +1710,7 @@ const createMapDispatchToProps = formConfig => {
|
|
|
1672
1710
|
const keys = Object.keys(formConfig);
|
|
1673
1711
|
for (let fieldName of keys) {
|
|
1674
1712
|
dispatchObj.fields[fieldName] = {
|
|
1675
|
-
set: value => dispatch(set
|
|
1713
|
+
set: value => dispatch(set(fieldName)(value)),
|
|
1676
1714
|
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
1677
1715
|
};
|
|
1678
1716
|
}
|
|
@@ -1691,4 +1729,4 @@ const createFormState = formConfig => ({
|
|
|
1691
1729
|
mapStateToProps: mapStateToProps
|
|
1692
1730
|
});
|
|
1693
1731
|
|
|
1694
|
-
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, isProbablyEmail, isRoutingNumber, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyIntegers, onlyNaturals, required, validateSum, validateWhen };
|
|
1732
|
+
export { createFormState, dateAfterToday, dateBeforeToday, hasLength, hasLowercaseLetter, hasNumber, hasSpecialCharacter, hasUppercaseLetter, isProbablyEmail, isRoutingNumber, isValidMonth, matchesField, matchesRegex, numberGreaterThan, numberGreaterThanOrEqualTo, numberLessThan, numberLessThanOrEqualTo, onlyIntegers, onlyNaturals, required, validateSum, validateWhen };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = global || self, factory(global[
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["redux-freeform"] = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const validatorToPredicate = (validatorFn, emptyCase) => (
|
|
8
8
|
value,
|
|
@@ -11,25 +11,37 @@
|
|
|
11
11
|
|
|
12
12
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
16
|
-
}
|
|
14
|
+
var dayjs_min = {exports: {}};
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else{var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
20
|
-
});
|
|
16
|
+
(function (module, exports) {
|
|
17
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
18
|
+
}(dayjs_min));
|
|
21
19
|
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
}
|
|
20
|
+
var dayjs = dayjs_min.exports;
|
|
21
|
+
|
|
22
|
+
var customParseFormat$1 = {exports: {}};
|
|
23
|
+
|
|
24
|
+
(function (module, exports) {
|
|
25
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
|
|
26
|
+
}(customParseFormat$1));
|
|
27
|
+
|
|
28
|
+
var customParseFormat = customParseFormat$1.exports;
|
|
29
|
+
|
|
30
|
+
var isSameOrBefore$1 = {exports: {}};
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
(function (module, exports) {
|
|
27
33
|
!function(e,i){module.exports=i();}(commonjsGlobal,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
28
|
-
});
|
|
34
|
+
}(isSameOrBefore$1));
|
|
35
|
+
|
|
36
|
+
var isSameOrBefore = isSameOrBefore$1.exports;
|
|
37
|
+
|
|
38
|
+
var isSameOrAfter$1 = {exports: {}};
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
(function (module, exports) {
|
|
31
41
|
!function(e,t){module.exports=t();}(commonjsGlobal,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
32
|
-
});
|
|
42
|
+
}(isSameOrAfter$1));
|
|
43
|
+
|
|
44
|
+
var isSameOrAfter = isSameOrAfter$1.exports;
|
|
33
45
|
|
|
34
46
|
/* eslint-disable no-unused-vars */
|
|
35
47
|
|
|
@@ -39,9 +51,9 @@
|
|
|
39
51
|
return validator;
|
|
40
52
|
};
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
dayjs.extend(customParseFormat);
|
|
55
|
+
dayjs.extend(isSameOrBefore);
|
|
56
|
+
dayjs.extend(isSameOrAfter);
|
|
45
57
|
|
|
46
58
|
let validatorFns = {};
|
|
47
59
|
|
|
@@ -120,15 +132,14 @@
|
|
|
120
132
|
const MATCHES_FIELD_ERROR = "error/MATCHES_FIELD";
|
|
121
133
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR);
|
|
122
134
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (form[args[0]] === undefined) {
|
|
135
|
+
const dependentField = form[args[0]];
|
|
136
|
+
const dependentFieldValue = dependentField?.rawValue ?? "";
|
|
137
|
+
if (dependentField === undefined) {
|
|
127
138
|
throw new Error(
|
|
128
139
|
`${args[0]} was passed to matchesField, but that field does not exist in the form`
|
|
129
140
|
);
|
|
130
141
|
}
|
|
131
|
-
return value ===
|
|
142
|
+
return value === dependentFieldValue;
|
|
132
143
|
};
|
|
133
144
|
|
|
134
145
|
const validateWhenErrorMessage = type =>
|
|
@@ -271,8 +282,8 @@
|
|
|
271
282
|
"Date format and unit need to be defined for dateBeforeToday, one or both are undefined"
|
|
272
283
|
);
|
|
273
284
|
}
|
|
274
|
-
const now =
|
|
275
|
-
const dateValue =
|
|
285
|
+
const now = dayjs();
|
|
286
|
+
const dateValue = dayjs(value, dateFormat);
|
|
276
287
|
|
|
277
288
|
if (inclusive === true) {
|
|
278
289
|
return dateValue.isSameOrBefore(now, unit);
|
|
@@ -299,8 +310,8 @@
|
|
|
299
310
|
"Date format and unit need to be defined for dateAfterToday, one or both are undefined"
|
|
300
311
|
);
|
|
301
312
|
}
|
|
302
|
-
const now =
|
|
303
|
-
const dateValue =
|
|
313
|
+
const now = dayjs();
|
|
314
|
+
const dateValue = dayjs(value, dateFormat);
|
|
304
315
|
|
|
305
316
|
if (inclusive === true) {
|
|
306
317
|
return dateValue.isSameOrAfter(now, unit);
|
|
@@ -308,6 +319,33 @@
|
|
|
308
319
|
return dateValue.isAfter(now, unit);
|
|
309
320
|
};
|
|
310
321
|
|
|
322
|
+
const IS_VALID_MONTH = "validator/IS_VALID_MONTH";
|
|
323
|
+
const IS_VALID_MONTH_ERROR = "error/IS_VALID_MONTH";
|
|
324
|
+
const isValidMonth = createValidator(
|
|
325
|
+
IS_VALID_MONTH,
|
|
326
|
+
IS_VALID_MONTH_ERROR
|
|
327
|
+
);
|
|
328
|
+
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
329
|
+
if (value === "") {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
// Function takes one argument representing the character position
|
|
333
|
+
// In a date string to identify where the month is
|
|
334
|
+
// Eg "10/21/2021" - start position is 0
|
|
335
|
+
// Or "18/03/1990" - start position is 3
|
|
336
|
+
// Only works with two digit months (01, 02, 03, etc)
|
|
337
|
+
const monthStartPosition = parseInt(args[0]);
|
|
338
|
+
const monthEndPosition = monthStartPosition + 2;
|
|
339
|
+
if (monthStartPosition === NaN) {
|
|
340
|
+
throw new Error("Month start position has to be a valid integer string");
|
|
341
|
+
}
|
|
342
|
+
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
343
|
+
if (month === NaN) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
return month >= 1 && month <= 12;
|
|
347
|
+
};
|
|
348
|
+
|
|
311
349
|
const MATCHES_REGEX = "validator/MATCHES_REGEX";
|
|
312
350
|
const MATCHES_REGEX_ERROR = "error/MATCHES_REGEX";
|
|
313
351
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
@@ -657,7 +695,7 @@
|
|
|
657
695
|
return value;
|
|
658
696
|
}
|
|
659
697
|
|
|
660
|
-
function set(state, prop, value) {
|
|
698
|
+
function set$1(state, prop, value) {
|
|
661
699
|
assertUnrevoked(state);
|
|
662
700
|
state.assigned[prop] = true;
|
|
663
701
|
|
|
@@ -708,8 +746,8 @@
|
|
|
708
746
|
return get(this[DRAFT_STATE], prop);
|
|
709
747
|
},
|
|
710
748
|
|
|
711
|
-
set: function set$1(value) {
|
|
712
|
-
set(this[DRAFT_STATE], prop, value);
|
|
749
|
+
set: function set$1$1(value) {
|
|
750
|
+
set$1(this[DRAFT_STATE], prop, value);
|
|
713
751
|
}
|
|
714
752
|
|
|
715
753
|
};
|
|
@@ -890,7 +928,7 @@
|
|
|
890
928
|
return Reflect.ownKeys(source$1(target));
|
|
891
929
|
},
|
|
892
930
|
|
|
893
|
-
set: set$1,
|
|
931
|
+
set: set$1$1,
|
|
894
932
|
deleteProperty: deleteProperty,
|
|
895
933
|
getOwnPropertyDescriptor: getOwnPropertyDescriptor,
|
|
896
934
|
|
|
@@ -968,7 +1006,7 @@
|
|
|
968
1006
|
return drafts[prop] = createProxy$1(value, state);
|
|
969
1007
|
}
|
|
970
1008
|
|
|
971
|
-
function set$1(state, prop, value) {
|
|
1009
|
+
function set$1$1(state, prop, value) {
|
|
972
1010
|
if (!state.modified) {
|
|
973
1011
|
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
974
1012
|
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
@@ -1191,7 +1229,7 @@
|
|
|
1191
1229
|
};
|
|
1192
1230
|
|
|
1193
1231
|
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
1194
|
-
var this$1 = this;
|
|
1232
|
+
var this$1$1 = this;
|
|
1195
1233
|
|
|
1196
1234
|
// curried invocation
|
|
1197
1235
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
@@ -1199,12 +1237,12 @@
|
|
|
1199
1237
|
recipe = base;
|
|
1200
1238
|
var self = this;
|
|
1201
1239
|
return function curriedProduce(base) {
|
|
1202
|
-
var this$1 = this;
|
|
1240
|
+
var this$1$1 = this;
|
|
1203
1241
|
if ( base === void 0 ) base = defaultBase;
|
|
1204
1242
|
var args = [], len = arguments.length - 1;
|
|
1205
1243
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1206
1244
|
|
|
1207
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1, draft ].concat( args )); }); // prettier-ignore
|
|
1245
|
+
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
1208
1246
|
};
|
|
1209
1247
|
} // prettier-ignore
|
|
1210
1248
|
|
|
@@ -1236,7 +1274,7 @@
|
|
|
1236
1274
|
if (result instanceof Promise) {
|
|
1237
1275
|
return result.then(function (result) {
|
|
1238
1276
|
scope.usePatches(patchListener);
|
|
1239
|
-
return this$1.processResult(result, scope);
|
|
1277
|
+
return this$1$1.processResult(result, scope);
|
|
1240
1278
|
}, function (error) {
|
|
1241
1279
|
scope.revoke();
|
|
1242
1280
|
throw error;
|
|
@@ -1253,14 +1291,14 @@
|
|
|
1253
1291
|
};
|
|
1254
1292
|
|
|
1255
1293
|
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
1256
|
-
var this$1 = this;
|
|
1294
|
+
var this$1$1 = this;
|
|
1257
1295
|
|
|
1258
1296
|
if (typeof arg1 === "function") {
|
|
1259
1297
|
return function (state) {
|
|
1260
1298
|
var args = [], len = arguments.length - 1;
|
|
1261
1299
|
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
1262
1300
|
|
|
1263
|
-
return this$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1301
|
+
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
1264
1302
|
};
|
|
1265
1303
|
} // non-curried form
|
|
1266
1304
|
|
|
@@ -1385,7 +1423,7 @@
|
|
|
1385
1423
|
|
|
1386
1424
|
|
|
1387
1425
|
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
1388
|
-
var this$1 = this;
|
|
1426
|
+
var this$1$1 = this;
|
|
1389
1427
|
|
|
1390
1428
|
var state = draft[DRAFT_STATE];
|
|
1391
1429
|
|
|
@@ -1419,7 +1457,7 @@
|
|
|
1419
1457
|
var base = state.base;
|
|
1420
1458
|
var copy = state.copy;
|
|
1421
1459
|
each(base, function (prop) {
|
|
1422
|
-
if (!has(copy, prop)) { this$1.onDelete(state, prop); }
|
|
1460
|
+
if (!has(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
1423
1461
|
});
|
|
1424
1462
|
}
|
|
1425
1463
|
}
|
|
@@ -1448,7 +1486,7 @@
|
|
|
1448
1486
|
|
|
1449
1487
|
|
|
1450
1488
|
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
1451
|
-
var this$1 = this;
|
|
1489
|
+
var this$1$1 = this;
|
|
1452
1490
|
|
|
1453
1491
|
var state = root[DRAFT_STATE];
|
|
1454
1492
|
|
|
@@ -1474,7 +1512,7 @@
|
|
|
1474
1512
|
if (isDraft(value)) {
|
|
1475
1513
|
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
1476
1514
|
|
|
1477
|
-
value = this$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1515
|
+
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
1478
1516
|
|
|
1479
1517
|
if (isDraft(value)) {
|
|
1480
1518
|
scope.canAutoFreeze = false;
|
|
@@ -1499,8 +1537,8 @@
|
|
|
1499
1537
|
each(value, finalizeProperty);
|
|
1500
1538
|
}
|
|
1501
1539
|
|
|
1502
|
-
if (isDraftProp && this$1.onAssign) {
|
|
1503
|
-
this$1.onAssign(state, prop, value);
|
|
1540
|
+
if (isDraftProp && this$1$1.onAssign) {
|
|
1541
|
+
this$1$1.onAssign(state, prop, value);
|
|
1504
1542
|
}
|
|
1505
1543
|
};
|
|
1506
1544
|
|
|
@@ -1535,14 +1573,14 @@
|
|
|
1535
1573
|
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
1536
1574
|
*/
|
|
1537
1575
|
|
|
1538
|
-
|
|
1576
|
+
immer.produceWithPatches.bind(immer);
|
|
1539
1577
|
/**
|
|
1540
1578
|
* Pass true to automatically freeze all copies created by Immer.
|
|
1541
1579
|
*
|
|
1542
1580
|
* By default, auto-freezing is disabled in production.
|
|
1543
1581
|
*/
|
|
1544
1582
|
|
|
1545
|
-
|
|
1583
|
+
immer.setAutoFreeze.bind(immer);
|
|
1546
1584
|
/**
|
|
1547
1585
|
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
1548
1586
|
* always faster than using ES5 proxies.
|
|
@@ -1550,20 +1588,20 @@
|
|
|
1550
1588
|
* By default, feature detection is used, so calling this is rarely necessary.
|
|
1551
1589
|
*/
|
|
1552
1590
|
|
|
1553
|
-
|
|
1591
|
+
immer.setUseProxies.bind(immer);
|
|
1554
1592
|
/**
|
|
1555
1593
|
* Apply an array of Immer patches to the first argument.
|
|
1556
1594
|
*
|
|
1557
1595
|
* This function is a producer, which means copy-on-write is in effect.
|
|
1558
1596
|
*/
|
|
1559
1597
|
|
|
1560
|
-
|
|
1598
|
+
immer.applyPatches.bind(immer);
|
|
1561
1599
|
/**
|
|
1562
1600
|
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
1563
1601
|
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
1564
1602
|
*/
|
|
1565
1603
|
|
|
1566
|
-
|
|
1604
|
+
immer.createDraft.bind(immer);
|
|
1567
1605
|
/**
|
|
1568
1606
|
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
1569
1607
|
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
@@ -1573,7 +1611,7 @@
|
|
|
1573
1611
|
* changes that were made.
|
|
1574
1612
|
*/
|
|
1575
1613
|
|
|
1576
|
-
|
|
1614
|
+
immer.finishDraft.bind(immer);
|
|
1577
1615
|
|
|
1578
1616
|
const createInitialState = formConfig => {
|
|
1579
1617
|
let initialForm = {};
|
|
@@ -1598,7 +1636,7 @@
|
|
|
1598
1636
|
};
|
|
1599
1637
|
|
|
1600
1638
|
const SET = "field/SET";
|
|
1601
|
-
const set
|
|
1639
|
+
const set = fieldName => value => ({
|
|
1602
1640
|
type: SET,
|
|
1603
1641
|
payload: { fieldName, value }
|
|
1604
1642
|
});
|
|
@@ -1678,7 +1716,7 @@
|
|
|
1678
1716
|
const keys = Object.keys(formConfig);
|
|
1679
1717
|
for (let fieldName of keys) {
|
|
1680
1718
|
dispatchObj.fields[fieldName] = {
|
|
1681
|
-
set: value => dispatch(set
|
|
1719
|
+
set: value => dispatch(set(fieldName)(value)),
|
|
1682
1720
|
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
1683
1721
|
};
|
|
1684
1722
|
}
|
|
@@ -1707,6 +1745,7 @@
|
|
|
1707
1745
|
exports.hasUppercaseLetter = hasUppercaseLetter;
|
|
1708
1746
|
exports.isProbablyEmail = isProbablyEmail;
|
|
1709
1747
|
exports.isRoutingNumber = isRoutingNumber;
|
|
1748
|
+
exports.isValidMonth = isValidMonth;
|
|
1710
1749
|
exports.matchesField = matchesField;
|
|
1711
1750
|
exports.matchesRegex = matchesRegex;
|
|
1712
1751
|
exports.numberGreaterThan = numberGreaterThan;
|
|
@@ -1721,4 +1760,4 @@
|
|
|
1721
1760
|
|
|
1722
1761
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1723
1762
|
|
|
1724
|
-
}))
|
|
1763
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redux-freeform",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "A small Redux form library that supports purely functional apps, without magic",
|
|
5
5
|
"main": "dist/redux-freeform.cjs.js",
|
|
6
6
|
"module": "dist/redux-freeform.esm.js",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"@babel/core": "^7.4.5",
|
|
19
19
|
"@babel/preset-env": "^7.4.5",
|
|
20
20
|
"@babel/register": "^7.4.4",
|
|
21
|
+
"@rollup/plugin-commonjs": "^21.0.2",
|
|
22
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
21
23
|
"ava": "^2.1.0",
|
|
22
24
|
"ava-fast-check": "^1.1.1",
|
|
23
25
|
"babel-eslint": "^10.0.2",
|
|
@@ -32,9 +34,7 @@
|
|
|
32
34
|
"nyc": "^14.1.1",
|
|
33
35
|
"prettier": "^1.19.1",
|
|
34
36
|
"prettier-eslint": "^9.0.0",
|
|
35
|
-
"rollup": "
|
|
36
|
-
"rollup-plugin-commonjs": "^10.0.0",
|
|
37
|
-
"rollup-plugin-node-resolve": "^5.1.0"
|
|
37
|
+
"rollup": "2.69.1"
|
|
38
38
|
},
|
|
39
39
|
"resolutions": {
|
|
40
40
|
"acorn": "^6.4.1",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"instrument": false
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
+
"acorn": "^6.4.1",
|
|
70
71
|
"dayjs": "^1.10.7",
|
|
71
72
|
"immer": "^3.1.3"
|
|
72
73
|
}
|