victory-box-plot
Advanced tools
Comparing version 34.3.12 to 35.0.0
@@ -156,2 +156,14 @@ import _isNil from "lodash/isNil"; | ||
var getLabelStyle = function (props, styleObject, namespace) { | ||
var component = props["".concat(namespace, "LabelComponent")] || props.labelComponent; | ||
var baseStyle = styleObject["".concat(namespace, "Labels")] || styleObject.labels; | ||
if (!Helpers.isTooltip(component)) { | ||
return baseStyle; | ||
} | ||
var tooltipTheme = props.theme && props.theme.tooltip || {}; | ||
return _defaults({}, tooltipTheme.style, baseStyle); | ||
}; | ||
var getStyles = function (props, styleObject) { | ||
@@ -165,3 +177,3 @@ var style = props.style || {}; | ||
var labelStyles = _defaults({}, style.labels, styleObject.labels); | ||
var labelStyles = _defaults({}, style.labels, getLabelStyle(props, styleObject)); | ||
@@ -177,11 +189,11 @@ var boxStyles = _defaults({}, style.boxes, styleObject.boxes); | ||
max: _defaults({}, style.max, styleObject.max, whiskerStyles), | ||
maxLabels: _defaults({}, style.maxLabels, styleObject.maxLabels, labelStyles), | ||
maxLabels: _defaults({}, style.maxLabels, getLabelStyle(props, styleObject, "max"), labelStyles), | ||
median: _defaults({}, style.median, styleObject.median, whiskerStyles), | ||
medianLabels: _defaults({}, style.medianLabels, styleObject.medianLabels, labelStyles), | ||
medianLabels: _defaults({}, style.medianLabels, getLabelStyle(props, styleObject, "median"), labelStyles), | ||
min: _defaults({}, style.min, styleObject.min, whiskerStyles), | ||
minLabels: _defaults({}, style.minLabels, styleObject.minLabels, labelStyles), | ||
minLabels: _defaults({}, style.minLabels, getLabelStyle(props, styleObject, "min"), labelStyles), | ||
q1: _defaults({}, style.q1, styleObject.q1, boxStyles), | ||
q1Labels: _defaults({}, style.q1Labels, styleObject.q1Labels, labelStyles), | ||
q1Labels: _defaults({}, style.q1Labels, getLabelStyle(props, styleObject, "q1"), labelStyles), | ||
q3: _defaults({}, style.q3, styleObject.q3, boxStyles), | ||
q3Labels: _defaults({}, style.q3Labels, styleObject.q3Labels, labelStyles), | ||
q3Labels: _defaults({}, style.q3Labels, getLabelStyle(props, styleObject, "q3"), labelStyles), | ||
whiskers: whiskerStyles | ||
@@ -342,3 +354,4 @@ }; | ||
labelOrientation = props.labelOrientation, | ||
style = props.style; | ||
style = props.style, | ||
theme = props.theme; | ||
var orientation = getOrientation(labelOrientation, type); | ||
@@ -370,3 +383,3 @@ var namespace = "".concat(type, "Labels"); | ||
return { | ||
var labelProps = { | ||
text: text, | ||
@@ -381,7 +394,15 @@ datum: datum, | ||
dx: horizontal ? 0 : getOffset("x"), | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[labelOrientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[labelOrientation], | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[orientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[orientation], | ||
angle: labelStyle.angle, | ||
horizontal: horizontal | ||
}; | ||
var component = props["".concat(type, "LabelComponent")]; | ||
if (!Helpers.isTooltip(component)) { | ||
return labelProps; | ||
} | ||
var tooltipTheme = theme && theme.tooltip || {}; | ||
return _defaults({}, labelProps, Helpers.omit(tooltipTheme, ["style"])); | ||
}; | ||
@@ -463,3 +484,3 @@ | ||
var target = "".concat(type, "Labels"); | ||
acc[eventKey][target] = getLabelProps(dataProps, labelText, type); | ||
acc[eventKey][target] = getLabelProps(_assign({}, props, dataProps), labelText, type); | ||
} | ||
@@ -466,0 +487,0 @@ }); |
@@ -181,2 +181,14 @@ "use strict"; | ||
var getLabelStyle = function (props, styleObject, namespace) { | ||
var component = props["".concat(namespace, "LabelComponent")] || props.labelComponent; | ||
var baseStyle = styleObject["".concat(namespace, "Labels")] || styleObject.labels; | ||
if (!_victoryCore.Helpers.isTooltip(component)) { | ||
return baseStyle; | ||
} | ||
var tooltipTheme = props.theme && props.theme.tooltip || {}; | ||
return (0, _defaults2.default)({}, tooltipTheme.style, baseStyle); | ||
}; | ||
var getStyles = function (props, styleObject) { | ||
@@ -189,3 +201,3 @@ var style = props.style || {}; | ||
}; | ||
var labelStyles = (0, _defaults2.default)({}, style.labels, styleObject.labels); | ||
var labelStyles = (0, _defaults2.default)({}, style.labels, getLabelStyle(props, styleObject)); | ||
var boxStyles = (0, _defaults2.default)({}, style.boxes, styleObject.boxes); | ||
@@ -198,11 +210,11 @@ var whiskerStyles = (0, _defaults2.default)({}, style.whiskers, styleObject.whiskers); | ||
max: (0, _defaults2.default)({}, style.max, styleObject.max, whiskerStyles), | ||
maxLabels: (0, _defaults2.default)({}, style.maxLabels, styleObject.maxLabels, labelStyles), | ||
maxLabels: (0, _defaults2.default)({}, style.maxLabels, getLabelStyle(props, styleObject, "max"), labelStyles), | ||
median: (0, _defaults2.default)({}, style.median, styleObject.median, whiskerStyles), | ||
medianLabels: (0, _defaults2.default)({}, style.medianLabels, styleObject.medianLabels, labelStyles), | ||
medianLabels: (0, _defaults2.default)({}, style.medianLabels, getLabelStyle(props, styleObject, "median"), labelStyles), | ||
min: (0, _defaults2.default)({}, style.min, styleObject.min, whiskerStyles), | ||
minLabels: (0, _defaults2.default)({}, style.minLabels, styleObject.minLabels, labelStyles), | ||
minLabels: (0, _defaults2.default)({}, style.minLabels, getLabelStyle(props, styleObject, "min"), labelStyles), | ||
q1: (0, _defaults2.default)({}, style.q1, styleObject.q1, boxStyles), | ||
q1Labels: (0, _defaults2.default)({}, style.q1Labels, styleObject.q1Labels, labelStyles), | ||
q1Labels: (0, _defaults2.default)({}, style.q1Labels, getLabelStyle(props, styleObject, "q1"), labelStyles), | ||
q3: (0, _defaults2.default)({}, style.q3, styleObject.q3, boxStyles), | ||
q3Labels: (0, _defaults2.default)({}, style.q3Labels, styleObject.q3Labels, labelStyles), | ||
q3Labels: (0, _defaults2.default)({}, style.q3Labels, getLabelStyle(props, styleObject, "q3"), labelStyles), | ||
whiskers: whiskerStyles | ||
@@ -363,3 +375,4 @@ }; | ||
labelOrientation = props.labelOrientation, | ||
style = props.style; | ||
style = props.style, | ||
theme = props.theme; | ||
var orientation = getOrientation(labelOrientation, type); | ||
@@ -391,3 +404,3 @@ var namespace = "".concat(type, "Labels"); | ||
return { | ||
var labelProps = { | ||
text: text, | ||
@@ -402,7 +415,15 @@ datum: datum, | ||
dx: horizontal ? 0 : getOffset("x"), | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[labelOrientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[labelOrientation], | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[orientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[orientation], | ||
angle: labelStyle.angle, | ||
horizontal: horizontal | ||
}; | ||
var component = props["".concat(type, "LabelComponent")]; | ||
if (!_victoryCore.Helpers.isTooltip(component)) { | ||
return labelProps; | ||
} | ||
var tooltipTheme = theme && theme.tooltip || {}; | ||
return (0, _defaults2.default)({}, labelProps, _victoryCore.Helpers.omit(tooltipTheme, ["style"])); | ||
}; | ||
@@ -483,3 +504,3 @@ | ||
var target = "".concat(type, "Labels"); | ||
acc[eventKey][target] = getLabelProps(dataProps, labelText, type); | ||
acc[eventKey][target] = getLabelProps((0, _assign3.default)({}, props, dataProps), labelText, type); | ||
} | ||
@@ -486,0 +507,0 @@ }); |
{ | ||
"name": "victory-box-plot", | ||
"version": "34.3.12", | ||
"version": "35.0.0", | ||
"description": "Box Plot Component for Victory", | ||
@@ -25,3 +25,3 @@ "keywords": [ | ||
"prop-types": "^15.5.8", | ||
"victory-core": "^34.3.12" | ||
"victory-core": "^35.0.0" | ||
}, | ||
@@ -28,0 +28,0 @@ "scripts": { |
@@ -140,2 +140,12 @@ import { orderBy, defaults, assign, uniq, groupBy, keys, isNaN, isNil } from "lodash"; | ||
const getLabelStyle = (props, styleObject, namespace) => { | ||
const component = props[`${namespace}LabelComponent`] || props.labelComponent; | ||
const baseStyle = styleObject[`${namespace}Labels`] || styleObject.labels; | ||
if (!Helpers.isTooltip(component)) { | ||
return baseStyle; | ||
} | ||
const tooltipTheme = (props.theme && props.theme.tooltip) || {}; | ||
return defaults({}, tooltipTheme.style, baseStyle); | ||
}; | ||
const getStyles = (props, styleObject) => { | ||
@@ -145,3 +155,3 @@ const style = props.style || {}; | ||
const parentStyles = { height: "100%", width: "100%" }; | ||
const labelStyles = defaults({}, style.labels, styleObject.labels); | ||
const labelStyles = defaults({}, style.labels, getLabelStyle(props, styleObject)); | ||
const boxStyles = defaults({}, style.boxes, styleObject.boxes); | ||
@@ -154,11 +164,16 @@ const whiskerStyles = defaults({}, style.whiskers, styleObject.whiskers); | ||
max: defaults({}, style.max, styleObject.max, whiskerStyles), | ||
maxLabels: defaults({}, style.maxLabels, styleObject.maxLabels, labelStyles), | ||
maxLabels: defaults({}, style.maxLabels, getLabelStyle(props, styleObject, "max"), labelStyles), | ||
median: defaults({}, style.median, styleObject.median, whiskerStyles), | ||
medianLabels: defaults({}, style.medianLabels, styleObject.medianLabels, labelStyles), | ||
medianLabels: defaults( | ||
{}, | ||
style.medianLabels, | ||
getLabelStyle(props, styleObject, "median"), | ||
labelStyles | ||
), | ||
min: defaults({}, style.min, styleObject.min, whiskerStyles), | ||
minLabels: defaults({}, style.minLabels, styleObject.minLabels, labelStyles), | ||
minLabels: defaults({}, style.minLabels, getLabelStyle(props, styleObject, "min"), labelStyles), | ||
q1: defaults({}, style.q1, styleObject.q1, boxStyles), | ||
q1Labels: defaults({}, style.q1Labels, styleObject.q1Labels, labelStyles), | ||
q1Labels: defaults({}, style.q1Labels, getLabelStyle(props, styleObject, "q1"), labelStyles), | ||
q3: defaults({}, style.q3, styleObject.q3, boxStyles), | ||
q3Labels: defaults({}, style.q3Labels, styleObject.q3Labels, labelStyles), | ||
q3Labels: defaults({}, style.q3Labels, getLabelStyle(props, styleObject, "q3"), labelStyles), | ||
whiskers: whiskerStyles | ||
@@ -273,3 +288,3 @@ }; | ||
const getLabelProps = (props, text, type) => { | ||
const { datum, positions, index, boxWidth, horizontal, labelOrientation, style } = props; | ||
const { datum, positions, index, boxWidth, horizontal, labelOrientation, style, theme } = props; | ||
const orientation = getOrientation(labelOrientation, type); | ||
@@ -291,3 +306,3 @@ const namespace = `${type}Labels`; | ||
return { | ||
const labelProps = { | ||
text, | ||
@@ -302,7 +317,14 @@ datum, | ||
dx: horizontal ? 0 : getOffset("x"), | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[labelOrientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[labelOrientation], | ||
textAnchor: labelStyle.textAnchor || defaultTextAnchors[orientation], | ||
verticalAnchor: labelStyle.verticalAnchor || defaultVerticalAnchors[orientation], | ||
angle: labelStyle.angle, | ||
horizontal | ||
}; | ||
const component = props[`${type}LabelComponent`]; | ||
if (!Helpers.isTooltip(component)) { | ||
return labelProps; | ||
} | ||
const tooltipTheme = (theme && theme.tooltip) || {}; | ||
return defaults({}, labelProps, Helpers.omit(tooltipTheme, ["style"])); | ||
}; | ||
@@ -382,3 +404,3 @@ | ||
const target = `${type}Labels`; | ||
acc[eventKey][target] = getLabelProps(dataProps, labelText, type); | ||
acc[eventKey][target] = getLabelProps(assign({}, props, dataProps), labelText, type); | ||
} | ||
@@ -385,0 +407,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1407882
9294
+ Addedreact@17.0.2(transitive)
+ Addedvictory-core@35.11.4(transitive)
- Removedvictory-core@34.3.12(transitive)
Updatedvictory-core@^35.0.0