victory-core
Advanced tools
Comparing version 10.0.0 to 10.0.1
@@ -66,8 +66,11 @@ Object.defineProperty(exports,"__esModule",{value:true});var _defaults2=require("lodash/defaults");var _defaults3=_interopRequireDefault(_defaults2);var _partialRight2=require("lodash/partialRight");var _partialRight3=_interopRequireDefault(_partialRight2);var _isFunction2=require("lodash/isFunction");var _isFunction3=_interopRequireDefault(_isFunction2);var _assign2=require("lodash/assign");var _assign3=_interopRequireDefault(_assign2);var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}(); | ||
childComponents){ | ||
var getBaseProps=function getBaseProps(children){ | ||
var getBaseProps=function getBaseProps(children,childIndex){ | ||
return children.reduce(function(memo,child,index){ | ||
if(child.type&&(0,_isFunction3.default)(child.type.getBaseProps)){ | ||
if(child.props&&child.props.children){ | ||
return getBaseProps(_react2.default.Children.toArray(child.props.children),index); | ||
}else if(child.type&&(0,_isFunction3.default)(child.type.getBaseProps)){ | ||
var baseChildProps=child.props&&child.type.getBaseProps(child.props); | ||
if(baseChildProps){ | ||
var childKey=child.props.name||index; | ||
var key=childIndex?childIndex+"-"+index:index; | ||
var childKey=child.props.name||key; | ||
memo[childKey]=baseChildProps; | ||
@@ -77,4 +80,2 @@ return memo; | ||
return memo; | ||
}else if(child.props&&child.props.children){ | ||
return getBaseProps(_react2.default.Children.toArray(child.props.children)); | ||
} | ||
@@ -90,7 +91,6 @@ return memo; | ||
var childNames=Object.keys(this.baseProps); | ||
var alterChildren=function alterChildren(children){ | ||
return children.reduce(function(memo,child){ | ||
return children.reduce(function(memo,child,index){ | ||
if(child.type&&(0,_isFunction3.default)(child.type.getBaseProps)){var _ret=function(){ | ||
var name=child.props.name||childNames.shift(); | ||
var name=child.props.name||childNames.shift()||index; | ||
var childEvents=Array.isArray(events)&& | ||
@@ -97,0 +97,0 @@ events.filter(function(event){ |
{ | ||
"name": "victory-core", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"description": "Victory Core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -66,8 +66,11 @@ import { assign, isFunction, partialRight, defaults } from "lodash"; | ||
getBasePropsFromChildren(childComponents) { | ||
const getBaseProps = (children) => { | ||
const getBaseProps = (children, childIndex) => { | ||
return children.reduce((memo, child, index) => { | ||
if (child.type && isFunction(child.type.getBaseProps)) { | ||
if (child.props && child.props.children) { | ||
return getBaseProps(React.Children.toArray(child.props.children), index); | ||
} else if (child.type && isFunction(child.type.getBaseProps)) { | ||
const baseChildProps = child.props && child.type.getBaseProps(child.props); | ||
if (baseChildProps) { | ||
const childKey = child.props.name || index; | ||
const key = childIndex ? `${childIndex}-${index}` : index; | ||
const childKey = child.props.name || key; | ||
memo[childKey] = baseChildProps; | ||
@@ -77,4 +80,2 @@ return memo; | ||
return memo; | ||
} else if (child.props && child.props.children) { | ||
return getBaseProps(React.Children.toArray(child.props.children)); | ||
} | ||
@@ -90,7 +91,6 @@ return memo; | ||
const childNames = Object.keys(this.baseProps); | ||
const alterChildren = (children) => { | ||
return children.reduce((memo, child) => { | ||
return children.reduce((memo, child, index) => { | ||
if (child.type && isFunction(child.type.getBaseProps)) { | ||
const name = child.props.name || childNames.shift(); | ||
const name = child.props.name || childNames.shift() || index; | ||
const childEvents = Array.isArray(events) && | ||
@@ -97,0 +97,0 @@ events.filter((event) => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1086745
21313