victory-legend
Advanced tools
Comparing version 30.1.0 to 30.2.0
@@ -238,4 +238,4 @@ import _range from "lodash/range"; | ||
style = props.style; | ||
var height = contentHeight + borderPadding.top + borderPadding.bottom; | ||
var width = contentWidth + borderPadding.left + borderPadding.right; | ||
var height = (contentHeight || 0) + borderPadding.top + borderPadding.bottom; | ||
var width = (contentWidth || 0) + borderPadding.left + borderPadding.right; | ||
return { | ||
@@ -312,2 +312,4 @@ x: x, | ||
var borderProps = getBorderProps(props, height, width); | ||
var titleProps = getTitleProps(props, borderProps); | ||
var initialProps = { | ||
@@ -323,6 +325,8 @@ parent: { | ||
style: style.parent | ||
}, | ||
all: { | ||
border: borderProps, | ||
title: titleProps | ||
} | ||
}; | ||
var borderProps = getBorderProps(props, height, width); | ||
var titleProps = getTitleProps(props, borderProps); | ||
return groupedData.reduce(function (childProps, datum, i) { | ||
@@ -357,9 +361,4 @@ var color = colorScale[i % colorScale.length]; | ||
}; | ||
childProps[eventKey] = eventKey === 0 ? { | ||
childProps[eventKey] = { | ||
data: dataProps, | ||
labels: labelProps, | ||
border: borderProps, | ||
title: titleProps | ||
} : { | ||
data: dataProps, | ||
labels: labelProps | ||
@@ -366,0 +365,0 @@ }; |
@@ -59,6 +59,10 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
var dataComponents = this.dataKeys.map(function (_dataKey, index) { | ||
if (_dataKey === "all") { | ||
return undefined; | ||
} | ||
var dataProps = _this.getComponentProps(dataComponent, "data", index); | ||
return React.cloneElement(dataComponent, dataProps); | ||
}); | ||
}).filter(Boolean); | ||
var labelComponents = this.dataKeys.map(function (_dataKey, index) { | ||
@@ -73,7 +77,7 @@ var labelProps = _this.getComponentProps(labelComponent, "labels", index); | ||
}).filter(Boolean); | ||
var borderProps = this.getComponentProps(props.borderComponent, "border", 0); | ||
var borderProps = this.getComponentProps(props.borderComponent, "border", "all"); | ||
var borderComponent = React.cloneElement(props.borderComponent, borderProps); | ||
if (title) { | ||
var titleProps = this.getComponentProps(props.title, "title", 0); | ||
var titleProps = this.getComponentProps(props.title, "title", "all"); | ||
var titleComponent = React.cloneElement(props.titleComponent, titleProps); | ||
@@ -80,0 +84,0 @@ return [borderComponent].concat(_toConsumableArray(dataComponents), [titleComponent], _toConsumableArray(labelComponents)); |
@@ -250,4 +250,4 @@ "use strict"; | ||
style = props.style; | ||
var height = contentHeight + borderPadding.top + borderPadding.bottom; | ||
var width = contentWidth + borderPadding.left + borderPadding.right; | ||
var height = (contentHeight || 0) + borderPadding.top + borderPadding.bottom; | ||
var width = (contentWidth || 0) + borderPadding.left + borderPadding.right; | ||
return { | ||
@@ -328,2 +328,4 @@ x: x, | ||
var borderProps = getBorderProps(props, height, width); | ||
var titleProps = getTitleProps(props, borderProps); | ||
var initialProps = { | ||
@@ -339,6 +341,8 @@ parent: { | ||
style: style.parent | ||
}, | ||
all: { | ||
border: borderProps, | ||
title: titleProps | ||
} | ||
}; | ||
var borderProps = getBorderProps(props, height, width); | ||
var titleProps = getTitleProps(props, borderProps); | ||
return groupedData.reduce(function (childProps, datum, i) { | ||
@@ -371,9 +375,4 @@ var color = colorScale[i % colorScale.length]; | ||
}; | ||
childProps[eventKey] = eventKey === 0 ? { | ||
childProps[eventKey] = { | ||
data: dataProps, | ||
labels: labelProps, | ||
border: borderProps, | ||
title: titleProps | ||
} : { | ||
data: dataProps, | ||
labels: labelProps | ||
@@ -380,0 +379,0 @@ }; |
@@ -72,6 +72,10 @@ "use strict"; | ||
var dataComponents = this.dataKeys.map(function (_dataKey, index) { | ||
if (_dataKey === "all") { | ||
return undefined; | ||
} | ||
var dataProps = _this.getComponentProps(dataComponent, "data", index); | ||
return _react.default.cloneElement(dataComponent, dataProps); | ||
}); | ||
}).filter(Boolean); | ||
var labelComponents = this.dataKeys.map(function (_dataKey, index) { | ||
@@ -86,3 +90,3 @@ var labelProps = _this.getComponentProps(labelComponent, "labels", index); | ||
}).filter(Boolean); | ||
var borderProps = this.getComponentProps(props.borderComponent, "border", 0); | ||
var borderProps = this.getComponentProps(props.borderComponent, "border", "all"); | ||
@@ -92,3 +96,3 @@ var borderComponent = _react.default.cloneElement(props.borderComponent, borderProps); | ||
if (title) { | ||
var titleProps = this.getComponentProps(props.title, "title", 0); | ||
var titleProps = this.getComponentProps(props.title, "title", "all"); | ||
@@ -95,0 +99,0 @@ var titleComponent = _react.default.cloneElement(props.titleComponent, titleProps); |
{ | ||
"name": "victory-legend", | ||
"version": "30.1.0", | ||
"version": "30.2.0", | ||
"description": "Legend Component for Victory", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"prop-types": "^15.5.8", | ||
"victory-core": "^30.1.0" | ||
"victory-core": "^30.2.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "scripts": { |
@@ -183,4 +183,4 @@ import { defaults, assign, groupBy, keys, sum, range } from "lodash"; | ||
const { x, y, borderPadding, style } = props; | ||
const height = contentHeight + borderPadding.top + borderPadding.bottom; | ||
const width = contentWidth + borderPadding.left + borderPadding.right; | ||
const height = (contentHeight || 0) + borderPadding.top + borderPadding.bottom; | ||
const width = (contentWidth || 0) + borderPadding.left + borderPadding.right; | ||
return { x, y, height, width, style: assign({ fill: "none" }, style.border) }; | ||
@@ -229,2 +229,4 @@ }; | ||
const { height, width } = getDimensions(props, fallbackProps); | ||
const borderProps = getBorderProps(props, height, width); | ||
const titleProps = getTitleProps(props, borderProps); | ||
const initialProps = { | ||
@@ -236,6 +238,5 @@ parent: { | ||
style: style.parent | ||
} | ||
}, | ||
all: { border: borderProps, title: titleProps } | ||
}; | ||
const borderProps = getBorderProps(props, height, width); | ||
const titleProps = getTitleProps(props, borderProps); | ||
return groupedData.reduce((childProps, datum, i) => { | ||
@@ -265,5 +266,3 @@ const color = colorScale[i % colorScale.length]; | ||
}; | ||
childProps[eventKey] = eventKey === 0 ? | ||
{ data: dataProps, labels: labelProps, border: borderProps, title: titleProps } : | ||
{ data: dataProps, labels: labelProps }; | ||
childProps[eventKey] = { data: dataProps, labels: labelProps }; | ||
@@ -270,0 +269,0 @@ return childProps; |
@@ -159,5 +159,8 @@ import React from "react"; | ||
const dataComponents = this.dataKeys.map((_dataKey, index) => { | ||
if (_dataKey === "all") { | ||
return undefined; | ||
} | ||
const dataProps = this.getComponentProps(dataComponent, "data", index); | ||
return React.cloneElement(dataComponent, dataProps); | ||
}); | ||
}).filter(Boolean); | ||
@@ -172,6 +175,6 @@ const labelComponents = this.dataKeys.map((_dataKey, index) => { | ||
const borderProps = this.getComponentProps(props.borderComponent, "border", 0); | ||
const borderProps = this.getComponentProps(props.borderComponent, "border", "all"); | ||
const borderComponent = React.cloneElement(props.borderComponent, borderProps); | ||
if (title) { | ||
const titleProps = this.getComponentProps(props.title, "title", 0); | ||
const titleProps = this.getComponentProps(props.title, "title", "all"); | ||
const titleComponent = React.cloneElement(props.titleComponent, titleProps); | ||
@@ -178,0 +181,0 @@ return [borderComponent, ...dataComponents, titleComponent, ...labelComponents]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1208351
21788
Updatedvictory-core@^30.2.0