@formily/reactive
Advanced tools
Comparing version 2.0.0-beta.41 to 2.0.0-beta.42
@@ -775,3 +775,2 @@ (function (global, factory) { | ||
return function () { | ||
var _this = this; | ||
var args = []; | ||
@@ -782,3 +781,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
return method(function () { | ||
return isFn(callback) ? callback.apply(_this, args) : undefined; | ||
return isFn(callback) ? callback.apply(target, args) : undefined; | ||
}); | ||
@@ -785,0 +784,0 @@ }; |
@@ -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,l=function(e){return"[object Object]"===Object.prototype.toString.call(e)},i=new WeakMap,c=new WeakMap,f=new WeakMap,s=new WeakMap,v=new WeakMap,y=new WeakMap,p=[],g={value:0},d={value:0},h={value:!1},b=new Set,O=new Set,k=Symbol("MakeObservableSymbol"),w=Symbol("iteration key"),S=function(e,t){var r,n=s.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},m=function(e,t){S(e,t).forEach((function(e){e._isComputed?e._scheduler(e):W()?O.has(e)||O.add(e):A()?b.has(e)||b.add(e):u(e._scheduler)?e._scheduler(e):e()}))},P=function(e){var t=e.key,r=e.type,n=e.target;"iterate"===r&&(t=w);var a=p[p.length-1];J()||a&&function(e,t){var r=v.get(e);r?r.has(t)||r.add(t):v.set(e,new Set([t]))}(a,function(e,t,r){var n=s.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 s.set(e,u),u}(n,t,a))},_=function(e){var t=e.key,r=e.type,n=e.target,a=e.oldTarget;!function(e){var t=f.get(i.get(e.target)||e.target),r=f.get(i.get(e.oldValue)||e.oldValue),n=f.get(i.get(e.value)||e.value);if(t){var a={path:t.path.concat(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=new Set,r.deepObservers=new Set),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){m(n,t)})):m(n,t),"add"!==r&&"delete"!==r&&"clear"!==r||(t=Array.isArray(n)?"length":w,m(n,t))},j=function(e){var t=v.get(e);t&&t.forEach((function(t){t.forEach((function(t){t.delete(e)}))})),v.delete(e)},R=function(e){j(e),function(e){var t=y.get(e);t&&t.forEach((function(e){0===S(e._context,e._property).size&&(R(e),e._dirty=!0)}))}(e)},E=function(){g.value++},V=function(){g.value--,0===g.value&&T()},M=function(){d.value++},x=function(){d.value--},A=function(){return g.value>0},W=function(){return h.value},J=function(){return d.value>0},T=function(){b.forEach((function(e){b.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=function(e){return i.has(e)},B=function(e){return e&&!!e[k]},K=function(e){return!q(e)&&(null!=e&&(!!o(e)||(l(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)))))},Y=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(e[n]);return r.push(t),r},L=function(e){var t=e.target,r=e.value,n=e.key,a=e.traverse,u=e.shallow,o=i.get(r)||r,l=i.get(t)||t,c=f.get(l),s=f.get(o);if(s)return s;if(c){var v={path:Y(c.path,n),parent:c,observers:new Set,deepObservers:new Set,shallow:u||c.shallow,traverse:a||c.traverse};return f.set(r,v),v}v={path:[],observers:new Set,deepObservers:new Set,shallow:u,traverse:a};return f.set(r,v),v},G=function(e,t,r){if(q(r))return r;var n=i.get(e)||e,a=i.get(r)||r,u=f.get(n),o=f.get(a);if(u){if(!K(r))return r;var l=u.path.concat(t),c=u.shallow;return o||f.set(a,{path:l,parent:u,observers:new Set,deepObservers:new Set,shallow:u.shallow,traverse:u.traverse}),c?r:u.traverse({target:e,key:t,value:r,path:l,shallow:c})}return r},H=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter((function(e){return"symbol"==typeof e}))),I=Object.prototype.hasOwnProperty;function Q(e,t,r){var n=c.get(r);return K(r)?n||G(e,t,r):n||r}function U(e,t,r,n){var a=r.next;return r.next=function(){var u=a.call(r),o=u.done,l=u.value;return o||(n?l[1]=Q(e,t,l[1]):l=Q(e,t,l)),{done:o,value:l}},r}var X=((D={has:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this);return P({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this);return P({target:t,key:e,type:"get"}),Q(t,e,r.get.apply(t,arguments))},add:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.add.apply(t,arguments);return n||_({target:t,key:e,value:e,type:"add"}),a},set:function(e,t){var r=i.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&&_({target:r,key:e,value:t,oldValue:u,type:"set"}):_({target:r,key:e,value:t,type:"add"}),o},delete:function(e){var t=i.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&&_({target:t,key:e,oldValue:a,type:"delete"}),u},clear:function(){var e=i.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&&_({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=i.get(this),u=Reflect.getPrototypeOf(this);P({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([Q(a,r,t),r],n))};return(t=u.forEach).call.apply(t,C([a,o],r))},keys:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);return P({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t.values.apply(e,arguments);return U(e,"",r,!1)},entries:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t.entries.apply(e,arguments);return U(e,"",r,!0)}})[Symbol.iterator]=function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t[Symbol.iterator].apply(e,arguments);return U(e,"",r,e instanceof Map)},Object.defineProperty(D,"size",{get:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);return P({target:e,type:"iterate"}),Reflect.get(t,"size",e)},enumerable:!1,configurable:!0}),D),Z={get:function(e,t,r){return e=I.call(X,t)?X:e,Reflect.get(e,t,r)}},ee={get:function(e,t,r){var n=Reflect.get(e,t,r);if("symbol"==typeof t&&H.has(t))return n;P({target:e,key:t,receiver:r,type:"get"});var a=c.get(n);if(K(n)){if(a)return a;var u=Reflect.getOwnPropertyDescriptor(e,t);if(!u||!1!==u.writable||!1!==u.configurable)return G(e,t,n)}return a||n},has:function(e,t){var r=Reflect.has(e,t);return P({target:e,key:t,type:"has"}),r},ownKeys:function(e){return P({target:e,type:"iterate"}),Reflect.ownKeys(e)},set:function(e,t,r,n){var a=I.call(e,t),u=G(e,t,r),o=e[t],l=Reflect.set(e,t,u,n);return e!==i.get(n)||(a?r!==o&&_({target:e,key:t,value:u,oldValue:o,receiver:n,type:"set"}):_({target:e,key:t,value:u,receiver:n,type:"add"})),l},deleteProperty:function(e,t){var r=Reflect.deleteProperty(e,t),n=e[t];return _({target:e,key:t,oldValue:n,type:"delete"}),r}},te=function(e){if(q(e))return e;var u=new Proxy(e,function(e){return t(e)||n(e)||r(e)||a(e)}(e)?Z:ee);return i.set(u,e),c.set(e,u),u},re=function(e){var t=e.value,r=e.target,n=e.key,a=e.traverse,u=e.shallow;return q(t)?t:K(t)?(L({target:r,key:n,value:t,shallow:u,traverse:a||re}),te(t)):t};function ne(e){var t=function(t){return e({value:t})};return u(e)&&(t[k]=e),t}function ae(e){if(e[k])return e[k][k]?ae(e[k]):e[k]}var ue=function(e){return ne((function(t){var r=t.target,n=t.key,a=t.value,o=function(t){return function(){for(var r=this,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)}))},oe=function(e){var t=null;try{E(),u(e)&&(t=e())}finally{V()}return t},le=ue(oe);oe.scope=function(e){var t=null;try{h.value=!0,u(e)&&(t=e())}finally{h.value=!1,O.forEach((function(e){O.delete(e),u(e._scheduler)?e._scheduler(e):e()}))}return t},oe[k]=le,oe.scope[k]=ue(oe.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 ce=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:re({target:t,key:r,value:t?t[r]:n})};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=re({target:t,key:r,value:e}),a.value=e,n!==e&&_({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return P({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),fe=ne((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&&_({target:a,key:r,type:"set",oldValue:t,value:e})},get:function(){return P({target:a,key:r,type:"get"}),a.value}};return i.set(u,a),c.set(a,u),L({target:t,key:r,value:a}),t?(Object.defineProperty(t,r,{value:u,enumerable:!0,configurable:!1,writable:!1}),t):u})),se=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={},o=t||a,l=t?r:"value";function f(){return P({target:o,key:l,type:"get"}),a.value}function s(e){var t=a.value;a.value=e,t!==e&&_({target:o,key:l,type:"set",oldValue:t,value:e})}return L({target:t,key:r,value:a}),i.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)})),ve=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:re({target:t,key:r,value:t?t[r]:n,shallow:!0})};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=re({target:t,key:r,value:e,shallow:!0}),a.value=e,n!==e&&_({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return P({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ye=ne((function(e){var t=e.target,r=e.key,n=e.value,a={},o={},l=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))}(l),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))}(l);function g(){var e;a.value=null===(e=null==s?void 0:s.call)||void 0===e?void 0:e.call(s,l)}function d(){if(-1===p.indexOf(d))try{p.push(d),g()}finally{p.pop()}}function h(){return p.length>0&&function(e){if(u(e)){var t=p[p.length-1];if(t){var r=y.get(t);r?r.has(e)||r.add(e):y.set(t,new Set([e]))}}}(d),J()?g():d._dirty&&(d(),d._dirty=!1),P({target:l,key:f,type:"get"}),a.value}function b(e){var t;try{E(),null===(t=null==v?void 0:v.call)||void 0===t||t.call(v,l,e)}finally{V()}}return d._name="ComputedReaction",d._scheduler=function(){d._dirty=!0,E(),_({target:l,key:f,value:a.value,type:"set"}),V()},d._isComputed=!0,d._dirty=!0,d._context=l,d._property=f,i.set(o,a),c.set(a,o),L({target:t,key:r,value:a}),t?(Object.defineProperty(t,r,{get:h,set:b,enumerable:!0,configurable:!1}),t):(Object.defineProperty(o,"value",{set:b,get:h}),o)}));function pe(e,t){return void 0===t&&(t=re),t({value:e,traverse:t})}function ge(e,t){return q(e)?e:K(e)?(L({value:e,traverse:re}),i.set(e,e),c.set(e,e),pe(e,(function(e){var r=e.target,n=e.value;if(r)return r;for(var a in t){var u=t[a];B(u)&&ae(u)({target:n,key:a})}return n}))):e}pe.box=fe,pe.ref=se,pe.deep=ce,pe.shallow=ve,pe.computed=ye,pe[k]=ce;var de=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)}},he=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=he,e.action=le,e.autorun=de,e.batch=oe,e.define=ge,e.isAnnotation=B,e.isObservable=q,e.isSupportObservable=K,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]=oe:t[r]=pe,t}),{});return ge(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=i.get(e)||e,a=f.get(t);return a&&(r?a.deepObservers.add(n):a.observers.add(n)),function(){var t=i.get(e)||e,r=f.get(t);r&&(r.deepObservers.delete(n),r.observers.delete(n))}}(e)},e.raw=function(e){return i.get(e)},e.reaction=function(e,t,r){var n=N({name:"Reaction"},r),a={},o={},l={};return de((function(){a.currentValue=e(),l.current=u(n.equals)?!n.equals(a.oldValue,a.currentValue):a.oldValue!==a.currentValue,l.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;if(q(e)){if(o(e)){t.add(e);var n=[];return e.forEach((function(e){n.push(r(e))})),n}if(l(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(e);var a={};for(var i in e)Object.hasOwnProperty.call(e,i)&&(a[i]=r(e[i]));return a}return e}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,l=function(e){return"[object Object]"===Object.prototype.toString.call(e)},i=new WeakMap,c=new WeakMap,f=new WeakMap,s=new WeakMap,v=new WeakMap,y=new WeakMap,p=[],g={value:0},d={value:0},h={value:!1},b=new Set,O=new Set,k=Symbol("MakeObservableSymbol"),w=Symbol("iteration key"),S=function(e,t){var r,n=s.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},m=function(e,t){S(e,t).forEach((function(e){e._isComputed?e._scheduler(e):W()?O.has(e)||O.add(e):A()?b.has(e)||b.add(e):u(e._scheduler)?e._scheduler(e):e()}))},P=function(e){var t=e.key,r=e.type,n=e.target;"iterate"===r&&(t=w);var a=p[p.length-1];J()||a&&function(e,t){var r=v.get(e);r?r.has(t)||r.add(t):v.set(e,new Set([t]))}(a,function(e,t,r){var n=s.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 s.set(e,u),u}(n,t,a))},_=function(e){var t=e.key,r=e.type,n=e.target,a=e.oldTarget;!function(e){var t=f.get(i.get(e.target)||e.target),r=f.get(i.get(e.oldValue)||e.oldValue),n=f.get(i.get(e.value)||e.value);if(t){var a={path:t.path.concat(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=new Set,r.deepObservers=new Set),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){m(n,t)})):m(n,t),"add"!==r&&"delete"!==r&&"clear"!==r||(t=Array.isArray(n)?"length":w,m(n,t))},j=function(e){var t=v.get(e);t&&t.forEach((function(t){t.forEach((function(t){t.delete(e)}))})),v.delete(e)},R=function(e){j(e),function(e){var t=y.get(e);t&&t.forEach((function(e){0===S(e._context,e._property).size&&(R(e),e._dirty=!0)}))}(e)},E=function(){g.value++},V=function(){g.value--,0===g.value&&T()},M=function(){d.value++},x=function(){d.value--},A=function(){return g.value>0},W=function(){return h.value},J=function(){return d.value>0},T=function(){b.forEach((function(e){b.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=function(e){return i.has(e)},B=function(e){return e&&!!e[k]},K=function(e){return!q(e)&&(null!=e&&(!!o(e)||(l(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)))))},Y=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(e[n]);return r.push(t),r},L=function(e){var t=e.target,r=e.value,n=e.key,a=e.traverse,u=e.shallow,o=i.get(r)||r,l=i.get(t)||t,c=f.get(l),s=f.get(o);if(s)return s;if(c){var v={path:Y(c.path,n),parent:c,observers:new Set,deepObservers:new Set,shallow:u||c.shallow,traverse:a||c.traverse};return f.set(r,v),v}v={path:[],observers:new Set,deepObservers:new Set,shallow:u,traverse:a};return f.set(r,v),v},G=function(e,t,r){if(q(r))return r;var n=i.get(e)||e,a=i.get(r)||r,u=f.get(n),o=f.get(a);if(u){if(!K(r))return r;var l=u.path.concat(t),c=u.shallow;return o||f.set(a,{path:l,parent:u,observers:new Set,deepObservers:new Set,shallow:u.shallow,traverse:u.traverse}),c?r:u.traverse({target:e,key:t,value:r,path:l,shallow:c})}return r},H=new Set(Object.getOwnPropertyNames(Symbol).map((function(e){return Symbol[e]})).filter((function(e){return"symbol"==typeof e}))),I=Object.prototype.hasOwnProperty;function Q(e,t,r){var n=c.get(r);return K(r)?n||G(e,t,r):n||r}function U(e,t,r,n){var a=r.next;return r.next=function(){var u=a.call(r),o=u.done,l=u.value;return o||(n?l[1]=Q(e,t,l[1]):l=Q(e,t,l)),{done:o,value:l}},r}var X=((D={has:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this);return P({target:t,key:e,type:"has"}),r.has.apply(t,arguments)},get:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this);return P({target:t,key:e,type:"get"}),Q(t,e,r.get.apply(t,arguments))},add:function(e){var t=i.get(this),r=Reflect.getPrototypeOf(this),n=r.has.call(t,e),a=r.add.apply(t,arguments);return n||_({target:t,key:e,value:e,type:"add"}),a},set:function(e,t){var r=i.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&&_({target:r,key:e,value:t,oldValue:u,type:"set"}):_({target:r,key:e,value:t,type:"add"}),o},delete:function(e){var t=i.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&&_({target:t,key:e,oldValue:a,type:"delete"}),u},clear:function(){var e=i.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&&_({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=i.get(this),u=Reflect.getPrototypeOf(this);P({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([Q(a,r,t),r],n))};return(t=u.forEach).call.apply(t,C([a,o],r))},keys:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);return P({target:e,type:"iterate"}),t.keys.apply(e,arguments)},values:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t.values.apply(e,arguments);return U(e,"",r,!1)},entries:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t.entries.apply(e,arguments);return U(e,"",r,!0)}})[Symbol.iterator]=function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);P({target:e,type:"iterate"});var r=t[Symbol.iterator].apply(e,arguments);return U(e,"",r,e instanceof Map)},Object.defineProperty(D,"size",{get:function(){var e=i.get(this),t=Reflect.getPrototypeOf(this);return P({target:e,type:"iterate"}),Reflect.get(t,"size",e)},enumerable:!1,configurable:!0}),D),Z={get:function(e,t,r){return e=I.call(X,t)?X:e,Reflect.get(e,t,r)}},ee={get:function(e,t,r){var n=Reflect.get(e,t,r);if("symbol"==typeof t&&H.has(t))return n;P({target:e,key:t,receiver:r,type:"get"});var a=c.get(n);if(K(n)){if(a)return a;var u=Reflect.getOwnPropertyDescriptor(e,t);if(!u||!1!==u.writable||!1!==u.configurable)return G(e,t,n)}return a||n},has:function(e,t){var r=Reflect.has(e,t);return P({target:e,key:t,type:"has"}),r},ownKeys:function(e){return P({target:e,type:"iterate"}),Reflect.ownKeys(e)},set:function(e,t,r,n){var a=I.call(e,t),u=G(e,t,r),o=e[t],l=Reflect.set(e,t,u,n);return e!==i.get(n)||(a?r!==o&&_({target:e,key:t,value:u,oldValue:o,receiver:n,type:"set"}):_({target:e,key:t,value:u,receiver:n,type:"add"})),l},deleteProperty:function(e,t){var r=Reflect.deleteProperty(e,t),n=e[t];return _({target:e,key:t,oldValue:n,type:"delete"}),r}},te=function(e){if(q(e))return e;var u=new Proxy(e,function(e){return t(e)||n(e)||r(e)||a(e)}(e)?Z:ee);return i.set(u,e),c.set(e,u),u},re=function(e){var t=e.value,r=e.target,n=e.key,a=e.traverse,u=e.shallow;return q(t)?t:K(t)?(L({target:r,key:n,value:t,shallow:u,traverse:a||re}),te(t)):t};function ne(e){var t=function(t){return e({value:t})};return u(e)&&(t[k]=e),t}function ae(e){if(e[k])return e[k][k]?ae(e[k]):e[k]}var ue=function(e){return ne((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)}))},oe=function(e){var t=null;try{E(),u(e)&&(t=e())}finally{V()}return t},le=ue(oe);oe.scope=function(e){var t=null;try{h.value=!0,u(e)&&(t=e())}finally{h.value=!1,O.forEach((function(e){O.delete(e),u(e._scheduler)?e._scheduler(e):e()}))}return t},oe[k]=le,oe.scope[k]=ue(oe.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 ce=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:re({target:t,key:r,value:t?t[r]:n})};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=re({target:t,key:r,value:e}),a.value=e,n!==e&&_({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return P({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),fe=ne((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&&_({target:a,key:r,type:"set",oldValue:t,value:e})},get:function(){return P({target:a,key:r,type:"get"}),a.value}};return i.set(u,a),c.set(a,u),L({target:t,key:r,value:a}),t?(Object.defineProperty(t,r,{value:u,enumerable:!0,configurable:!1,writable:!1}),t):u})),se=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:t?t[r]:n},u={},o=t||a,l=t?r:"value";function f(){return P({target:o,key:l,type:"get"}),a.value}function s(e){var t=a.value;a.value=e,t!==e&&_({target:o,key:l,type:"set",oldValue:t,value:e})}return L({target:t,key:r,value:a}),i.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)})),ve=ne((function(e){var t=e.target,r=e.key,n=e.value,a={value:re({target:t,key:r,value:t?t[r]:n,shallow:!0})};return t?(Object.defineProperty(t,r,{set:function(e){var n=a.value;e=re({target:t,key:r,value:e,shallow:!0}),a.value=e,n!==e&&_({target:t,key:r,type:"set",oldValue:n,value:e})},get:function(){return P({target:t,key:r,type:"get"}),a.value},enumerable:!0,configurable:!1}),t):a.value})),ye=ne((function(e){var t=e.target,r=e.key,n=e.value,a={},o={},l=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))}(l),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))}(l);function g(){var e;a.value=null===(e=null==s?void 0:s.call)||void 0===e?void 0:e.call(s,l)}function d(){if(-1===p.indexOf(d))try{p.push(d),g()}finally{p.pop()}}function h(){return p.length>0&&function(e){if(u(e)){var t=p[p.length-1];if(t){var r=y.get(t);r?r.has(e)||r.add(e):y.set(t,new Set([e]))}}}(d),J()?g():d._dirty&&(d(),d._dirty=!1),P({target:l,key:f,type:"get"}),a.value}function b(e){var t;try{E(),null===(t=null==v?void 0:v.call)||void 0===t||t.call(v,l,e)}finally{V()}}return d._name="ComputedReaction",d._scheduler=function(){d._dirty=!0,E(),_({target:l,key:f,value:a.value,type:"set"}),V()},d._isComputed=!0,d._dirty=!0,d._context=l,d._property=f,i.set(o,a),c.set(a,o),L({target:t,key:r,value:a}),t?(Object.defineProperty(t,r,{get:h,set:b,enumerable:!0,configurable:!1}),t):(Object.defineProperty(o,"value",{set:b,get:h}),o)}));function pe(e,t){return void 0===t&&(t=re),t({value:e,traverse:t})}function ge(e,t){return q(e)?e:K(e)?(L({value:e,traverse:re}),i.set(e,e),c.set(e,e),pe(e,(function(e){var r=e.target,n=e.value;if(r)return r;for(var a in t){var u=t[a];B(u)&&ae(u)({target:n,key:a})}return n}))):e}pe.box=fe,pe.ref=se,pe.deep=ce,pe.shallow=ve,pe.computed=ye,pe[k]=ce;var de=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)}},he=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=he,e.action=le,e.autorun=de,e.batch=oe,e.define=ge,e.isAnnotation=B,e.isObservable=q,e.isSupportObservable=K,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]=oe:t[r]=pe,t}),{});return ge(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=i.get(e)||e,a=f.get(t);return a&&(r?a.deepObservers.add(n):a.observers.add(n)),function(){var t=i.get(e)||e,r=f.get(t);r&&(r.deepObservers.delete(n),r.observers.delete(n))}}(e)},e.raw=function(e){return i.get(e)},e.reaction=function(e,t,r){var n=N({name:"Reaction"},r),a={},o={},l={};return de((function(){a.currentValue=e(),l.current=u(n.equals)?!n.equals(a.oldValue,a.currentValue):a.oldValue!==a.currentValue,l.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;if(q(e)){if(o(e)){t.add(e);var n=[];return e.forEach((function(e){n.push(r(e))})),n}if(l(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(e);var a={};for(var i in e)Object.hasOwnProperty.call(e,i)&&(a[i]=r(e[i]));return a}return e}return e};return r(e)},e.untracked=ie,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -10,3 +10,2 @@ import { isFn } from './checkers'; | ||
return function () { | ||
var _this = this; | ||
var args = []; | ||
@@ -17,3 +16,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
return method(function () { | ||
return isFn(callback) ? callback.apply(_this, args) : undefined; | ||
return isFn(callback) ? callback.apply(target, args) : undefined; | ||
}); | ||
@@ -20,0 +19,0 @@ }; |
@@ -13,3 +13,2 @@ "use strict"; | ||
return function () { | ||
var _this = this; | ||
var args = []; | ||
@@ -20,3 +19,3 @@ for (var _i = 0; _i < arguments.length; _i++) { | ||
return method(function () { | ||
return checkers_1.isFn(callback) ? callback.apply(_this, args) : undefined; | ||
return checkers_1.isFn(callback) ? callback.apply(target, args) : undefined; | ||
}); | ||
@@ -23,0 +22,0 @@ }; |
{ | ||
"name": "@formily/reactive", | ||
"version": "2.0.0-beta.41", | ||
"version": "2.0.0-beta.42", | ||
"license": "MIT", | ||
@@ -37,3 +37,3 @@ "main": "lib", | ||
}, | ||
"gitHead": "4fef95af22bd0fe044ecdbcf35446ffba288150e" | ||
"gitHead": "93f5e7d6ba777bee901e4df57a682b87d0450027" | ||
} |
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
180505
4780