taro-form-react 0.2.7 → 0.2.8
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.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
Copyright (c) 2018 Jed Watson.
|
|
13
13
|
Licensed under the MIT License (MIT), see
|
|
14
14
|
http://jedwatson.github.io/classnames
|
|
15
|
-
*/var fe=(se||(se=1,function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=o(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var a in e)t.call(e,a)&&e[a]&&(n=o(n,a));return n}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(le)),le.exports),pe=n(fe),de="object"==typeof global&&global&&global.Object===Object&&global,ve="object"==typeof self&&self&&self.Object===Object&&self,ye=de||ve||Function("return this")(),be=ye.Symbol,he=Object.prototype,ge=he.hasOwnProperty,me=he.toString,je=be?be.toStringTag:void 0;var _e=Object.prototype.toString;var we=be?be.toStringTag:void 0;function Oe(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":we&&we in Object(e)?function(e){var t=ge.call(e,je),r=e[je];try{e[je]=void 0;var n=!0}catch(e){}var o=me.call(e);return n&&(t?e[je]=r:delete e[je]),o}(e):function(e){return _e.call(e)}(e)}function Fe(e){return null!=e&&"object"==typeof e}function Se(e){return"symbol"==typeof e||Fe(e)&&"[object Symbol]"==Oe(e)}function ke(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var xe=Array.isArray,Ae=be?be.prototype:void 0,Ee=Ae?Ae.toString:void 0;function Te(e){if("string"==typeof e)return e;if(xe(e))return ke(e,Te)+"";if(Se(e))return Ee?Ee.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ce(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return e}function Re(e){if(!Ce(e))return!1;var t=Oe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Ne,$e=ye["__core-js_shared__"],Ve=(Ne=/[^.]+$/.exec($e&&$e.keys&&$e.keys.IE_PROTO||""))?"Symbol(src)_1."+Ne:"";var Me=Function.prototype.toString;function ze(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var De=/^\[object .+?Constructor\]$/,Ie=Function.prototype,Ue=Object.prototype,Be=Ie.toString,qe=Ue.hasOwnProperty,Le=RegExp("^"+Be.call(qe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function We(e){return!(!Ce(e)||(t=e,Ve&&Ve in t))&&(Re(e)?Le:De).test(ze(e));var t}function Ye(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return We(r)?r:void 0}var Ke=Ye(ye,"WeakMap"),Je=Object.create,Xe=function(){function e(){}return function(t){if(!Ce(t))return{};if(Je)return Je(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Ge(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var He=Date.now;var Qe,Ze,et,tt=function(){try{var e=Ye(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),rt=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:Pe,nt=(Qe=rt,Ze=0,et=0,function(){var e=He(),t=16-(e-et);if(et=e,t>0){if(++Ze>=800)return arguments[0]}else Ze=0;return Qe.apply(void 0,arguments)});var ot=/^(?:0|[1-9]\d*)$/;function at(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&ot.test(e))&&e>-1&&e%1==0&&e<t}function it(e,t,r){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ut(e,t){return e===t||e!=e&&t!=t}var ct=Object.prototype.hasOwnProperty;function st(e,t,r){var n=e[t];ct.call(e,t)&&ut(n,r)&&(void 0!==r||t in e)||it(e,t,r)}function lt(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var u=t[a],c=void 0;void 0===c&&(c=e[u]),o?it(r,u,c):st(r,u,c)}return r}var ft=Math.max;function pt(e,t,r){return t=ft(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=ft(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=n[o];return u[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,u)}}function dt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function vt(e){return null!=e&&dt(e.length)&&!Re(e)}var yt=Object.prototype;function bt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||yt)}function ht(e){return Fe(e)&&"[object Arguments]"==Oe(e)}var gt=Object.prototype,mt=gt.hasOwnProperty,jt=gt.propertyIsEnumerable,_t=ht(function(){return arguments}())?ht:function(e){return Fe(e)&&mt.call(e,"callee")&&!jt.call(e,"callee")};var wt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ot=wt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ot&&Ot.exports===wt?ye.Buffer:void 0,St=(Ft?Ft.isBuffer:void 0)||function(){return!1},kt={};function xt(e){return function(t){return e(t)}}kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var At="object"==typeof exports&&exports&&!exports.nodeType&&exports,Et=At&&"object"==typeof module&&module&&!module.nodeType&&module,Tt=Et&&Et.exports===At&&de.process,Ct=function(){try{var e=Et&&Et.require&&Et.require("util").types;return e||Tt&&Tt.binding&&Tt.binding("util")}catch(e){}}(),Pt=Ct&&Ct.isTypedArray,Rt=Pt?xt(Pt):function(e){return Fe(e)&&dt(e.length)&&!!kt[Oe(e)]},Nt=Object.prototype.hasOwnProperty;function $t(e,t){var r=xe(e),n=!r&&_t(e),o=!r&&!n&&St(e),a=!r&&!n&&!o&&Rt(e),i=r||n||o||a,u=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=u.length;for(var s in e)!t&&!Nt.call(e,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||at(s,c))||u.push(s);return u}function Vt(e,t){return function(r){return e(t(r))}}var Mt=Vt(Object.keys,Object),zt=Object.prototype.hasOwnProperty;function Dt(e){return vt(e)?$t(e):function(e){if(!bt(e))return Mt(e);var t=[];for(var r in Object(e))zt.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var It=Object.prototype.hasOwnProperty;function Ut(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=bt(e),r=[];for(var n in e)("constructor"!=n||!t&&It.call(e,n))&&r.push(n);return r}function Bt(e){return vt(e)?$t(e,!0):Ut(e)}var qt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/;var Wt=Ye(Object,"create");var Yt=Object.prototype.hasOwnProperty;var Kt=Object.prototype.hasOwnProperty;function Jt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Xt(e,t){for(var r=e.length;r--;)if(ut(e[r][0],t))return r;return-1}Jt.prototype.clear=function(){this.__data__=Wt?Wt(null):{},this.size=0},Jt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Jt.prototype.get=function(e){var t=this.__data__;if(Wt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Yt.call(t,e)?t[e]:void 0},Jt.prototype.has=function(e){var t=this.__data__;return Wt?void 0!==t[e]:Kt.call(t,e)},Jt.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Wt&&void 0===t?"__lodash_hash_undefined__":t,this};var Gt=Array.prototype.splice;function Ht(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ht.prototype.clear=function(){this.__data__=[],this.size=0},Ht.prototype.delete=function(e){var t=this.__data__,r=Xt(t,e);return!(r<0)&&(r==t.length-1?t.pop():Gt.call(t,r,1),--this.size,!0)},Ht.prototype.get=function(e){var t=this.__data__,r=Xt(t,e);return r<0?void 0:t[r][1]},Ht.prototype.has=function(e){return Xt(this.__data__,e)>-1},Ht.prototype.set=function(e,t){var r=this.__data__,n=Xt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var Qt=Ye(ye,"Map");function Zt(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function er(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}er.prototype.clear=function(){this.size=0,this.__data__={hash:new Jt,map:new(Qt||Ht),string:new Jt}},er.prototype.delete=function(e){var t=Zt(this,e).delete(e);return this.size-=t?1:0,t},er.prototype.get=function(e){return Zt(this,e).get(e)},er.prototype.has=function(e){return Zt(this,e).has(e)},er.prototype.set=function(e,t){var r=Zt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function tr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(tr.Cache||er),r}tr.Cache=er;var rr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nr=/\\(\\)?/g,or=function(e){var t=tr(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rr,(function(e,r,n,o){t.push(n?o.replace(nr,"$1"):r||e)})),t}));function ar(e,t){return xe(e)?e:function(e,t){if(xe(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Se(e))||Lt.test(e)||!qt.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:or(function(e){return null==e?"":Te(e)}(e))}function ir(e){if("string"==typeof e||Se(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ur(e,t){for(var r=0,n=(t=ar(t,e)).length;null!=e&&r<n;)e=e[ir(t[r++])];return r&&r==n?e:void 0}function cr(e,t,r){var n=null==e?void 0:ur(e,t);return void 0===n?r:n}function sr(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}var lr=be?be.isConcatSpreadable:void 0;function fr(e){return xe(e)||_t(e)||!!(lr&&e&&e[lr])}function pr(e){return(null==e?0:e.length)?function(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=fr),o||(o=[]);++a<i;){var u=e[a];r(u)?sr(o,u):o[o.length]=u}return o}(e):[]}var dr=Vt(Object.getPrototypeOf,Object),vr=Function.prototype,yr=Object.prototype,br=vr.toString,hr=yr.hasOwnProperty,gr=br.call(Object);function mr(e){if(!Fe(e)||"[object Object]"!=Oe(e))return!1;var t=dr(e);if(null===t)return!0;var r=hr.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&br.call(r)==gr}function jr(e){var t=this.__data__=new Ht(e);this.size=t.size}jr.prototype.clear=function(){this.__data__=new Ht,this.size=0},jr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},jr.prototype.get=function(e){return this.__data__.get(e)},jr.prototype.has=function(e){return this.__data__.has(e)},jr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ht){var n=r.__data__;if(!Qt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new er(n)}return r.set(e,t),this.size=r.size,this};var _r="object"==typeof exports&&exports&&!exports.nodeType&&exports,wr=_r&&"object"==typeof module&&module&&!module.nodeType&&module,Or=wr&&wr.exports===_r?ye.Buffer:void 0,Fr=Or?Or.allocUnsafe:void 0;function Sr(e,t){if(t)return e.slice();var r=e.length,n=Fr?Fr(r):new e.constructor(r);return e.copy(n),n}function kr(){return[]}var xr=Object.prototype.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,Er=Ar?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(Ar(e),(function(t){return xr.call(e,t)})))}:kr;var Tr=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sr(t,Er(e)),e=dr(e);return t}:kr;function Cr(e,t,r){var n=t(e);return xe(e)?n:sr(n,r(e))}function Pr(e){return Cr(e,Dt,Er)}function Rr(e){return Cr(e,Bt,Tr)}var Nr=Ye(ye,"DataView"),$r=Ye(ye,"Promise"),Vr=Ye(ye,"Set"),Mr="[object Map]",zr="[object Promise]",Dr="[object Set]",Ir="[object WeakMap]",Ur="[object DataView]",Br=ze(Nr),qr=ze(Qt),Lr=ze($r),Wr=ze(Vr),Yr=ze(Ke),Kr=Oe;(Nr&&Kr(new Nr(new ArrayBuffer(1)))!=Ur||Qt&&Kr(new Qt)!=Mr||$r&&Kr($r.resolve())!=zr||Vr&&Kr(new Vr)!=Dr||Ke&&Kr(new Ke)!=Ir)&&(Kr=function(e){var t=Oe(e),r="[object Object]"==t?e.constructor:void 0,n=r?ze(r):"";if(n)switch(n){case Br:return Ur;case qr:return Mr;case Lr:return zr;case Wr:return Dr;case Yr:return Ir}return t});var Jr=Object.prototype.hasOwnProperty;var Xr=ye.Uint8Array;function Gr(e){var t=new e.constructor(e.byteLength);return new Xr(t).set(new Xr(e)),t}var Hr=/\w*$/;var Qr=be?be.prototype:void 0,Zr=Qr?Qr.valueOf:void 0;function en(e,t){var r=t?Gr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function tn(e,t,r){var n,o,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Gr(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var r=t?Gr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return en(e,r);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(o=e).constructor(o.source,Hr.exec(o))).lastIndex=o.lastIndex,a;case"[object Symbol]":return n=e,Zr?Object(Zr.call(n)):{}}}function rn(e){return"function"!=typeof e.constructor||bt(e)?{}:Xe(dr(e))}var nn=Ct&&Ct.isMap,on=nn?xt(nn):function(e){return Fe(e)&&"[object Map]"==Kr(e)};var an=Ct&&Ct.isSet,un=an?xt(an):function(e){return Fe(e)&&"[object Set]"==Kr(e)},cn="[object Arguments]",sn="[object Function]",ln="[object Object]",fn={};function pn(e,t,r,n,o,a){var i,u=1&t,c=2&t,s=4&t;if(r&&(i=o?r(e,n,o,a):r(e)),void 0!==i)return i;if(!Ce(e))return e;var l=xe(e);if(l){if(i=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Jr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!u)return Ge(e,i)}else{var f=Kr(e),p=f==sn||"[object GeneratorFunction]"==f;if(St(e))return Sr(e,u);if(f==ln||f==cn||p&&!o){if(i=c||p?{}:rn(e),!u)return c?function(e,t){return lt(e,Tr(e),t)}(e,function(e,t){return e&<(t,Bt(t),e)}(i,e)):function(e,t){return lt(e,Er(e),t)}(e,function(e,t){return e&<(t,Dt(t),e)}(i,e))}else{if(!fn[f])return o?e:{};i=tn(e,f,u)}}a||(a=new jr);var d=a.get(e);if(d)return d;a.set(e,i),un(e)?e.forEach((function(n){i.add(pn(n,t,r,n,e,a))})):on(e)&&e.forEach((function(n,o){i.set(o,pn(n,t,r,o,e,a))}));var v=l?void 0:(s?c?Rr:Pr:c?Bt:Dt)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(v||e,(function(n,o){v&&(n=e[o=n]),st(i,o,pn(n,t,r,o,e,a))})),i}fn[cn]=fn["[object Array]"]=fn["[object ArrayBuffer]"]=fn["[object DataView]"]=fn["[object Boolean]"]=fn["[object Date]"]=fn["[object Float32Array]"]=fn["[object Float64Array]"]=fn["[object Int8Array]"]=fn["[object Int16Array]"]=fn["[object Int32Array]"]=fn["[object Map]"]=fn["[object Number]"]=fn[ln]=fn["[object RegExp]"]=fn["[object Set]"]=fn["[object String]"]=fn["[object Symbol]"]=fn["[object Uint8Array]"]=fn["[object Uint8ClampedArray]"]=fn["[object Uint16Array]"]=fn["[object Uint32Array]"]=!0,fn["[object Error]"]=fn[sn]=fn["[object WeakMap]"]=!1;function dn(e){return pn(e,5)}var vn=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var u=a[++n];if(!1===t(o[u],u,o))break}return e};function yn(e,t,r){(void 0!==r&&!ut(e[t],r)||void 0===r&&!(t in e))&&it(e,t,r)}function bn(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function hn(e,t,r,n,o,a,i){var u=bn(e,r),c=bn(t,r),s=i.get(c);if(s)yn(e,r,s);else{var l,f=a?a(u,c,r+"",e,t,i):void 0,p=void 0===f;if(p){var d=xe(c),v=!d&&St(c),y=!d&&!v&&Rt(c);f=c,d||v||y?xe(u)?f=u:Fe(l=u)&&vt(l)?f=Ge(u):v?(p=!1,f=Sr(c,!0)):y?(p=!1,f=en(c,!0)):f=[]:mr(c)||_t(c)?(f=u,_t(u)?f=function(e){return lt(e,Bt(e))}(u):Ce(u)&&!Re(u)||(f=rn(c))):p=!1}p&&(i.set(c,f),o(f,c,n,a,i),i.delete(c)),yn(e,r,f)}}function gn(e,t,r,n,o){e!==t&&vn(t,(function(a,i){if(o||(o=new jr),Ce(a))hn(e,t,i,r,gn,n,o);else{var u=n?n(bn(e,i),a,i+"",e,t,o):void 0;void 0===u&&(u=a),yn(e,i,u)}}),Bt)}function mn(e,t){return t.length<2?e:ur(e,function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}(t,0,-1))}function jn(e){return null===e}var _n,wn=(_n=function(e,t,r){gn(e,t,r)},function(e,t){return nt(pt(e,t,Pe),e+"")}((function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=_n.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!Ce(r))return!1;var n=typeof t;return!!("number"==n?vt(r)&&at(t,r.length):"string"==n&&t in r)&&ut(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&_n(e,i,r,o)}return e})));function On(e,t){return null==(e=mn(e,t=ar(t,e)))||delete e[ir((r=t,n=null==r?0:r.length,n?r[n-1]:void 0))];var r,n}function Fn(e){return mr(e)?void 0:e}var Sn=function(e){return nt(pt(e,void 0,pr),e+"")}((function(e,t){var r={};if(null==e)return r;var n=!1;t=ke(t,(function(t){return t=ar(t,e),n||(n=t.length>1),t})),lt(e,Rr(e),r),n&&(r=pn(r,7,Fn));for(var o=t.length;o--;)On(r,t[o]);return r}));function kn(e,t,r){return null==e?e:function(e,t,r){if(!Ce(e))return e;for(var n=-1,o=(t=ar(t,e)).length,a=o-1,i=e;null!=i&&++n<o;){var u=ir(t[n]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(n!=a){var s=i[u];void 0===(c=void 0)&&(c=Ce(s)?s:at(t[n+1])?[]:{})}st(i,u,c),i=i[u]}return e}(e,t,r)}function xn(){const t=e.useRef(new Map),r=(n=d(e.useState({}),2)[1],e.useCallback((function(){return n({})}),[]));var n;const o=e.useCallback(((e,n)=>{t.current.set(e,n),r()}),[r]),a=e.useCallback((e=>{t.current=new Map(e),r()}),[r]),i=e.useCallback((e=>{t.current.delete(e),r()}),[r]),u=e.useCallback((()=>{t.current.clear(),r()}),[r]),c=e.useCallback((e=>t.current.get(e)),[]);return[t.current,{set:o,setAll:a,remove:i,reset:u,get:c}]}const An=e=>e.map((e=>"number"==typeof e?`[${e}]`:`.${e}`)).join(""),En=e.createContext(void 0),Tn=()=>{const t=e.useContext(En);if(!t)throw new Error("useFormContext must be used within a FormProvider");return t},Cn=t=>{var{initialValues:r,onFieldsChange:n,onValuesChange:o,children:a}=t,i=p(t,["initialValues","onFieldsChange","onValuesChange","children"]);const[u,{set:c,get:s,remove:l}]=xn(),[d,v]=e.useState({}),y=e.useCallback(((e,t,o)=>{const a=An(e),i=cr(d,e),l=i||(null!=o?o:cr(r,e));v((t=>{const r=dn(t);return kn(r,e,l),r}));const f=s(a);f&&console.warn(`[taro-form-react] Field "${a}" is already registered, register multiple times may cause unexpected behavior.`);const p=f?Object.assign(Object.assign({},f),{refs:[...f.refs,t],initialValue:o,count:f.count+1}):{refs:[t],name:e,touched:!1,errors:[],initialValue:o,count:1};c(a,p),null==n||n([{name:e,value:l}],Array.from(u.values()).map((e=>({name:e.name,value:cr(d,e.name)}))).concat([{name:e,value:l}]))}),[d,u,s,r,n,c]),b=e.useCallback(((e,t)=>{const r=An(e),o=s(r);o?1===o.count?(l(r),v((t=>{const r=dn(t);var n,o;return o=e,null==(n=r)||On(n,o),r})),null==n||n([{name:e,value:cr(d,e)}],Array.from(u.values()).map((e=>({name:e.name,value:cr(d,e.name)}))).filter((t=>t.name!==e)))):c(r,Object.assign(Object.assign({},o),{count:o.count-1,refs:o.refs.filter((e=>e!==t))})):console.warn(`[taro-form-react] Attempted to unregister field "${r}" that was never registered. Nothing will happen.`)}),[d,u,s,n,l,c]),h=e.useCallback(((e,t)=>{const r=An(e),n=s(r);if(v((r=>{const n=dn(r);return kn(n,e,t),n})),n?c(r,Object.assign(Object.assign({},n),{touched:!0})):console.warn(`[taro-form-react] Attempted to set value for field "${r}" that was never registered.\nForm data will still be updated but may not present while submit.\nUse Form.Keep to keep the field in sync with the form data.`),o){const r={};kn(r,e,t);const n=dn(d);kn(n,e,t),o(r,n)}}),[d,s,o,c]),g=e.useCallback((e=>cr(d,e)),[d]),m=e.useCallback((e=>{if(!e)return d;const t={};for(const r of e){kn(t,r,cr(d,r))}return t}),[d]),j=e.useCallback((async e=>{const t=null!=e?e:Array.from(u.values()).map((e=>e.name)),r={};for(const e of t){const t=s(An(e));if(!t){console.warn(`[taro-form-react] Attempted to get formatted value for field "${An(e)}" that was never registered. This field's value will not present in the result.`);continue}if(t.refs.some((e=>!e.current))){console.warn(`[taro-form-react] Attempted to get formatted value for field "${An(e)}" that has no or missing ref. This may cause unexpected behavior.`);continue}const n=t.refs[t.refs.length-1].current.transform;if(n){const t=await n();t.__form_internals_should_merge?wn(r,t.value):kn(r,e,t)}else kn(r,e,cr(d,e))}return r}),[d,u,s]),_=e.useCallback((e=>{v((t=>{const r={},n=dn(t);for(const t of e){const e=An(t.name),o=s(An(t.name));o?(void 0!==t.touched&&c(e,Object.assign(Object.assign({},o),{touched:t.touched})),kn(n,t.name,t.value),kn(r,t.name,t.value)):console.warn(`[taro-form-react] Attempted to set field "${e}" that was never registered. Changes will be ignored.`)}return setTimeout((()=>{null==o||o(r,wn(dn(t),n))}),0),n}))}),[s,o,c]),w=e.useCallback((e=>{if(!e)return Array.from(u.values()).map((e=>Object.assign(Object.assign({},e),{value:cr(d,e.name)})));const t=[];for(const r of e){const e=s(An(r));if(!e){console.warn(`[taro-form-react] Attempted to get field "${An(r)}" that was never registered. This field will not present in the result.`);continue}const n=cr(d,r);t.push(Object.assign(Object.assign({},e),{value:n}))}return t}),[d,u,s]),O=e.useCallback((e=>{var t;const n=null!==(t=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to reset field "${t}" that was never registered. This field will not be reset.`)})).filter((e=>void 0!==e)))&&void 0!==t?t:Array.from(u.values());for(const e of n)v((t=>{var n;const o=dn(t);return kn(o,e.name,null!==(n=e.initialValue)&&void 0!==n?n:cr(r,e.name)),o})),c(An(e.name),Object.assign(Object.assign({},e),{touched:!1}))}),[u,s,r,c]),F=e.useCallback(((e,t)=>{const r=An(e),n=s(r);n?c(r,Object.assign(Object.assign({},n),{errors:t})):console.warn(`[taro-form-react] Attempted to set errors for field "${r}" that was never registered. Nothing will happen.`)}),[s,c]),S=e.useCallback((e=>{const t=s(An(e));return t?t.errors:(console.warn(`[taro-form-react] Attempted to get errors for field "${An(e)}" that was never registered. Returning empty array.`),[])}),[s]),k=e.useCallback((async e=>{var t;const r=null!==(t=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to validate field "${t}" that was never registered. This field will not be validated.`)})).filter((e=>void 0!==e)))&&void 0!==t?t:Array.from(u.values()),n=[];for(const e of r){if(e.refs.some((e=>!e.current))){console.warn(`[taro-form-react] Attempted to validate field "${An(e.name)}" that has no or missing ref. This field will not be validated.`);continue}const t=await Promise.all(e.refs.map((e=>e.current.validate()))),r=Array.from(new Set(t.flat().filter(Boolean)));r.length>0&&n.push({name:e.name,errors:r})}return n.length>0?n:void 0}),[u,s]),x=e.useCallback(((e,t)=>{var r;const{allTouched:n=!1}=null!=t?t:{},o=null!==(r=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to check if field "${t}" is touched but it was never registered. This field will not be considered.`)})).filter((e=>void 0!==e)))&&void 0!==r?r:Array.from(u.values());return n?o.every((e=>e.touched)):o.some((e=>e.touched))}),[u,s]);return f.jsx(En.Provider,{value:Object.assign(Object.assign({initialValues:r},i),{data:d,setData:v,fields:u,registerField:y,unregisterField:b,setFieldValue:h,getFieldValue:g,getFieldsValue:m,getFieldsFormattedValue:j,setFields:_,getFields:w,resetFields:O,setFieldError:F,getFieldError:S,validateFields:k,isFieldsTouched:x}),children:a})},Pn=(e,t)=>void 0===e?t:e;const Rn=e=>null==e||""===e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length;var Nn,$n={exports:{}};
|
|
15
|
+
*/var fe=(se||(se=1,function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=o(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var a in e)t.call(e,a)&&e[a]&&(n=o(n,a));return n}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(le)),le.exports),pe=n(fe),de="object"==typeof global&&global&&global.Object===Object&&global,ve="object"==typeof self&&self&&self.Object===Object&&self,ye=de||ve||Function("return this")(),be=ye.Symbol,he=Object.prototype,ge=he.hasOwnProperty,me=he.toString,je=be?be.toStringTag:void 0;var _e=Object.prototype.toString;var we=be?be.toStringTag:void 0;function Oe(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":we&&we in Object(e)?function(e){var t=ge.call(e,je),r=e[je];try{e[je]=void 0;var n=!0}catch(e){}var o=me.call(e);return n&&(t?e[je]=r:delete e[je]),o}(e):function(e){return _e.call(e)}(e)}function Fe(e){return null!=e&&"object"==typeof e}function Se(e){return"symbol"==typeof e||Fe(e)&&"[object Symbol]"==Oe(e)}function ke(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var xe=Array.isArray,Ae=be?be.prototype:void 0,Ee=Ae?Ae.toString:void 0;function Te(e){if("string"==typeof e)return e;if(xe(e))return ke(e,Te)+"";if(Se(e))return Ee?Ee.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ce(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Pe(e){return e}function Re(e){if(!Ce(e))return!1;var t=Oe(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Ne,$e=ye["__core-js_shared__"],Ve=(Ne=/[^.]+$/.exec($e&&$e.keys&&$e.keys.IE_PROTO||""))?"Symbol(src)_1."+Ne:"";var Me=Function.prototype.toString;function ze(e){if(null!=e){try{return Me.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var De=/^\[object .+?Constructor\]$/,Ie=Function.prototype,Ue=Object.prototype,Be=Ie.toString,qe=Ue.hasOwnProperty,Le=RegExp("^"+Be.call(qe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function We(e){return!(!Ce(e)||(t=e,Ve&&Ve in t))&&(Re(e)?Le:De).test(ze(e));var t}function Ye(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return We(r)?r:void 0}var Ke=Ye(ye,"WeakMap"),Je=Object.create,Xe=function(){function e(){}return function(t){if(!Ce(t))return{};if(Je)return Je(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Ge(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var He=Date.now;var Qe,Ze,et,tt=function(){try{var e=Ye(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),rt=tt?function(e,t){return tt(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:Pe,nt=(Qe=rt,Ze=0,et=0,function(){var e=He(),t=16-(e-et);if(et=e,t>0){if(++Ze>=800)return arguments[0]}else Ze=0;return Qe.apply(void 0,arguments)});var ot=/^(?:0|[1-9]\d*)$/;function at(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&ot.test(e))&&e>-1&&e%1==0&&e<t}function it(e,t,r){"__proto__"==t&&tt?tt(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ut(e,t){return e===t||e!=e&&t!=t}var ct=Object.prototype.hasOwnProperty;function st(e,t,r){var n=e[t];ct.call(e,t)&&ut(n,r)&&(void 0!==r||t in e)||it(e,t,r)}function lt(e,t,r,n){var o=!r;r||(r={});for(var a=-1,i=t.length;++a<i;){var u=t[a],c=void 0;void 0===c&&(c=e[u]),o?it(r,u,c):st(r,u,c)}return r}var ft=Math.max;function pt(e,t,r){return t=ft(void 0===t?e.length-1:t,0),function(){for(var n=arguments,o=-1,a=ft(n.length-t,0),i=Array(a);++o<a;)i[o]=n[t+o];o=-1;for(var u=Array(t+1);++o<t;)u[o]=n[o];return u[t]=r(i),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,u)}}function dt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function vt(e){return null!=e&&dt(e.length)&&!Re(e)}var yt=Object.prototype;function bt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||yt)}function ht(e){return Fe(e)&&"[object Arguments]"==Oe(e)}var gt=Object.prototype,mt=gt.hasOwnProperty,jt=gt.propertyIsEnumerable,_t=ht(function(){return arguments}())?ht:function(e){return Fe(e)&&mt.call(e,"callee")&&!jt.call(e,"callee")};var wt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ot=wt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Ot&&Ot.exports===wt?ye.Buffer:void 0,St=(Ft?Ft.isBuffer:void 0)||function(){return!1},kt={};function xt(e){return function(t){return e(t)}}kt["[object Float32Array]"]=kt["[object Float64Array]"]=kt["[object Int8Array]"]=kt["[object Int16Array]"]=kt["[object Int32Array]"]=kt["[object Uint8Array]"]=kt["[object Uint8ClampedArray]"]=kt["[object Uint16Array]"]=kt["[object Uint32Array]"]=!0,kt["[object Arguments]"]=kt["[object Array]"]=kt["[object ArrayBuffer]"]=kt["[object Boolean]"]=kt["[object DataView]"]=kt["[object Date]"]=kt["[object Error]"]=kt["[object Function]"]=kt["[object Map]"]=kt["[object Number]"]=kt["[object Object]"]=kt["[object RegExp]"]=kt["[object Set]"]=kt["[object String]"]=kt["[object WeakMap]"]=!1;var At="object"==typeof exports&&exports&&!exports.nodeType&&exports,Et=At&&"object"==typeof module&&module&&!module.nodeType&&module,Tt=Et&&Et.exports===At&&de.process,Ct=function(){try{var e=Et&&Et.require&&Et.require("util").types;return e||Tt&&Tt.binding&&Tt.binding("util")}catch(e){}}(),Pt=Ct&&Ct.isTypedArray,Rt=Pt?xt(Pt):function(e){return Fe(e)&&dt(e.length)&&!!kt[Oe(e)]},Nt=Object.prototype.hasOwnProperty;function $t(e,t){var r=xe(e),n=!r&&_t(e),o=!r&&!n&&St(e),a=!r&&!n&&!o&&Rt(e),i=r||n||o||a,u=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=u.length;for(var s in e)!t&&!Nt.call(e,s)||i&&("length"==s||o&&("offset"==s||"parent"==s)||a&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||at(s,c))||u.push(s);return u}function Vt(e,t){return function(r){return e(t(r))}}var Mt=Vt(Object.keys,Object),zt=Object.prototype.hasOwnProperty;function Dt(e){return vt(e)?$t(e):function(e){if(!bt(e))return Mt(e);var t=[];for(var r in Object(e))zt.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var It=Object.prototype.hasOwnProperty;function Ut(e){if(!Ce(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=bt(e),r=[];for(var n in e)("constructor"!=n||!t&&It.call(e,n))&&r.push(n);return r}function Bt(e){return vt(e)?$t(e,!0):Ut(e)}var qt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/;var Wt=Ye(Object,"create");var Yt=Object.prototype.hasOwnProperty;var Kt=Object.prototype.hasOwnProperty;function Jt(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function Xt(e,t){for(var r=e.length;r--;)if(ut(e[r][0],t))return r;return-1}Jt.prototype.clear=function(){this.__data__=Wt?Wt(null):{},this.size=0},Jt.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Jt.prototype.get=function(e){var t=this.__data__;if(Wt){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Yt.call(t,e)?t[e]:void 0},Jt.prototype.has=function(e){var t=this.__data__;return Wt?void 0!==t[e]:Kt.call(t,e)},Jt.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Wt&&void 0===t?"__lodash_hash_undefined__":t,this};var Gt=Array.prototype.splice;function Ht(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Ht.prototype.clear=function(){this.__data__=[],this.size=0},Ht.prototype.delete=function(e){var t=this.__data__,r=Xt(t,e);return!(r<0)&&(r==t.length-1?t.pop():Gt.call(t,r,1),--this.size,!0)},Ht.prototype.get=function(e){var t=this.__data__,r=Xt(t,e);return r<0?void 0:t[r][1]},Ht.prototype.has=function(e){return Xt(this.__data__,e)>-1},Ht.prototype.set=function(e,t){var r=this.__data__,n=Xt(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var Qt=Ye(ye,"Map");function Zt(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function er(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}er.prototype.clear=function(){this.size=0,this.__data__={hash:new Jt,map:new(Qt||Ht),string:new Jt}},er.prototype.delete=function(e){var t=Zt(this,e).delete(e);return this.size-=t?1:0,t},er.prototype.get=function(e){return Zt(this,e).get(e)},er.prototype.has=function(e){return Zt(this,e).has(e)},er.prototype.set=function(e,t){var r=Zt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function tr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],a=r.cache;if(a.has(o))return a.get(o);var i=e.apply(this,n);return r.cache=a.set(o,i)||a,i};return r.cache=new(tr.Cache||er),r}tr.Cache=er;var rr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nr=/\\(\\)?/g,or=function(e){var t=tr(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rr,(function(e,r,n,o){t.push(n?o.replace(nr,"$1"):r||e)})),t}));function ar(e,t){return xe(e)?e:function(e,t){if(xe(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Se(e))||Lt.test(e)||!qt.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:or(function(e){return null==e?"":Te(e)}(e))}function ir(e){if("string"==typeof e||Se(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ur(e,t){for(var r=0,n=(t=ar(t,e)).length;null!=e&&r<n;)e=e[ir(t[r++])];return r&&r==n?e:void 0}function cr(e,t,r){var n=null==e?void 0:ur(e,t);return void 0===n?r:n}function sr(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}var lr=be?be.isConcatSpreadable:void 0;function fr(e){return xe(e)||_t(e)||!!(lr&&e&&e[lr])}function pr(e){return(null==e?0:e.length)?function(e,t,r,n,o){var a=-1,i=e.length;for(r||(r=fr),o||(o=[]);++a<i;){var u=e[a];r(u)?sr(o,u):o[o.length]=u}return o}(e):[]}var dr=Vt(Object.getPrototypeOf,Object),vr=Function.prototype,yr=Object.prototype,br=vr.toString,hr=yr.hasOwnProperty,gr=br.call(Object);function mr(e){if(!Fe(e)||"[object Object]"!=Oe(e))return!1;var t=dr(e);if(null===t)return!0;var r=hr.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&br.call(r)==gr}function jr(e){var t=this.__data__=new Ht(e);this.size=t.size}jr.prototype.clear=function(){this.__data__=new Ht,this.size=0},jr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},jr.prototype.get=function(e){return this.__data__.get(e)},jr.prototype.has=function(e){return this.__data__.has(e)},jr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ht){var n=r.__data__;if(!Qt||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new er(n)}return r.set(e,t),this.size=r.size,this};var _r="object"==typeof exports&&exports&&!exports.nodeType&&exports,wr=_r&&"object"==typeof module&&module&&!module.nodeType&&module,Or=wr&&wr.exports===_r?ye.Buffer:void 0,Fr=Or?Or.allocUnsafe:void 0;function Sr(e,t){if(t)return e.slice();var r=e.length,n=Fr?Fr(r):new e.constructor(r);return e.copy(n),n}function kr(){return[]}var xr=Object.prototype.propertyIsEnumerable,Ar=Object.getOwnPropertySymbols,Er=Ar?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(Ar(e),(function(t){return xr.call(e,t)})))}:kr;var Tr=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)sr(t,Er(e)),e=dr(e);return t}:kr;function Cr(e,t,r){var n=t(e);return xe(e)?n:sr(n,r(e))}function Pr(e){return Cr(e,Dt,Er)}function Rr(e){return Cr(e,Bt,Tr)}var Nr=Ye(ye,"DataView"),$r=Ye(ye,"Promise"),Vr=Ye(ye,"Set"),Mr="[object Map]",zr="[object Promise]",Dr="[object Set]",Ir="[object WeakMap]",Ur="[object DataView]",Br=ze(Nr),qr=ze(Qt),Lr=ze($r),Wr=ze(Vr),Yr=ze(Ke),Kr=Oe;(Nr&&Kr(new Nr(new ArrayBuffer(1)))!=Ur||Qt&&Kr(new Qt)!=Mr||$r&&Kr($r.resolve())!=zr||Vr&&Kr(new Vr)!=Dr||Ke&&Kr(new Ke)!=Ir)&&(Kr=function(e){var t=Oe(e),r="[object Object]"==t?e.constructor:void 0,n=r?ze(r):"";if(n)switch(n){case Br:return Ur;case qr:return Mr;case Lr:return zr;case Wr:return Dr;case Yr:return Ir}return t});var Jr=Object.prototype.hasOwnProperty;var Xr=ye.Uint8Array;function Gr(e){var t=new e.constructor(e.byteLength);return new Xr(t).set(new Xr(e)),t}var Hr=/\w*$/;var Qr=be?be.prototype:void 0,Zr=Qr?Qr.valueOf:void 0;function en(e,t){var r=t?Gr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function tn(e,t,r){var n,o,a,i=e.constructor;switch(t){case"[object ArrayBuffer]":return Gr(e);case"[object Boolean]":case"[object Date]":return new i(+e);case"[object DataView]":return function(e,t){var r=t?Gr(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return en(e,r);case"[object Map]":case"[object Set]":return new i;case"[object Number]":case"[object String]":return new i(e);case"[object RegExp]":return(a=new(o=e).constructor(o.source,Hr.exec(o))).lastIndex=o.lastIndex,a;case"[object Symbol]":return n=e,Zr?Object(Zr.call(n)):{}}}function rn(e){return"function"!=typeof e.constructor||bt(e)?{}:Xe(dr(e))}var nn=Ct&&Ct.isMap,on=nn?xt(nn):function(e){return Fe(e)&&"[object Map]"==Kr(e)};var an=Ct&&Ct.isSet,un=an?xt(an):function(e){return Fe(e)&&"[object Set]"==Kr(e)},cn="[object Arguments]",sn="[object Function]",ln="[object Object]",fn={};function pn(e,t,r,n,o,a){var i,u=1&t,c=2&t,s=4&t;if(r&&(i=o?r(e,n,o,a):r(e)),void 0!==i)return i;if(!Ce(e))return e;var l=xe(e);if(l){if(i=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Jr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!u)return Ge(e,i)}else{var f=Kr(e),p=f==sn||"[object GeneratorFunction]"==f;if(St(e))return Sr(e,u);if(f==ln||f==cn||p&&!o){if(i=c||p?{}:rn(e),!u)return c?function(e,t){return lt(e,Tr(e),t)}(e,function(e,t){return e&<(t,Bt(t),e)}(i,e)):function(e,t){return lt(e,Er(e),t)}(e,function(e,t){return e&<(t,Dt(t),e)}(i,e))}else{if(!fn[f])return o?e:{};i=tn(e,f,u)}}a||(a=new jr);var d=a.get(e);if(d)return d;a.set(e,i),un(e)?e.forEach((function(n){i.add(pn(n,t,r,n,e,a))})):on(e)&&e.forEach((function(n,o){i.set(o,pn(n,t,r,o,e,a))}));var v=l?void 0:(s?c?Rr:Pr:c?Bt:Dt)(e);return function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==t(e[r],r,e););}(v||e,(function(n,o){v&&(n=e[o=n]),st(i,o,pn(n,t,r,o,e,a))})),i}fn[cn]=fn["[object Array]"]=fn["[object ArrayBuffer]"]=fn["[object DataView]"]=fn["[object Boolean]"]=fn["[object Date]"]=fn["[object Float32Array]"]=fn["[object Float64Array]"]=fn["[object Int8Array]"]=fn["[object Int16Array]"]=fn["[object Int32Array]"]=fn["[object Map]"]=fn["[object Number]"]=fn[ln]=fn["[object RegExp]"]=fn["[object Set]"]=fn["[object String]"]=fn["[object Symbol]"]=fn["[object Uint8Array]"]=fn["[object Uint8ClampedArray]"]=fn["[object Uint16Array]"]=fn["[object Uint32Array]"]=!0,fn["[object Error]"]=fn[sn]=fn["[object WeakMap]"]=!1;function dn(e){return pn(e,5)}var vn=function(e,t,r){for(var n=-1,o=Object(e),a=r(e),i=a.length;i--;){var u=a[++n];if(!1===t(o[u],u,o))break}return e};function yn(e,t,r){(void 0!==r&&!ut(e[t],r)||void 0===r&&!(t in e))&&it(e,t,r)}function bn(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function hn(e,t,r,n,o,a,i){var u=bn(e,r),c=bn(t,r),s=i.get(c);if(s)yn(e,r,s);else{var l,f=a?a(u,c,r+"",e,t,i):void 0,p=void 0===f;if(p){var d=xe(c),v=!d&&St(c),y=!d&&!v&&Rt(c);f=c,d||v||y?xe(u)?f=u:Fe(l=u)&&vt(l)?f=Ge(u):v?(p=!1,f=Sr(c,!0)):y?(p=!1,f=en(c,!0)):f=[]:mr(c)||_t(c)?(f=u,_t(u)?f=function(e){return lt(e,Bt(e))}(u):Ce(u)&&!Re(u)||(f=rn(c))):p=!1}p&&(i.set(c,f),o(f,c,n,a,i),i.delete(c)),yn(e,r,f)}}function gn(e,t,r,n,o){e!==t&&vn(t,(function(a,i){if(o||(o=new jr),Ce(a))hn(e,t,i,r,gn,n,o);else{var u=n?n(bn(e,i),a,i+"",e,t,o):void 0;void 0===u&&(u=a),yn(e,i,u)}}),Bt)}function mn(e,t){return t.length<2?e:ur(e,function(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}(t,0,-1))}function jn(e){return null===e}var _n,wn=(_n=function(e,t,r){gn(e,t,r)},function(e,t){return nt(pt(e,t,Pe),e+"")}((function(e,t){var r=-1,n=t.length,o=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(o=_n.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,t,r){if(!Ce(r))return!1;var n=typeof t;return!!("number"==n?vt(r)&&at(t,r.length):"string"==n&&t in r)&&ut(r[t],e)}(t[0],t[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var i=t[r];i&&_n(e,i,r,o)}return e})));function On(e,t){return null==(e=mn(e,t=ar(t,e)))||delete e[ir((r=t,n=null==r?0:r.length,n?r[n-1]:void 0))];var r,n}function Fn(e){return mr(e)?void 0:e}var Sn=function(e){return nt(pt(e,void 0,pr),e+"")}((function(e,t){var r={};if(null==e)return r;var n=!1;t=ke(t,(function(t){return t=ar(t,e),n||(n=t.length>1),t})),lt(e,Rr(e),r),n&&(r=pn(r,7,Fn));for(var o=t.length;o--;)On(r,t[o]);return r}));function kn(e,t,r){return null==e?e:function(e,t,r){if(!Ce(e))return e;for(var n=-1,o=(t=ar(t,e)).length,a=o-1,i=e;null!=i&&++n<o;){var u=ir(t[n]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(n!=a){var s=i[u];void 0===(c=void 0)&&(c=Ce(s)?s:at(t[n+1])?[]:{})}st(i,u,c),i=i[u]}return e}(e,t,r)}function xn(){const t=e.useRef(new Map),r=(n=d(e.useState({}),2)[1],e.useCallback((function(){return n({})}),[]));var n;const o=e.useCallback(((e,n)=>{t.current.set(e,n),r()}),[r]),a=e.useCallback((e=>{t.current=new Map(e),r()}),[r]),i=e.useCallback((e=>{t.current.delete(e),r()}),[r]),u=e.useCallback((()=>{t.current.clear(),r()}),[r]),c=e.useCallback((e=>t.current.get(e)),[]);return[t.current,{set:o,setAll:a,remove:i,reset:u,get:c}]}const An=e=>e.map((e=>"number"==typeof e?`[${e}]`:`.${e}`)).join(""),En=e.createContext(void 0),Tn=()=>{const t=e.useContext(En);if(!t)throw new Error("useFormContext must be used within a FormProvider");return t},Cn=t=>{var{initialValues:r,onFieldsChange:n,onValuesChange:o,children:a}=t,i=p(t,["initialValues","onFieldsChange","onValuesChange","children"]);const[u,{set:c,get:s,remove:l}]=xn(),[d,v]=e.useState({}),y=e.useCallback(((e,t,o)=>{const a=An(e),i=cr(d,e),l=i||(null!=o?o:cr(r,e));v((t=>{const r=dn(t);return kn(r,e,l),r}));const f=s(a);f&&console.warn(`[taro-form-react] Field "${a}" is already registered, register multiple times may cause unexpected behavior.`);const p=f?Object.assign(Object.assign({},f),{refs:[...f.refs,t],initialValue:o,count:f.count+1}):{refs:[t],name:e,touched:!1,errors:[],initialValue:o,count:1};c(a,p),null==n||n([{name:e,value:l}],Array.from(u.values()).map((e=>({name:e.name,value:cr(d,e.name)}))).concat([{name:e,value:l}]))}),[d,u,s,r,n,c]),b=e.useCallback(((e,t)=>{const r=An(e),o=s(r);o?1===o.count?(l(r),v((t=>{const r=dn(t);var n,o;return o=e,null==(n=r)||On(n,o),r})),null==n||n([{name:e,value:cr(d,e)}],Array.from(u.values()).map((e=>({name:e.name,value:cr(d,e.name)}))).filter((t=>t.name!==e)))):c(r,Object.assign(Object.assign({},o),{count:o.count-1,refs:o.refs.filter((e=>e!==t))})):console.warn(`[taro-form-react] Attempted to unregister field "${r}" that was never registered. Nothing will happen.`)}),[d,u,s,n,l,c]),h=e.useCallback(((e,t)=>{const r=An(e),n=s(r);if(v((r=>{const n=dn(r);return kn(n,e,t),n})),n?c(r,Object.assign(Object.assign({},n),{touched:!0})):console.warn(`[taro-form-react] Attempted to set value for field "${r}" that was never registered.\nForm data will still be updated but may not present while submit.\nUse Form.Keep to keep the field in sync with the form data.`),o){const r={};kn(r,e,t);const n=dn(d);kn(n,e,t),o(r,n)}}),[d,s,o,c]),g=e.useCallback((e=>cr(d,e)),[d]),m=e.useCallback((e=>{if(!e)return d;const t={};for(const r of e){kn(t,r,cr(d,r))}return t}),[d]),j=e.useCallback((async e=>{const t=null!=e?e:Array.from(u.values()).map((e=>e.name)),r={};for(const e of t){const t=s(An(e));if(!t){console.warn(`[taro-form-react] Attempted to get formatted value for field "${An(e)}" that was never registered. This field's value will not present in the result.`);continue}if(t.refs.some((e=>!e.current))){console.warn(`[taro-form-react] Attempted to get formatted value for field "${An(e)}" that has no or missing ref. This may cause unexpected behavior.`);continue}const n=t.refs[t.refs.length-1].current.transform;if(n){const t=await n();t.__form_internals_should_merge?wn(r,t.value):kn(r,e,t.value)}else kn(r,e,cr(d,e))}return r}),[d,u,s]),_=e.useCallback((e=>{v((t=>{const r={},n=dn(t);for(const t of e){const e=An(t.name),o=s(An(t.name));o?(void 0!==t.touched&&c(e,Object.assign(Object.assign({},o),{touched:t.touched})),kn(n,t.name,t.value),kn(r,t.name,t.value)):console.warn(`[taro-form-react] Attempted to set field "${e}" that was never registered. Changes will be ignored.`)}return setTimeout((()=>{null==o||o(r,wn(dn(t),n))}),0),n}))}),[s,o,c]),w=e.useCallback((e=>{if(!e)return Array.from(u.values()).map((e=>Object.assign(Object.assign({},e),{value:cr(d,e.name)})));const t=[];for(const r of e){const e=s(An(r));if(!e){console.warn(`[taro-form-react] Attempted to get field "${An(r)}" that was never registered. This field will not present in the result.`);continue}const n=cr(d,r);t.push(Object.assign(Object.assign({},e),{value:n}))}return t}),[d,u,s]),O=e.useCallback((e=>{var t;const n=null!==(t=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to reset field "${t}" that was never registered. This field will not be reset.`)})).filter((e=>void 0!==e)))&&void 0!==t?t:Array.from(u.values());for(const e of n)v((t=>{var n;const o=dn(t);return kn(o,e.name,null!==(n=e.initialValue)&&void 0!==n?n:cr(r,e.name)),o})),c(An(e.name),Object.assign(Object.assign({},e),{touched:!1}))}),[u,s,r,c]),F=e.useCallback(((e,t)=>{const r=An(e),n=s(r);n?c(r,Object.assign(Object.assign({},n),{errors:t})):console.warn(`[taro-form-react] Attempted to set errors for field "${r}" that was never registered. Nothing will happen.`)}),[s,c]),S=e.useCallback((e=>{const t=s(An(e));return t?t.errors:(console.warn(`[taro-form-react] Attempted to get errors for field "${An(e)}" that was never registered. Returning empty array.`),[])}),[s]),k=e.useCallback((async e=>{var t;const r=null!==(t=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to validate field "${t}" that was never registered. This field will not be validated.`)})).filter((e=>void 0!==e)))&&void 0!==t?t:Array.from(u.values()),n=[];for(const e of r){if(e.refs.some((e=>!e.current))){console.warn(`[taro-form-react] Attempted to validate field "${An(e.name)}" that has no or missing ref. This field will not be validated.`);continue}const t=await Promise.all(e.refs.map((e=>e.current.validate()))),r=Array.from(new Set(t.flat().filter(Boolean)));r.length>0&&n.push({name:e.name,errors:r})}return n.length>0?n:void 0}),[u,s]),x=e.useCallback(((e,t)=>{var r;const{allTouched:n=!1}=null!=t?t:{},o=null!==(r=null==e?void 0:e.map((e=>{const t=An(e),r=s(t);if(r)return r;console.warn(`[taro-form-react] Attempted to check if field "${t}" is touched but it was never registered. This field will not be considered.`)})).filter((e=>void 0!==e)))&&void 0!==r?r:Array.from(u.values());return n?o.every((e=>e.touched)):o.some((e=>e.touched))}),[u,s]);return f.jsx(En.Provider,{value:Object.assign(Object.assign({initialValues:r},i),{data:d,setData:v,fields:u,registerField:y,unregisterField:b,setFieldValue:h,getFieldValue:g,getFieldsValue:m,getFieldsFormattedValue:j,setFields:_,getFields:w,resetFields:O,setFieldError:F,getFieldError:S,validateFields:k,isFieldsTouched:x}),children:a})},Pn=(e,t)=>void 0===e?t:e;const Rn=e=>null==e||""===e||Array.isArray(e)&&0===e.length||"object"==typeof e&&0===Object.keys(e).length;var Nn,$n={exports:{}};
|
|
16
16
|
/*!
|
|
17
17
|
Copyright (c) 2018 Jed Watson.
|
|
18
18
|
Licensed under the MIT License (MIT), see
|