@appbaseio/reactivecore
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -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 _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 _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(var _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;}return options;}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 getQuery(react,queryList){var query=[];Object.keys(react).forEach(function(conjunction){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;});var boolQuery=createBoolQuery(operation,queryArr);if(boolQuery){query=[].concat(_toConsumableArray(query),[boolQuery]);}}else if(typeof react[conjunction]==='string'){var _operation=getOperation(conjunction);var _boolQuery=createBoolQuery(_operation,queryList[react[conjunction]]);if(_boolQuery){query=[].concat(_toConsumableArray(query),[_boolQuery]);}}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){var _boolQuery2=getQuery(react[conjunction],queryList);if(_boolQuery2){query=[].concat(_toConsumableArray(query),[_boolQuery2]);}}});if(query&&query.length){return{bool:{must:query}};}return null;}function getExternalQueryOptions(react,options,component){var queryOptions={};Object.keys(react).forEach(function(conjunction){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;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null;var options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and=[].concat(_toConsumableArray(react.and),[component]);return react;}else if(typeof react.and==='string'){react.and=[react.and,component];return react;}react.and=this.pushToAndClause(react.and,component);return react;}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};}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]||'';};var handleA11yAction=exports.handleA11yAction=function handleA11yAction(e,callback){if(e.key==='Enter'||e.key===' '){e.preventDefault();callback();}};var highlightResults=function highlightResults(result){var data=_extends({},result);if(data.highlight){Object.keys(data.highlight).forEach(function(highlightItem){var highlightValue=data.highlight[highlightItem][0];data._source=_extends({},data._source,_defineProperty({},highlightItem,highlightValue));});}return data;};var parseHits=exports.parseHits=function parseHits(hits){var results=null;if(hits){results=[].concat(_toConsumableArray(hits)).map(function(item){var streamProps={};if(item._updated){streamProps._updated=item._updated;}else if(item._deleted){streamProps._deleted=item._deleted;}var data=highlightResults(item);return _extends({_id:data._id},data._source,streamProps);});}return results;}; | ||
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 _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 _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(var _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;}return options;}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 getQuery(react,queryList){var query=[];Object.keys(react).forEach(function(conjunction){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;});var boolQuery=createBoolQuery(operation,queryArr);if(boolQuery){query=[].concat(_toConsumableArray(query),[boolQuery]);}}else if(typeof react[conjunction]==='string'){var _operation=getOperation(conjunction);var _boolQuery=createBoolQuery(_operation,queryList[react[conjunction]]);if(_boolQuery){query=[].concat(_toConsumableArray(query),[_boolQuery]);}}else if(typeof react[conjunction]==='object'&&react[conjunction]!==null&&!Array.isArray(react[conjunction])){var _boolQuery2=getQuery(react[conjunction],queryList);if(_boolQuery2){query=[].concat(_toConsumableArray(query),[_boolQuery2]);}}});if(query&&query.length){return{bool:{must:query}};}return null;}function getExternalQueryOptions(react,options,component){var queryOptions={};Object.keys(react).forEach(function(conjunction){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;}function buildQuery(component,dependencyTree,queryList,queryOptions){var queryObj=null;var options=null;if(component in dependencyTree){queryObj=getQuery(dependencyTree[component],queryList);options=getExternalQueryOptions(dependencyTree[component],queryOptions,component);}return{queryObj:queryObj,options:options};}function pushToAndClause(reactProp,component){var react=_extends({},reactProp);if(react.and){if(Array.isArray(react.and)){react.and=[].concat(_toConsumableArray(react.and),[component]);return react;}else if(typeof react.and==='string'){react.and=[react.and,component];return react;}react.and=this.pushToAndClause(react.and,component);return react;}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};}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]||'';};var getInnerKey=exports.getInnerKey=function getInnerKey(obj,key){return obj&&obj[key]||{};};var handleA11yAction=exports.handleA11yAction=function handleA11yAction(e,callback){if(e.key==='Enter'||e.key===' '){e.preventDefault();callback();}};var highlightResults=function highlightResults(result){var data=_extends({},result);if(data.highlight){Object.keys(data.highlight).forEach(function(highlightItem){var highlightValue=data.highlight[highlightItem][0];data._source=_extends({},data._source,_defineProperty({},highlightItem,highlightValue));});}return data;};var parseHits=exports.parseHits=function parseHits(hits){var results=null;if(hits){results=[].concat(_toConsumableArray(hits)).map(function(item){var streamProps={};if(item._updated){streamProps._updated=item._updated;}else if(item._deleted){streamProps._deleted=item._deleted;}var data=highlightResults(item);return _extends({_id:data._id},data._source,streamProps);});}return results;}; |
@@ -1,1 +0,1 @@ | ||
Object.defineProperty(exports,"__esModule",{value:true});var _propTypes=require('prop-types');var _dateFormats=require('./dateFormats');var _dateFormats2=_interopRequireDefault(_dateFormats);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var reactKeyType=(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),_propTypes.object]);function validateLocation(props,propName){if(isNaN(props[propName])){return new Error(propName+' value must be number');}if(propName==='lat'&&(props[propName]<-90||props[propName]>90)){return new Error(propName+' value should be between -90 and 90.');}else if(propName==='lng'&&(props[propName]<-180||props[propName]>180)){return new Error(propName+' value should be between -180 and 180.');}return null;}var types={any:_propTypes.any,bool:_propTypes.bool,boolRequired:_propTypes.bool.isRequired,components:(0,_propTypes.arrayOf)(_propTypes.string),children:_propTypes.any,data:(0,_propTypes.arrayOf)(_propTypes.object),dataFieldArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]).isRequired,dataNumberBox:(0,_propTypes.shape)({label:_propTypes.string,start:_propTypes.number.isRequired,end:_propTypes.number.isRequired}).isRequired,date:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),dateObject:_propTypes.object,dateRange:(0,_propTypes.shape)({start:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),end:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)])}),fieldWeights:(0,_propTypes.arrayOf)(_propTypes.number),filterLabel:_propTypes.string,func:_propTypes.func,funcRequired:_propTypes.func.isRequired,fuzziness:(0,_propTypes.oneOf)([0,1,2,'AUTO']),headers:_propTypes.object,hits:(0,_propTypes.arrayOf)(_propTypes.object),iconPosition:(0,_propTypes.oneOf)(['left','right']),labelPosition:(0,_propTypes.oneOf)(['left','right','top','bottom']),number:_propTypes.number,options:(0,_propTypes.oneOfType)([(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object]),paginationAt:(0,_propTypes.oneOf)(['top','bottom','both']),range:(0,_propTypes.shape)({start:_propTypes.number,end:_propTypes.number}),rangeLabels:(0,_propTypes.shape)({start:_propTypes.string,end:_propTypes.string}),react:(0,_propTypes.shape)({and:reactKeyType,or:reactKeyType,not:reactKeyType}),selectedValues:_propTypes.object,selectedValue:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object,_propTypes.number,(0,_propTypes.arrayOf)(_propTypes.number)]),suggestions:(0,_propTypes.arrayOf)(_propTypes.object),supportedOrientations:(0,_propTypes.oneOf)(['portrait','portrait-upside-down','landscape','landscape-left','landscape-right']),sortBy:(0,_propTypes.oneOf)(['asc','desc']),sortOptions:(0,_propTypes.arrayOf)((0,_propTypes.shape)({label:_propTypes.string,dataField:_propTypes.string,sortBy:_propTypes.string})),sortByWithCount:(0,_propTypes.oneOf)(['asc','desc','count']),stats:(0,_propTypes.arrayOf)(_propTypes.object),string:_propTypes.string,stringArray:(0,_propTypes.arrayOf)(_propTypes.string),stringOrArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),stringRequired:_propTypes.string.isRequired,style:_propTypes.object,queryFormatDate:(0,_propTypes.oneOf)(Object.keys(_dateFormats2.default)),queryFormatSearch:(0,_propTypes.oneOf)(['and','or']),queryFormatNumberBox:(0,_propTypes.oneOf)(['exact','lte','gte']),params:_propTypes.object.isRequired,props:_propTypes.object,rangeLabelsAlign:(0,_propTypes.oneOf)(['left','right']),title:(0,_propTypes.oneOfType)([_propTypes.string,_propTypes.any]),location:(0,_propTypes.shape)({lat:validateLocation,lng:validateLocation}),unit:(0,_propTypes.oneOf)(['mi','miles','yd','yards','ft','feet','in','inch','km','kilometers','m','meters','cm','centimeters','mm','millimeters','NM','nmi','nauticalmiles'])};exports.default=types; | ||
Object.defineProperty(exports,"__esModule",{value:true});var _propTypes=require('prop-types');var _dateFormats=require('./dateFormats');var _dateFormats2=_interopRequireDefault(_dateFormats);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var reactKeyType=(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),_propTypes.object]);function validateLocation(props,propName){if(isNaN(props[propName])){return new Error(propName+' value must be a number');}if(propName==='lat'&&(props[propName]<-90||props[propName]>90)){return new Error(propName+' value should be between -90 and 90.');}else if(propName==='lng'&&(props[propName]<-180||props[propName]>180)){return new Error(propName+' value should be between -180 and 180.');}return null;}var types={any:_propTypes.any,bool:_propTypes.bool,boolRequired:_propTypes.bool.isRequired,components:(0,_propTypes.arrayOf)(_propTypes.string),children:_propTypes.any,data:(0,_propTypes.arrayOf)(_propTypes.object),dataFieldArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]).isRequired,dataNumberBox:(0,_propTypes.shape)({label:_propTypes.string,start:_propTypes.number.isRequired,end:_propTypes.number.isRequired}).isRequired,date:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),dateObject:_propTypes.object,dateRange:(0,_propTypes.shape)({start:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),end:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)])}),fieldWeights:(0,_propTypes.arrayOf)(_propTypes.number),filterLabel:_propTypes.string,func:_propTypes.func,funcRequired:_propTypes.func.isRequired,fuzziness:(0,_propTypes.oneOf)([0,1,2,'AUTO']),headers:_propTypes.object,hits:(0,_propTypes.arrayOf)(_propTypes.object),iconPosition:(0,_propTypes.oneOf)(['left','right']),labelPosition:(0,_propTypes.oneOf)(['left','right','top','bottom']),number:_propTypes.number,options:(0,_propTypes.oneOfType)([(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object]),paginationAt:(0,_propTypes.oneOf)(['top','bottom','both']),range:(0,_propTypes.shape)({start:_propTypes.number,end:_propTypes.number}),rangeLabels:(0,_propTypes.shape)({start:_propTypes.string,end:_propTypes.string}),react:(0,_propTypes.shape)({and:reactKeyType,or:reactKeyType,not:reactKeyType}),selectedValues:_propTypes.object,selectedValue:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string),(0,_propTypes.arrayOf)(_propTypes.object),_propTypes.object,_propTypes.number,(0,_propTypes.arrayOf)(_propTypes.number)]),suggestions:(0,_propTypes.arrayOf)(_propTypes.object),supportedOrientations:(0,_propTypes.oneOf)(['portrait','portrait-upside-down','landscape','landscape-left','landscape-right']),sortBy:(0,_propTypes.oneOf)(['asc','desc']),sortOptions:(0,_propTypes.arrayOf)((0,_propTypes.shape)({label:_propTypes.string,dataField:_propTypes.string,sortBy:_propTypes.string})),sortByWithCount:(0,_propTypes.oneOf)(['asc','desc','count']),stats:(0,_propTypes.arrayOf)(_propTypes.object),string:_propTypes.string,stringArray:(0,_propTypes.arrayOf)(_propTypes.string),stringOrArray:(0,_propTypes.oneOfType)([_propTypes.string,(0,_propTypes.arrayOf)(_propTypes.string)]),stringRequired:_propTypes.string.isRequired,style:_propTypes.object,themePreset:(0,_propTypes.oneOf)(['light','dark']),queryFormatDate:(0,_propTypes.oneOf)(Object.keys(_dateFormats2.default)),queryFormatSearch:(0,_propTypes.oneOf)(['and','or']),queryFormatNumberBox:(0,_propTypes.oneOf)(['exact','lte','gte']),params:_propTypes.object.isRequired,props:_propTypes.object,rangeLabelsAlign:(0,_propTypes.oneOf)(['left','right']),title:(0,_propTypes.oneOfType)([_propTypes.string,_propTypes.any]),location:(0,_propTypes.shape)({lat:validateLocation,lng:validateLocation}),unit:(0,_propTypes.oneOf)(['mi','miles','yd','yards','ft','feet','in','inch','km','kilometers','m','meters','cm','centimeters','mm','millimeters','NM','nmi','nauticalmiles'])};exports.default=types; |
{ | ||
"name": "@appbaseio/reactivecore", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Core architecture of reactive UI libraries", | ||
@@ -12,5 +12,6 @@ "main": "lib/index.js", | ||
"start": "yarn run build -w", | ||
"build": "babel src --out-dir lib", | ||
"build": "babel --ignore __tests__ src --out-dir lib", | ||
"precommit": "eslint .", | ||
"prepublish": "yarn run build" | ||
"prepublish": "yarn run build", | ||
"test": "../../node_modules/jest/bin/jest.js --watch" | ||
}, | ||
@@ -40,6 +41,8 @@ "repository": { | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jest": "^21.12.2", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.5.1", | ||
"husky": "^0.14.3" | ||
"husky": "^0.14.3", | ||
"jest": "^22.4.2" | ||
} | ||
} |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
59890
29
12
22