@thecb/components 9.0.6-beta.1 → 9.0.6-beta.3
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/dist/index.cjs.js +233 -1328
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +233 -1328
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-select/FormSelect.js +3 -1
- package/src/components/atoms/form-select/index.d.ts +2 -2
- /package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -24197,7 +24197,9 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24197
24197
|
_ref$smoothScroll = _ref.smoothScroll,
|
|
24198
24198
|
smoothScroll = _ref$smoothScroll === void 0 ? true : _ref$smoothScroll,
|
|
24199
24199
|
_ref$dataQa = _ref.dataQa,
|
|
24200
|
-
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa
|
|
24200
|
+
dataQa = _ref$dataQa === void 0 ? null : _ref$dataQa,
|
|
24201
|
+
_ref$widthFitOptions = _ref.widthFitOptions,
|
|
24202
|
+
widthFitOptions = _ref$widthFitOptions === void 0 ? false : _ref$widthFitOptions;
|
|
24201
24203
|
|
|
24202
24204
|
var _useState = React.useState(false),
|
|
24203
24205
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24240,6 +24242,7 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
24240
24242
|
ariaLabelledby: createIdFromString(labelTextWhenNoError),
|
|
24241
24243
|
ariaDescribedby: createIdFromString(labelTextWhenNoError, "error message"),
|
|
24242
24244
|
maxHeight: dropdownMaxHeight,
|
|
24245
|
+
widthFitOptions: widthFitOptions,
|
|
24243
24246
|
hasTitles: hasTitles,
|
|
24244
24247
|
placeholder: options[0] ? options[0].text : "",
|
|
24245
24248
|
options: options,
|
|
@@ -38616,44 +38619,52 @@ var TableHeading_styled = styled__default.th.withConfig({
|
|
|
38616
38619
|
return extraStyles;
|
|
38617
38620
|
});
|
|
38618
38621
|
|
|
38619
|
-
const validatorToPredicate =
|
|
38620
|
-
|
|
38621
|
-
...rest
|
|
38622
|
-
|
|
38622
|
+
const validatorToPredicate =
|
|
38623
|
+
(validatorFn, emptyCase) =>
|
|
38624
|
+
(value, ...rest) =>
|
|
38625
|
+
value === '' ? emptyCase : validatorFn(value, ...rest);
|
|
38623
38626
|
|
|
38624
38627
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38625
38628
|
|
|
38629
|
+
function getDefaultExportFromCjs (x) {
|
|
38630
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
38631
|
+
}
|
|
38632
|
+
|
|
38626
38633
|
var dayjs_min = {exports: {}};
|
|
38627
38634
|
|
|
38628
38635
|
(function (module, exports) {
|
|
38629
|
-
!function(t,e){module.exports=e();}(commonjsGlobal$1,(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"
|
|
38630
|
-
}(dayjs_min));
|
|
38636
|
+
!function(t,e){module.exports=e();}(commonjsGlobal$1,(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",l="Invalid Date",$=/^(\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("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={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}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},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=v;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($);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()===l)},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),l=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)},$=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,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"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":""),l=(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],$=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 l&&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,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||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||l;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].slice(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},$={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||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[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}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[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=D[g],w.Ls=D,w.p={},w}));
|
|
38637
|
+
} (dayjs_min));
|
|
38631
38638
|
|
|
38632
|
-
var
|
|
38639
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
38640
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
38633
38641
|
|
|
38634
38642
|
var customParseFormat$1 = {exports: {}};
|
|
38635
38643
|
|
|
38636
38644
|
(function (module, exports) {
|
|
38637
|
-
!function(t
|
|
38638
|
-
}(customParseFormat$1));
|
|
38645
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e={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"},t=/(\[[^[]*\])|([-_:/.,()\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(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],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(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],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(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},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,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=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=h||0,g=u||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(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=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,e);};}}));
|
|
38646
|
+
} (customParseFormat$1));
|
|
38639
38647
|
|
|
38640
|
-
var
|
|
38648
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
38649
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
38641
38650
|
|
|
38642
38651
|
var isSameOrBefore$1 = {exports: {}};
|
|
38643
38652
|
|
|
38644
38653
|
(function (module, exports) {
|
|
38645
|
-
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38646
|
-
}(isSameOrBefore$1));
|
|
38654
|
+
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38655
|
+
} (isSameOrBefore$1));
|
|
38647
38656
|
|
|
38648
|
-
var
|
|
38657
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
38658
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
38649
38659
|
|
|
38650
38660
|
var isSameOrAfter$1 = {exports: {}};
|
|
38651
38661
|
|
|
38652
38662
|
(function (module, exports) {
|
|
38653
|
-
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38654
|
-
}(isSameOrAfter$1));
|
|
38663
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38664
|
+
} (isSameOrAfter$1));
|
|
38655
38665
|
|
|
38656
|
-
var
|
|
38666
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
38667
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
38657
38668
|
|
|
38658
38669
|
/* eslint-disable no-unused-vars */
|
|
38659
38670
|
|
|
@@ -38669,24 +38680,24 @@ dayjs.extend(isSameOrAfter);
|
|
|
38669
38680
|
|
|
38670
38681
|
let validatorFns = {};
|
|
38671
38682
|
|
|
38672
|
-
const INCLUDED_IN =
|
|
38673
|
-
const INCLUDED_IN_ERROR =
|
|
38683
|
+
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
38684
|
+
const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
|
|
38674
38685
|
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
38675
38686
|
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
38676
38687
|
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
38677
38688
|
|
|
38678
|
-
const REQUIRED =
|
|
38679
|
-
const REQUIRED_ERROR =
|
|
38689
|
+
const REQUIRED = 'validator/REQUIRED';
|
|
38690
|
+
const REQUIRED_ERROR = 'error/REQUIRED';
|
|
38680
38691
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
38681
|
-
validatorFns[REQUIRED] = (value, args, form) => value !==
|
|
38692
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== '';
|
|
38682
38693
|
|
|
38683
|
-
const ONLY_INTEGERS =
|
|
38684
|
-
const ONLY_INTEGERS_ERROR =
|
|
38694
|
+
const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
|
|
38695
|
+
const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
|
|
38685
38696
|
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
38686
38697
|
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
38687
38698
|
|
|
38688
|
-
const ONLY_NATURALS =
|
|
38689
|
-
const ONLY_NATURALS_ERROR =
|
|
38699
|
+
const ONLY_NATURALS = 'validator/ONLY_NATURALS';
|
|
38700
|
+
const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
|
|
38690
38701
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
38691
38702
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
38692
38703
|
|
|
@@ -38699,8 +38710,8 @@ not tested as validation function
|
|
|
38699
38710
|
to validate exp date instead use combo of:
|
|
38700
38711
|
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
38701
38712
|
*/
|
|
38702
|
-
const ONLY_EXPIRATION_DATE =
|
|
38703
|
-
const ONLY_EXPIRATION_DATE_ERROR =
|
|
38713
|
+
const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
|
|
38714
|
+
const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
|
|
38704
38715
|
const onlyExpirationDate = createValidator(
|
|
38705
38716
|
ONLY_EXPIRATION_DATE,
|
|
38706
38717
|
ONLY_EXPIRATION_DATE_ERROR
|
|
@@ -38708,64 +38719,63 @@ const onlyExpirationDate = createValidator(
|
|
|
38708
38719
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
38709
38720
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
38710
38721
|
|
|
38711
|
-
const NUMBER_LESS_THAN =
|
|
38712
|
-
const NUMBER_LESS_THAN_ERROR =
|
|
38722
|
+
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
38723
|
+
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
38713
38724
|
const numberLessThan = createValidator(
|
|
38714
38725
|
NUMBER_LESS_THAN,
|
|
38715
38726
|
NUMBER_LESS_THAN_ERROR
|
|
38716
38727
|
);
|
|
38717
38728
|
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
38718
|
-
if (value ===
|
|
38729
|
+
if (value === '') {
|
|
38719
38730
|
return true;
|
|
38720
38731
|
}
|
|
38721
38732
|
return Number(value) < args[0];
|
|
38722
38733
|
};
|
|
38723
38734
|
|
|
38724
|
-
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
38725
|
-
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
38735
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38726
38736
|
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
38727
|
-
|
|
38737
|
+
'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38728
38738
|
const numberLessThanOrEqualTo = createValidator(
|
|
38729
38739
|
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
38730
38740
|
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
38731
38741
|
);
|
|
38732
38742
|
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38733
|
-
if (value ===
|
|
38743
|
+
if (value === '') {
|
|
38734
38744
|
return true;
|
|
38735
38745
|
}
|
|
38736
38746
|
return Number(value) <= args[0];
|
|
38737
38747
|
};
|
|
38738
38748
|
|
|
38739
|
-
const NUMBER_GREATER_THAN =
|
|
38740
|
-
const NUMBER_GREATER_THAN_ERROR =
|
|
38749
|
+
const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
|
|
38750
|
+
const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
|
|
38741
38751
|
const numberGreaterThan = createValidator(
|
|
38742
38752
|
NUMBER_GREATER_THAN,
|
|
38743
38753
|
NUMBER_GREATER_THAN_ERROR
|
|
38744
38754
|
);
|
|
38745
38755
|
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
38746
|
-
if (value ===
|
|
38756
|
+
if (value === '') {
|
|
38747
38757
|
return true;
|
|
38748
38758
|
}
|
|
38749
38759
|
return Number(value) > args[0];
|
|
38750
38760
|
};
|
|
38751
38761
|
|
|
38752
38762
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
38753
|
-
|
|
38763
|
+
'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38754
38764
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
38755
|
-
|
|
38765
|
+
'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38756
38766
|
const numberGreaterThanOrEqualTo = createValidator(
|
|
38757
38767
|
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
38758
38768
|
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
38759
38769
|
);
|
|
38760
38770
|
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38761
|
-
if (value ===
|
|
38771
|
+
if (value === '') {
|
|
38762
38772
|
return true;
|
|
38763
38773
|
}
|
|
38764
38774
|
return Number(value) >= args[0];
|
|
38765
38775
|
};
|
|
38766
38776
|
|
|
38767
|
-
const MATCHES_FIELD =
|
|
38768
|
-
const MATCHES_FIELD_ERROR$1 =
|
|
38777
|
+
const MATCHES_FIELD = 'validator/MATCHES_FIELD';
|
|
38778
|
+
const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
|
|
38769
38779
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
38770
38780
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
38771
38781
|
const dependentField = form[args[0]];
|
|
@@ -38778,7 +38788,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
|
38778
38788
|
return value === dependentFieldValue;
|
|
38779
38789
|
};
|
|
38780
38790
|
|
|
38781
|
-
const validateWhenErrorMessage = type =>
|
|
38791
|
+
const validateWhenErrorMessage = (type) =>
|
|
38782
38792
|
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
38783
38793
|
Please check that you are only calling validator creator functions exported from
|
|
38784
38794
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -38786,25 +38796,21 @@ const validateWhenErrorMessage = type =>
|
|
|
38786
38796
|
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
38787
38797
|
as the primary validator.`;
|
|
38788
38798
|
|
|
38789
|
-
const VALIDATE_WHEN =
|
|
38790
|
-
const VALIDATE_WHEN_ERROR =
|
|
38791
|
-
const validateWhen = (
|
|
38792
|
-
dependentValidator,
|
|
38793
|
-
primaryValidator,
|
|
38794
|
-
optionalFieldName
|
|
38795
|
-
) => ({
|
|
38799
|
+
const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
|
|
38800
|
+
const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
|
|
38801
|
+
const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
|
|
38796
38802
|
type: VALIDATE_WHEN,
|
|
38797
38803
|
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
38798
|
-
error: dependentValidator.error
|
|
38804
|
+
error: dependentValidator.error,
|
|
38799
38805
|
});
|
|
38800
38806
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
38801
38807
|
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
38802
38808
|
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
38803
|
-
const dependsOnOtherField = typeof optionalFieldName ===
|
|
38809
|
+
const dependsOnOtherField = typeof optionalFieldName === 'string';
|
|
38804
38810
|
|
|
38805
38811
|
if (
|
|
38806
38812
|
primaryValidator.type === undefined ||
|
|
38807
|
-
typeof validatorFns[primaryValidator.type] !==
|
|
38813
|
+
typeof validatorFns[primaryValidator.type] !== 'function'
|
|
38808
38814
|
) {
|
|
38809
38815
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
38810
38816
|
}
|
|
@@ -38828,26 +38834,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
|
38828
38834
|
);
|
|
38829
38835
|
|
|
38830
38836
|
return primaryPredicatePassed
|
|
38831
|
-
? validatorFns[dependentValidator.type](
|
|
38832
|
-
value,
|
|
38833
|
-
dependentValidator.args,
|
|
38834
|
-
form
|
|
38835
|
-
)
|
|
38837
|
+
? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
|
|
38836
38838
|
: true;
|
|
38837
38839
|
};
|
|
38838
38840
|
|
|
38839
|
-
const validateSumErrorMessage = type =>
|
|
38841
|
+
const validateSumErrorMessage = (type) =>
|
|
38840
38842
|
`${type} was passed to validateSum, but that validator type does not exist.
|
|
38841
38843
|
Please check that you are only calling validator creator functions exported from
|
|
38842
38844
|
redux-freeform in your form config and that you didn't forget to
|
|
38843
38845
|
invoke the validator creator (you cannot pass the functions themselves to
|
|
38844
38846
|
createFormState).`;
|
|
38845
|
-
const VALIDATE_SUM =
|
|
38846
|
-
const VALIDATE_SUM_ERROR =
|
|
38847
|
+
const VALIDATE_SUM = 'validator/VALIDATE_SUM';
|
|
38848
|
+
const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
|
|
38847
38849
|
const validateSum = (validator, fieldNamesArray) => ({
|
|
38848
38850
|
type: VALIDATE_SUM,
|
|
38849
38851
|
args: [validator, fieldNamesArray],
|
|
38850
|
-
error: validator.error
|
|
38852
|
+
error: validator.error,
|
|
38851
38853
|
});
|
|
38852
38854
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
38853
38855
|
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
@@ -38855,7 +38857,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38855
38857
|
|
|
38856
38858
|
if (
|
|
38857
38859
|
validator.type === undefined ||
|
|
38858
|
-
typeof validatorFns[validator.type] !==
|
|
38860
|
+
typeof validatorFns[validator.type] !== 'function'
|
|
38859
38861
|
) {
|
|
38860
38862
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
38861
38863
|
}
|
|
@@ -38876,37 +38878,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38876
38878
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
38877
38879
|
};
|
|
38878
38880
|
|
|
38879
|
-
const HAS_LENGTH =
|
|
38880
|
-
const HAS_LENGTH_ERROR =
|
|
38881
|
+
const HAS_LENGTH = 'validator/HAS_LENGTH';
|
|
38882
|
+
const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
|
|
38881
38883
|
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
38882
38884
|
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
38883
|
-
if (value ===
|
|
38885
|
+
if (value === '') {
|
|
38884
38886
|
return true;
|
|
38885
38887
|
}
|
|
38886
38888
|
const min = args[0];
|
|
38887
38889
|
const max = args[1];
|
|
38888
38890
|
if (max == undefined || min == undefined) {
|
|
38889
38891
|
throw new Error(
|
|
38890
|
-
|
|
38892
|
+
'Max and min need to be defined for hasLength, both or one of them is undefined'
|
|
38891
38893
|
);
|
|
38892
38894
|
}
|
|
38893
38895
|
if (max < min) {
|
|
38894
|
-
throw new Error(
|
|
38895
|
-
"hasLength validator was passed a min greater than the max"
|
|
38896
|
-
);
|
|
38896
|
+
throw new Error('hasLength validator was passed a min greater than the max');
|
|
38897
38897
|
}
|
|
38898
38898
|
const valueLength = value.length;
|
|
38899
38899
|
return max >= valueLength && valueLength >= min;
|
|
38900
38900
|
};
|
|
38901
38901
|
|
|
38902
|
-
const DATE_BEFORE_TODAY =
|
|
38903
|
-
const DATE_BEFORE_TODAY_ERROR =
|
|
38902
|
+
const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
|
|
38903
|
+
const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
|
|
38904
38904
|
const dateBeforeToday = createValidator(
|
|
38905
38905
|
DATE_BEFORE_TODAY,
|
|
38906
38906
|
DATE_BEFORE_TODAY_ERROR
|
|
38907
38907
|
);
|
|
38908
38908
|
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
38909
|
-
if (value ===
|
|
38909
|
+
if (value === '') {
|
|
38910
38910
|
return true;
|
|
38911
38911
|
}
|
|
38912
38912
|
const dateFormat = args[0];
|
|
@@ -38915,7 +38915,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38915
38915
|
|
|
38916
38916
|
if (dateFormat == undefined || unit == undefined) {
|
|
38917
38917
|
throw new Error(
|
|
38918
|
-
|
|
38918
|
+
'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
|
|
38919
38919
|
);
|
|
38920
38920
|
}
|
|
38921
38921
|
const now = dayjs();
|
|
@@ -38927,14 +38927,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38927
38927
|
return dateValue.isBefore(now, unit);
|
|
38928
38928
|
};
|
|
38929
38929
|
|
|
38930
|
-
const DATE_AFTER_TODAY =
|
|
38931
|
-
const DATE_AFTER_TODAY_ERROR =
|
|
38930
|
+
const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
|
|
38931
|
+
const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
|
|
38932
38932
|
const dateAfterToday = createValidator(
|
|
38933
38933
|
DATE_AFTER_TODAY,
|
|
38934
38934
|
DATE_AFTER_TODAY_ERROR
|
|
38935
38935
|
);
|
|
38936
38936
|
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
38937
|
-
if (value ===
|
|
38937
|
+
if (value === '') {
|
|
38938
38938
|
return true;
|
|
38939
38939
|
}
|
|
38940
38940
|
const dateFormat = args[0];
|
|
@@ -38943,7 +38943,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38943
38943
|
|
|
38944
38944
|
if (dateFormat == undefined || unit == undefined) {
|
|
38945
38945
|
throw new Error(
|
|
38946
|
-
|
|
38946
|
+
'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
|
|
38947
38947
|
);
|
|
38948
38948
|
}
|
|
38949
38949
|
const now = dayjs();
|
|
@@ -38955,14 +38955,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38955
38955
|
return dateValue.isAfter(now, unit);
|
|
38956
38956
|
};
|
|
38957
38957
|
|
|
38958
|
-
const IS_VALID_MONTH =
|
|
38959
|
-
const IS_VALID_MONTH_ERROR =
|
|
38960
|
-
const isValidMonth = createValidator(
|
|
38961
|
-
IS_VALID_MONTH,
|
|
38962
|
-
IS_VALID_MONTH_ERROR
|
|
38963
|
-
);
|
|
38958
|
+
const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
|
|
38959
|
+
const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
|
|
38960
|
+
const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
38964
38961
|
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
38965
|
-
if (value ===
|
|
38962
|
+
if (value === '') {
|
|
38966
38963
|
return true;
|
|
38967
38964
|
}
|
|
38968
38965
|
// Function takes one argument representing the character position
|
|
@@ -38972,43 +38969,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
|
38972
38969
|
// Only works with two digit months (01, 02, 03, etc)
|
|
38973
38970
|
const monthStartPosition = parseInt(args[0]);
|
|
38974
38971
|
const monthEndPosition = monthStartPosition + 2;
|
|
38975
|
-
if (monthStartPosition
|
|
38976
|
-
throw new Error(
|
|
38972
|
+
if (isNaN(monthStartPosition)) {
|
|
38973
|
+
throw new Error('Month start position has to be a valid integer string');
|
|
38977
38974
|
}
|
|
38978
38975
|
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
38979
|
-
if (month
|
|
38976
|
+
if (isNaN(month)) {
|
|
38980
38977
|
return false;
|
|
38981
38978
|
}
|
|
38982
38979
|
return month >= 1 && month <= 12;
|
|
38983
38980
|
};
|
|
38984
38981
|
|
|
38985
|
-
const MATCHES_REGEX =
|
|
38986
|
-
const MATCHES_REGEX_ERROR =
|
|
38982
|
+
const MATCHES_REGEX = 'validator/MATCHES_REGEX';
|
|
38983
|
+
const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
|
|
38987
38984
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
38988
38985
|
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
38989
|
-
if (value ===
|
|
38986
|
+
if (value === '') {
|
|
38990
38987
|
return true;
|
|
38991
38988
|
}
|
|
38992
38989
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
38993
38990
|
};
|
|
38994
38991
|
|
|
38995
38992
|
// based on http://www.brainjar.com/js/validation/
|
|
38996
|
-
const IS_ROUTING_NUMBER =
|
|
38997
|
-
const IS_ROUTING_NUMBER_ERROR =
|
|
38993
|
+
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
38994
|
+
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
38998
38995
|
const isRoutingNumber = createValidator(
|
|
38999
38996
|
IS_ROUTING_NUMBER,
|
|
39000
38997
|
IS_ROUTING_NUMBER_ERROR
|
|
39001
38998
|
);
|
|
39002
38999
|
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
39003
|
-
if (value ===
|
|
39000
|
+
if (value === '') {
|
|
39004
39001
|
return true;
|
|
39005
39002
|
}
|
|
39006
39003
|
if (value.length != 9) {
|
|
39007
39004
|
return false;
|
|
39008
39005
|
}
|
|
39009
39006
|
const sum = value
|
|
39010
|
-
.split(
|
|
39011
|
-
.map(ch => parseInt(ch))
|
|
39007
|
+
.split('')
|
|
39008
|
+
.map((ch) => parseInt(ch))
|
|
39012
39009
|
.reduce((acc, cur, idx) => {
|
|
39013
39010
|
switch (idx % 3) {
|
|
39014
39011
|
case 0:
|
|
@@ -39022,69 +39019,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
|
39022
39019
|
return sum != 0 && sum % 10 == 0;
|
|
39023
39020
|
};
|
|
39024
39021
|
|
|
39025
|
-
const HAS_NUMBER =
|
|
39026
|
-
const HAS_NUMBER_ERROR$1 =
|
|
39022
|
+
const HAS_NUMBER = 'validator/HAS_NUMBER';
|
|
39023
|
+
const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
|
|
39027
39024
|
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
39028
39025
|
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
39029
|
-
if (value ===
|
|
39026
|
+
if (value === '') {
|
|
39030
39027
|
return true;
|
|
39031
39028
|
}
|
|
39032
39029
|
return new RegExp(/[0-9]/).test(value);
|
|
39033
39030
|
};
|
|
39034
39031
|
|
|
39035
|
-
const HAS_LOWERCASE_LETTER =
|
|
39036
|
-
const HAS_LOWERCASE_LETTER_ERROR$1 =
|
|
39032
|
+
const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
|
|
39033
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
|
|
39037
39034
|
const hasLowercaseLetter = createValidator(
|
|
39038
39035
|
HAS_LOWERCASE_LETTER,
|
|
39039
39036
|
HAS_LOWERCASE_LETTER_ERROR$1
|
|
39040
39037
|
);
|
|
39041
39038
|
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
39042
|
-
if (value ===
|
|
39039
|
+
if (value === '') {
|
|
39043
39040
|
return true;
|
|
39044
39041
|
}
|
|
39045
39042
|
return new RegExp(/[a-z]/).test(value);
|
|
39046
39043
|
};
|
|
39047
39044
|
|
|
39048
|
-
const HAS_UPPERCASE_LETTER =
|
|
39049
|
-
const HAS_UPPERCASE_LETTER_ERROR$1 =
|
|
39045
|
+
const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
|
|
39046
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
|
|
39050
39047
|
const hasUppercaseLetter = createValidator(
|
|
39051
39048
|
HAS_UPPERCASE_LETTER,
|
|
39052
39049
|
HAS_UPPERCASE_LETTER_ERROR$1
|
|
39053
39050
|
);
|
|
39054
39051
|
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
39055
|
-
if (value ===
|
|
39052
|
+
if (value === '') {
|
|
39056
39053
|
return true;
|
|
39057
39054
|
}
|
|
39058
39055
|
return new RegExp(/[A-Z]/).test(value);
|
|
39059
39056
|
};
|
|
39060
39057
|
|
|
39061
|
-
const HAS_SPECIAL_CHARACTER =
|
|
39062
|
-
const HAS_SPECIAL_CHARACTER_ERROR$1 =
|
|
39058
|
+
const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
|
|
39059
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
|
|
39063
39060
|
const hasSpecialCharacter = createValidator(
|
|
39064
39061
|
HAS_SPECIAL_CHARACTER,
|
|
39065
39062
|
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
39066
39063
|
);
|
|
39067
39064
|
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
39068
|
-
if (value ===
|
|
39065
|
+
if (value === '') {
|
|
39069
39066
|
return true;
|
|
39070
39067
|
}
|
|
39071
39068
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
39072
39069
|
};
|
|
39073
39070
|
|
|
39074
|
-
const IS_PROBABLY_EMAIL =
|
|
39075
|
-
const IS_PROBABLY_EMAIL_ERROR =
|
|
39071
|
+
const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
|
|
39072
|
+
const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
|
|
39076
39073
|
const isProbablyEmail = createValidator(
|
|
39077
39074
|
IS_PROBABLY_EMAIL,
|
|
39078
39075
|
IS_PROBABLY_EMAIL_ERROR
|
|
39079
39076
|
);
|
|
39080
39077
|
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
39081
|
-
if (value ===
|
|
39078
|
+
if (value === '') {
|
|
39082
39079
|
return true;
|
|
39083
39080
|
}
|
|
39084
39081
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
39085
39082
|
};
|
|
39086
39083
|
|
|
39087
|
-
const runValidatorErrorMessage = type =>
|
|
39084
|
+
const runValidatorErrorMessage = (type) =>
|
|
39088
39085
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
39089
39086
|
Please check that you are only calling validator creator functions exported from
|
|
39090
39087
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -39099,1165 +39096,53 @@ const runValidator = (validator, value, form) => {
|
|
|
39099
39096
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
39100
39097
|
};
|
|
39101
39098
|
|
|
39102
|
-
const
|
|
39099
|
+
const runFormValidators = (fieldName, form, validators) => {
|
|
39103
39100
|
return validators
|
|
39104
|
-
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
39105
|
-
.filter(x => x !== null);
|
|
39101
|
+
.map((v) => runValidator(v, form[fieldName].rawValue, form))
|
|
39102
|
+
.filter((x) => x !== null);
|
|
39106
39103
|
};
|
|
39107
39104
|
|
|
39108
39105
|
const computeConstraints = (fieldName, form) => {
|
|
39109
39106
|
const constraints = form[fieldName].constraints;
|
|
39110
|
-
return
|
|
39107
|
+
return runFormValidators(fieldName, form, constraints);
|
|
39111
39108
|
};
|
|
39112
39109
|
|
|
39113
39110
|
const computeErrors = (fieldName, form) => {
|
|
39114
39111
|
const validators = form[fieldName].validators;
|
|
39115
|
-
return
|
|
39116
|
-
};
|
|
39117
|
-
|
|
39118
|
-
var obj;
|
|
39119
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
39120
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
39121
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
39122
|
-
function isDraft(value) {
|
|
39123
|
-
return !!value && !!value[DRAFT_STATE];
|
|
39124
|
-
}
|
|
39125
|
-
function isDraftable(value) {
|
|
39126
|
-
if (!value) { return false; }
|
|
39127
|
-
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
39128
|
-
}
|
|
39129
|
-
function isPlainObject(value) {
|
|
39130
|
-
if (!value || typeof value !== "object") { return false; }
|
|
39131
|
-
if (Array.isArray(value)) { return true; }
|
|
39132
|
-
var proto = Object.getPrototypeOf(value);
|
|
39133
|
-
return !proto || proto === Object.prototype;
|
|
39134
|
-
}
|
|
39135
|
-
var assign = Object.assign || function assign(target, value) {
|
|
39136
|
-
for (var key in value) {
|
|
39137
|
-
if (has$1(value, key)) {
|
|
39138
|
-
target[key] = value[key];
|
|
39139
|
-
}
|
|
39140
|
-
}
|
|
39141
|
-
|
|
39142
|
-
return target;
|
|
39143
|
-
};
|
|
39144
|
-
var ownKeys$2 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
|
|
39145
|
-
function shallowCopy(base, invokeGetters) {
|
|
39146
|
-
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
39147
|
-
|
|
39148
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
39149
|
-
var clone = Object.create(Object.getPrototypeOf(base));
|
|
39150
|
-
ownKeys$2(base).forEach(function (key) {
|
|
39151
|
-
if (key === DRAFT_STATE) {
|
|
39152
|
-
return; // Never copy over draft state.
|
|
39153
|
-
}
|
|
39154
|
-
|
|
39155
|
-
var desc = Object.getOwnPropertyDescriptor(base, key);
|
|
39156
|
-
var value = desc.value;
|
|
39157
|
-
|
|
39158
|
-
if (desc.get) {
|
|
39159
|
-
if (!invokeGetters) {
|
|
39160
|
-
throw new Error("Immer drafts cannot have computed properties");
|
|
39161
|
-
}
|
|
39162
|
-
|
|
39163
|
-
value = desc.get.call(base);
|
|
39164
|
-
}
|
|
39165
|
-
|
|
39166
|
-
if (desc.enumerable) {
|
|
39167
|
-
clone[key] = value;
|
|
39168
|
-
} else {
|
|
39169
|
-
Object.defineProperty(clone, key, {
|
|
39170
|
-
value: value,
|
|
39171
|
-
writable: true,
|
|
39172
|
-
configurable: true
|
|
39173
|
-
});
|
|
39174
|
-
}
|
|
39175
|
-
});
|
|
39176
|
-
return clone;
|
|
39177
|
-
}
|
|
39178
|
-
function each(value, cb) {
|
|
39179
|
-
if (Array.isArray(value)) {
|
|
39180
|
-
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
39181
|
-
} else {
|
|
39182
|
-
ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
39183
|
-
}
|
|
39184
|
-
}
|
|
39185
|
-
function isEnumerable(base, prop) {
|
|
39186
|
-
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
39187
|
-
return !!desc && desc.enumerable;
|
|
39188
|
-
}
|
|
39189
|
-
function has$1(thing, prop) {
|
|
39190
|
-
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
39191
|
-
}
|
|
39192
|
-
function is(x, y) {
|
|
39193
|
-
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
39194
|
-
if (x === y) {
|
|
39195
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
39196
|
-
} else {
|
|
39197
|
-
return x !== x && y !== y;
|
|
39198
|
-
}
|
|
39199
|
-
}
|
|
39200
|
-
function clone(obj) {
|
|
39201
|
-
if (!isDraftable(obj)) { return obj; }
|
|
39202
|
-
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
39203
|
-
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
39204
|
-
|
|
39205
|
-
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
39206
|
-
|
|
39207
|
-
return cloned;
|
|
39208
|
-
}
|
|
39209
|
-
|
|
39210
|
-
/** Each scope represents a `produce` call. */
|
|
39211
|
-
|
|
39212
|
-
var ImmerScope = function ImmerScope(parent) {
|
|
39213
|
-
this.drafts = [];
|
|
39214
|
-
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
39215
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
39216
|
-
|
|
39217
|
-
this.canAutoFreeze = true; // To avoid prototype lookups:
|
|
39218
|
-
|
|
39219
|
-
this.patches = null;
|
|
39220
|
-
};
|
|
39221
|
-
|
|
39222
|
-
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
39223
|
-
if (patchListener) {
|
|
39224
|
-
this.patches = [];
|
|
39225
|
-
this.inversePatches = [];
|
|
39226
|
-
this.patchListener = patchListener;
|
|
39227
|
-
}
|
|
39228
|
-
};
|
|
39229
|
-
|
|
39230
|
-
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
39231
|
-
this.leave();
|
|
39232
|
-
this.drafts.forEach(revoke);
|
|
39233
|
-
this.drafts = null; // Make draft-related methods throw.
|
|
39234
|
-
};
|
|
39235
|
-
|
|
39236
|
-
ImmerScope.prototype.leave = function leave () {
|
|
39237
|
-
if (this === ImmerScope.current) {
|
|
39238
|
-
ImmerScope.current = this.parent;
|
|
39239
|
-
}
|
|
39240
|
-
};
|
|
39241
|
-
ImmerScope.current = null;
|
|
39242
|
-
|
|
39243
|
-
ImmerScope.enter = function () {
|
|
39244
|
-
return this.current = new ImmerScope(this.current);
|
|
39245
|
-
};
|
|
39246
|
-
|
|
39247
|
-
function revoke(draft) {
|
|
39248
|
-
draft[DRAFT_STATE].revoke();
|
|
39249
|
-
}
|
|
39250
|
-
|
|
39251
|
-
// but share them all instead
|
|
39252
|
-
|
|
39253
|
-
var descriptors$1 = {};
|
|
39254
|
-
function willFinalize(scope, result, isReplaced) {
|
|
39255
|
-
scope.drafts.forEach(function (draft) {
|
|
39256
|
-
draft[DRAFT_STATE].finalizing = true;
|
|
39257
|
-
});
|
|
39258
|
-
|
|
39259
|
-
if (!isReplaced) {
|
|
39260
|
-
if (scope.patches) {
|
|
39261
|
-
markChangesRecursively(scope.drafts[0]);
|
|
39262
|
-
} // This is faster when we don't care about which attributes changed.
|
|
39263
|
-
|
|
39264
|
-
|
|
39265
|
-
markChangesSweep(scope.drafts);
|
|
39266
|
-
} // When a child draft is returned, look for changes.
|
|
39267
|
-
else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
|
|
39268
|
-
markChangesSweep(scope.drafts);
|
|
39269
|
-
}
|
|
39270
|
-
}
|
|
39271
|
-
function createProxy(base, parent) {
|
|
39272
|
-
var isArray = Array.isArray(base);
|
|
39273
|
-
var draft = clonePotentialDraft(base);
|
|
39274
|
-
each(draft, function (prop) {
|
|
39275
|
-
proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
|
|
39276
|
-
}); // See "proxy.js" for property documentation.
|
|
39277
|
-
|
|
39278
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39279
|
-
var state = {
|
|
39280
|
-
scope: scope,
|
|
39281
|
-
modified: false,
|
|
39282
|
-
finalizing: false,
|
|
39283
|
-
// es5 only
|
|
39284
|
-
finalized: false,
|
|
39285
|
-
assigned: {},
|
|
39286
|
-
parent: parent,
|
|
39287
|
-
base: base,
|
|
39288
|
-
draft: draft,
|
|
39289
|
-
copy: null,
|
|
39290
|
-
revoke: revoke$1,
|
|
39291
|
-
revoked: false // es5 only
|
|
39292
|
-
|
|
39293
|
-
};
|
|
39294
|
-
createHiddenProperty(draft, DRAFT_STATE, state);
|
|
39295
|
-
scope.drafts.push(draft);
|
|
39296
|
-
return draft;
|
|
39297
|
-
}
|
|
39298
|
-
|
|
39299
|
-
function revoke$1() {
|
|
39300
|
-
this.revoked = true;
|
|
39301
|
-
}
|
|
39302
|
-
|
|
39303
|
-
function source(state) {
|
|
39304
|
-
return state.copy || state.base;
|
|
39305
|
-
} // Access a property without creating an Immer draft.
|
|
39306
|
-
|
|
39307
|
-
|
|
39308
|
-
function peek(draft, prop) {
|
|
39309
|
-
var state = draft[DRAFT_STATE];
|
|
39310
|
-
|
|
39311
|
-
if (state && !state.finalizing) {
|
|
39312
|
-
state.finalizing = true;
|
|
39313
|
-
var value = draft[prop];
|
|
39314
|
-
state.finalizing = false;
|
|
39315
|
-
return value;
|
|
39316
|
-
}
|
|
39317
|
-
|
|
39318
|
-
return draft[prop];
|
|
39319
|
-
}
|
|
39320
|
-
|
|
39321
|
-
function get$1(state, prop) {
|
|
39322
|
-
assertUnrevoked(state);
|
|
39323
|
-
var value = peek(source(state), prop);
|
|
39324
|
-
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
39325
|
-
|
|
39326
|
-
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
39327
|
-
prepareCopy(state);
|
|
39328
|
-
return state.copy[prop] = createProxy(value, state);
|
|
39329
|
-
}
|
|
39330
|
-
|
|
39331
|
-
return value;
|
|
39332
|
-
}
|
|
39333
|
-
|
|
39334
|
-
function set$1(state, prop, value) {
|
|
39335
|
-
assertUnrevoked(state);
|
|
39336
|
-
state.assigned[prop] = true;
|
|
39337
|
-
|
|
39338
|
-
if (!state.modified) {
|
|
39339
|
-
if (is(value, peek(source(state), prop))) { return; }
|
|
39340
|
-
markChanged(state);
|
|
39341
|
-
prepareCopy(state);
|
|
39342
|
-
}
|
|
39343
|
-
|
|
39344
|
-
state.copy[prop] = value;
|
|
39345
|
-
}
|
|
39346
|
-
|
|
39347
|
-
function markChanged(state) {
|
|
39348
|
-
if (!state.modified) {
|
|
39349
|
-
state.modified = true;
|
|
39350
|
-
if (state.parent) { markChanged(state.parent); }
|
|
39351
|
-
}
|
|
39352
|
-
}
|
|
39353
|
-
|
|
39354
|
-
function prepareCopy(state) {
|
|
39355
|
-
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
39356
|
-
}
|
|
39357
|
-
|
|
39358
|
-
function clonePotentialDraft(base) {
|
|
39359
|
-
var state = base && base[DRAFT_STATE];
|
|
39360
|
-
|
|
39361
|
-
if (state) {
|
|
39362
|
-
state.finalizing = true;
|
|
39363
|
-
var draft = shallowCopy(state.draft, true);
|
|
39364
|
-
state.finalizing = false;
|
|
39365
|
-
return draft;
|
|
39366
|
-
}
|
|
39367
|
-
|
|
39368
|
-
return shallowCopy(base);
|
|
39369
|
-
}
|
|
39370
|
-
|
|
39371
|
-
function proxyProperty(draft, prop, enumerable) {
|
|
39372
|
-
var desc = descriptors$1[prop];
|
|
39373
|
-
|
|
39374
|
-
if (desc) {
|
|
39375
|
-
desc.enumerable = enumerable;
|
|
39376
|
-
} else {
|
|
39377
|
-
descriptors$1[prop] = desc = {
|
|
39378
|
-
configurable: true,
|
|
39379
|
-
enumerable: enumerable,
|
|
39380
|
-
|
|
39381
|
-
get: function get$1$1() {
|
|
39382
|
-
return get$1(this[DRAFT_STATE], prop);
|
|
39383
|
-
},
|
|
39384
|
-
|
|
39385
|
-
set: function set$1$1(value) {
|
|
39386
|
-
set$1(this[DRAFT_STATE], prop, value);
|
|
39387
|
-
}
|
|
39388
|
-
|
|
39389
|
-
};
|
|
39390
|
-
}
|
|
39391
|
-
|
|
39392
|
-
Object.defineProperty(draft, prop, desc);
|
|
39393
|
-
}
|
|
39394
|
-
|
|
39395
|
-
function assertUnrevoked(state) {
|
|
39396
|
-
if (state.revoked === true) { throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state))); }
|
|
39397
|
-
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
39398
|
-
|
|
39399
|
-
|
|
39400
|
-
function markChangesSweep(drafts) {
|
|
39401
|
-
// The natural order of drafts in the `scope` array is based on when they
|
|
39402
|
-
// were accessed. By processing drafts in reverse natural order, we have a
|
|
39403
|
-
// better chance of processing leaf nodes first. When a leaf node is known to
|
|
39404
|
-
// have changed, we can avoid any traversal of its ancestor nodes.
|
|
39405
|
-
for (var i = drafts.length - 1; i >= 0; i--) {
|
|
39406
|
-
var state = drafts[i][DRAFT_STATE];
|
|
39407
|
-
|
|
39408
|
-
if (!state.modified) {
|
|
39409
|
-
if (Array.isArray(state.base)) {
|
|
39410
|
-
if (hasArrayChanges(state)) { markChanged(state); }
|
|
39411
|
-
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
39412
|
-
}
|
|
39413
|
-
}
|
|
39414
|
-
}
|
|
39415
|
-
|
|
39416
|
-
function markChangesRecursively(object) {
|
|
39417
|
-
if (!object || typeof object !== "object") { return; }
|
|
39418
|
-
var state = object[DRAFT_STATE];
|
|
39419
|
-
if (!state) { return; }
|
|
39420
|
-
var base = state.base;
|
|
39421
|
-
var draft = state.draft;
|
|
39422
|
-
var assigned = state.assigned;
|
|
39423
|
-
|
|
39424
|
-
if (!Array.isArray(object)) {
|
|
39425
|
-
// Look for added keys.
|
|
39426
|
-
Object.keys(draft).forEach(function (key) {
|
|
39427
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39428
|
-
if (base[key] === undefined && !has$1(base, key)) {
|
|
39429
|
-
assigned[key] = true;
|
|
39430
|
-
markChanged(state);
|
|
39431
|
-
} else if (!assigned[key]) {
|
|
39432
|
-
// Only untouched properties trigger recursion.
|
|
39433
|
-
markChangesRecursively(draft[key]);
|
|
39434
|
-
}
|
|
39435
|
-
}); // Look for removed keys.
|
|
39436
|
-
|
|
39437
|
-
Object.keys(base).forEach(function (key) {
|
|
39438
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39439
|
-
if (draft[key] === undefined && !has$1(draft, key)) {
|
|
39440
|
-
assigned[key] = false;
|
|
39441
|
-
markChanged(state);
|
|
39442
|
-
}
|
|
39443
|
-
});
|
|
39444
|
-
} else if (hasArrayChanges(state)) {
|
|
39445
|
-
markChanged(state);
|
|
39446
|
-
assigned.length = true;
|
|
39447
|
-
|
|
39448
|
-
if (draft.length < base.length) {
|
|
39449
|
-
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
39450
|
-
} else {
|
|
39451
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
39452
|
-
}
|
|
39453
|
-
|
|
39454
|
-
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
39455
|
-
// Only untouched indices trigger recursion.
|
|
39456
|
-
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
39457
|
-
}
|
|
39458
|
-
}
|
|
39459
|
-
}
|
|
39460
|
-
|
|
39461
|
-
function hasObjectChanges(state) {
|
|
39462
|
-
var base = state.base;
|
|
39463
|
-
var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
|
|
39464
|
-
// non-numeric keys are ordered by time of definition on the object.
|
|
39465
|
-
|
|
39466
|
-
var keys = Object.keys(draft);
|
|
39467
|
-
|
|
39468
|
-
for (var i = keys.length - 1; i >= 0; i--) {
|
|
39469
|
-
var key = keys[i];
|
|
39470
|
-
var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
|
|
39471
|
-
|
|
39472
|
-
if (baseValue === undefined && !has$1(base, key)) {
|
|
39473
|
-
return true;
|
|
39474
|
-
} // Once a base key is deleted, future changes go undetected, because its
|
|
39475
|
-
// descriptor is erased. This branch detects any missed changes.
|
|
39476
|
-
else {
|
|
39477
|
-
var value = draft[key];
|
|
39478
|
-
var state$1 = value && value[DRAFT_STATE];
|
|
39479
|
-
|
|
39480
|
-
if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
|
|
39481
|
-
return true;
|
|
39482
|
-
}
|
|
39483
|
-
}
|
|
39484
|
-
} // At this point, no keys were added or changed.
|
|
39485
|
-
// Compare key count to determine if keys were deleted.
|
|
39486
|
-
|
|
39487
|
-
|
|
39488
|
-
return keys.length !== Object.keys(base).length;
|
|
39489
|
-
}
|
|
39490
|
-
|
|
39491
|
-
function hasArrayChanges(state) {
|
|
39492
|
-
var draft = state.draft;
|
|
39493
|
-
if (draft.length !== state.base.length) { return true; } // See #116
|
|
39494
|
-
// If we first shorten the length, our array interceptors will be removed.
|
|
39495
|
-
// If after that new items are added, result in the same original length,
|
|
39496
|
-
// those last items will have no intercepting property.
|
|
39497
|
-
// So if there is no own descriptor on the last position, we know that items were removed and added
|
|
39498
|
-
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
39499
|
-
// the last one
|
|
39500
|
-
|
|
39501
|
-
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
39502
|
-
|
|
39503
|
-
if (descriptor && !descriptor.get) { return true; } // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
39504
|
-
|
|
39505
|
-
return false;
|
|
39506
|
-
}
|
|
39507
|
-
|
|
39508
|
-
function createHiddenProperty(target, prop, value) {
|
|
39509
|
-
Object.defineProperty(target, prop, {
|
|
39510
|
-
value: value,
|
|
39511
|
-
enumerable: false,
|
|
39512
|
-
writable: true
|
|
39513
|
-
});
|
|
39514
|
-
}
|
|
39515
|
-
|
|
39516
|
-
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
39517
|
-
willFinalize: willFinalize,
|
|
39518
|
-
createProxy: createProxy
|
|
39519
|
-
});
|
|
39520
|
-
|
|
39521
|
-
function willFinalize$1() {}
|
|
39522
|
-
function createProxy$1(base, parent) {
|
|
39523
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39524
|
-
var state = {
|
|
39525
|
-
// Track which produce call this is associated with.
|
|
39526
|
-
scope: scope,
|
|
39527
|
-
// True for both shallow and deep changes.
|
|
39528
|
-
modified: false,
|
|
39529
|
-
// Used during finalization.
|
|
39530
|
-
finalized: false,
|
|
39531
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
39532
|
-
assigned: {},
|
|
39533
|
-
// The parent draft state.
|
|
39534
|
-
parent: parent,
|
|
39535
|
-
// The base state.
|
|
39536
|
-
base: base,
|
|
39537
|
-
// The base proxy.
|
|
39538
|
-
draft: null,
|
|
39539
|
-
// Any property proxies.
|
|
39540
|
-
drafts: {},
|
|
39541
|
-
// The base copy with any updated values.
|
|
39542
|
-
copy: null,
|
|
39543
|
-
// Called by the `produce` function.
|
|
39544
|
-
revoke: null
|
|
39545
|
-
};
|
|
39546
|
-
var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
|
|
39547
|
-
// although state itself is an object
|
|
39548
|
-
Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
|
|
39549
|
-
var revoke = ref.revoke;
|
|
39550
|
-
var proxy = ref.proxy;
|
|
39551
|
-
state.draft = proxy;
|
|
39552
|
-
state.revoke = revoke;
|
|
39553
|
-
scope.drafts.push(proxy);
|
|
39554
|
-
return proxy;
|
|
39555
|
-
}
|
|
39556
|
-
var objectTraps = {
|
|
39557
|
-
get: get$1$1,
|
|
39558
|
-
|
|
39559
|
-
has: function has(target, prop) {
|
|
39560
|
-
return prop in source$1(target);
|
|
39561
|
-
},
|
|
39562
|
-
|
|
39563
|
-
ownKeys: function ownKeys(target) {
|
|
39564
|
-
return Reflect.ownKeys(source$1(target));
|
|
39565
|
-
},
|
|
39566
|
-
|
|
39567
|
-
set: set$1$1,
|
|
39568
|
-
deleteProperty: deleteProperty,
|
|
39569
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
|
|
39570
|
-
|
|
39571
|
-
defineProperty: function defineProperty() {
|
|
39572
|
-
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
39573
|
-
},
|
|
39574
|
-
|
|
39575
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
39576
|
-
return Object.getPrototypeOf(target.base);
|
|
39577
|
-
},
|
|
39578
|
-
|
|
39579
|
-
setPrototypeOf: function setPrototypeOf() {
|
|
39580
|
-
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
39581
|
-
}
|
|
39582
|
-
|
|
39583
|
-
};
|
|
39584
|
-
var arrayTraps = {};
|
|
39585
|
-
each(objectTraps, function (key, fn) {
|
|
39586
|
-
arrayTraps[key] = function () {
|
|
39587
|
-
arguments[0] = arguments[0][0];
|
|
39588
|
-
return fn.apply(this, arguments);
|
|
39589
|
-
};
|
|
39590
|
-
});
|
|
39591
|
-
|
|
39592
|
-
arrayTraps.deleteProperty = function (state, prop) {
|
|
39593
|
-
if (isNaN(parseInt(prop))) {
|
|
39594
|
-
throw new Error("Immer only supports deleting array indices"); // prettier-ignore
|
|
39595
|
-
}
|
|
39596
|
-
|
|
39597
|
-
return objectTraps.deleteProperty.call(this, state[0], prop);
|
|
39598
|
-
};
|
|
39599
|
-
|
|
39600
|
-
arrayTraps.set = function (state, prop, value) {
|
|
39601
|
-
if (prop !== "length" && isNaN(parseInt(prop))) {
|
|
39602
|
-
throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
|
|
39603
|
-
}
|
|
39604
|
-
|
|
39605
|
-
return objectTraps.set.call(this, state[0], prop, value);
|
|
39606
|
-
}; // returns the object we should be reading the current value from, which is base, until some change has been made
|
|
39607
|
-
|
|
39608
|
-
|
|
39609
|
-
function source$1(state) {
|
|
39610
|
-
return state.copy || state.base;
|
|
39611
|
-
} // Access a property without creating an Immer draft.
|
|
39612
|
-
|
|
39613
|
-
|
|
39614
|
-
function peek$1(draft, prop) {
|
|
39615
|
-
var state = draft[DRAFT_STATE];
|
|
39616
|
-
var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
|
|
39617
|
-
return desc && desc.value;
|
|
39618
|
-
}
|
|
39619
|
-
|
|
39620
|
-
function get$1$1(state, prop) {
|
|
39621
|
-
if (prop === DRAFT_STATE) { return state; }
|
|
39622
|
-
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
39623
|
-
|
|
39624
|
-
if (!state.modified && has$1(drafts, prop)) {
|
|
39625
|
-
return drafts[prop];
|
|
39626
|
-
}
|
|
39627
|
-
|
|
39628
|
-
var value = source$1(state)[prop];
|
|
39629
|
-
|
|
39630
|
-
if (state.finalized || !isDraftable(value)) {
|
|
39631
|
-
return value;
|
|
39632
|
-
} // Check for existing draft in modified state.
|
|
39633
|
-
|
|
39634
|
-
|
|
39635
|
-
if (state.modified) {
|
|
39636
|
-
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
39637
|
-
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
39638
|
-
|
|
39639
|
-
drafts = state.copy;
|
|
39640
|
-
}
|
|
39641
|
-
|
|
39642
|
-
return drafts[prop] = createProxy$1(value, state);
|
|
39643
|
-
}
|
|
39644
|
-
|
|
39645
|
-
function set$1$1(state, prop, value) {
|
|
39646
|
-
if (!state.modified) {
|
|
39647
|
-
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
39648
|
-
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
39649
|
-
// values may be drafts, but falsy values are never drafts.
|
|
39650
|
-
|
|
39651
|
-
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
39652
|
-
if (isUnchanged) { return true; }
|
|
39653
|
-
markChanged$1(state);
|
|
39654
|
-
}
|
|
39655
|
-
|
|
39656
|
-
state.assigned[prop] = true;
|
|
39657
|
-
state.copy[prop] = value;
|
|
39658
|
-
return true;
|
|
39659
|
-
}
|
|
39660
|
-
|
|
39661
|
-
function deleteProperty(state, prop) {
|
|
39662
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39663
|
-
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
39664
|
-
state.assigned[prop] = false;
|
|
39665
|
-
markChanged$1(state);
|
|
39666
|
-
} else if (state.assigned[prop]) {
|
|
39667
|
-
// if an originally not assigned property was deleted
|
|
39668
|
-
delete state.assigned[prop];
|
|
39669
|
-
}
|
|
39670
|
-
|
|
39671
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
39672
|
-
return true;
|
|
39673
|
-
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
39674
|
-
// the same guarantee in ES5 mode.
|
|
39675
|
-
|
|
39676
|
-
|
|
39677
|
-
function getOwnPropertyDescriptor$2(state, prop) {
|
|
39678
|
-
var owner = source$1(state);
|
|
39679
|
-
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
39680
|
-
|
|
39681
|
-
if (desc) {
|
|
39682
|
-
desc.writable = true;
|
|
39683
|
-
desc.configurable = !Array.isArray(owner) || prop !== "length";
|
|
39684
|
-
}
|
|
39685
|
-
|
|
39686
|
-
return desc;
|
|
39687
|
-
}
|
|
39688
|
-
|
|
39689
|
-
function markChanged$1(state) {
|
|
39690
|
-
if (!state.modified) {
|
|
39691
|
-
state.modified = true;
|
|
39692
|
-
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
39693
|
-
state.drafts = null;
|
|
39694
|
-
if (state.parent) { markChanged$1(state.parent); }
|
|
39695
|
-
}
|
|
39696
|
-
}
|
|
39697
|
-
|
|
39698
|
-
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
39699
|
-
willFinalize: willFinalize$1,
|
|
39700
|
-
createProxy: createProxy$1
|
|
39701
|
-
});
|
|
39702
|
-
|
|
39703
|
-
function generatePatches(state, basePath, patches, inversePatches) {
|
|
39704
|
-
Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
|
|
39705
|
-
}
|
|
39706
|
-
|
|
39707
|
-
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
39708
|
-
var assign, assign$1;
|
|
39709
|
-
|
|
39710
|
-
var base = state.base;
|
|
39711
|
-
var copy = state.copy;
|
|
39712
|
-
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
39713
|
-
|
|
39714
|
-
if (copy.length < base.length) {
|
|
39715
|
-
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
39716
|
-
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
39717
|
-
}
|
|
39718
|
-
|
|
39719
|
-
var delta = copy.length - base.length; // Find the first replaced index.
|
|
39720
|
-
|
|
39721
|
-
var start = 0;
|
|
39722
|
-
|
|
39723
|
-
while (base[start] === copy[start] && start < base.length) {
|
|
39724
|
-
++start;
|
|
39725
|
-
} // Find the last replaced index. Search from the end to optimize splice patches.
|
|
39726
|
-
|
|
39727
|
-
|
|
39728
|
-
var end = base.length;
|
|
39729
|
-
|
|
39730
|
-
while (end > start && base[end - 1] === copy[end + delta - 1]) {
|
|
39731
|
-
--end;
|
|
39732
|
-
} // Process replaced indices.
|
|
39733
|
-
|
|
39734
|
-
|
|
39735
|
-
for (var i = start; i < end; ++i) {
|
|
39736
|
-
if (assigned[i] && copy[i] !== base[i]) {
|
|
39737
|
-
var path = basePath.concat([i]);
|
|
39738
|
-
patches.push({
|
|
39739
|
-
op: "replace",
|
|
39740
|
-
path: path,
|
|
39741
|
-
value: copy[i]
|
|
39742
|
-
});
|
|
39743
|
-
inversePatches.push({
|
|
39744
|
-
op: "replace",
|
|
39745
|
-
path: path,
|
|
39746
|
-
value: base[i]
|
|
39747
|
-
});
|
|
39748
|
-
}
|
|
39749
|
-
}
|
|
39750
|
-
|
|
39751
|
-
var replaceCount = patches.length; // Process added indices.
|
|
39752
|
-
|
|
39753
|
-
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
39754
|
-
var path$1 = basePath.concat([i$1]);
|
|
39755
|
-
patches[replaceCount + i$1 - end] = {
|
|
39756
|
-
op: "add",
|
|
39757
|
-
path: path$1,
|
|
39758
|
-
value: copy[i$1]
|
|
39759
|
-
};
|
|
39760
|
-
inversePatches.push({
|
|
39761
|
-
op: "remove",
|
|
39762
|
-
path: path$1
|
|
39763
|
-
});
|
|
39764
|
-
}
|
|
39765
|
-
}
|
|
39766
|
-
|
|
39767
|
-
function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
39768
|
-
var base = state.base;
|
|
39769
|
-
var copy = state.copy;
|
|
39770
|
-
each(state.assigned, function (key, assignedValue) {
|
|
39771
|
-
var origValue = base[key];
|
|
39772
|
-
var value = copy[key];
|
|
39773
|
-
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
39774
|
-
if (origValue === value && op === "replace") { return; }
|
|
39775
|
-
var path = basePath.concat(key);
|
|
39776
|
-
patches.push(op === "remove" ? {
|
|
39777
|
-
op: op,
|
|
39778
|
-
path: path
|
|
39779
|
-
} : {
|
|
39780
|
-
op: op,
|
|
39781
|
-
path: path,
|
|
39782
|
-
value: value
|
|
39783
|
-
});
|
|
39784
|
-
inversePatches.push(op === "add" ? {
|
|
39785
|
-
op: "remove",
|
|
39786
|
-
path: path
|
|
39787
|
-
} : op === "remove" ? {
|
|
39788
|
-
op: "add",
|
|
39789
|
-
path: path,
|
|
39790
|
-
value: origValue
|
|
39791
|
-
} : {
|
|
39792
|
-
op: "replace",
|
|
39793
|
-
path: path,
|
|
39794
|
-
value: origValue
|
|
39795
|
-
});
|
|
39796
|
-
});
|
|
39797
|
-
}
|
|
39798
|
-
|
|
39799
|
-
var applyPatches = function (draft, patches) {
|
|
39800
|
-
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
39801
|
-
var patch = list[i$1];
|
|
39802
|
-
|
|
39803
|
-
var path = patch.path;
|
|
39804
|
-
var op = patch.op;
|
|
39805
|
-
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
39806
|
-
|
|
39807
|
-
if (!path.length) { throw new Error("Illegal state"); }
|
|
39808
|
-
var base = draft;
|
|
39809
|
-
|
|
39810
|
-
for (var i = 0; i < path.length - 1; i++) {
|
|
39811
|
-
base = base[path[i]];
|
|
39812
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
39813
|
-
}
|
|
39814
|
-
|
|
39815
|
-
var key = path[path.length - 1];
|
|
39816
|
-
|
|
39817
|
-
switch (op) {
|
|
39818
|
-
case "replace":
|
|
39819
|
-
// if value is an object, then it's assigned by reference
|
|
39820
|
-
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
39821
|
-
// so we use value from the cloned patch
|
|
39822
|
-
base[key] = value;
|
|
39823
|
-
break;
|
|
39824
|
-
|
|
39825
|
-
case "add":
|
|
39826
|
-
if (Array.isArray(base)) {
|
|
39827
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
39828
|
-
base.splice(key, 0, value);
|
|
39829
|
-
} else {
|
|
39830
|
-
base[key] = value;
|
|
39831
|
-
}
|
|
39832
|
-
|
|
39833
|
-
break;
|
|
39834
|
-
|
|
39835
|
-
case "remove":
|
|
39836
|
-
if (Array.isArray(base)) {
|
|
39837
|
-
base.splice(key, 1);
|
|
39838
|
-
} else {
|
|
39839
|
-
delete base[key];
|
|
39840
|
-
}
|
|
39841
|
-
|
|
39842
|
-
break;
|
|
39843
|
-
|
|
39844
|
-
default:
|
|
39845
|
-
throw new Error("Unsupported patch operation: " + op);
|
|
39846
|
-
}
|
|
39847
|
-
}
|
|
39848
|
-
|
|
39849
|
-
return draft;
|
|
39850
|
-
};
|
|
39851
|
-
|
|
39852
|
-
function verifyMinified() {}
|
|
39853
|
-
|
|
39854
|
-
var configDefaults = {
|
|
39855
|
-
useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
|
|
39856
|
-
autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
|
|
39857
|
-
onAssign: null,
|
|
39858
|
-
onDelete: null,
|
|
39859
|
-
onCopy: null
|
|
39860
|
-
};
|
|
39861
|
-
var Immer = function Immer(config) {
|
|
39862
|
-
assign(this, configDefaults, config);
|
|
39863
|
-
this.setUseProxies(this.useProxies);
|
|
39864
|
-
this.produce = this.produce.bind(this);
|
|
39865
|
-
};
|
|
39866
|
-
|
|
39867
|
-
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
39868
|
-
var this$1$1 = this;
|
|
39869
|
-
|
|
39870
|
-
// curried invocation
|
|
39871
|
-
if (typeof base === "function" && typeof recipe !== "function") {
|
|
39872
|
-
var defaultBase = recipe;
|
|
39873
|
-
recipe = base;
|
|
39874
|
-
var self = this;
|
|
39875
|
-
return function curriedProduce(base) {
|
|
39876
|
-
var this$1$1 = this;
|
|
39877
|
-
if ( base === void 0 ) base = defaultBase;
|
|
39878
|
-
var args = [], len = arguments.length - 1;
|
|
39879
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39880
|
-
|
|
39881
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
39882
|
-
};
|
|
39883
|
-
} // prettier-ignore
|
|
39884
|
-
|
|
39885
|
-
|
|
39886
|
-
{
|
|
39887
|
-
if (typeof recipe !== "function") {
|
|
39888
|
-
throw new Error("The first or second argument to `produce` must be a function");
|
|
39889
|
-
}
|
|
39890
|
-
|
|
39891
|
-
if (patchListener !== undefined && typeof patchListener !== "function") {
|
|
39892
|
-
throw new Error("The third argument to `produce` must be a function or undefined");
|
|
39893
|
-
}
|
|
39894
|
-
}
|
|
39895
|
-
var result; // Only plain objects, arrays, and "immerable classes" are drafted.
|
|
39896
|
-
|
|
39897
|
-
if (isDraftable(base)) {
|
|
39898
|
-
var scope = ImmerScope.enter();
|
|
39899
|
-
var proxy = this.createProxy(base);
|
|
39900
|
-
var hasError = true;
|
|
39901
|
-
|
|
39902
|
-
try {
|
|
39903
|
-
result = recipe(proxy);
|
|
39904
|
-
hasError = false;
|
|
39905
|
-
} finally {
|
|
39906
|
-
// finally instead of catch + rethrow better preserves original stack
|
|
39907
|
-
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
39908
|
-
}
|
|
39909
|
-
|
|
39910
|
-
if (result instanceof Promise) {
|
|
39911
|
-
return result.then(function (result) {
|
|
39912
|
-
scope.usePatches(patchListener);
|
|
39913
|
-
return this$1$1.processResult(result, scope);
|
|
39914
|
-
}, function (error) {
|
|
39915
|
-
scope.revoke();
|
|
39916
|
-
throw error;
|
|
39917
|
-
});
|
|
39918
|
-
}
|
|
39919
|
-
|
|
39920
|
-
scope.usePatches(patchListener);
|
|
39921
|
-
return this.processResult(result, scope);
|
|
39922
|
-
} else {
|
|
39923
|
-
result = recipe(base);
|
|
39924
|
-
if (result === undefined) { return base; }
|
|
39925
|
-
return result !== NOTHING ? result : undefined;
|
|
39926
|
-
}
|
|
39927
|
-
};
|
|
39928
|
-
|
|
39929
|
-
Immer.prototype.produceWithPatches = function produceWithPatches (arg1, arg2, arg3) {
|
|
39930
|
-
var this$1$1 = this;
|
|
39931
|
-
|
|
39932
|
-
if (typeof arg1 === "function") {
|
|
39933
|
-
return function (state) {
|
|
39934
|
-
var args = [], len = arguments.length - 1;
|
|
39935
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39936
|
-
|
|
39937
|
-
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
39938
|
-
};
|
|
39939
|
-
} // non-curried form
|
|
39940
|
-
|
|
39941
|
-
|
|
39942
|
-
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
39943
|
-
var patches, inversePatches;
|
|
39944
|
-
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
39945
|
-
patches = p;
|
|
39946
|
-
inversePatches = ip;
|
|
39947
|
-
});
|
|
39948
|
-
return [nextState, patches, inversePatches];
|
|
39949
|
-
};
|
|
39950
|
-
|
|
39951
|
-
Immer.prototype.createDraft = function createDraft (base) {
|
|
39952
|
-
if (!isDraftable(base)) {
|
|
39953
|
-
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
39954
|
-
}
|
|
39955
|
-
|
|
39956
|
-
var scope = ImmerScope.enter();
|
|
39957
|
-
var proxy = this.createProxy(base);
|
|
39958
|
-
proxy[DRAFT_STATE].isManual = true;
|
|
39959
|
-
scope.leave();
|
|
39960
|
-
return proxy;
|
|
39961
|
-
};
|
|
39962
|
-
|
|
39963
|
-
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
39964
|
-
var state = draft && draft[DRAFT_STATE];
|
|
39965
|
-
|
|
39966
|
-
if (!state || !state.isManual) {
|
|
39967
|
-
throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
|
|
39968
|
-
}
|
|
39969
|
-
|
|
39970
|
-
if (state.finalized) {
|
|
39971
|
-
throw new Error("The given draft is already finalized"); // prettier-ignore
|
|
39972
|
-
}
|
|
39973
|
-
|
|
39974
|
-
var scope = state.scope;
|
|
39975
|
-
scope.usePatches(patchListener);
|
|
39976
|
-
return this.processResult(undefined, scope);
|
|
39977
|
-
};
|
|
39978
|
-
|
|
39979
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
39980
|
-
this.autoFreeze = value;
|
|
39981
|
-
};
|
|
39982
|
-
|
|
39983
|
-
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
39984
|
-
this.useProxies = value;
|
|
39985
|
-
assign(this, value ? modernProxy : legacyProxy);
|
|
39986
|
-
};
|
|
39987
|
-
|
|
39988
|
-
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
39989
|
-
// If a patch replaces the entire state, take that replacement as base
|
|
39990
|
-
// before applying patches
|
|
39991
|
-
var i;
|
|
39992
|
-
|
|
39993
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
39994
|
-
var patch = patches[i];
|
|
39995
|
-
|
|
39996
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
39997
|
-
base = patch.value;
|
|
39998
|
-
break;
|
|
39999
|
-
}
|
|
40000
|
-
}
|
|
40001
|
-
|
|
40002
|
-
if (isDraft(base)) {
|
|
40003
|
-
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
40004
|
-
return applyPatches(base, patches);
|
|
40005
|
-
} // Otherwise, produce a copy of the base state.
|
|
40006
|
-
|
|
40007
|
-
|
|
40008
|
-
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
40009
|
-
};
|
|
40010
|
-
/** @internal */
|
|
40011
|
-
|
|
40012
|
-
|
|
40013
|
-
Immer.prototype.processResult = function processResult (result, scope) {
|
|
40014
|
-
var baseDraft = scope.drafts[0];
|
|
40015
|
-
var isReplaced = result !== undefined && result !== baseDraft;
|
|
40016
|
-
this.willFinalize(scope, result, isReplaced);
|
|
40017
|
-
|
|
40018
|
-
if (isReplaced) {
|
|
40019
|
-
if (baseDraft[DRAFT_STATE].modified) {
|
|
40020
|
-
scope.revoke();
|
|
40021
|
-
throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft."); // prettier-ignore
|
|
40022
|
-
}
|
|
40023
|
-
|
|
40024
|
-
if (isDraftable(result)) {
|
|
40025
|
-
// Finalize the result in case it contains (or is) a subset of the draft.
|
|
40026
|
-
result = this.finalize(result, null, scope);
|
|
40027
|
-
}
|
|
40028
|
-
|
|
40029
|
-
if (scope.patches) {
|
|
40030
|
-
scope.patches.push({
|
|
40031
|
-
op: "replace",
|
|
40032
|
-
path: [],
|
|
40033
|
-
value: result
|
|
40034
|
-
});
|
|
40035
|
-
scope.inversePatches.push({
|
|
40036
|
-
op: "replace",
|
|
40037
|
-
path: [],
|
|
40038
|
-
value: baseDraft[DRAFT_STATE].base
|
|
40039
|
-
});
|
|
40040
|
-
}
|
|
40041
|
-
} else {
|
|
40042
|
-
// Finalize the base draft.
|
|
40043
|
-
result = this.finalize(baseDraft, [], scope);
|
|
40044
|
-
}
|
|
40045
|
-
|
|
40046
|
-
scope.revoke();
|
|
40047
|
-
|
|
40048
|
-
if (scope.patches) {
|
|
40049
|
-
scope.patchListener(scope.patches, scope.inversePatches);
|
|
40050
|
-
}
|
|
40051
|
-
|
|
40052
|
-
return result !== NOTHING ? result : undefined;
|
|
39112
|
+
return runFormValidators(fieldName, form, validators);
|
|
40053
39113
|
};
|
|
40054
|
-
/**
|
|
40055
|
-
* @internal
|
|
40056
|
-
* Finalize a draft, returning either the unmodified base state or a modified
|
|
40057
|
-
* copy of the base state.
|
|
40058
|
-
*/
|
|
40059
|
-
|
|
40060
|
-
|
|
40061
|
-
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
40062
|
-
var this$1$1 = this;
|
|
40063
|
-
|
|
40064
|
-
var state = draft[DRAFT_STATE];
|
|
40065
|
-
|
|
40066
|
-
if (!state) {
|
|
40067
|
-
if (Object.isFrozen(draft)) { return draft; }
|
|
40068
|
-
return this.finalizeTree(draft, null, scope);
|
|
40069
|
-
} // Never finalize drafts owned by another scope.
|
|
40070
|
-
|
|
40071
|
-
|
|
40072
|
-
if (state.scope !== scope) {
|
|
40073
|
-
return draft;
|
|
40074
|
-
}
|
|
40075
|
-
|
|
40076
|
-
if (!state.modified) {
|
|
40077
|
-
return state.base;
|
|
40078
|
-
}
|
|
40079
|
-
|
|
40080
|
-
if (!state.finalized) {
|
|
40081
|
-
state.finalized = true;
|
|
40082
|
-
this.finalizeTree(state.draft, path, scope);
|
|
40083
|
-
|
|
40084
|
-
if (this.onDelete) {
|
|
40085
|
-
// The `assigned` object is unreliable with ES5 drafts.
|
|
40086
|
-
if (this.useProxies) {
|
|
40087
|
-
var assigned = state.assigned;
|
|
40088
|
-
|
|
40089
|
-
for (var prop in assigned) {
|
|
40090
|
-
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
40091
|
-
}
|
|
40092
|
-
} else {
|
|
40093
|
-
var base = state.base;
|
|
40094
|
-
var copy = state.copy;
|
|
40095
|
-
each(base, function (prop) {
|
|
40096
|
-
if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
40097
|
-
});
|
|
40098
|
-
}
|
|
40099
|
-
}
|
|
40100
|
-
|
|
40101
|
-
if (this.onCopy) {
|
|
40102
|
-
this.onCopy(state);
|
|
40103
|
-
} // At this point, all descendants of `state.copy` have been finalized,
|
|
40104
|
-
// so we can be sure that `scope.canAutoFreeze` is accurate.
|
|
40105
|
-
|
|
40106
39114
|
|
|
40107
|
-
|
|
40108
|
-
|
|
40109
|
-
|
|
40110
|
-
|
|
40111
|
-
|
|
40112
|
-
|
|
40113
|
-
|
|
39115
|
+
const computeErrorEntries = (formState) => {
|
|
39116
|
+
const fields = Object.entries(formState);
|
|
39117
|
+
for (let entry of fields) {
|
|
39118
|
+
let fieldName = entry[0];
|
|
39119
|
+
let errors = computeErrors(fieldName, formState);
|
|
39120
|
+
formState[fieldName].errors = errors;
|
|
39121
|
+
formState[fieldName].hasErrors = errors.length > 0;
|
|
40114
39122
|
}
|
|
40115
|
-
|
|
40116
|
-
return state.copy;
|
|
40117
39123
|
};
|
|
40118
|
-
/**
|
|
40119
|
-
* @internal
|
|
40120
|
-
* Finalize all drafts in the given state tree.
|
|
40121
|
-
*/
|
|
40122
|
-
|
|
40123
|
-
|
|
40124
|
-
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
40125
|
-
var this$1$1 = this;
|
|
40126
39124
|
|
|
40127
|
-
|
|
40128
|
-
|
|
40129
|
-
|
|
40130
|
-
|
|
40131
|
-
|
|
40132
|
-
|
|
40133
|
-
|
|
40134
|
-
|
|
40135
|
-
root = state.copy;
|
|
39125
|
+
const computeDirtyEntries = (formState, changedFieldName) => {
|
|
39126
|
+
const fields = Object.entries(formState);
|
|
39127
|
+
for (let entry of fields) {
|
|
39128
|
+
let fieldName = entry[0];
|
|
39129
|
+
let field = entry[1];
|
|
39130
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
39131
|
+
formState[fieldName].dirty = dirty;
|
|
40136
39132
|
}
|
|
40137
|
-
|
|
40138
|
-
var needPatches = !!rootPath && !!scope.patches;
|
|
40139
|
-
|
|
40140
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
40141
|
-
if (value === parent) {
|
|
40142
|
-
throw Error("Immer forbids circular references");
|
|
40143
|
-
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
40144
|
-
|
|
40145
|
-
|
|
40146
|
-
var isDraftProp = !!state && parent === root;
|
|
40147
|
-
|
|
40148
|
-
if (isDraft(value)) {
|
|
40149
|
-
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
40150
|
-
|
|
40151
|
-
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
40152
|
-
|
|
40153
|
-
if (isDraft(value)) {
|
|
40154
|
-
scope.canAutoFreeze = false;
|
|
40155
|
-
} // Preserve non-enumerable properties.
|
|
40156
|
-
|
|
40157
|
-
|
|
40158
|
-
if (Array.isArray(parent) || isEnumerable(parent, prop)) {
|
|
40159
|
-
parent[prop] = value;
|
|
40160
|
-
} else {
|
|
40161
|
-
Object.defineProperty(parent, prop, {
|
|
40162
|
-
value: value
|
|
40163
|
-
});
|
|
40164
|
-
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
40165
|
-
|
|
40166
|
-
|
|
40167
|
-
if (isDraftProp && value === state.base[prop]) { return; }
|
|
40168
|
-
} // Unchanged draft properties are ignored.
|
|
40169
|
-
else if (isDraftProp && is(value, state.base[prop])) {
|
|
40170
|
-
return;
|
|
40171
|
-
} // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
|
|
40172
|
-
else if (isDraftable(value) && !Object.isFrozen(value)) {
|
|
40173
|
-
each(value, finalizeProperty);
|
|
40174
|
-
}
|
|
40175
|
-
|
|
40176
|
-
if (isDraftProp && this$1$1.onAssign) {
|
|
40177
|
-
this$1$1.onAssign(state, prop, value);
|
|
40178
|
-
}
|
|
40179
|
-
};
|
|
40180
|
-
|
|
40181
|
-
each(root, finalizeProperty);
|
|
40182
|
-
return root;
|
|
40183
39133
|
};
|
|
40184
39134
|
|
|
40185
|
-
var immer = new Immer();
|
|
40186
|
-
/**
|
|
40187
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
40188
|
-
* return value often depends on the base state). The recipe function is
|
|
40189
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
40190
|
-
* only ever applied to a __copy__ of the base state.
|
|
40191
|
-
*
|
|
40192
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
40193
|
-
* from passing the recipe function every time.
|
|
40194
|
-
*
|
|
40195
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
40196
|
-
* considered uncopyable.
|
|
40197
|
-
*
|
|
40198
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
40199
|
-
*
|
|
40200
|
-
* @param {any} base - the initial state
|
|
40201
|
-
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
40202
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
40203
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
40204
|
-
*/
|
|
40205
|
-
|
|
40206
|
-
var produce = immer.produce;
|
|
40207
|
-
/**
|
|
40208
|
-
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
40209
|
-
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
40210
|
-
*/
|
|
40211
|
-
|
|
40212
|
-
immer.produceWithPatches.bind(immer);
|
|
40213
|
-
/**
|
|
40214
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
40215
|
-
*
|
|
40216
|
-
* By default, auto-freezing is disabled in production.
|
|
40217
|
-
*/
|
|
40218
|
-
|
|
40219
|
-
immer.setAutoFreeze.bind(immer);
|
|
40220
|
-
/**
|
|
40221
|
-
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
40222
|
-
* always faster than using ES5 proxies.
|
|
40223
|
-
*
|
|
40224
|
-
* By default, feature detection is used, so calling this is rarely necessary.
|
|
40225
|
-
*/
|
|
40226
|
-
|
|
40227
|
-
immer.setUseProxies.bind(immer);
|
|
40228
|
-
/**
|
|
40229
|
-
* Apply an array of Immer patches to the first argument.
|
|
40230
|
-
*
|
|
40231
|
-
* This function is a producer, which means copy-on-write is in effect.
|
|
40232
|
-
*/
|
|
40233
|
-
|
|
40234
|
-
immer.applyPatches.bind(immer);
|
|
40235
|
-
/**
|
|
40236
|
-
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
40237
|
-
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
40238
|
-
*/
|
|
40239
|
-
|
|
40240
|
-
immer.createDraft.bind(immer);
|
|
40241
|
-
/**
|
|
40242
|
-
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
40243
|
-
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
40244
|
-
* mutated afterwards.
|
|
40245
|
-
*
|
|
40246
|
-
* Pass a function as the 2nd argument to generate Immer patches based on the
|
|
40247
|
-
* changes that were made.
|
|
40248
|
-
*/
|
|
39135
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a$1(n,r){return 2===o(n)?n.get(r):n[r]}function f$6(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$1(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$1(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b$1("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$1("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b$1("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b$1("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f$6(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b$1("MapSet").F(r,t):v(r)?b$1("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$1("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$1("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a$1(u.t,r)===t||f$6(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$1(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b$1("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$1("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
40249
39136
|
|
|
40250
|
-
|
|
40251
|
-
|
|
40252
|
-
const createInitialState = formConfig => {
|
|
39137
|
+
const createInitialState = (formConfig) => {
|
|
40253
39138
|
let initialForm = {};
|
|
40254
39139
|
const formConfigKeys = Object.keys(formConfig);
|
|
40255
39140
|
for (let formKey of formConfigKeys) {
|
|
40256
39141
|
initialForm[formKey] = {
|
|
40257
39142
|
dirty: false,
|
|
40258
|
-
rawValue: formConfig[formKey].defaultValue ||
|
|
39143
|
+
rawValue: formConfig[formKey].defaultValue || '',
|
|
40259
39144
|
validators: formConfig[formKey].validators || [],
|
|
40260
|
-
constraints: formConfig[formKey].constraints || []
|
|
39145
|
+
constraints: formConfig[formKey].constraints || [],
|
|
40261
39146
|
};
|
|
40262
39147
|
}
|
|
40263
39148
|
// Because validators require the entire form we have to do a
|
|
@@ -40268,82 +39153,99 @@ const createInitialState = formConfig => {
|
|
|
40268
39153
|
initialForm[formKey].errors = errors;
|
|
40269
39154
|
initialForm[formKey].hasErrors = errors.length > 0;
|
|
40270
39155
|
}
|
|
39156
|
+
|
|
40271
39157
|
return initialForm;
|
|
40272
39158
|
};
|
|
40273
39159
|
|
|
40274
|
-
const SET =
|
|
40275
|
-
const set$
|
|
39160
|
+
const SET = 'field/SET';
|
|
39161
|
+
const set$1 = (fieldName) => (value) => ({
|
|
40276
39162
|
type: SET,
|
|
40277
|
-
payload: { fieldName, value }
|
|
39163
|
+
payload: { fieldName, value },
|
|
40278
39164
|
});
|
|
40279
39165
|
|
|
40280
|
-
const CLEAR =
|
|
39166
|
+
const CLEAR = 'form/CLEAR';
|
|
40281
39167
|
const clear = () => ({ type: CLEAR });
|
|
40282
39168
|
|
|
40283
|
-
const ADD_VALIDATOR =
|
|
40284
|
-
const addValidator = fieldName => validator => ({
|
|
39169
|
+
const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
|
|
39170
|
+
const addValidator = (fieldName) => (validator) => ({
|
|
40285
39171
|
type: ADD_VALIDATOR,
|
|
40286
|
-
payload: { fieldName, validator }
|
|
39172
|
+
payload: { fieldName, validator },
|
|
40287
39173
|
});
|
|
40288
39174
|
|
|
40289
|
-
const
|
|
40290
|
-
|
|
40291
|
-
|
|
40292
|
-
|
|
40293
|
-
|
|
40294
|
-
case SET:
|
|
40295
|
-
const changedFieldName = action.payload.fieldName;
|
|
40296
|
-
const newRawValue = action.payload.value;
|
|
40297
|
-
|
|
40298
|
-
return produce(state, draftState => {
|
|
40299
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
40300
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
40301
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
40302
|
-
// If the change violates constraints, revert the change
|
|
40303
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
40304
|
-
return draftState;
|
|
40305
|
-
}
|
|
39175
|
+
const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
|
|
39176
|
+
const removeValidator = (fieldName) => (validator) => ({
|
|
39177
|
+
type: REMOVE_VALIDATOR,
|
|
39178
|
+
payload: { fieldName, validator },
|
|
39179
|
+
});
|
|
40306
39180
|
|
|
40307
|
-
|
|
40308
|
-
|
|
40309
|
-
|
|
40310
|
-
|
|
40311
|
-
|
|
40312
|
-
|
|
40313
|
-
|
|
40314
|
-
|
|
40315
|
-
|
|
40316
|
-
|
|
40317
|
-
|
|
40318
|
-
|
|
40319
|
-
|
|
40320
|
-
|
|
40321
|
-
|
|
40322
|
-
|
|
40323
|
-
|
|
40324
|
-
|
|
40325
|
-
|
|
40326
|
-
|
|
40327
|
-
|
|
40328
|
-
|
|
40329
|
-
|
|
40330
|
-
|
|
40331
|
-
|
|
40332
|
-
|
|
40333
|
-
|
|
40334
|
-
|
|
40335
|
-
|
|
40336
|
-
|
|
40337
|
-
|
|
40338
|
-
|
|
40339
|
-
|
|
40340
|
-
|
|
39181
|
+
const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
|
|
39182
|
+
const clearFieldValidators = (fieldName) => () => ({
|
|
39183
|
+
type: CLEAR_FIELD_VALIDATORS,
|
|
39184
|
+
payload: { fieldName },
|
|
39185
|
+
});
|
|
39186
|
+
|
|
39187
|
+
const createFormReducer =
|
|
39188
|
+
(formConfig) =>
|
|
39189
|
+
(state = createInitialState(formConfig), action) => {
|
|
39190
|
+
switch (action.type) {
|
|
39191
|
+
case SET: {
|
|
39192
|
+
const changedFieldName = action.payload.fieldName;
|
|
39193
|
+
const newRawValue = action.payload.value;
|
|
39194
|
+
|
|
39195
|
+
return produce(state, (draftState) => {
|
|
39196
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
39197
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
39198
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
39199
|
+
// If the change violates constraints, revert the change
|
|
39200
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
39201
|
+
return draftState;
|
|
39202
|
+
}
|
|
39203
|
+
|
|
39204
|
+
computeDirtyEntries(draftState, changedFieldName);
|
|
39205
|
+
computeErrorEntries(draftState);
|
|
39206
|
+
});
|
|
39207
|
+
}
|
|
39208
|
+
case CLEAR:
|
|
39209
|
+
return createInitialState(formConfig);
|
|
39210
|
+
case ADD_VALIDATOR: {
|
|
39211
|
+
const fieldWithOverride = action.payload.fieldName;
|
|
39212
|
+
const newValidator = action.payload.validator;
|
|
39213
|
+
|
|
39214
|
+
return produce(state, (draftState) => {
|
|
39215
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
39216
|
+
computeErrorEntries(draftState);
|
|
39217
|
+
});
|
|
39218
|
+
}
|
|
39219
|
+
case REMOVE_VALIDATOR: {
|
|
39220
|
+
const fieldToOverride = action.payload.fieldName;
|
|
39221
|
+
const targetValidator = action.payload.validator;
|
|
39222
|
+
|
|
39223
|
+
return produce(state, (draftState) => {
|
|
39224
|
+
let fieldValidators = draftState[fieldToOverride].validators;
|
|
39225
|
+
draftState[fieldToOverride].validators = fieldValidators.filter(
|
|
39226
|
+
(validator) => validator.type !== targetValidator.type
|
|
39227
|
+
);
|
|
39228
|
+
computeErrorEntries(draftState);
|
|
39229
|
+
});
|
|
39230
|
+
}
|
|
39231
|
+
case CLEAR_FIELD_VALIDATORS: {
|
|
39232
|
+
const fieldToClear = action.payload.fieldName;
|
|
39233
|
+
|
|
39234
|
+
return produce(state, (draftState) => {
|
|
39235
|
+
draftState[fieldToClear].validators = [];
|
|
39236
|
+
computeErrorEntries(draftState);
|
|
39237
|
+
});
|
|
39238
|
+
}
|
|
39239
|
+
default:
|
|
39240
|
+
return state;
|
|
39241
|
+
}
|
|
39242
|
+
};
|
|
40341
39243
|
|
|
40342
|
-
const createMapDispatchToProps = formConfig => {
|
|
39244
|
+
const createMapDispatchToProps = (formConfig) => {
|
|
40343
39245
|
// Do memo-ization
|
|
40344
39246
|
let cachedDispatch;
|
|
40345
39247
|
let cacheValue;
|
|
40346
|
-
return dispatch => {
|
|
39248
|
+
return (dispatch) => {
|
|
40347
39249
|
if (dispatch == cachedDispatch) {
|
|
40348
39250
|
return cacheValue;
|
|
40349
39251
|
}
|
|
@@ -40352,8 +39254,11 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40352
39254
|
const keys = Object.keys(formConfig);
|
|
40353
39255
|
for (let fieldName of keys) {
|
|
40354
39256
|
dispatchObj.fields[fieldName] = {
|
|
40355
|
-
set: value => dispatch(set$
|
|
40356
|
-
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
39257
|
+
set: (value) => dispatch(set$1(fieldName)(value)),
|
|
39258
|
+
addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
|
|
39259
|
+
removeValidator: (validator) =>
|
|
39260
|
+
dispatch(removeValidator(fieldName)(validator)),
|
|
39261
|
+
clear: () => dispatch(clearFieldValidators(fieldName)()),
|
|
40357
39262
|
};
|
|
40358
39263
|
}
|
|
40359
39264
|
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
@@ -40363,12 +39268,12 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40363
39268
|
};
|
|
40364
39269
|
};
|
|
40365
39270
|
|
|
40366
|
-
const mapStateToProps = state => ({ fields: state });
|
|
39271
|
+
const mapStateToProps = (state) => ({ fields: state });
|
|
40367
39272
|
|
|
40368
|
-
const createFormState = formConfig => ({
|
|
39273
|
+
const createFormState = (formConfig) => ({
|
|
40369
39274
|
reducer: createFormReducer(formConfig),
|
|
40370
39275
|
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
40371
|
-
mapStateToProps: mapStateToProps
|
|
39276
|
+
mapStateToProps: mapStateToProps,
|
|
40372
39277
|
});
|
|
40373
39278
|
|
|
40374
39279
|
var AddressForm = function AddressForm(_ref) {
|
|
@@ -43234,12 +42139,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
|
|
|
43234
42139
|
* This source code is licensed under the MIT license found in the
|
|
43235
42140
|
* LICENSE file in the root directory of this source tree.
|
|
43236
42141
|
*/
|
|
43237
|
-
var b$
|
|
43238
|
-
Symbol.for("react.suspense_list"):60120,r=b$
|
|
43239
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$
|
|
43240
|
-
var Profiler=g;var StrictMode=f$
|
|
43241
|
-
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f$
|
|
43242
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$
|
|
42142
|
+
var b$2="function"===typeof Symbol&&Symbol.for,c$2=b$2?Symbol.for("react.element"):60103,d$1=b$2?Symbol.for("react.portal"):60106,e=b$2?Symbol.for("react.fragment"):60107,f$7=b$2?Symbol.for("react.strict_mode"):60108,g$1=b$2?Symbol.for("react.profiler"):60114,h$1=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$1=b$2?Symbol.for("react.async_mode"):60111,m=b$2?Symbol.for("react.concurrent_mode"):60111,n$1=b$2?Symbol.for("react.forward_ref"):60112,p$1=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
|
|
42143
|
+
Symbol.for("react.suspense_list"):60120,r$1=b$2?Symbol.for("react.memo"):60115,t$1=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$1=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
|
|
42144
|
+
function z$1(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$2:switch(a=a.type,a){case l$1:case m:case e:case g$1:case f$7:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r$1:case h$1:return a;default:return u}}case d$1:return u}}}function A$1(a){return z$1(a)===m}var AsyncMode=l$1;var ConcurrentMode=m;var ContextConsumer=k$1;var ContextProvider=h$1;var Element$1=c$2;var ForwardRef=n$1;var Fragment=e;var Lazy=t$1;var Memo=r$1;var Portal=d$1;
|
|
42145
|
+
var Profiler=g$1;var StrictMode=f$7;var Suspense=p$1;var isAsyncMode=function(a){return A$1(a)||z$1(a)===l$1};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z$1(a)===k$1};var isContextProvider=function(a){return z$1(a)===h$1};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$2};var isForwardRef=function(a){return z$1(a)===n$1};var isFragment=function(a){return z$1(a)===e};var isLazy=function(a){return z$1(a)===t$1};
|
|
42146
|
+
var isMemo=function(a){return z$1(a)===r$1};var isPortal=function(a){return z$1(a)===d$1};var isProfiler=function(a){return z$1(a)===g$1};var isStrictMode=function(a){return z$1(a)===f$7};var isSuspense=function(a){return z$1(a)===p$1};
|
|
42147
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g$1||a===f$7||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z$1;
|
|
43243
42148
|
|
|
43244
42149
|
var reactIs_production_min = {
|
|
43245
42150
|
AsyncMode: AsyncMode,
|
|
@@ -43610,14 +42515,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
43610
42515
|
|
|
43611
42516
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
43612
42517
|
|
|
43613
|
-
var has$
|
|
42518
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
43614
42519
|
|
|
43615
42520
|
var printWarning = function() {};
|
|
43616
42521
|
|
|
43617
42522
|
if (process.env.NODE_ENV !== 'production') {
|
|
43618
42523
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
43619
42524
|
var loggedTypeFailures = {};
|
|
43620
|
-
var has$
|
|
42525
|
+
var has$2 = has$1;
|
|
43621
42526
|
|
|
43622
42527
|
printWarning = function(text) {
|
|
43623
42528
|
var message = 'Warning: ' + text;
|
|
@@ -43647,7 +42552,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43647
42552
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
43648
42553
|
if (process.env.NODE_ENV !== 'production') {
|
|
43649
42554
|
for (var typeSpecName in typeSpecs) {
|
|
43650
|
-
if (has$
|
|
42555
|
+
if (has$2(typeSpecs, typeSpecName)) {
|
|
43651
42556
|
var error;
|
|
43652
42557
|
// Prop type validation may throw. In case they do, we don't want to
|
|
43653
42558
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -44046,7 +42951,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44046
42951
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
44047
42952
|
}
|
|
44048
42953
|
for (var key in propValue) {
|
|
44049
|
-
if (has$
|
|
42954
|
+
if (has$1(propValue, key)) {
|
|
44050
42955
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
44051
42956
|
if (error instanceof Error) {
|
|
44052
42957
|
return error;
|
|
@@ -44083,7 +42988,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44083
42988
|
if (checkerResult == null) {
|
|
44084
42989
|
return null;
|
|
44085
42990
|
}
|
|
44086
|
-
if (checkerResult.data && has$
|
|
42991
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
44087
42992
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
44088
42993
|
}
|
|
44089
42994
|
}
|
|
@@ -44143,7 +43048,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44143
43048
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
44144
43049
|
for (var key in allKeys) {
|
|
44145
43050
|
var checker = shapeTypes[key];
|
|
44146
|
-
if (has$
|
|
43051
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
44147
43052
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
44148
43053
|
}
|
|
44149
43054
|
if (!checker) {
|
|
@@ -44881,7 +43786,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
44881
43786
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
44882
43787
|
*/
|
|
44883
43788
|
|
|
44884
|
-
function ownKeys$
|
|
43789
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
44885
43790
|
var keys = Object.keys(object);
|
|
44886
43791
|
|
|
44887
43792
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -44897,9 +43802,9 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
44897
43802
|
function _objectSpread2$1(target) {
|
|
44898
43803
|
for (var i = 1; i < arguments.length; i++) {
|
|
44899
43804
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
44900
|
-
i % 2 ? ownKeys$
|
|
43805
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
44901
43806
|
_defineProperty$1(target, key, source[key]);
|
|
44902
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$
|
|
43807
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
44903
43808
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44904
43809
|
});
|
|
44905
43810
|
}
|