Skip to content

Commit 9d2a8d8

Browse files
committed
upgrade to 2.2.0
1 parent f8f20be commit 9d2a8d8

File tree

5 files changed

+651
-429
lines changed

5 files changed

+651
-429
lines changed

dist/react-chartjs-2.js

Lines changed: 89 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ emptyFunction.thatReturnsArgument = function (arg) {
3838

3939
module.exports = emptyFunction;
4040
},{}],2:[function(require,module,exports){
41+
(function (process){
4142
/**
4243
* Copyright (c) 2013-present, Facebook, Inc.
4344
* All rights reserved.
@@ -63,7 +64,7 @@ module.exports = emptyFunction;
6364

6465
var validateFormat = function validateFormat(format) {};
6566

66-
if ("production" !== 'production') {
67+
if (process.env.NODE_ENV !== 'production') {
6768
validateFormat = function validateFormat(format) {
6869
if (format === undefined) {
6970
throw new Error('invariant requires an error message argument');
@@ -93,7 +94,9 @@ function invariant(condition, format, a, b, c, d, e, f) {
9394
}
9495

9596
module.exports = invariant;
96-
},{}],3:[function(require,module,exports){
97+
}).call(this,require('_process'))
98+
},{"_process":5}],3:[function(require,module,exports){
99+
(function (process){
97100
/**
98101
* Copyright 2014-2015, Facebook, Inc.
99102
* All rights reserved.
@@ -117,7 +120,7 @@ var emptyFunction = require('./emptyFunction');
117120

118121
var warning = emptyFunction;
119122

120-
if ("production" !== 'production') {
123+
if (process.env.NODE_ENV !== 'production') {
121124
(function () {
122125
var printWarning = function printWarning(format) {
123126
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -160,7 +163,8 @@ if ("production" !== 'production') {
160163
}
161164

162165
module.exports = warning;
163-
},{"./emptyFunction":1}],4:[function(require,module,exports){
166+
}).call(this,require('_process'))
167+
},{"./emptyFunction":1,"_process":5}],4:[function(require,module,exports){
164168
(function (global){
165169
/**
166170
* Lodash (Custom Build) <https://lodash.com/>
@@ -2183,6 +2187,10 @@ process.off = noop;
21832187
process.removeListener = noop;
21842188
process.removeAllListeners = noop;
21852189
process.emit = noop;
2190+
process.prependListener = noop;
2191+
process.prependOnceListener = noop;
2192+
2193+
process.listeners = function (name) { return [] }
21862194

21872195
process.binding = function (name) {
21882196
throw new Error('process.binding is not supported');
@@ -2273,11 +2281,14 @@ module.exports = checkPropTypes;
22732281

22742282
var emptyFunction = require('fbjs/lib/emptyFunction');
22752283
var invariant = require('fbjs/lib/invariant');
2284+
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
22762285

22772286
module.exports = function() {
2278-
// Important!
2279-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2280-
function shim() {
2287+
function shim(props, propName, componentName, location, propFullName, secret) {
2288+
if (secret === ReactPropTypesSecret) {
2289+
// It is still safe when called from React.
2290+
return;
2291+
}
22812292
invariant(
22822293
false,
22832294
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
@@ -2289,6 +2300,8 @@ module.exports = function() {
22892300
function getShim() {
22902301
return shim;
22912302
};
2303+
// Important!
2304+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
22922305
var ReactPropTypes = {
22932306
array: shim,
22942307
bool: shim,
@@ -2315,7 +2328,7 @@ module.exports = function() {
23152328
return ReactPropTypes;
23162329
};
23172330

2318-
},{"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],8:[function(require,module,exports){
2331+
},{"./lib/ReactPropTypesSecret":10,"fbjs/lib/emptyFunction":1,"fbjs/lib/invariant":2}],8:[function(require,module,exports){
23192332
(function (process){
23202333
/**
23212334
* Copyright 2013-present, Facebook, Inc.
@@ -2639,6 +2652,20 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
26392652
return emptyFunction.thatReturnsNull;
26402653
}
26412654

2655+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2656+
var checker = arrayOfTypeCheckers[i];
2657+
if (typeof checker !== 'function') {
2658+
warning(
2659+
false,
2660+
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' +
2661+
'received %s at index %s.',
2662+
getPostfixForTypeWarning(checker),
2663+
i
2664+
);
2665+
return emptyFunction.thatReturnsNull;
2666+
}
2667+
}
2668+
26422669
function validate(props, propName, componentName, location, propFullName) {
26432670
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
26442671
var checker = arrayOfTypeCheckers[i];
@@ -2771,6 +2798,9 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
27712798
// This handles more types than `getPropType`. Only used for error messages.
27722799
// See `createPrimitiveTypeChecker`.
27732800
function getPreciseType(propValue) {
2801+
if (typeof propValue === 'undefined' || propValue === null) {
2802+
return '' + propValue;
2803+
}
27742804
var propType = getPropType(propValue);
27752805
if (propType === 'object') {
27762806
if (propValue instanceof Date) {
@@ -2782,6 +2812,23 @@ module.exports = function(isValidElement, throwOnDirectAccess) {
27822812
return propType;
27832813
}
27842814

2815+
// Returns a string that is postfixed to a warning about an invalid type.
2816+
// For example, "undefined" or "of type array"
2817+
function getPostfixForTypeWarning(value) {
2818+
var type = getPreciseType(value);
2819+
switch (type) {
2820+
case 'array':
2821+
case 'object':
2822+
return 'an ' + type;
2823+
case 'boolean':
2824+
case 'date':
2825+
case 'regexp':
2826+
return 'a ' + type;
2827+
default:
2828+
return type;
2829+
}
2830+
}
2831+
27852832
// Returns class name of the object, if any.
27862833
function getClassName(propValue) {
27872834
if (!propValue.constructor || !propValue.constructor.name) {
@@ -2854,7 +2901,7 @@ module.exports = ReactPropTypesSecret;
28542901
Object.defineProperty(exports, "__esModule", {
28552902
value: true
28562903
});
2857-
exports.Chart = exports.defaults = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
2904+
exports.Chart = exports.defaults = exports.Scatter = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
28582905

28592906
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; };
28602907

@@ -3149,7 +3196,13 @@ ChartComponent.propTypes = {
31493196
options: _propTypes2.default.object,
31503197
plugins: _propTypes2.default.arrayOf(_propTypes2.default.object),
31513198
redraw: _propTypes2.default.bool,
3152-
type: _propTypes2.default.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
3199+
type: function type(props, propName, componentName) {
3200+
if (!Object.keys(_chart2.default.controllers).find(function (chartType) {
3201+
return chartType === props[propName];
3202+
})) {
3203+
return new Error('Invalid chart type `' + props[propName] + '` supplied to' + ' `' + componentName + '`.');
3204+
}
3205+
},
31533206
width: _propTypes2.default.number,
31543207
datasetKeyProvider: _propTypes2.default.func
31553208
};
@@ -3375,6 +3428,32 @@ var Bubble = exports.Bubble = function (_React$Component9) {
33753428
return Bubble;
33763429
}(_react2.default.Component);
33773430

3431+
var Scatter = exports.Scatter = function (_React$Component10) {
3432+
_inherits(Scatter, _React$Component10);
3433+
3434+
function Scatter() {
3435+
_classCallCheck(this, Scatter);
3436+
3437+
return _possibleConstructorReturn(this, (Scatter.__proto__ || Object.getPrototypeOf(Scatter)).apply(this, arguments));
3438+
}
3439+
3440+
_createClass(Scatter, [{
3441+
key: 'render',
3442+
value: function render() {
3443+
var _this20 = this;
3444+
3445+
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
3446+
ref: function ref(_ref10) {
3447+
return _this20.chart_instance = _ref10 && _ref10.chart_instance;
3448+
},
3449+
type: 'scatter'
3450+
}));
3451+
}
3452+
}]);
3453+
3454+
return Scatter;
3455+
}(_react2.default.Component);
3456+
33783457
var defaults = exports.defaults = _chart2.default.defaults;
33793458
exports.Chart = _chart2.default;
33803459

dist/react-chartjs-2.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Object.defineProperty(exports, "__esModule", {
44
value: true
55
});
6-
exports.Chart = exports.defaults = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
6+
exports.Chart = exports.defaults = exports.Scatter = exports.Bubble = exports.Polar = exports.Radar = exports.HorizontalBar = exports.Bar = exports.Line = exports.Pie = exports.Doughnut = undefined;
77

88
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; };
99

@@ -298,7 +298,13 @@ ChartComponent.propTypes = {
298298
options: _propTypes2.default.object,
299299
plugins: _propTypes2.default.arrayOf(_propTypes2.default.object),
300300
redraw: _propTypes2.default.bool,
301-
type: _propTypes2.default.oneOf(['doughnut', 'pie', 'line', 'bar', 'horizontalBar', 'radar', 'polarArea', 'bubble']),
301+
type: function type(props, propName, componentName) {
302+
if (!Object.keys(_chart2.default.controllers).find(function (chartType) {
303+
return chartType === props[propName];
304+
})) {
305+
return new Error('Invalid chart type `' + props[propName] + '` supplied to' + ' `' + componentName + '`.');
306+
}
307+
},
302308
width: _propTypes2.default.number,
303309
datasetKeyProvider: _propTypes2.default.func
304310
};
@@ -524,5 +530,31 @@ var Bubble = exports.Bubble = function (_React$Component9) {
524530
return Bubble;
525531
}(_react2.default.Component);
526532

533+
var Scatter = exports.Scatter = function (_React$Component10) {
534+
_inherits(Scatter, _React$Component10);
535+
536+
function Scatter() {
537+
_classCallCheck(this, Scatter);
538+
539+
return _possibleConstructorReturn(this, (Scatter.__proto__ || Object.getPrototypeOf(Scatter)).apply(this, arguments));
540+
}
541+
542+
_createClass(Scatter, [{
543+
key: 'render',
544+
value: function render() {
545+
var _this20 = this;
546+
547+
return _react2.default.createElement(ChartComponent, _extends({}, this.props, {
548+
ref: function ref(_ref10) {
549+
return _this20.chart_instance = _ref10 && _ref10.chart_instance;
550+
},
551+
type: 'scatter'
552+
}));
553+
}
554+
}]);
555+
556+
return Scatter;
557+
}(_react2.default.Component);
558+
527559
var defaults = exports.defaults = _chart2.default.defaults;
528560
exports.Chart = _chart2.default;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-chartjs-2",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "react-chartjs-2",
55
"main": "lib/index.js",
66
"author": "Goran Udosic",

0 commit comments

Comments
 (0)