carbon-addons-data-viz-react
Advanced tools
Comparing version 1.12.1 to 1.13.0
@@ -43,2 +43,6 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -53,3 +57,4 @@ | ||
id: _propTypes2.default.string, | ||
color: _propTypes2.default.array | ||
color: _propTypes2.default.array, | ||
onHover: _propTypes2.default.func | ||
}; | ||
@@ -86,5 +91,12 @@ | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.renderSVG(nextProps); | ||
if (!_lodash2.default.isEqual(this.props, nextProps)) { | ||
this.renderSVG(nextProps); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps) { | ||
return !_lodash2.default.isEqual(this.props, nextProps); | ||
} | ||
}, { | ||
key: 'renderSVG', | ||
@@ -98,3 +110,4 @@ value: function renderSVG() { | ||
formatFunction = _props.formatFunction, | ||
id = _props.id; | ||
id = _props.id, | ||
onHover = _props.onHover; | ||
@@ -123,5 +136,11 @@ var color = d3.scaleOrdinal(this.props.color); | ||
d3.select('#' + id + ' .bx--pie-value').text('' + formatFunction(d.data[1])); | ||
if (onHover) { | ||
onHover(true, d.data[0]); | ||
} | ||
}).on('mouseout', function (d) { | ||
d3.select('#' + id + ' .bx--pie-tooltip').style('display', 'none'); | ||
d3.select(this).transition().attr('d', path); | ||
if (onHover) { | ||
onHover(false); | ||
} | ||
}); | ||
@@ -128,0 +147,0 @@ } |
@@ -10,2 +10,3 @@ import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of'; | ||
import * as d3 from 'd3'; | ||
import _ from 'lodash'; | ||
@@ -17,3 +18,4 @@ var propTypes = { | ||
id: PropTypes.string, | ||
color: PropTypes.array | ||
color: PropTypes.array, | ||
onHover: PropTypes.func | ||
}; | ||
@@ -51,5 +53,12 @@ | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.renderSVG(nextProps); | ||
if (!_.isEqual(this.props, nextProps)) { | ||
this.renderSVG(nextProps); | ||
} | ||
} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate(nextProps) { | ||
return !_.isEqual(this.props, nextProps); | ||
} | ||
}, { | ||
key: 'renderSVG', | ||
@@ -63,3 +72,4 @@ value: function renderSVG() { | ||
formatFunction = _props.formatFunction, | ||
id = _props.id; | ||
id = _props.id, | ||
onHover = _props.onHover; | ||
@@ -88,5 +98,11 @@ var color = d3.scaleOrdinal(this.props.color); | ||
d3.select('#' + id + ' .bx--pie-value').text('' + formatFunction(d.data[1])); | ||
if (onHover) { | ||
onHover(true, d.data[0]); | ||
} | ||
}).on('mouseout', function (d) { | ||
d3.select('#' + id + ' .bx--pie-tooltip').style('display', 'none'); | ||
d3.select(this).transition().attr('d', path); | ||
if (onHover) { | ||
onHover(false); | ||
} | ||
}); | ||
@@ -93,0 +109,0 @@ } |
{ | ||
"name": "carbon-addons-data-viz-react", | ||
"version": "1.12.1", | ||
"version": "1.13.0", | ||
"description": "Carbon Data Visualization", | ||
@@ -5,0 +5,0 @@ "main": "cjs/index.js", |
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
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
97164
2248