source: node_modules/recharts/lib/util/BarUtils.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 2.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.BarRectangle = BarRectangle;
7exports.minPointSizeCallback = void 0;
8var React = _interopRequireWildcard(require("react"));
9var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
10var _ActiveShapeUtils = require("./ActiveShapeUtils");
11var _DataUtils = require("./DataUtils");
12function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
14function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
15function BarRectangle(props) {
16 return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
17 shapeType: "rectangle",
18 activeClassName: "recharts-active-bar"
19 }, props));
20}
21/**
22 * Safely gets minPointSize from the minPointSize prop if it is a function
23 * @param minPointSize minPointSize as passed to the Bar component
24 * @param defaultValue default minPointSize
25 * @returns minPointSize
26 */
27var minPointSizeCallback = exports.minPointSizeCallback = function minPointSizeCallback(minPointSize) {
28 var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
29 return (value, index) => {
30 if ((0, _DataUtils.isNumber)(minPointSize)) return minPointSize;
31 var isValueNumberOrNil = (0, _DataUtils.isNumber)(value) || (0, _DataUtils.isNullish)(value);
32 if (isValueNumberOrNil) {
33 return minPointSize(value, index);
34 }
35 !isValueNumberOrNil ? true ? (0, _tinyInvariant.default)(false, "minPointSize callback function received a value with type of ".concat(typeof value, ". Currently only numbers or null/undefined are supported.")) : (0, _tinyInvariant.default)(false) : void 0;
36 return defaultValue;
37 };
38};
Note: See TracBrowser for help on using the repository browser.