@formily/reactive
Advanced tools
Comparing version 2.0.0-beta.46 to 2.0.0-beta.47
@@ -397,10 +397,10 @@ (function (global, factory) { | ||
var tojs = function (values) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
if (isArr(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
visited.add(originValues); | ||
@@ -414,2 +414,9 @@ var res_1 = []; | ||
else if (isPlainObj(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
if ('$$typeof' in values && '_owner' in values) { | ||
@@ -416,0 +423,0 @@ return values; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Formily=e.Formily||{},e.Formily.Reactive={}))}(this,(function(e){"use strict";var t=function(e){return e&&e instanceof Map},r=function(e){return e&&e instanceof Set},n=function(e){return e&&e instanceof WeakMap},a=function(e){return e&&e instanceof WeakSet},u=function(e){return"function"==typeof e},o=Array.isArray,i=function(e){return"[object Object]"===Object.prototype.toString.call(e)},l=new WeakMap,c=new WeakMap,f=new WeakMap,s=new WeakMap,v=new WeakMap,p=[],y={value:0},g={value:0},d={value:!1},h=new Set,b=new Set,O=Symbol("MakeObservableSymbol"),k=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(e[n]);return r.push(t),r},m=Symbol("iteration key"),S=function(e,t){var r,n=v.get(e),a=new Set;return n&&(null===(r=n.get(t))||void 0===r||r.forEach((function(e){a.has(e)||a.add(e)}))),a},_=function(e,t){S(e,t).forEach((function(e){e._isComputed?e._scheduler(e):J()?b.has(e)||b.add(e):A()?h.has(e)||h.add(e):u(e._scheduler)?e._scheduler(e):e()}))},w=function(e){var t=e.key,r=e.type,n=e.target;"iterate"===r&&(t=m);var a=p[p.length-1];W()||a&&function(e,t){var r=e._reactionsSet;r?r.has(t)||r.add(t):e._reactionsSet=new Set([t])}(a,function(e,t,r){var n=v.get(e);if(n){var a=n.get(t);return a?a.has(r)||a.add(r):n.set(t,new Set([r])),n}var u=new Map([[t,new Set([r])]]);return v.set(e,u),u}(n,t,a))},P=function(e){var t=e.key,r=e.type,n=e.target,a=e.oldTarget;!function(e){var t=s.get(l.get(e.target)||e.target),r=s.get(l.get(e.oldValue)||e.oldValue),n=s.get(l.get(e.value)||e.value);if(t){var a=function(){return{get path(){return k(t.path,e.key)},type:e.type,key:e.key,value:e.value,oldValue:e.oldValue}};r&&"set"===e.type&&(r.observers.forEach((function(e){return e(a())})),r.deepObservers.forEach((function(e){return e(a())})),n&&(n.observers=r.observers,n.deepObservers=r.deepObservers)),r&&"delete"===e.type&&(r.observers=[],r.deepObservers=[]),t.observers.forEach((function(e){return e(a())})),t.deepObservers.forEach((function(e){return e(a())}));for(var u=t.parent;u;)u.deepObservers.forEach((function(e){return e(a())})),u=u.parent}}(e),"clear"===r?a.forEach((function(e,t){_(n,t)})):_(n,t),"add"!==r&&"delete"!==r&&"clear"!==r||(t=Array.isArray(n)?"length":m,_(n,t))},j=function(e){var t=e._reactionsSet;t&&t.forEach((function(t){t.forEach((function(t){t.delete(e)}))})),delete e._reactionsSet},R=function(e){j(e),function(e){var t=e._computedsSet;t&&t.forEach((function(e){0===S(e._context,e._property).size&&(R(e),e._dirty=!0)}))}(e)},E=function(){y.value++},V=function(){y.value--,0===y.value&&T()},M=function(){g.value++},x=function(){g.value--},A=function(){return y.value>0},J=function(){return d.value},W=function(){return g.value>0},T=function(){h.forEach((function(e){h.delete(e),u(e._scheduler)?e._scheduler(e):e()}))},N=function(){return(N=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function z(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,u=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(a)throw a.error}}return o}function C(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(z(arguments[t]));return e}var D,$=Symbol("RAW_TYPE"),F=Symbol("OBSERVABLE_TYPE"),q=Object.prototype.hasOwnProperty,B=function(e){return l.has(e)},K=function(e){return e&&!!e[O]},Y=function(e){return!B(e)&&(null!=e&&(!!o(e)||(i(e)?!e[$]&&(!!e[F]||(!("$$typeof"in e)||!("_owner"in e))&&(!e._isAMomentObject&&(!e._isJSONSchemaObject&&(!u(e.toJS)&&!u(e.toJSON))))):!!(t(e)||n(e)||r(e)||a(e)))))},L=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter((function(e){return"symbol"==typeof e}))),G=Object.prototype.hasOwnProperty;function H(e,t,r){var n=c.get(r);return Y(r)?n||te(e,t,r):n||r}function I(e,t,r,n){var a=r.next;return r.next=function(){var u=a.call(r),o=u.done,i=u.value;return o||(n?i[1]=H(e,t,i[1]):i=H(e,t,i)),{done:o,value:i}},r}var Q=((D={has:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this);return w({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this);return w({target:t,key:e,type:"get"}),H(t,e,r.get.apply(t,arguments))},add:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.add.apply(t,arguments);return n||P({target:t,key:e,value:e,type:"add"}),a},set:function(e,t){var r=l.get(this),n=Reflect.getPrototypeOf(this),a=n.has.call(r,e),u=n.get.call(r,e),o=n.set.apply(r,arguments);return a?t!==u&&P({target:r,key:e,value:t,oldValue:u,type:"set"}):P({target:r,key:e,value:t,type:"add"}),o},delete:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.get?r.get.call(t,e):void 0,u=r.delete.apply(t,arguments);return n&&P({target:t,key:e,oldValue:a,type:"delete"}),u},clear:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this),r=0!==e.size,n=e instanceof Map?new Map(e):new Set(e),a=t.clear.apply(e,arguments);return r&&P({target:e,oldTarget:n,type:"clear"}),a},forEach:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var a=l.get(this),u=Reflect.getPrototypeOf(this);w({target:a,type:"iterate"});var o=function(t,r){for(var n=[],u=2;u<arguments.length;u++)n[u-2]=arguments[u];return e.apply(void 0,C([H(a,r,t),r],n))};return(t=u.forEach).call.apply(t,C([a,o],r))},keys:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);return w({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t.values.apply(e,arguments);return I(e,"",r,!1)},entries:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t.entries.apply(e,arguments);return I(e,"",r,!0)}})[Symbol.iterator]=function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t[Symbol.iterator].apply(e,arguments);return I(e,"",r,e instanceof Map)},Object.defineProperty(D,"size",{get:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);return w({target:e,type:"iterate"}),Reflect.get(t,"size",e)},enumerable:!1,configurable:!0}),D),U={get:function(e,t,r){return e=G.call(Q,t)?Q:e,Reflect.get(e,t,r)}},X={get:function(e,t,r){var n=Reflect.get(e,t,r);if("symbol"==typeof t&&L.has(t))return n;w({target:e,key:t,receiver:r,type:"get"});var a=c.get(n);if(Y(n)){if(a)return a;var u=Reflect.getOwnPropertyDescriptor(e,t);if(!u||!1!==u.writable||!1!==u.configurable)return te(e,t,n)}return a||n},has:function(e,t){var r=Reflect.has(e,t);return w({target:e,key:t,type:"has"}),r},ownKeys:function(e){return w({target:e,type:"iterate"}),Reflect.ownKeys(e)},set:function(e,t,r,n){var a=G.call(e,t),u=te(e,t,r),o=e[t],i=Reflect.set(e,t,u,n);return e!==l.get(n)||(a?r!==o&&P({target:e,key:t,value:u,oldValue:o,receiver:n,type:"set"}):P({target:e,key:t,value:u,receiver:n,type:"add"})),i},deleteProperty:function(e,t){var r=Reflect.deleteProperty(e,t),n=e[t];return P({target:e,key:t,oldValue:n,type:"delete"}),r}},Z=function(e,t,r){var n=l.get(r)||r,a=s.get(n);if(a)return a;var u=l.get(e)||e,o=s.get(u);o?s.set(r,{get path(){return k(o.path,t)},parent:o,observers:[],deepObservers:[]}):s.set(r,{path:[],observers:[],deepObservers:[]})},ee=function(e,u){var o=new Proxy(e,function(e){return t(e)||n(e)||r(e)||a(e)}(e)?U:X);return l.set(o,e),u?f.set(e,o):c.set(e,o),o},te=function(e,t,r,n){if(e){var a=l.get(e)||e;if(f.get(a))return r}return B(r)?r:Y(r)?(Z(e,t,r),ee(r,n)):r};function re(e){var t=function(t){return e({value:t})};return u(e)&&(t[O]=e),t}function ne(e){if(e[O])return e[O][O]?ne(e[O]):e[O]}var ae=function(e){return re((function(t){var r=t.target,n=t.key,a=t.value,o=function(t){return function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return e((function(){return u(t)?t.apply(r,n):void 0}))}};return r?(r[n]=o(r[n]),r):o(a)}))},ue=function(e){var t=null;try{E(),u(e)&&(t=e())}finally{V()}return t},oe=ae(ue);ue.scope=function(e){var t=null;try{d.value=!0,u(e)&&(t=e())}finally{d.value=!1,b.forEach((function(e){b.delete(e),u(e._scheduler)?e._scheduler(e):e()}))}return t},ue[O]=oe,ue.scope[O]=ae(ue.scope);var ie=function(e){var t;M();try{u(e)&&(t=e())}finally{return x(),t}};ie.create=function(){M();var e=!1;return function(){e||(x(),e=!0)}};var le=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:te(t,r,t?t[r]:n)};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=te(t,r,e),a.value=e,n!==e&&P({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return w({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ce=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={set:function(e){var t=a.value;a.value=e,t!==e&&P({target:a,key:r,type:"set",oldValue:t,value:e})},get:function(){return w({target:a,key:r,type:"get"}),a.value}};return l.set(u,a),c.set(a,u),Z(t,r,a),t?(Object.defineProperty(t,r,{value:u,enumerable:!0,configurable:!1,writable:!1}),t):u})),fe=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={},o=t||a,i=t?r:"value";function f(){return w({target:o,key:i,type:"get"}),a.value}function s(e){var t=a.value;a.value=e,t!==e&&P({target:o,key:i,type:"set",oldValue:t,value:e})}return Z(t,r,a),l.set(u,a),c.set(a,u),t?(Object.defineProperty(t,r,{get:f,set:s,enumerable:!0,configurable:!1}),t):(Object.defineProperty(u,"value",{set:s,get:f}),u)})),se=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:te(t,r,t?t[r]:n,!0)};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=te(t,r,e,!0),a.value=e,n!==e&&P({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return w({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ve=re((function(e){var t=e.target,r=e.key,n=e.value,a={},o={},i=t||a,f=t?r:"value",s=function e(t){if(!t)return(null==n?void 0:n.get)?null==n?void 0:n.get:n;var r=Object.getOwnPropertyDescriptor(t,f);return(null==r?void 0:r.get)?r.get:e(Object.getPrototypeOf(t))}(i),v=function e(t){if(!t)return(null==n?void 0:n.set)?null==n?void 0:n.set:void 0;var r=Object.getOwnPropertyDescriptor(t,f);return(null==r?void 0:r.set)?r.set:e(Object.getPrototypeOf(t))}(i);function y(){var e;a.value=null===(e=null==s?void 0:s.call)||void 0===e?void 0:e.call(s,i)}function g(){if(-1===p.indexOf(g))try{p.push(g),y()}finally{p.pop()}}function d(){return p.length>0&&function(e){if(u(e)){var t=p[p.length-1];if(t){var r=t._computedsSet;r?r.has(e)||r.add(e):t._computedsSet=new Set([e])}}}(g),W()?y():g._dirty&&(g(),g._dirty=!1),w({target:i,key:f,type:"get"}),a.value}function h(e){var t;try{E(),null===(t=null==v?void 0:v.call)||void 0===t||t.call(v,i,e)}finally{V()}}return g._name="ComputedReaction",g._scheduler=function(){g._dirty=!0,E(),P({target:i,key:f,value:a.value,type:"set"}),V()},g._isComputed=!0,g._dirty=!0,g._context=i,g._property=f,l.set(o,a),c.set(a,o),Z(t,r,a),t?(Object.defineProperty(t,r,{get:d,set:h,enumerable:!0,configurable:!1}),t):(Object.defineProperty(o,"value",{set:h,get:d}),o)}));function pe(e){return te(null,null,e)}function ye(e,t){if(B(e))return e;if(!Y(e))return e;for(var r in Z(void 0,void 0,e),l.set(e,e),c.set(e,e),t){var n=t[r];K(n)&&ne(n)({target:e,key:r})}return e}pe.box=ce,pe.ref=fe,pe.deep=le,pe.shallow=se,pe.computed=ve,pe[O]=le;var ge=function(e,t){void 0===t&&(t="AutoRun");var r=function(){if(-1===p.indexOf(r)){j(r);try{p.push(r),E(),u(e)&&e()}finally{V(),p.pop()}}};return r._name=t,r(),function(){R(r)}},de=function(e,t){var r=this;void 0===t&&(t="TrackerReaction"),this.track=function(e){if(-1===p.indexOf(r.track)){j(r.track);try{p.push(r.track),E(),u(e)&&(r.results=e())}finally{V(),p.pop()}}return r.results},this.dispose=function(){R(r.track)},this.track._scheduler=e,this.track._name=t};e.Tracker=de,e.action=oe,e.autorun=ge,e.batch=ue,e.define=ye,e.isAnnotation=K,e.isObservable=B,e.isSupportObservable=Y,e.markObservable=function(e){if(e)return u(e)?e.prototype[F]=!0:e[F]=!0,e},e.markRaw=function(e){if(e)return u(e)?e.prototype[$]=!0:e[$]=!0,e},e.model=function(e){var t=Object.keys(e||{}).reduce((function(t,r){var n=Object.getOwnPropertyDescriptor(e,r);return n&&n.get?t[r]=pe.computed:u(e[r])?t[r]=ue:t[r]=pe,t}),{});return ye(e,t)},e.observable=pe,e.observe=function(e,t,r){void 0===r&&(r=!0);var n=function(e){u(t)&&t(e)};if(e&&"object"!=typeof e)throw Error("Can not observe "+typeof e+" type.");return function(e){var t=l.get(e)||e,a=s.get(t);if(a)if(r){var u=a.deepObservers.length;a.deepObservers.push(n),n.unobserve=function(){a.deepObservers.splice(u,1)}}else{var o=a.observers.length;a.observers.push(n),n.unobserve=function(){a.observers.splice(o,1)}}return function(){null==n||n.unobserve()}}(e)},e.raw=function(e){return l.get(e)},e.reaction=function(e,t,r){var n=N({name:"Reaction"},r),a={},o={},i={};return ge((function(){a.currentValue=e(),i.current=u(n.equals)?!n.equals(a.oldValue,a.currentValue):a.oldValue!==a.currentValue,i.current&&o.current&&ie((function(){u(t)&&t(a.currentValue)})),a.oldValue=a.currentValue,o.current=!0}),n.name)},e.toJS=function(e){var t=new WeakSet,r=function(e){if(t.has(e))return e;var n=e;if(l.has(e)&&(e=l.get(e)),o(e)){t.add(n);var a=[];return e.forEach((function(e){a.push(r(e))})),a}if(i(e)){if("$$typeof"in e&&"_owner"in e)return e;if(e._isAMomentObject)return e;if(e._isJSONSchemaObject)return e;if(u(e.toJS))return e.toJS();if(u(e.toJSON))return e.toJSON();t.add(n);var c={};for(var f in e)q.call(e,f)&&(c[f]=r(e[f]));return c}return e};return r(e)},e.untracked=ie,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).Formily=e.Formily||{},e.Formily.Reactive={}))}(this,(function(e){"use strict";var t=function(e){return e&&e instanceof Map},r=function(e){return e&&e instanceof Set},n=function(e){return e&&e instanceof WeakMap},a=function(e){return e&&e instanceof WeakSet},u=function(e){return"function"==typeof e},o=Array.isArray,i=function(e){return"[object Object]"===Object.prototype.toString.call(e)},l=new WeakMap,c=new WeakMap,f=new WeakMap,s=new WeakMap,v=new WeakMap,p=[],y={value:0},g={value:0},d={value:!1},h=new Set,b=new Set,O=Symbol("MakeObservableSymbol"),k=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(e[n]);return r.push(t),r},m=Symbol("iteration key"),S=function(e,t){var r,n=v.get(e),a=new Set;return n&&(null===(r=n.get(t))||void 0===r||r.forEach((function(e){a.has(e)||a.add(e)}))),a},_=function(e,t){S(e,t).forEach((function(e){e._isComputed?e._scheduler(e):J()?b.has(e)||b.add(e):A()?h.has(e)||h.add(e):u(e._scheduler)?e._scheduler(e):e()}))},w=function(e){var t=e.key,r=e.type,n=e.target;"iterate"===r&&(t=m);var a=p[p.length-1];W()||a&&function(e,t){var r=e._reactionsSet;r?r.has(t)||r.add(t):e._reactionsSet=new Set([t])}(a,function(e,t,r){var n=v.get(e);if(n){var a=n.get(t);return a?a.has(r)||a.add(r):n.set(t,new Set([r])),n}var u=new Map([[t,new Set([r])]]);return v.set(e,u),u}(n,t,a))},P=function(e){var t=e.key,r=e.type,n=e.target,a=e.oldTarget;!function(e){var t=s.get(l.get(e.target)||e.target),r=s.get(l.get(e.oldValue)||e.oldValue),n=s.get(l.get(e.value)||e.value);if(t){var a=function(){return{get path(){return k(t.path,e.key)},type:e.type,key:e.key,value:e.value,oldValue:e.oldValue}};r&&"set"===e.type&&(r.observers.forEach((function(e){return e(a())})),r.deepObservers.forEach((function(e){return e(a())})),n&&(n.observers=r.observers,n.deepObservers=r.deepObservers)),r&&"delete"===e.type&&(r.observers=[],r.deepObservers=[]),t.observers.forEach((function(e){return e(a())})),t.deepObservers.forEach((function(e){return e(a())}));for(var u=t.parent;u;)u.deepObservers.forEach((function(e){return e(a())})),u=u.parent}}(e),"clear"===r?a.forEach((function(e,t){_(n,t)})):_(n,t),"add"!==r&&"delete"!==r&&"clear"!==r||(t=Array.isArray(n)?"length":m,_(n,t))},j=function(e){var t=e._reactionsSet;t&&t.forEach((function(t){t.forEach((function(t){t.delete(e)}))})),delete e._reactionsSet},R=function(e){j(e),function(e){var t=e._computedsSet;t&&t.forEach((function(e){0===S(e._context,e._property).size&&(R(e),e._dirty=!0)}))}(e)},E=function(){y.value++},V=function(){y.value--,0===y.value&&T()},M=function(){g.value++},x=function(){g.value--},A=function(){return y.value>0},J=function(){return d.value},W=function(){return g.value>0},T=function(){h.forEach((function(e){h.delete(e),u(e._scheduler)?e._scheduler(e):e()}))},N=function(){return(N=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function z(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,a,u=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=u.next()).done;)o.push(n.value)}catch(e){a={error:e}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(a)throw a.error}}return o}function C(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(z(arguments[t]));return e}var D,$=Symbol("RAW_TYPE"),F=Symbol("OBSERVABLE_TYPE"),q=Object.prototype.hasOwnProperty,B=function(e){return l.has(e)},K=function(e){return e&&!!e[O]},Y=function(e){return!B(e)&&(null!=e&&(!!o(e)||(i(e)?!e[$]&&(!!e[F]||(!("$$typeof"in e)||!("_owner"in e))&&(!e._isAMomentObject&&(!e._isJSONSchemaObject&&(!u(e.toJS)&&!u(e.toJSON))))):!!(t(e)||n(e)||r(e)||a(e)))))},L=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter((function(e){return"symbol"==typeof e}))),G=Object.prototype.hasOwnProperty;function H(e,t,r){var n=c.get(r);return Y(r)?n||te(e,t,r):n||r}function I(e,t,r,n){var a=r.next;return r.next=function(){var u=a.call(r),o=u.done,i=u.value;return o||(n?i[1]=H(e,t,i[1]):i=H(e,t,i)),{done:o,value:i}},r}var Q=((D={has:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this);return w({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this);return w({target:t,key:e,type:"get"}),H(t,e,r.get.apply(t,arguments))},add:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.add.apply(t,arguments);return n||P({target:t,key:e,value:e,type:"add"}),a},set:function(e,t){var r=l.get(this),n=Reflect.getPrototypeOf(this),a=n.has.call(r,e),u=n.get.call(r,e),o=n.set.apply(r,arguments);return a?t!==u&&P({target:r,key:e,value:t,oldValue:u,type:"set"}):P({target:r,key:e,value:t,type:"add"}),o},delete:function(e){var t=l.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.get?r.get.call(t,e):void 0,u=r.delete.apply(t,arguments);return n&&P({target:t,key:e,oldValue:a,type:"delete"}),u},clear:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this),r=0!==e.size,n=e instanceof Map?new Map(e):new Set(e),a=t.clear.apply(e,arguments);return r&&P({target:e,oldTarget:n,type:"clear"}),a},forEach:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var a=l.get(this),u=Reflect.getPrototypeOf(this);w({target:a,type:"iterate"});var o=function(t,r){for(var n=[],u=2;u<arguments.length;u++)n[u-2]=arguments[u];return e.apply(void 0,C([H(a,r,t),r],n))};return(t=u.forEach).call.apply(t,C([a,o],r))},keys:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);return w({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t.values.apply(e,arguments);return I(e,"",r,!1)},entries:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t.entries.apply(e,arguments);return I(e,"",r,!0)}})[Symbol.iterator]=function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);w({target:e,type:"iterate"});var r=t[Symbol.iterator].apply(e,arguments);return I(e,"",r,e instanceof Map)},Object.defineProperty(D,"size",{get:function(){var e=l.get(this),t=Reflect.getPrototypeOf(this);return w({target:e,type:"iterate"}),Reflect.get(t,"size",e)},enumerable:!1,configurable:!0}),D),U={get:function(e,t,r){return e=G.call(Q,t)?Q:e,Reflect.get(e,t,r)}},X={get:function(e,t,r){var n=Reflect.get(e,t,r);if("symbol"==typeof t&&L.has(t))return n;w({target:e,key:t,receiver:r,type:"get"});var a=c.get(n);if(Y(n)){if(a)return a;var u=Reflect.getOwnPropertyDescriptor(e,t);if(!u||!1!==u.writable||!1!==u.configurable)return te(e,t,n)}return a||n},has:function(e,t){var r=Reflect.has(e,t);return w({target:e,key:t,type:"has"}),r},ownKeys:function(e){return w({target:e,type:"iterate"}),Reflect.ownKeys(e)},set:function(e,t,r,n){var a=G.call(e,t),u=te(e,t,r),o=e[t],i=Reflect.set(e,t,u,n);return e!==l.get(n)||(a?r!==o&&P({target:e,key:t,value:u,oldValue:o,receiver:n,type:"set"}):P({target:e,key:t,value:u,receiver:n,type:"add"})),i},deleteProperty:function(e,t){var r=Reflect.deleteProperty(e,t),n=e[t];return P({target:e,key:t,oldValue:n,type:"delete"}),r}},Z=function(e,t,r){var n=l.get(r)||r,a=s.get(n);if(a)return a;var u=l.get(e)||e,o=s.get(u);o?s.set(r,{get path(){return k(o.path,t)},parent:o,observers:[],deepObservers:[]}):s.set(r,{path:[],observers:[],deepObservers:[]})},ee=function(e,u){var o=new Proxy(e,function(e){return t(e)||n(e)||r(e)||a(e)}(e)?U:X);return l.set(o,e),u?f.set(e,o):c.set(e,o),o},te=function(e,t,r,n){if(e){var a=l.get(e)||e;if(f.get(a))return r}return B(r)?r:Y(r)?(Z(e,t,r),ee(r,n)):r};function re(e){var t=function(t){return e({value:t})};return u(e)&&(t[O]=e),t}function ne(e){if(e[O])return e[O][O]?ne(e[O]):e[O]}var ae=function(e){return re((function(t){var r=t.target,n=t.key,a=t.value,o=function(t){return function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return e((function(){return u(t)?t.apply(r,n):void 0}))}};return r?(r[n]=o(r[n]),r):o(a)}))},ue=function(e){var t=null;try{E(),u(e)&&(t=e())}finally{V()}return t},oe=ae(ue);ue.scope=function(e){var t=null;try{d.value=!0,u(e)&&(t=e())}finally{d.value=!1,b.forEach((function(e){b.delete(e),u(e._scheduler)?e._scheduler(e):e()}))}return t},ue[O]=oe,ue.scope[O]=ae(ue.scope);var ie=function(e){var t;M();try{u(e)&&(t=e())}finally{return x(),t}};ie.create=function(){M();var e=!1;return function(){e||(x(),e=!0)}};var le=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:te(t,r,t?t[r]:n)};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=te(t,r,e),a.value=e,n!==e&&P({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return w({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ce=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={set:function(e){var t=a.value;a.value=e,t!==e&&P({target:a,key:r,type:"set",oldValue:t,value:e})},get:function(){return w({target:a,key:r,type:"get"}),a.value}};return l.set(u,a),c.set(a,u),Z(t,r,a),t?(Object.defineProperty(t,r,{value:u,enumerable:!0,configurable:!1,writable:!1}),t):u})),fe=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={},o=t||a,i=t?r:"value";function f(){return w({target:o,key:i,type:"get"}),a.value}function s(e){var t=a.value;a.value=e,t!==e&&P({target:o,key:i,type:"set",oldValue:t,value:e})}return Z(t,r,a),l.set(u,a),c.set(a,u),t?(Object.defineProperty(t,r,{get:f,set:s,enumerable:!0,configurable:!1}),t):(Object.defineProperty(u,"value",{set:s,get:f}),u)})),se=re((function(e){var t=e.target,r=e.key,n=e.value,a={value:te(t,r,t?t[r]:n,!0)};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=te(t,r,e,!0),a.value=e,n!==e&&P({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return w({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ve=re((function(e){var t=e.target,r=e.key,n=e.value,a={},o={},i=t||a,f=t?r:"value",s=function e(t){if(!t)return(null==n?void 0:n.get)?null==n?void 0:n.get:n;var r=Object.getOwnPropertyDescriptor(t,f);return(null==r?void 0:r.get)?r.get:e(Object.getPrototypeOf(t))}(i),v=function e(t){if(!t)return(null==n?void 0:n.set)?null==n?void 0:n.set:void 0;var r=Object.getOwnPropertyDescriptor(t,f);return(null==r?void 0:r.set)?r.set:e(Object.getPrototypeOf(t))}(i);function y(){var e;a.value=null===(e=null==s?void 0:s.call)||void 0===e?void 0:e.call(s,i)}function g(){if(-1===p.indexOf(g))try{p.push(g),y()}finally{p.pop()}}function d(){return p.length>0&&function(e){if(u(e)){var t=p[p.length-1];if(t){var r=t._computedsSet;r?r.has(e)||r.add(e):t._computedsSet=new Set([e])}}}(g),W()?y():g._dirty&&(g(),g._dirty=!1),w({target:i,key:f,type:"get"}),a.value}function h(e){var t;try{E(),null===(t=null==v?void 0:v.call)||void 0===t||t.call(v,i,e)}finally{V()}}return g._name="ComputedReaction",g._scheduler=function(){g._dirty=!0,E(),P({target:i,key:f,value:a.value,type:"set"}),V()},g._isComputed=!0,g._dirty=!0,g._context=i,g._property=f,l.set(o,a),c.set(a,o),Z(t,r,a),t?(Object.defineProperty(t,r,{get:d,set:h,enumerable:!0,configurable:!1}),t):(Object.defineProperty(o,"value",{set:h,get:d}),o)}));function pe(e){return te(null,null,e)}function ye(e,t){if(B(e))return e;if(!Y(e))return e;for(var r in Z(void 0,void 0,e),l.set(e,e),c.set(e,e),t){var n=t[r];K(n)&&ne(n)({target:e,key:r})}return e}pe.box=ce,pe.ref=fe,pe.deep=le,pe.shallow=se,pe.computed=ve,pe[O]=le;var ge=function(e,t){void 0===t&&(t="AutoRun");var r=function(){if(-1===p.indexOf(r)){j(r);try{p.push(r),E(),u(e)&&e()}finally{V(),p.pop()}}};return r._name=t,r(),function(){R(r)}},de=function(e,t){var r=this;void 0===t&&(t="TrackerReaction"),this.track=function(e){if(-1===p.indexOf(r.track)){j(r.track);try{p.push(r.track),E(),u(e)&&(r.results=e())}finally{V(),p.pop()}}return r.results},this.dispose=function(){R(r.track)},this.track._scheduler=e,this.track._name=t};e.Tracker=de,e.action=oe,e.autorun=ge,e.batch=ue,e.define=ye,e.isAnnotation=K,e.isObservable=B,e.isSupportObservable=Y,e.markObservable=function(e){if(e)return u(e)?e.prototype[F]=!0:e[F]=!0,e},e.markRaw=function(e){if(e)return u(e)?e.prototype[$]=!0:e[$]=!0,e},e.model=function(e){var t=Object.keys(e||{}).reduce((function(t,r){var n=Object.getOwnPropertyDescriptor(e,r);return n&&n.get?t[r]=pe.computed:u(e[r])?t[r]=ue:t[r]=pe,t}),{});return ye(e,t)},e.observable=pe,e.observe=function(e,t,r){void 0===r&&(r=!0);var n=function(e){u(t)&&t(e)};if(e&&"object"!=typeof e)throw Error("Can not observe "+typeof e+" type.");return function(e){var t=l.get(e)||e,a=s.get(t);if(a)if(r){var u=a.deepObservers.length;a.deepObservers.push(n),n.unobserve=function(){a.deepObservers.splice(u,1)}}else{var o=a.observers.length;a.observers.push(n),n.unobserve=function(){a.observers.splice(o,1)}}return function(){null==n||n.unobserve()}}(e)},e.raw=function(e){return l.get(e)},e.reaction=function(e,t,r){var n=N({name:"Reaction"},r),a={},o={},i={};return ge((function(){a.currentValue=e(),i.current=u(n.equals)?!n.equals(a.oldValue,a.currentValue):a.oldValue!==a.currentValue,i.current&&o.current&&ie((function(){u(t)&&t(a.currentValue)})),a.oldValue=a.currentValue,o.current=!0}),n.name)},e.toJS=function(e){var t=new WeakSet,r=function(e){if(o(e)){if(t.has(e))return e;var n=e;l.has(e)&&(e=l.get(e)),t.add(n);var a=[];return e.forEach((function(e){a.push(r(e))})),a}if(i(e)){if(t.has(e))return e;n=e;if(l.has(e)&&(e=l.get(e)),"$$typeof"in e&&"_owner"in e)return e;if(e._isAMomentObject)return e;if(e._isJSONSchemaObject)return e;if(u(e.toJS))return e.toJS();if(u(e.toJSON))return e.toJSON();t.add(n);var c={};for(var f in e)q.call(e,f)&&(c[f]=r(e[f]));return c}return e};return r(e)},e.untracked=ie,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -73,10 +73,10 @@ import { isValid, isFn, isMap, isWeakMap, isSet, isWeakSet, isPlainObj, isArr, } from './checkers'; | ||
var tojs = function (values) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
if (isArr(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
visited.add(originValues); | ||
@@ -90,2 +90,9 @@ var res_1 = []; | ||
else if (isPlainObj(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (ProxyRaw.has(values)) { | ||
values = ProxyRaw.get(values); | ||
} | ||
if ('$$typeof' in values && '_owner' in values) { | ||
@@ -92,0 +99,0 @@ return values; |
@@ -82,10 +82,10 @@ "use strict"; | ||
var tojs = function (values) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (environment_1.ProxyRaw.has(values)) { | ||
values = environment_1.ProxyRaw.get(values); | ||
} | ||
if (checkers_1.isArr(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (environment_1.ProxyRaw.has(values)) { | ||
values = environment_1.ProxyRaw.get(values); | ||
} | ||
visited.add(originValues); | ||
@@ -99,2 +99,9 @@ var res_1 = []; | ||
else if (checkers_1.isPlainObj(values)) { | ||
if (visited.has(values)) { | ||
return values; | ||
} | ||
var originValues = values; | ||
if (environment_1.ProxyRaw.has(values)) { | ||
values = environment_1.ProxyRaw.get(values); | ||
} | ||
if ('$$typeof' in values && '_owner' in values) { | ||
@@ -101,0 +108,0 @@ return values; |
{ | ||
"name": "@formily/reactive", | ||
"version": "2.0.0-beta.46", | ||
"version": "2.0.0-beta.47", | ||
"license": "MIT", | ||
@@ -42,3 +42,3 @@ "main": "lib", | ||
}, | ||
"gitHead": "6cae76f7fec679ae765aa32b5b586e58c4eb1cd9" | ||
"gitHead": "5732eaffdc067b03043e3200231ab762038be386" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175455
4629