@appbaseio/reactivecore
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.default=watchManReducer;var _constants=require("../constants");function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function watchManReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments[1];if(action.type===_constants.WATCH_COMPONENT){var watchList=getWatchList(action.react);var newState=_extends({},state);watchList.forEach(function(item){if(Array.isArray(newState[item])){newState[item].push(action.component);}else{newState[item]=[action.component];}});return newState;}else if(action.type===_constants.REMOVE_COMPONENT){var _newState=_extends({},state);for(var component in _newState){if(component===action.component){delete _newState[component];}else{_newState[component]=_newState[component].filter(function(item){return item!==action.component;});}}return _newState;}return state;}function getWatchList(depTree){var list=Object.values(depTree);var components=[];list.forEach(function(item){if(typeof item==="string"){components.push(item);}else if(Array.isArray(item)){components.push.apply(components,_toConsumableArray(item));}else if(typeof item==="object"&&item!==null){components.push.apply(components,_toConsumableArray(getWatchList(item)));}});return[].concat(_toConsumableArray(new Set(components)));} | ||
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.default=watchManReducer;var _constants=require("../constants");function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++){arr2[i]=arr[i];}return arr2;}else{return Array.from(arr);}}function watchManReducer(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var action=arguments[1];if(action.type===_constants.WATCH_COMPONENT){var watchList=getWatchList(action.react);var newState=_extends({},state);Object.keys(newState).forEach(function(key){newState[key]=newState[key].filter(function(value){return value!==action.component;});});watchList.forEach(function(item){if(Array.isArray(newState[item])){newState[item]=[].concat(_toConsumableArray(newState[item]),[action.component]);}else{newState[item]=[action.component];}});return newState;}else if(action.type===_constants.REMOVE_COMPONENT){var _newState=_extends({},state);for(var component in _newState){if(component===action.component){delete _newState[component];}else{_newState[component]=_newState[component].filter(function(item){return item!==action.component;});}}return _newState;}return state;}function getWatchList(depTree){var list=Object.values(depTree);var components=[];list.forEach(function(item){if(typeof item==="string"){components.push(item);}else if(Array.isArray(item)){components.push.apply(components,_toConsumableArray(item));}else if(typeof item==="object"&&item!==null){components.push.apply(components,_toConsumableArray(getWatchList(item)));}});return[].concat(_toConsumableArray(new Set(components)));} |
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.isEqual=isEqual;exports.debounce=debounce;exports.getQueryOptions=getQueryOptions;exports.buildQuery=buildQuery;exports.pushToAndClause=pushToAndClause;exports.checkValueChange=checkValueChange;exports.getAggsOrder=getAggsOrder;function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function isEqual(x,y){if(x===y)return true;if(!(x instanceof Object)||!(y instanceof Object))return false;if(x.constructor!==y.constructor)return false;for(var p in x){if(!x.hasOwnProperty(p))continue;if(!y.hasOwnProperty(p))return false;if(x[p]===y[p])continue;if(typeof x[p]!=="object")return false;if(!isEqual(x[p],y[p]))return false;}for(p in y){if(y.hasOwnProperty(p)&&!x.hasOwnProperty(p))return false;}return true;}function debounce(callback,wait){var context=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var timeout=null;var callbackArgs=null;var later=function later(){return callback.apply(context,callbackArgs);};return function(){callbackArgs=arguments;clearTimeout(timeout);timeout=setTimeout(later,wait);};}function getQueryOptions(props){var options={};if(props.size!==undefined){options.size=props.size;}if(props.from!==undefined){options.from=props.from;}return options;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null,options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function getQuery(react,queryList){var query={};for(conjunction in react){if(Array.isArray(react[conjunction])){var operation=getOperation(conjunction);var queryArr=react[conjunction].map(function(comp){if(comp in queryList){return queryList[comp];}return null;}).filter(function(item){return item!==null;});query=createBoolQuery(operation,queryArr);}else if(typeof react[conjunction]==="string"){var _operation=getOperation(conjunction);query=createBoolQuery(_operation,queryList[react[conjunction]]);}else if(typeof react[conjunction]==="object"&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){query=getQuery(react[conjunction],queryList);}}return query;}function getOperation(conjunction){if(conjunction==="and"){return"must";}if(conjunction==="or"){return"should";}return"must_not";}function createBoolQuery(operation,query){if(Array.isArray(query)&&query.length||!Array.isArray(query)&&query){return{bool:_defineProperty({},operation,query)};}return null;}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and.push(component);return react;}else if(typeof react.and==="string"){react.and=[react.and,component];return react;}else{react.and=this.pushToAndClause(react.and,component);return react;}}else{return _extends({},react,{and:component});}}function checkValueChange(componentId,value,beforeValueChange,onValueChange,performUpdate){var selectedValue=value;if(Array.isArray(value)&&value.length){selectedValue=null;}var executeUpdate=function executeUpdate(){performUpdate();if(onValueChange){onValueChange(selectedValue);}};if(beforeValueChange){beforeValueChange(selectedValue).then(executeUpdate).catch(function(e){console.warn(componentId+" - beforeValueChange rejected the promise with ",e);});}else{executeUpdate();}}function getAggsOrder(sortBy){if(sortBy==="count"){return{_count:"desc"};}return{_term:sortBy};}function getExternalQueryOptions(react,options,component){var queryOptions={};for(conjunction in react){if(Array.isArray(react[conjunction])){react[conjunction].forEach(function(comp){if(options[comp]){queryOptions=_extends({},queryOptions,options[comp]);}});}else if(typeof react[conjunction]==="string"){if(options[react[conjunction]]){queryOptions=_extends({},queryOptions,options[react[conjunction]]);}}else if(typeof react[conjunction]==="object"&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){queryOptions=_extends({},queryOptions,getExternalQueryOptions(react[conjunction],options));}}if(options[component]){queryOptions=_extends({},queryOptions,options[component]);}return queryOptions;}var checkPropChange=exports.checkPropChange=function checkPropChange(prevProp,nextProp,callback){if(!isEqual(prevProp,nextProp)){callback();return true;}return false;};var checkSomePropChange=exports.checkSomePropChange=function checkSomePropChange(prevProps,nextProps,propsList,callback){propsList.some(function(prop){return checkPropChange(prevProps[prop],nextProps[prop],callback);});};var getClassName=exports.getClassName=function getClassName(classMap,component){return classMap?classMap[component]:"";}; | ||
Object.defineProperty(exports,"__esModule",{value:true});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};exports.isEqual=isEqual;exports.debounce=debounce;exports.getQueryOptions=getQueryOptions;exports.buildQuery=buildQuery;exports.pushToAndClause=pushToAndClause;exports.checkValueChange=checkValueChange;exports.getAggsOrder=getAggsOrder;function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function isEqual(x,y){if(x===y)return true;if(!(x instanceof Object)||!(y instanceof Object))return false;if(x.constructor!==y.constructor)return false;for(var p in x){if(!x.hasOwnProperty(p))continue;if(!y.hasOwnProperty(p))return false;if(x[p]===y[p])continue;if(typeof x[p]!=="object")return false;if(!isEqual(x[p],y[p]))return false;}for(p in y){if(y.hasOwnProperty(p)&&!x.hasOwnProperty(p))return false;}return true;}function debounce(callback,wait){var context=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this;var timeout=null;var callbackArgs=null;var later=function later(){return callback.apply(context,callbackArgs);};return function(){callbackArgs=arguments;clearTimeout(timeout);timeout=setTimeout(later,wait);};}function getQueryOptions(props){var options={};if(props.size!==undefined){options.size=props.size;}if(props.from!==undefined){options.from=props.from;}return options;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null,options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function getQuery(react,queryList){var query={};for(conjunction in react){if(Array.isArray(react[conjunction])){var operation=getOperation(conjunction);var queryArr=react[conjunction].map(function(comp){if(comp in queryList){return queryList[comp];}return null;}).filter(function(item){return item!==null;});query=createBoolQuery(operation,queryArr);}else if(typeof react[conjunction]==="string"){var _operation=getOperation(conjunction);query=createBoolQuery(_operation,queryList[react[conjunction]]);}else if(typeof react[conjunction]==="object"&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){query=getQuery(react[conjunction],queryList);}}return query;}function getOperation(conjunction){if(conjunction==="and"){return"must";}if(conjunction==="or"){return"should";}return"must_not";}function createBoolQuery(operation,query){if(Array.isArray(query)&&query.length||!Array.isArray(query)&&query){return{bool:_defineProperty({},operation,query)};}return null;}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and.push(component);return react;}else if(typeof react.and==="string"){react.and=[react.and,component];return react;}else{react.and=this.pushToAndClause(react.and,component);return react;}}else{return _extends({},react,{and:component});}}function checkValueChange(componentId,value,beforeValueChange,onValueChange,performUpdate){var selectedValue=value;if(Array.isArray(value)&&!value.length){selectedValue=null;}var executeUpdate=function executeUpdate(){performUpdate();if(onValueChange){onValueChange(selectedValue);}};if(beforeValueChange){beforeValueChange(selectedValue).then(executeUpdate).catch(function(e){console.warn(componentId+" - beforeValueChange rejected the promise with ",e);});}else{executeUpdate();}}function getAggsOrder(sortBy){if(sortBy==="count"){return{_count:"desc"};}return{_term:sortBy};}function getExternalQueryOptions(react,options,component){var queryOptions={};for(conjunction in react){if(Array.isArray(react[conjunction])){react[conjunction].forEach(function(comp){if(options[comp]){queryOptions=_extends({},queryOptions,options[comp]);}});}else if(typeof react[conjunction]==="string"){if(options[react[conjunction]]){queryOptions=_extends({},queryOptions,options[react[conjunction]]);}}else if(typeof react[conjunction]==="object"&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){queryOptions=_extends({},queryOptions,getExternalQueryOptions(react[conjunction],options));}}if(options[component]){queryOptions=_extends({},queryOptions,options[component]);}return queryOptions;}var checkPropChange=exports.checkPropChange=function checkPropChange(prevProp,nextProp,callback){if(!isEqual(prevProp,nextProp)){callback();return true;}return false;};var checkSomePropChange=exports.checkSomePropChange=function checkSomePropChange(prevProps,nextProps,propsList,callback){propsList.some(function(prop){return checkPropChange(prevProps[prop],nextProps[prop],callback);});};var getClassName=exports.getClassName=function getClassName(classMap,component){return classMap?classMap[component]:"";}; |
{ | ||
"name": "@appbaseio/reactivecore", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Core architecture of reactive UI libraries", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
49068