victory-chart
Advanced tools
Comparing version 26.0.1 to 26.1.0
# VictoryChart Changelog | ||
## 26.1.0 (2018-05-04) | ||
-[594](https://github.com/FormidableLabs/victory-chart/pull/594) Support functional `cornerRadius` and objects with `cornerRadius` defined for "top" and "bottom" | ||
-[593](https://github.com/FormidableLabs/victory-chart/pull/593) Add `defaultBrushArea` prop with supported options "all", "none" and "disable" | ||
## 26.0.1 (2018-04-25) | ||
@@ -4,0 +9,0 @@ |
@@ -92,2 +92,11 @@ import _mapValues from "lodash/mapValues"; | ||
}, | ||
getDefaultBrushArea: function (defaultBrushArea, domain, cachedDomain) { | ||
if (defaultBrushArea === "none") { | ||
return this.getMinimumDomain(); | ||
} else if (defaultBrushArea === "disable") { | ||
return cachedDomain; | ||
} else { | ||
return domain; | ||
} | ||
}, | ||
getSelectionMutation: function (point, box, brushDimension) { | ||
@@ -221,2 +230,3 @@ var x = point.x, | ||
cachedBrushDomain: brushDomain, | ||
cachedCurrentDomain: currentDomain, | ||
currentDomain: _this2.getMinimumDomain() | ||
@@ -299,7 +309,10 @@ }, _this2.getSelectionMutation({ x: x, y: y }, domainBox, brushDimension)); | ||
domain = targetProps.domain, | ||
allowResize = targetProps.allowResize; | ||
allowResize = targetProps.allowResize, | ||
defaultBrushArea = targetProps.defaultBrushArea; | ||
// if the mouse hasn't moved since a mouseDown event, select the whole domain region | ||
if (allowResize && x1 === x2 || y1 === y2) { | ||
var mutatedProps = { isPanning: false, isSelecting: false, currentDomain: domain }; | ||
var cachedDomain = targetProps.cachedCurrentDomain || targetProps.currentDomain; | ||
var currentDomain = this.getDefaultBrushArea(defaultBrushArea, domain, cachedDomain); | ||
var mutatedProps = { isPanning: false, isSelecting: false, currentDomain: currentDomain }; | ||
if (_isFunction(onBrushDomainChange)) { | ||
@@ -306,0 +319,0 @@ onBrushDomainChange(domain, _defaults({}, mutatedProps, targetProps)); |
@@ -122,2 +122,3 @@ import _defaults from "lodash/defaults"; | ||
brushStyle: PropTypes.object, | ||
defaultBrushArea: PropTypes.oneOf(["all", "disable", "none"]), | ||
disable: PropTypes.bool, | ||
@@ -124,0 +125,0 @@ handleComponent: PropTypes.element, |
@@ -92,3 +92,6 @@ 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; }; | ||
barRatio: PropTypes.number, | ||
cornerRadius: PropTypes.number, | ||
cornerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.func, PropTypes.shape({ | ||
top: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), | ||
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.func]) | ||
})]), | ||
horizontal: PropTypes.bool | ||
@@ -95,0 +98,0 @@ }); |
@@ -114,2 +114,11 @@ Object.defineProperty(exports, "__esModule", { | ||
}, | ||
getDefaultBrushArea: function (defaultBrushArea, domain, cachedDomain) { | ||
if (defaultBrushArea === "none") { | ||
return this.getMinimumDomain(); | ||
} else if (defaultBrushArea === "disable") { | ||
return cachedDomain; | ||
} else { | ||
return domain; | ||
} | ||
}, | ||
getSelectionMutation: function (point, box, brushDimension) { | ||
@@ -243,2 +252,3 @@ var x = point.x, | ||
cachedBrushDomain: brushDomain, | ||
cachedCurrentDomain: currentDomain, | ||
currentDomain: _this2.getMinimumDomain() | ||
@@ -321,7 +331,10 @@ }, _this2.getSelectionMutation({ x: x, y: y }, domainBox, brushDimension)); | ||
domain = targetProps.domain, | ||
allowResize = targetProps.allowResize; | ||
allowResize = targetProps.allowResize, | ||
defaultBrushArea = targetProps.defaultBrushArea; | ||
// if the mouse hasn't moved since a mouseDown event, select the whole domain region | ||
if (allowResize && x1 === x2 || y1 === y2) { | ||
var mutatedProps = { isPanning: false, isSelecting: false, currentDomain: domain }; | ||
var cachedDomain = targetProps.cachedCurrentDomain || targetProps.currentDomain; | ||
var currentDomain = this.getDefaultBrushArea(defaultBrushArea, domain, cachedDomain); | ||
var mutatedProps = { isPanning: false, isSelecting: false, currentDomain: currentDomain }; | ||
if ((0, _isFunction3.default)(onBrushDomainChange)) { | ||
@@ -328,0 +341,0 @@ onBrushDomainChange(domain, (0, _defaults3.default)({}, mutatedProps, targetProps)); |
@@ -145,2 +145,3 @@ Object.defineProperty(exports, "__esModule", { | ||
brushStyle: _propTypes2.default.object, | ||
defaultBrushArea: _propTypes2.default.oneOf(["all", "disable", "none"]), | ||
disable: _propTypes2.default.bool, | ||
@@ -147,0 +148,0 @@ handleComponent: _propTypes2.default.element, |
@@ -106,3 +106,6 @@ Object.defineProperty(exports, "__esModule", { | ||
barRatio: _propTypes2.default.number, | ||
cornerRadius: _propTypes2.default.number, | ||
cornerRadius: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.func, _propTypes2.default.shape({ | ||
top: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.func]), | ||
bottom: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.func]) | ||
})]), | ||
horizontal: _propTypes2.default.bool | ||
@@ -109,0 +112,0 @@ }); |
{ | ||
"name": "victory-chart", | ||
"version": "26.0.1", | ||
"version": "26.1.0", | ||
"description": "Chart Component for Victory", | ||
@@ -42,3 +42,3 @@ "main": "lib/index.js", | ||
"react-fast-compare": "^1.0.0", | ||
"victory-core": "^22.0.0" | ||
"victory-core": "^22.1.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "devDependencies": { |
@@ -72,2 +72,12 @@ import { Selection } from "victory-core"; | ||
getDefaultBrushArea(defaultBrushArea, domain, cachedDomain) { | ||
if (defaultBrushArea === "none") { | ||
return this.getMinimumDomain(); | ||
} else if (defaultBrushArea === "disable") { | ||
return cachedDomain; | ||
} else { | ||
return domain; | ||
} | ||
}, | ||
getSelectionMutation(point, box, brushDimension) { | ||
@@ -173,2 +183,3 @@ const { x, y } = point; | ||
cachedBrushDomain: brushDomain, | ||
cachedCurrentDomain: currentDomain, | ||
currentDomain: this.getMinimumDomain(), | ||
@@ -235,6 +246,10 @@ ...this.getSelectionMutation({ x, y }, domainBox, brushDimension) | ||
onMouseUp(evt, targetProps) { | ||
const { x1, y1, x2, y2, onBrushDomainChange, domain, allowResize } = targetProps; | ||
const { | ||
x1, y1, x2, y2, onBrushDomainChange, domain, allowResize, defaultBrushArea | ||
} = targetProps; | ||
// if the mouse hasn't moved since a mouseDown event, select the whole domain region | ||
if (allowResize && x1 === x2 || y1 === y2) { | ||
const mutatedProps = { isPanning: false, isSelecting: false, currentDomain: domain }; | ||
const cachedDomain = targetProps.cachedCurrentDomain || targetProps.currentDomain; | ||
const currentDomain = this.getDefaultBrushArea(defaultBrushArea, domain, cachedDomain); | ||
const mutatedProps = { isPanning: false, isSelecting: false, currentDomain }; | ||
if (isFunction(onBrushDomainChange)) { | ||
@@ -241,0 +256,0 @@ onBrushDomainChange(domain, defaults({}, mutatedProps, targetProps)); |
@@ -21,2 +21,3 @@ import PropTypes from "prop-types"; | ||
brushStyle: PropTypes.object, | ||
defaultBrushArea: PropTypes.oneOf(["all", "disable", "none"]), | ||
disable: PropTypes.bool, | ||
@@ -23,0 +24,0 @@ handleComponent: PropTypes.element, |
@@ -51,3 +51,10 @@ import PropTypes from "prop-types"; | ||
barRatio: PropTypes.number, | ||
cornerRadius: PropTypes.number, | ||
cornerRadius: PropTypes.oneOfType([ | ||
PropTypes.number, | ||
PropTypes.func, | ||
PropTypes.shape({ | ||
top: PropTypes.oneOfType([PropTypes.number, PropTypes.func]), | ||
bottom: PropTypes.oneOfType([PropTypes.number, PropTypes.func]) | ||
}) | ||
]), | ||
horizontal: PropTypes.bool | ||
@@ -54,0 +61,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
3044056
54220
Updatedvictory-core@^22.1.0