@formily/shared
Advanced tools
Comparing version 2.1.2 to 2.1.3
@@ -224,2 +224,3 @@ declare type EachArrayIterator<T> = (currentValue: T, key: number) => void | boolean; | ||
declare function deepmerge(target: any, source: any, options?: Options): any; | ||
declare const lazyMerge: <T extends object>(target: T, source: T) => T; | ||
declare const merge: typeof deepmerge; | ||
@@ -238,2 +239,2 @@ | ||
export { Path as FormPath, Pattern as FormPathPattern, IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, camelCase, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lowerCase, map, merge, paramCase, pascalCase, reduce, shallowClone, some, stringLength, toArr, uid, upperCase }; | ||
export { Path as FormPath, Pattern as FormPathPattern, IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, camelCase, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, lowerCase, map, merge, paramCase, pascalCase, reduce, shallowClone, some, stringLength, toArr, uid, upperCase }; |
@@ -104,2 +104,3 @@ export { camelCase } from 'camel-case'; | ||
declare function deepmerge(target: any, source: any, options?: Options): any; | ||
declare const lazyMerge: <T extends object>(target: T, source: T) => T; | ||
declare const merge: typeof deepmerge; | ||
@@ -118,2 +119,2 @@ | ||
export { IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, map, merge, reduce, shallowClone, some, stringLength, toArr, uid }; | ||
export { IMiddleware, Subscribable, Subscriber, Subscription, applyMiddleware, clone, defaults, deprecate, each, every, find, findIndex, getType, globalThisPolyfill, includes, instOf, isArr, isBool, isEmpty, isEqual, isFn, isHTMLElement, isMap, isNum, isNumberLike, isObj, isPlainObj, isReactElement, isRegExp, isSet, isStr, isUndef, isValid, isWeakMap, isWeakSet, lazyMerge, map, merge, reduce, shallowClone, some, stringLength, toArr, uid }; |
@@ -776,2 +776,40 @@ (function (global, factory) { | ||
} | ||
var lazyMerge = function (target, source) { | ||
if (!isValid(source)) | ||
return target; | ||
if (!isValid(target)) | ||
return source; | ||
if (typeof target !== 'object') | ||
return source; | ||
if (typeof source !== 'object') | ||
return target; | ||
return new Proxy({}, { | ||
get: function (_, key) { | ||
if (key in source) | ||
return source[key]; | ||
return target[key]; | ||
}, | ||
ownKeys: function () { | ||
var keys = Object.keys(target); | ||
for (var key in source) { | ||
if (!(key in target)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
}, | ||
getOwnPropertyDescriptor: function () { | ||
return { | ||
enumerable: true, | ||
configurable: true, | ||
writable: false, | ||
}; | ||
}, | ||
has: function (_, key) { | ||
if (key in source || key in target) | ||
return true; | ||
return false; | ||
}, | ||
}); | ||
}; | ||
var merge = deepmerge; | ||
@@ -869,2 +907,3 @@ | ||
exports.isWeakSet = isWeakSet; | ||
exports.lazyMerge = lazyMerge; | ||
exports.lowerCase = lowerCase; | ||
@@ -871,0 +910,0 @@ exports.map = map; |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("formily.shared",["exports"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).Formily=r.Formily||{},r.Formily.Shared={}))}(this,(function(r){"use strict";!function(){const r={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,r)}catch(r){}globalThis.process={env:r}}();var e=Object.prototype.toString,n=function(r){return function(e){return t(e)==="[object ".concat(r,"]")}},t=function(r){return e.call(r)},i=function(r){return"function"==typeof r},o=Array.isArray,u=n("Object"),c=n("String"),f=n("Boolean"),a=n("Number"),s=function(r){return"object"==typeof r},l=n("RegExp");function p(r,e,n){if(o(r)||c(r)){if(n){for(var t=r.length-1;t>=0;t--)if(!1===e(r[t],t))return}else for(t=0;t<r.length;t++)if(!1===e(r[t],t))return}else if(s(r)){var i=void 0;for(i in r)if(Object.hasOwnProperty.call(r,i)&&!1===e(r[i],i))return}}function b(r,e,n){var t=!1;return p(r,(function(r,n){if(e(r,n))return t=!0,!1}),n),t}var d=function(){try{if("undefined"!=typeof self)return self}catch(r){}try{if("undefined"!=typeof window)return window}catch(r){}try{if("undefined"!=typeof global)return global}catch(r){}return Function("return this")()}(),y=function(r,e){return i(e)?r instanceof e:!!c(e)&&(!!d[e]&&r instanceof d[e])},v=o,g=Object.keys,h=Object.prototype.hasOwnProperty;function O(r,e){if(r===e)return!0;if(r&&e&&"object"==typeof r&&"object"==typeof e){var n,t=v(r),i=v(e),o=void 0,u=void 0;if(t&&i){if((n=r.length)!==e.length)return!1;for(o=n;0!=o--;)if(!O(r[o],e[o]))return!1;return!0}if(t!==i)return!1;var c=r&&r._isAMomentObject,f=e&&e._isAMomentObject;if(c!==f)return!1;if(c&&f)return r.isSame(e);var a=r&&r.toJS;if(a!==(e&&e.toJS))return!1;if(a)return r.is?r.is(e):r===e;var s=y(r,"Date"),l=y(e,"Date");if(s!==l)return!1;if(s&&l)return r.getTime()===e.getTime();var p=y(r,"RegExp"),b=y(e,"RegExp");if(p!==b)return!1;if(p&&b)return r.toString()===e.toString();var d=y(r,"URL"),m=y(e,"URL");if(d!==m)return!1;if(d&&m)return r.href===e.href;var j=r&&r.toJSON,S=e&&e.toJSON;if(j!==S)return!1;if(j&&S)return O(r.toJSON(),e.toJSON());var w=g(r);if((n=w.length)!==g(e).length)return!1;for(o=n;0!=o--;)if(!h.call(e,w[o]))return!1;for(o=n;0!=o--;)if(!("_owner"===(u=w[o])&&r.$$typeof||O(r[u],e[u])))return!1;return!0}return r!=r&&e!=e}var m=function(){return m=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},m.apply(this,arguments)},j=function(r){if(Array.isArray(r)){var e=[];return r.forEach((function(r){e.push(j(r))})),e}if(u(r)){if("$$typeof"in r&&"_owner"in r)return r;if(r._isAMomentObject)return r;if(r._isJSONSchemaObject)return r;if(i(r.toJS))return r.toJS();if(i(r.toJSON))return r.toJSON();var n={};for(var t in r)Object.hasOwnProperty.call(r,t)&&(n[t]=j(r[t]));return n}return r},S=Object.prototype.hasOwnProperty,w=Object.prototype.toString,A=function(r){return null!=r}; | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("formily.shared",["exports"],e):e(((r="undefined"!=typeof globalThis?globalThis:r||self).Formily=r.Formily||{},r.Formily.Shared={}))}(this,(function(r){"use strict";!function(){const r={NODE_ENV:"production"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,r)}catch(r){}globalThis.process={env:r}}();var e=Object.prototype.toString,n=function(r){return function(e){return t(e)==="[object ".concat(r,"]")}},t=function(r){return e.call(r)},i=function(r){return"function"==typeof r},o=Array.isArray,u=n("Object"),c=n("String"),f=n("Boolean"),a=n("Number"),s=function(r){return"object"==typeof r},l=n("RegExp");function p(r,e,n){if(o(r)||c(r)){if(n){for(var t=r.length-1;t>=0;t--)if(!1===e(r[t],t))return}else for(t=0;t<r.length;t++)if(!1===e(r[t],t))return}else if(s(r)){var i=void 0;for(i in r)if(Object.hasOwnProperty.call(r,i)&&!1===e(r[i],i))return}}function b(r,e,n){var t=!1;return p(r,(function(r,n){if(e(r,n))return t=!0,!1}),n),t}var y=function(){try{if("undefined"!=typeof self)return self}catch(r){}try{if("undefined"!=typeof window)return window}catch(r){}try{if("undefined"!=typeof global)return global}catch(r){}return Function("return this")()}(),d=function(r,e){return i(e)?r instanceof e:!!c(e)&&(!!y[e]&&r instanceof y[e])},v=o,g=Object.keys,h=Object.prototype.hasOwnProperty;function O(r,e){if(r===e)return!0;if(r&&e&&"object"==typeof r&&"object"==typeof e){var n,t=v(r),i=v(e),o=void 0,u=void 0;if(t&&i){if((n=r.length)!==e.length)return!1;for(o=n;0!=o--;)if(!O(r[o],e[o]))return!1;return!0}if(t!==i)return!1;var c=r&&r._isAMomentObject,f=e&&e._isAMomentObject;if(c!==f)return!1;if(c&&f)return r.isSame(e);var a=r&&r.toJS;if(a!==(e&&e.toJS))return!1;if(a)return r.is?r.is(e):r===e;var s=d(r,"Date"),l=d(e,"Date");if(s!==l)return!1;if(s&&l)return r.getTime()===e.getTime();var p=d(r,"RegExp"),b=d(e,"RegExp");if(p!==b)return!1;if(p&&b)return r.toString()===e.toString();var y=d(r,"URL"),m=d(e,"URL");if(y!==m)return!1;if(y&&m)return r.href===e.href;var j=r&&r.toJSON,S=e&&e.toJSON;if(j!==S)return!1;if(j&&S)return O(r.toJSON(),e.toJSON());var w=g(r);if((n=w.length)!==g(e).length)return!1;for(o=n;0!=o--;)if(!h.call(e,w[o]))return!1;for(o=n;0!=o--;)if(!("_owner"===(u=w[o])&&r.$$typeof||O(r[u],e[u])))return!1;return!0}return r!=r&&e!=e}var m=function(){return m=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},m.apply(this,arguments)},j=function(r){if(Array.isArray(r)){var e=[];return r.forEach((function(r){e.push(j(r))})),e}if(u(r)){if("$$typeof"in r&&"_owner"in r)return r;if(r._isAMomentObject)return r;if(r._isJSONSchemaObject)return r;if(i(r.toJS))return r.toJS();if(i(r.toJSON))return r.toJSON();var n={};for(var t in r)Object.hasOwnProperty.call(r,t)&&(n[t]=j(r[t]));return n}return r},S=Object.prototype.hasOwnProperty,w=Object.prototype.toString,A=function(r){return null!=r}; | ||
/*! ***************************************************************************** | ||
@@ -15,3 +15,3 @@ Copyright (c) Microsoft Corporation. | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function M(r,e){if(void 0===e&&(e=!1),null==r)return!0;if("boolean"==typeof r)return!1;if("number"==typeof r)return!1;if("string"==typeof r)return 0===r.length;if("function"==typeof r)return 0===r.length;if(Array.isArray(r)){if(0===r.length)return!0;for(var n=0;n<r.length;n++)if(e){if(void 0!==r[n]&&null!==r[n])return!1}else if(void 0!==r[n]&&null!==r[n]&&""!==r[n]&&0!==r[n])return!1;return!0}if(y(r,"Error"))return""===r.message;if(r.toString===w)switch(r.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===r.size;case"[object Object]":for(var t in r)if(S.call(r,t))return!1;return!0}return!1}function E(r){return r.toLowerCase()}var x=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],J=/[^A-Z0-9]+/gi;function _(r,e){void 0===e&&(e={});for(var n=e.splitRegexp,t=void 0===n?x:n,i=e.stripRegexp,o=void 0===i?J:i,u=e.transform,c=void 0===u?E:u,f=e.delimiter,a=void 0===f?" ":f,s=N(N(r,t,"$1\0$2"),o,"\0"),l=0,p=s.length;"\0"===s.charAt(l);)l++;for(;"\0"===s.charAt(p-1);)p--;return s.slice(l,p).split("\0").map(c).join(a)}function N(r,e,n){return e instanceof RegExp?r.replace(e,n):e.reduce((function(r,e){return r.replace(e,n)}),r)}function P(r,e){var n=r.charAt(0),t=r.substr(1).toLowerCase();return e>0&&n>="0"&&n<="9"?"_"+n+t:""+n.toUpperCase()+t}function $(r,e){return void 0===e&&(e={}),_(r,m({delimiter:"",transform:P},e))}function R(r,e){return 0===e?r.toLowerCase():P(r,e)}var C="[\ud800-\udbff][\udc00-\udfff]",L=function(r){return"string"==typeof r?r.replace((e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),new RegExp(e,"g")),""):r;var e};const T=Formily.Path.Path;var k={};var F=function(){var r=this;this.subscribers={index:0},this.subscribe=function(e){if(i(e)){var n=r.subscribers.index+1;return r.subscribers[n]=e,r.subscribers.index++,n}},this.unsubscribe=function(e){r.subscribers[e]?delete r.subscribers[e]:e||(r.subscribers={index:0})},this.notify=function(e,n){r.subscription&&r.subscription&&i(r.subscription.notify)&&!1===r.subscription.notify.call(r,e)||n||p(r.subscribers,(function(n){i(n)&&n(function(e){return r.subscription&&i(r.subscription.filter)?r.subscription.filter.call(r,e):e}(e))}))}};function Z(r){return function(r){return!!r&&"object"==typeof r}(r)&&!function(r){if("$$typeof"in r&&"_owner"in r)return!0;if(r._isAMomentObject)return!0;if(r._isJSONSchemaObject)return!0;if(i(r.toJS))return!0;if(i(r.toJSON))return!0;return!u(r)}(r)}function U(r,e){return!1!==e.clone&&e.isMergeableObject(r)?I((n=r,Array.isArray(n)?[]:{}),r,e):r;var n}function z(r,e,n){return r.concat(e).map((function(r){return U(r,n)}))}function W(r){return A(r)?Object.keys(r).concat(function(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter((function(e){return r.propertyIsEnumerable(e)})):[]}(r)):[]}function B(r,e){try{return e in r}catch(r){return!1}}function D(r,e,n){var t=n.assign&&r||{};return n.isMergeableObject(r)?(n.assign||W(r).forEach((function(e){t[e]=U(r[e],n)})),W(e).forEach((function(i){(function(r,e){return B(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))})(r,i)||(M(r[i])?t[i]=e[i]:B(r,i)&&n.isMergeableObject(e[i])?t[i]=function(r,e){if(!e.customMerge)return I;var n=e.customMerge(r);return"function"==typeof n?n:I}(i,n)(r[i],e[i],n):t[i]=U(e[i],n))})),t):r}function I(r,e,n){(n=n||{}).arrayMerge=n.arrayMerge||z,n.isMergeableObject=n.isMergeableObject||Z,n.cloneUnlessOtherwiseSpecified=U;var t=Array.isArray(e);return t===Array.isArray(r)?t?n.arrayMerge(r,e,n):D(r,e,n):U(e,n)}for(var q=I,H=function(r){return!((null==(e=r)?void 0:e._owner)&&(null==e?void 0:e.$$typeof)||(null==e?void 0:e._isAMomentObject)||(null==e?void 0:e._isJSONSchemaObject)||(null==e?void 0:e.toJS)||(null==e?void 0:e.toJSON))&&"object"==typeof r;var e},V=function(r,e){if(t(r)===t(e)&&H(r)&&H(e)){var n=o(r)?[]:u(r)?{}:r;return p(e,(function(e,t){n[t]=V(r[t],e)})),p(r,(function(r,e){A(n[e])||(n[e]=r)})),n}return M(e)?r:e},G=36,K="";G--;)K+=G.toString(36);r.FormPath=T,r.Subscribable=F,r.applyMiddleware=function(r,e){void 0===e&&(e=[]);var n=function(r,e){var t=r;return Promise.resolve(e[0](r,(function(r){return n(null!=r?r:t,e.slice(1))})))};return new Promise((function(t,i){n(r,e.concat((function(r){t(r)}))).catch(i)}))},r.camelCase=function(r,e){return void 0===e&&(e={}),$(r,m({transform:R},e))},r.clone=j,r.defaults=V,r.deprecate=function r(e,n,t){if(i(e))return function(i,o,u,c,f){return r(n,t),e.apply(this,arguments)};c(e)&&!k[e]&&(k[e]=!0,console.warn(new Error("".concat(e," has been deprecated. Do not continue to use this api.").concat(n||""))))},r.each=p,r.every=function(r,e,n){var t=!0;return p(r,(function(r,n){if(!e(r,n))return t=!1,!1}),n),t},r.find=function(r,e,n){var t;return p(r,(function(r,n){if(e(r,n))return t=r,!1}),n),t},r.findIndex=function(r,e,n){var t=-1;return p(r,(function(r,n){if(e(r,n))return t=n,!1}),n),t},r.getType=t,r.globalThisPolyfill=d,r.includes=function(r,e,n){return c(r)?r.includes(e):b(r,(function(r){return r===e}),n)},r.instOf=y,r.isArr=o,r.isBool=f,r.isEmpty=M,r.isEqual=function(r,e){try{return O(r,e)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||-2146828260===r.number)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},r.isFn=i,r.isHTMLElement=function(r){return Object.prototype.toString.call(r).indexOf("HTML")>-1},r.isMap=function(r){return r&&r instanceof Map},r.isNum=a,r.isNumberLike=function(r){return a(r)||/^\d+$/.test(r)},r.isObj=s,r.isPlainObj=u,r.isReactElement=function(r){return r&&r.$$typeof&&r._owner},r.isRegExp=l,r.isSet=function(r){return r&&r instanceof Set},r.isStr=c,r.isUndef=function(r){return void 0===r},r.isValid=A,r.isWeakMap=function(r){return r&&r instanceof WeakMap},r.isWeakSet=function(r){return r&&r instanceof WeakSet},r.lowerCase=E,r.map=function(r,e,n){var t=o(r)||c(r)?[]:{};return p(r,(function(r,n){var i=e(r,n);o(t)?t.push(i):t[n]=i}),n),t},r.merge=q,r.paramCase=function(r,e){return void 0===e&&(e={}),function(r,e){return void 0===e&&(e={}),_(r,m({delimiter:"."},e))}(r,m({delimiter:"-"},e))},r.pascalCase=$,r.reduce=function(r,e,n,t){var i=n;return p(r,(function(r,n){i=e(i,r,n)}),t),i},r.shallowClone=function(r){return Array.isArray(r)?r.slice(0):u(r)?"$$typeof"in r&&"_owner"in r||r._isAMomentObject||r._isJSONSchemaObject||i(r.toJS)||i(r.toJSON)?r:m({},r):"object"==typeof r?new r.constructor(r):r},r.some=b,r.stringLength=function(r){return L(r).replace(e&&e.exact?new RegExp("^".concat(C,"$")):new RegExp(C,"g")," ").length;var e},r.toArr=function(r){return o(r)?r:r?[r]:[]},r.uid=function(r){for(var e="",n=r||11;n--;)e+=K[36*Math.random()|0];return e},r.upperCase=function(r){return r.toUpperCase()},Object.defineProperty(r,"__esModule",{value:!0})})); | ||
***************************************************************************** */function M(r,e){if(void 0===e&&(e=!1),null==r)return!0;if("boolean"==typeof r)return!1;if("number"==typeof r)return!1;if("string"==typeof r)return 0===r.length;if("function"==typeof r)return 0===r.length;if(Array.isArray(r)){if(0===r.length)return!0;for(var n=0;n<r.length;n++)if(e){if(void 0!==r[n]&&null!==r[n])return!1}else if(void 0!==r[n]&&null!==r[n]&&""!==r[n]&&0!==r[n])return!1;return!0}if(d(r,"Error"))return""===r.message;if(r.toString===w)switch(r.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===r.size;case"[object Object]":for(var t in r)if(S.call(r,t))return!1;return!0}return!1}function x(r){return r.toLowerCase()}var E=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],J=/[^A-Z0-9]+/gi;function _(r,e){void 0===e&&(e={});for(var n=e.splitRegexp,t=void 0===n?E:n,i=e.stripRegexp,o=void 0===i?J:i,u=e.transform,c=void 0===u?x:u,f=e.delimiter,a=void 0===f?" ":f,s=P(P(r,t,"$1\0$2"),o,"\0"),l=0,p=s.length;"\0"===s.charAt(l);)l++;for(;"\0"===s.charAt(p-1);)p--;return s.slice(l,p).split("\0").map(c).join(a)}function P(r,e,n){return e instanceof RegExp?r.replace(e,n):e.reduce((function(r,e){return r.replace(e,n)}),r)}function N(r,e){var n=r.charAt(0),t=r.substr(1).toLowerCase();return e>0&&n>="0"&&n<="9"?"_"+n+t:""+n.toUpperCase()+t}function $(r,e){return void 0===e&&(e={}),_(r,m({delimiter:"",transform:N},e))}function R(r,e){return 0===e?r.toLowerCase():N(r,e)}var C="[\ud800-\udbff][\udc00-\udfff]",k=function(r){return"string"==typeof r?r.replace((e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),new RegExp(e,"g")),""):r;var e};const L=Formily.Path.Path;var T={};var F=function(){var r=this;this.subscribers={index:0},this.subscribe=function(e){if(i(e)){var n=r.subscribers.index+1;return r.subscribers[n]=e,r.subscribers.index++,n}},this.unsubscribe=function(e){r.subscribers[e]?delete r.subscribers[e]:e||(r.subscribers={index:0})},this.notify=function(e,n){r.subscription&&r.subscription&&i(r.subscription.notify)&&!1===r.subscription.notify.call(r,e)||n||p(r.subscribers,(function(n){i(n)&&n(function(e){return r.subscription&&i(r.subscription.filter)?r.subscription.filter.call(r,e):e}(e))}))}};function Z(r){return function(r){return!!r&&"object"==typeof r}(r)&&!function(r){if("$$typeof"in r&&"_owner"in r)return!0;if(r._isAMomentObject)return!0;if(r._isJSONSchemaObject)return!0;if(i(r.toJS))return!0;if(i(r.toJSON))return!0;return!u(r)}(r)}function z(r,e){return!1!==e.clone&&e.isMergeableObject(r)?I((n=r,Array.isArray(n)?[]:{}),r,e):r;var n}function U(r,e,n){return r.concat(e).map((function(r){return z(r,n)}))}function D(r){return A(r)?Object.keys(r).concat(function(r){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(r).filter((function(e){return r.propertyIsEnumerable(e)})):[]}(r)):[]}function W(r,e){try{return e in r}catch(r){return!1}}function B(r,e,n){var t=n.assign&&r||{};return n.isMergeableObject(r)?(n.assign||D(r).forEach((function(e){t[e]=z(r[e],n)})),D(e).forEach((function(i){(function(r,e){return W(r,e)&&!(Object.hasOwnProperty.call(r,e)&&Object.propertyIsEnumerable.call(r,e))})(r,i)||(M(r[i])?t[i]=e[i]:W(r,i)&&n.isMergeableObject(e[i])?t[i]=function(r,e){if(!e.customMerge)return I;var n=e.customMerge(r);return"function"==typeof n?n:I}(i,n)(r[i],e[i],n):t[i]=z(e[i],n))})),t):r}function I(r,e,n){(n=n||{}).arrayMerge=n.arrayMerge||U,n.isMergeableObject=n.isMergeableObject||Z,n.cloneUnlessOtherwiseSpecified=z;var t=Array.isArray(e);return t===Array.isArray(r)?t?n.arrayMerge(r,e,n):B(r,e,n):z(e,n)}for(var q=I,H=function(r){return!((null==(e=r)?void 0:e._owner)&&(null==e?void 0:e.$$typeof)||(null==e?void 0:e._isAMomentObject)||(null==e?void 0:e._isJSONSchemaObject)||(null==e?void 0:e.toJS)||(null==e?void 0:e.toJSON))&&"object"==typeof r;var e},V=function(r,e){if(t(r)===t(e)&&H(r)&&H(e)){var n=o(r)?[]:u(r)?{}:r;return p(e,(function(e,t){n[t]=V(r[t],e)})),p(r,(function(r,e){A(n[e])||(n[e]=r)})),n}return M(e)?r:e},K=36,G="";K--;)G+=K.toString(36);r.FormPath=L,r.Subscribable=F,r.applyMiddleware=function(r,e){void 0===e&&(e=[]);var n=function(r,e){var t=r;return Promise.resolve(e[0](r,(function(r){return n(null!=r?r:t,e.slice(1))})))};return new Promise((function(t,i){n(r,e.concat((function(r){t(r)}))).catch(i)}))},r.camelCase=function(r,e){return void 0===e&&(e={}),$(r,m({transform:R},e))},r.clone=j,r.defaults=V,r.deprecate=function r(e,n,t){if(i(e))return function(i,o,u,c,f){return r(n,t),e.apply(this,arguments)};c(e)&&!T[e]&&(T[e]=!0,console.warn(new Error("".concat(e," has been deprecated. Do not continue to use this api.").concat(n||""))))},r.each=p,r.every=function(r,e,n){var t=!0;return p(r,(function(r,n){if(!e(r,n))return t=!1,!1}),n),t},r.find=function(r,e,n){var t;return p(r,(function(r,n){if(e(r,n))return t=r,!1}),n),t},r.findIndex=function(r,e,n){var t=-1;return p(r,(function(r,n){if(e(r,n))return t=n,!1}),n),t},r.getType=t,r.globalThisPolyfill=y,r.includes=function(r,e,n){return c(r)?r.includes(e):b(r,(function(r){return r===e}),n)},r.instOf=d,r.isArr=o,r.isBool=f,r.isEmpty=M,r.isEqual=function(r,e){try{return O(r,e)}catch(r){if(r.message&&r.message.match(/stack|recursion/i)||-2146828260===r.number)return console.warn("Warning: react-fast-compare does not handle circular references.",r.name,r.message),!1;throw r}},r.isFn=i,r.isHTMLElement=function(r){return Object.prototype.toString.call(r).indexOf("HTML")>-1},r.isMap=function(r){return r&&r instanceof Map},r.isNum=a,r.isNumberLike=function(r){return a(r)||/^\d+$/.test(r)},r.isObj=s,r.isPlainObj=u,r.isReactElement=function(r){return r&&r.$$typeof&&r._owner},r.isRegExp=l,r.isSet=function(r){return r&&r instanceof Set},r.isStr=c,r.isUndef=function(r){return void 0===r},r.isValid=A,r.isWeakMap=function(r){return r&&r instanceof WeakMap},r.isWeakSet=function(r){return r&&r instanceof WeakSet},r.lazyMerge=function(r,e){return A(e)?A(r)?"object"!=typeof r?e:"object"!=typeof e?r:new Proxy({},{get:function(n,t){return t in e?e[t]:r[t]},ownKeys:function(){var n=Object.keys(r);for(var t in e)t in r||n.push(t);return n},getOwnPropertyDescriptor:function(){return{enumerable:!0,configurable:!0,writable:!1}},has:function(n,t){return t in e||t in r}}):e:r},r.lowerCase=x,r.map=function(r,e,n){var t=o(r)||c(r)?[]:{};return p(r,(function(r,n){var i=e(r,n);o(t)?t.push(i):t[n]=i}),n),t},r.merge=q,r.paramCase=function(r,e){return void 0===e&&(e={}),function(r,e){return void 0===e&&(e={}),_(r,m({delimiter:"."},e))}(r,m({delimiter:"-"},e))},r.pascalCase=$,r.reduce=function(r,e,n,t){var i=n;return p(r,(function(r,n){i=e(i,r,n)}),t),i},r.shallowClone=function(r){return Array.isArray(r)?r.slice(0):u(r)?"$$typeof"in r&&"_owner"in r||r._isAMomentObject||r._isJSONSchemaObject||i(r.toJS)||i(r.toJSON)?r:m({},r):"object"==typeof r?new r.constructor(r):r},r.some=b,r.stringLength=function(r){return k(r).replace(e&&e.exact?new RegExp("^".concat(C,"$")):new RegExp(C,"g")," ").length;var e},r.toArr=function(r){return o(r)?r:r?[r]:[]},r.uid=function(r){for(var e="",n=r||11;n--;)e+=G[36*Math.random()|0];return e},r.upperCase=function(r){return r.toUpperCase()},Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=formily.shared.umd.production.js.map |
@@ -10,3 +10,4 @@ interface Options { | ||
declare function deepmerge(target: any, source: any, options?: Options): any; | ||
export declare const lazyMerge: <T extends object>(target: T, source: T) => T; | ||
export declare const merge: typeof deepmerge; | ||
export {}; |
@@ -123,3 +123,41 @@ import { isValid, isEmpty } from './isEmpty'; | ||
} | ||
export var lazyMerge = function (target, source) { | ||
if (!isValid(source)) | ||
return target; | ||
if (!isValid(target)) | ||
return source; | ||
if (typeof target !== 'object') | ||
return source; | ||
if (typeof source !== 'object') | ||
return target; | ||
return new Proxy({}, { | ||
get: function (_, key) { | ||
if (key in source) | ||
return source[key]; | ||
return target[key]; | ||
}, | ||
ownKeys: function () { | ||
var keys = Object.keys(target); | ||
for (var key in source) { | ||
if (!(key in target)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
}, | ||
getOwnPropertyDescriptor: function () { | ||
return { | ||
enumerable: true, | ||
configurable: true, | ||
writable: false, | ||
}; | ||
}, | ||
has: function (_, key) { | ||
if (key in source || key in target) | ||
return true; | ||
return false; | ||
}, | ||
}); | ||
}; | ||
export var merge = deepmerge; | ||
//# sourceMappingURL=merge.js.map |
@@ -10,3 +10,4 @@ interface Options { | ||
declare function deepmerge(target: any, source: any, options?: Options): any; | ||
export declare const lazyMerge: <T extends object>(target: T, source: T) => T; | ||
export declare const merge: typeof deepmerge; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.merge = void 0; | ||
exports.merge = exports.lazyMerge = void 0; | ||
var isEmpty_1 = require("./isEmpty"); | ||
@@ -126,3 +126,42 @@ var checkers_1 = require("./checkers"); | ||
} | ||
var lazyMerge = function (target, source) { | ||
if (!(0, isEmpty_1.isValid)(source)) | ||
return target; | ||
if (!(0, isEmpty_1.isValid)(target)) | ||
return source; | ||
if (typeof target !== 'object') | ||
return source; | ||
if (typeof source !== 'object') | ||
return target; | ||
return new Proxy({}, { | ||
get: function (_, key) { | ||
if (key in source) | ||
return source[key]; | ||
return target[key]; | ||
}, | ||
ownKeys: function () { | ||
var keys = Object.keys(target); | ||
for (var key in source) { | ||
if (!(key in target)) { | ||
keys.push(key); | ||
} | ||
} | ||
return keys; | ||
}, | ||
getOwnPropertyDescriptor: function () { | ||
return { | ||
enumerable: true, | ||
configurable: true, | ||
writable: false, | ||
}; | ||
}, | ||
has: function (_, key) { | ||
if (key in source || key in target) | ||
return true; | ||
return false; | ||
}, | ||
}); | ||
}; | ||
exports.lazyMerge = lazyMerge; | ||
exports.merge = deepmerge; | ||
//# sourceMappingURL=merge.js.map |
{ | ||
"name": "@formily/shared", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "main": "lib", | ||
}, | ||
"gitHead": "6fcdc133e80fe5f714a9c459fbac8aecf0b5d0a6", | ||
"gitHead": "2b8e70536b4d845e918f99a8a434d475615262df", | ||
"scripts": { | ||
@@ -35,3 +35,3 @@ "build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm && npm run build:umd", | ||
"dependencies": { | ||
"@formily/path": "2.1.2", | ||
"@formily/path": "2.1.3", | ||
"camel-case": "^4.1.1", | ||
@@ -38,0 +38,0 @@ "lower-case": "^2.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
348520
3197
+ Added@formily/path@2.1.3(transitive)
- Removed@formily/path@2.1.2(transitive)
Updated@formily/path@2.1.3