main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

199
node_modules/recharts/es6/util/ActiveShapeUtils.js generated vendored Normal file
View File

@@ -0,0 +1,199 @@
var _excluded = ["option", "shapeType", "propTransformer", "activeClassName", "isActive"];
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React, { isValidElement, cloneElement } from 'react';
import isFunction from 'lodash/isFunction';
import isPlainObject from 'lodash/isPlainObject';
import isBoolean from 'lodash/isBoolean';
import isEqual from 'lodash/isEqual';
import { Rectangle } from '../shape/Rectangle';
import { Trapezoid } from '../shape/Trapezoid';
import { Sector } from '../shape/Sector';
import { Layer } from '../container/Layer';
import { Symbols } from '../shape/Symbols';
/**
* This is an abstraction for rendering a user defined prop for a customized shape in several forms.
*
* <Shape /> is the root and will handle taking in:
* - an object of svg properties
* - a boolean
* - a render prop(inline function that returns jsx)
* - a react element
*
* <ShapeSelector /> is a subcomponent of <Shape /> and used to match a component
* to the value of props.shapeType that is passed to the root.
*
*/
function defaultPropTransformer(option, props) {
return _objectSpread(_objectSpread({}, props), option);
}
function isSymbolsProps(shapeType, _elementProps) {
return shapeType === 'symbols';
}
function ShapeSelector(_ref) {
var shapeType = _ref.shapeType,
elementProps = _ref.elementProps;
switch (shapeType) {
case 'rectangle':
return /*#__PURE__*/React.createElement(Rectangle, elementProps);
case 'trapezoid':
return /*#__PURE__*/React.createElement(Trapezoid, elementProps);
case 'sector':
return /*#__PURE__*/React.createElement(Sector, elementProps);
case 'symbols':
if (isSymbolsProps(shapeType, elementProps)) {
return /*#__PURE__*/React.createElement(Symbols, elementProps);
}
break;
default:
return null;
}
}
export function getPropsFromShapeOption(option) {
if ( /*#__PURE__*/isValidElement(option)) {
return option.props;
}
return option;
}
export function Shape(_ref2) {
var option = _ref2.option,
shapeType = _ref2.shapeType,
_ref2$propTransformer = _ref2.propTransformer,
propTransformer = _ref2$propTransformer === void 0 ? defaultPropTransformer : _ref2$propTransformer,
_ref2$activeClassName = _ref2.activeClassName,
activeClassName = _ref2$activeClassName === void 0 ? 'recharts-active-shape' : _ref2$activeClassName,
isActive = _ref2.isActive,
props = _objectWithoutProperties(_ref2, _excluded);
var shape;
if ( /*#__PURE__*/isValidElement(option)) {
shape = /*#__PURE__*/cloneElement(option, _objectSpread(_objectSpread({}, props), getPropsFromShapeOption(option)));
} else if (isFunction(option)) {
shape = option(props);
} else if (isPlainObject(option) && !isBoolean(option)) {
var nextProps = propTransformer(option, props);
shape = /*#__PURE__*/React.createElement(ShapeSelector, {
shapeType: shapeType,
elementProps: nextProps
});
} else {
var elementProps = props;
shape = /*#__PURE__*/React.createElement(ShapeSelector, {
shapeType: shapeType,
elementProps: elementProps
});
}
if (isActive) {
return /*#__PURE__*/React.createElement(Layer, {
className: activeClassName
}, shape);
}
return shape;
}
/**
* This is an abstraction to handle identifying the active index from a tooltip mouse interaction
*/
export function isFunnel(graphicalItem, _item) {
return _item != null && 'trapezoids' in graphicalItem.props;
}
export function isPie(graphicalItem, _item) {
return _item != null && 'sectors' in graphicalItem.props;
}
export function isScatter(graphicalItem, _item) {
return _item != null && 'points' in graphicalItem.props;
}
export function compareFunnel(shapeData, activeTooltipItem) {
var _activeTooltipItem$la, _activeTooltipItem$la2;
var xMatches = shapeData.x === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la === void 0 ? void 0 : _activeTooltipItem$la.x) || shapeData.x === activeTooltipItem.x;
var yMatches = shapeData.y === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la2 = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la2 === void 0 ? void 0 : _activeTooltipItem$la2.y) || shapeData.y === activeTooltipItem.y;
return xMatches && yMatches;
}
export function comparePie(shapeData, activeTooltipItem) {
var startAngleMatches = shapeData.endAngle === activeTooltipItem.endAngle;
var endAngleMatches = shapeData.startAngle === activeTooltipItem.startAngle;
return startAngleMatches && endAngleMatches;
}
export function compareScatter(shapeData, activeTooltipItem) {
var xMatches = shapeData.x === activeTooltipItem.x;
var yMatches = shapeData.y === activeTooltipItem.y;
var zMatches = shapeData.z === activeTooltipItem.z;
return xMatches && yMatches && zMatches;
}
function getComparisonFn(graphicalItem, activeItem) {
var comparison;
if (isFunnel(graphicalItem, activeItem)) {
comparison = compareFunnel;
} else if (isPie(graphicalItem, activeItem)) {
comparison = comparePie;
} else if (isScatter(graphicalItem, activeItem)) {
comparison = compareScatter;
}
return comparison;
}
function getShapeDataKey(graphicalItem, activeItem) {
var shapeKey;
if (isFunnel(graphicalItem, activeItem)) {
shapeKey = 'trapezoids';
} else if (isPie(graphicalItem, activeItem)) {
shapeKey = 'sectors';
} else if (isScatter(graphicalItem, activeItem)) {
shapeKey = 'points';
}
return shapeKey;
}
function getActiveShapeTooltipPayload(graphicalItem, activeItem) {
if (isFunnel(graphicalItem, activeItem)) {
var _activeItem$tooltipPa;
return (_activeItem$tooltipPa = activeItem.tooltipPayload) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa[0]) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa.payload) === null || _activeItem$tooltipPa === void 0 ? void 0 : _activeItem$tooltipPa.payload;
}
if (isPie(graphicalItem, activeItem)) {
var _activeItem$tooltipPa2;
return (_activeItem$tooltipPa2 = activeItem.tooltipPayload) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2[0]) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2.payload) === null || _activeItem$tooltipPa2 === void 0 ? void 0 : _activeItem$tooltipPa2.payload;
}
if (isScatter(graphicalItem, activeItem)) {
return activeItem.payload;
}
return {};
}
/**
*
* @param {GetActiveShapeIndexForTooltip} arg an object of incoming attributes from Tooltip
* @returns {number}
*
* To handle possible duplicates in the data set,
* match both the data value of the active item to a data value on a graph item,
* and match the mouse coordinates of the active item to the coordinates of in a particular components shape data.
* This assumes equal lengths of shape objects to data items.
*/
export function getActiveShapeIndexForTooltip(_ref3) {
var activeTooltipItem = _ref3.activeTooltipItem,
graphicalItem = _ref3.graphicalItem,
itemData = _ref3.itemData;
var shapeKey = getShapeDataKey(graphicalItem, activeTooltipItem);
var tooltipPayload = getActiveShapeTooltipPayload(graphicalItem, activeTooltipItem);
var activeItemMatches = itemData.filter(function (datum, dataIndex) {
var valuesMatch = isEqual(tooltipPayload, datum);
var mouseCoordinateMatches = graphicalItem.props[shapeKey].filter(function (shapeData) {
var comparison = getComparisonFn(graphicalItem, activeTooltipItem);
return comparison(shapeData, activeTooltipItem);
});
// get the last index in case of multiple matches
var indexOfMouseCoordinates = graphicalItem.props[shapeKey].indexOf(mouseCoordinateMatches[mouseCoordinateMatches.length - 1]);
var coordinatesMatch = dataIndex === indexOfMouseCoordinates;
return valuesMatch && coordinatesMatch;
});
// get the last index in case of multiple matches
var activeIndex = itemData.indexOf(activeItemMatches[activeItemMatches.length - 1]);
return activeIndex;
}

67
node_modules/recharts/es6/util/BarUtils.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
var _excluded = ["x", "y"];
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import invariant from 'tiny-invariant';
import { Shape } from './ActiveShapeUtils';
// Rectangle props is expecting x, y, height, width as numbers, name as a string, and radius as a custom type
// When props are being spread in from a user defined component in Bar,
// the prop types of an SVGElement have these typed as something else.
// This function will return the passed in props
// along with x, y, height as numbers, name as a string, and radius as number | [number, number, number, number]
function typeguardBarRectangleProps(_ref, props) {
var xProp = _ref.x,
yProp = _ref.y,
option = _objectWithoutProperties(_ref, _excluded);
var xValue = "".concat(xProp);
var x = parseInt(xValue, 10);
var yValue = "".concat(yProp);
var y = parseInt(yValue, 10);
var heightValue = "".concat(props.height || option.height);
var height = parseInt(heightValue, 10);
var widthValue = "".concat(props.width || option.width);
var width = parseInt(widthValue, 10);
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props), option), x ? {
x: x
} : {}), y ? {
y: y
} : {}), {}, {
height: height,
width: width,
name: props.name,
radius: props.radius
});
}
export function BarRectangle(props) {
return /*#__PURE__*/React.createElement(Shape, _extends({
shapeType: "rectangle",
propTransformer: typeguardBarRectangleProps,
activeClassName: "recharts-active-bar"
}, props));
}
/**
* Safely gets minPointSize from from the minPointSize prop if it is a function
* @param minPointSize minPointSize as passed to the Bar component
* @param defaultValue default minPointSize
* @returns minPointSize
*/
export var minPointSizeCallback = function minPointSizeCallback(minPointSize) {
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return function (value, index) {
if (typeof minPointSize === 'number') return minPointSize;
var isValueNumber = typeof value === 'number';
if (isValueNumber) {
return minPointSize(value, index);
}
!isValueNumber ? process.env.NODE_ENV !== "production" ? invariant(false, "minPointSize callback function received a value with type of ".concat(_typeof(value), ". Currently only numbers are supported.")) : invariant(false) : void 0;
return defaultValue;
};
};

283
node_modules/recharts/es6/util/CartesianUtils.js generated vendored Normal file
View File

@@ -0,0 +1,283 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import mapValues from 'lodash/mapValues';
import every from 'lodash/every';
import { getTicksOfScale, parseScale, checkDomainOfScale, getBandSizeOfAxis } from './ChartUtils';
import { findChildByType } from './ReactUtils';
import { getPercentValue } from './DataUtils';
import { Bar } from '../cartesian/Bar';
/**
* Calculate the scale function, position, width, height of axes
* @param {Object} props Latest props
* @param {Object} axisMap The configuration of axes
* @param {Object} offset The offset of main part in the svg element
* @param {String} axisType The type of axes, x-axis or y-axis
* @param {String} chartName The name of chart
* @return {Object} Configuration
*/
export var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {
var width = props.width,
height = props.height,
layout = props.layout,
children = props.children;
var ids = Object.keys(axisMap);
var steps = {
left: offset.left,
leftMirror: offset.left,
right: width - offset.right,
rightMirror: width - offset.right,
top: offset.top,
topMirror: offset.top,
bottom: height - offset.bottom,
bottomMirror: height - offset.bottom
};
var hasBar = !!findChildByType(children, Bar);
return ids.reduce(function (result, id) {
var axis = axisMap[id];
var orientation = axis.orientation,
domain = axis.domain,
_axis$padding = axis.padding,
padding = _axis$padding === void 0 ? {} : _axis$padding,
mirror = axis.mirror,
reversed = axis.reversed;
var offsetKey = "".concat(orientation).concat(mirror ? 'Mirror' : '');
var calculatedPadding, range, x, y, needSpace;
if (axis.type === 'number' && (axis.padding === 'gap' || axis.padding === 'no-gap')) {
var diff = domain[1] - domain[0];
var smallestDistanceBetweenValues = Infinity;
var sortedValues = axis.categoricalDomain.sort();
sortedValues.forEach(function (value, index) {
if (index > 0) {
smallestDistanceBetweenValues = Math.min((value || 0) - (sortedValues[index - 1] || 0), smallestDistanceBetweenValues);
}
});
if (Number.isFinite(smallestDistanceBetweenValues)) {
var smallestDistanceInPercent = smallestDistanceBetweenValues / diff;
var rangeWidth = axis.layout === 'vertical' ? offset.height : offset.width;
if (axis.padding === 'gap') {
calculatedPadding = smallestDistanceInPercent * rangeWidth / 2;
}
if (axis.padding === 'no-gap') {
var gap = getPercentValue(props.barCategoryGap, smallestDistanceInPercent * rangeWidth);
var halfBand = smallestDistanceInPercent * rangeWidth / 2;
calculatedPadding = halfBand - gap - (halfBand - gap) / rangeWidth * gap;
}
}
}
if (axisType === 'xAxis') {
range = [offset.left + (padding.left || 0) + (calculatedPadding || 0), offset.left + offset.width - (padding.right || 0) - (calculatedPadding || 0)];
} else if (axisType === 'yAxis') {
range = layout === 'horizontal' ? [offset.top + offset.height - (padding.bottom || 0), offset.top + (padding.top || 0)] : [offset.top + (padding.top || 0) + (calculatedPadding || 0), offset.top + offset.height - (padding.bottom || 0) - (calculatedPadding || 0)];
} else {
range = axis.range;
}
if (reversed) {
range = [range[1], range[0]];
}
var _parseScale = parseScale(axis, chartName, hasBar),
scale = _parseScale.scale,
realScaleType = _parseScale.realScaleType;
scale.domain(domain).range(range);
checkDomainOfScale(scale);
var ticks = getTicksOfScale(scale, _objectSpread(_objectSpread({}, axis), {}, {
realScaleType: realScaleType
}));
if (axisType === 'xAxis') {
needSpace = orientation === 'top' && !mirror || orientation === 'bottom' && mirror;
x = offset.left;
y = steps[offsetKey] - needSpace * axis.height;
} else if (axisType === 'yAxis') {
needSpace = orientation === 'left' && !mirror || orientation === 'right' && mirror;
x = steps[offsetKey] - needSpace * axis.width;
y = offset.top;
}
var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {
realScaleType: realScaleType,
x: x,
y: y,
scale: scale,
width: axisType === 'xAxis' ? offset.width : axis.width,
height: axisType === 'yAxis' ? offset.height : axis.height
});
finalAxis.bandSize = getBandSizeOfAxis(finalAxis, ticks);
if (!axis.hide && axisType === 'xAxis') {
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.height;
} else if (!axis.hide) {
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.width;
}
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));
}, {});
};
export var rectWithPoints = function rectWithPoints(_ref, _ref2) {
var x1 = _ref.x,
y1 = _ref.y;
var x2 = _ref2.x,
y2 = _ref2.y;
return {
x: Math.min(x1, x2),
y: Math.min(y1, y2),
width: Math.abs(x2 - x1),
height: Math.abs(y2 - y1)
};
};
/**
* Compute the x, y, width, and height of a box from two reference points.
* @param {Object} coords x1, x2, y1, and y2
* @return {Object} object
*/
export var rectWithCoords = function rectWithCoords(_ref3) {
var x1 = _ref3.x1,
y1 = _ref3.y1,
x2 = _ref3.x2,
y2 = _ref3.y2;
return rectWithPoints({
x: x1,
y: y1
}, {
x: x2,
y: y2
});
};
export var ScaleHelper = /*#__PURE__*/function () {
function ScaleHelper(scale) {
_classCallCheck(this, ScaleHelper);
this.scale = scale;
}
_createClass(ScaleHelper, [{
key: "domain",
get: function get() {
return this.scale.domain;
}
}, {
key: "range",
get: function get() {
return this.scale.range;
}
}, {
key: "rangeMin",
get: function get() {
return this.range()[0];
}
}, {
key: "rangeMax",
get: function get() {
return this.range()[1];
}
}, {
key: "bandwidth",
get: function get() {
return this.scale.bandwidth;
}
}, {
key: "apply",
value: function apply(value) {
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
bandAware = _ref4.bandAware,
position = _ref4.position;
if (value === undefined) {
return undefined;
}
if (position) {
switch (position) {
case 'start':
{
return this.scale(value);
}
case 'middle':
{
var offset = this.bandwidth ? this.bandwidth() / 2 : 0;
return this.scale(value) + offset;
}
case 'end':
{
var _offset = this.bandwidth ? this.bandwidth() : 0;
return this.scale(value) + _offset;
}
default:
{
return this.scale(value);
}
}
}
if (bandAware) {
var _offset2 = this.bandwidth ? this.bandwidth() / 2 : 0;
return this.scale(value) + _offset2;
}
return this.scale(value);
}
}, {
key: "isInRange",
value: function isInRange(value) {
var range = this.range();
var first = range[0];
var last = range[range.length - 1];
return first <= last ? value >= first && value <= last : value >= last && value <= first;
}
}], [{
key: "create",
value: function create(obj) {
return new ScaleHelper(obj);
}
}]);
return ScaleHelper;
}();
_defineProperty(ScaleHelper, "EPS", 1e-4);
export var createLabeledScales = function createLabeledScales(options) {
var scales = Object.keys(options).reduce(function (res, key) {
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, ScaleHelper.create(options[key])));
}, {});
return _objectSpread(_objectSpread({}, scales), {}, {
apply: function apply(coord) {
var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
bandAware = _ref5.bandAware,
position = _ref5.position;
return mapValues(coord, function (value, label) {
return scales[label].apply(value, {
bandAware: bandAware,
position: position
});
});
},
isInRange: function isInRange(coord) {
return every(coord, function (value, label) {
return scales[label].isInRange(value);
});
}
});
};
/** Normalizes the angle so that 0 <= angle < 180.
* @param {number} angle Angle in degrees.
* @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */
export function normalizeAngle(angle) {
return (angle % 180 + 180) % 180;
}
/** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
* @param {Object} size Width and height of the text in a horizontal position.
* @param {number} angle Angle in degrees in which the text is displayed.
* @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
*/
export var getAngledRectangleWidth = function getAngledRectangleWidth(_ref6) {
var width = _ref6.width,
height = _ref6.height;
var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// Ensure angle is >= 0 && < 180
var normalizedAngle = normalizeAngle(angle);
var angleRadians = normalizedAngle * Math.PI / 180;
/* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled
* width. This threshold defines when each formula should kick in. */
var angleThreshold = Math.atan(height / width);
var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);
return Math.abs(angledWidth);
};

1055
node_modules/recharts/es6/util/ChartUtils.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

1
node_modules/recharts/es6/util/Constants.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export var COLOR_PANEL = ['#1890FF', '#66B5FF', '#41D9C7', '#2FC25B', '#6EDB8F', '#9AE65C', '#FACC14', '#E6965C', '#57AD71', '#223273', '#738AE6', '#7564CC', '#8543E0', '#A877ED', '#5C8EE6', '#13C2C2', '#70E0E0', '#5CA3E6', '#3436C7', '#8082FF', '#DD81E6', '#F04864', '#FA7D92', '#D598D9'];

20
node_modules/recharts/es6/util/CssPrefixUtils.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms'];
export var generatePrefixStyle = function generatePrefixStyle(name, value) {
if (!name) {
return null;
}
var camelName = name.replace(/(\w)/, function (v) {
return v.toUpperCase();
});
var result = PREFIX_LIST.reduce(function (res, entry) {
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, entry + camelName, value));
}, {});
result[name] = value;
return result;
};

112
node_modules/recharts/es6/util/DOMUtils.js generated vendored Normal file
View File

@@ -0,0 +1,112 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
import { Global } from './Global';
var stringCache = {
widthCache: {},
cacheCount: 0
};
var MAX_CACHE_NUM = 2000;
var SPAN_STYLE = {
position: 'absolute',
top: '-20000px',
left: 0,
padding: 0,
margin: 0,
border: 'none',
whiteSpace: 'pre'
};
var STYLE_LIST = ['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'lineHeight', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom'];
var MEASUREMENT_SPAN_ID = 'recharts_measurement_span';
function autoCompleteStyle(name, value) {
if (STYLE_LIST.indexOf(name) >= 0 && value === +value) {
return "".concat(value, "px");
}
return value;
}
function camelToMiddleLine(text) {
var strs = text.split('');
var formatStrs = strs.reduce(function (result, entry) {
if (entry === entry.toUpperCase()) {
return [].concat(_toConsumableArray(result), ['-', entry.toLowerCase()]);
}
return [].concat(_toConsumableArray(result), [entry]);
}, []);
return formatStrs.join('');
}
export var getStyleString = function getStyleString(style) {
return Object.keys(style).reduce(function (result, s) {
return "".concat(result).concat(camelToMiddleLine(s), ":").concat(autoCompleteStyle(s, style[s]), ";");
}, '');
};
function removeInvalidKeys(obj) {
var copyObj = _objectSpread({}, obj);
Object.keys(copyObj).forEach(function (key) {
if (!copyObj[key]) {
delete copyObj[key];
}
});
return copyObj;
}
export var getStringSize = function getStringSize(text) {
var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (text === undefined || text === null || Global.isSsr) {
return {
width: 0,
height: 0
};
}
var copyStyle = removeInvalidKeys(style);
var cacheKey = JSON.stringify({
text: text,
copyStyle: copyStyle
});
if (stringCache.widthCache[cacheKey]) {
return stringCache.widthCache[cacheKey];
}
try {
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
if (!measurementSpan) {
measurementSpan = document.createElement('span');
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
measurementSpan.setAttribute('aria-hidden', 'true');
document.body.appendChild(measurementSpan);
}
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
// https://en.wikipedia.org/wiki/Content_Security_Policy
var measurementSpanStyle = _objectSpread(_objectSpread({}, SPAN_STYLE), copyStyle);
Object.assign(measurementSpan.style, measurementSpanStyle);
measurementSpan.textContent = "".concat(text);
var rect = measurementSpan.getBoundingClientRect();
var result = {
width: rect.width,
height: rect.height
};
stringCache.widthCache[cacheKey] = result;
if (++stringCache.cacheCount > MAX_CACHE_NUM) {
stringCache.cacheCount = 0;
stringCache.widthCache = {};
}
return result;
} catch (e) {
return {
width: 0,
height: 0
};
}
};
export var getOffset = function getOffset(rect) {
return {
top: rect.top + window.scrollY - document.documentElement.clientTop,
left: rect.left + window.scrollX - document.documentElement.clientLeft
};
};

139
node_modules/recharts/es6/util/DataUtils.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
import isString from 'lodash/isString';
import isNan from 'lodash/isNaN';
import get from 'lodash/get';
import lodashIsNumber from 'lodash/isNumber';
export var mathSign = function mathSign(value) {
if (value === 0) {
return 0;
}
if (value > 0) {
return 1;
}
return -1;
};
export var isPercent = function isPercent(value) {
return isString(value) && value.indexOf('%') === value.length - 1;
};
export var isNumber = function isNumber(value) {
return lodashIsNumber(value) && !isNan(value);
};
export var isNumOrStr = function isNumOrStr(value) {
return isNumber(value) || isString(value);
};
var idCounter = 0;
export var uniqueId = function uniqueId(prefix) {
var id = ++idCounter;
return "".concat(prefix || '').concat(id);
};
/**
* Get percent value of a total value
* @param {number|string} percent A percent
* @param {number} totalValue Total value
* @param {number} defaultValue The value returned when percent is undefined or invalid
* @param {boolean} validate If set to be true, the result will be validated
* @return {number} value
*/
export var getPercentValue = function getPercentValue(percent, totalValue) {
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (!isNumber(percent) && !isString(percent)) {
return defaultValue;
}
var value;
if (isPercent(percent)) {
var index = percent.indexOf('%');
value = totalValue * parseFloat(percent.slice(0, index)) / 100;
} else {
value = +percent;
}
if (isNan(value)) {
value = defaultValue;
}
if (validate && value > totalValue) {
value = totalValue;
}
return value;
};
export var getAnyElementOfObject = function getAnyElementOfObject(obj) {
if (!obj) {
return null;
}
var keys = Object.keys(obj);
if (keys && keys.length) {
return obj[keys[0]];
}
return null;
};
export var hasDuplicate = function hasDuplicate(ary) {
if (!Array.isArray(ary)) {
return false;
}
var len = ary.length;
var cache = {};
for (var i = 0; i < len; i++) {
if (!cache[ary[i]]) {
cache[ary[i]] = true;
} else {
return true;
}
}
return false;
};
/* @todo consider to rename this function into `getInterpolator` */
export var interpolateNumber = function interpolateNumber(numberA, numberB) {
if (isNumber(numberA) && isNumber(numberB)) {
return function (t) {
return numberA + t * (numberB - numberA);
};
}
return function () {
return numberB;
};
};
export function findEntryInArray(ary, specifiedKey, specifiedValue) {
if (!ary || !ary.length) {
return null;
}
return ary.find(function (entry) {
return entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : get(entry, specifiedKey)) === specifiedValue;
});
}
/**
* The least square linear regression
* @param {Array} data The array of points
* @returns {Object} The domain of x, and the parameter of linear function
*/
export var getLinearRegression = function getLinearRegression(data) {
if (!data || !data.length) {
return null;
}
var len = data.length;
var xsum = 0;
var ysum = 0;
var xysum = 0;
var xxsum = 0;
var xmin = Infinity;
var xmax = -Infinity;
var xcurrent = 0;
var ycurrent = 0;
for (var i = 0; i < len; i++) {
xcurrent = data[i].cx || 0;
ycurrent = data[i].cy || 0;
xsum += xcurrent;
ysum += ycurrent;
xysum += xcurrent * ycurrent;
xxsum += xcurrent * xcurrent;
xmin = Math.min(xmin, xcurrent);
xmax = Math.max(xmax, xcurrent);
}
var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
return {
xmin: xmin,
xmax: xmax,
a: a,
b: (ysum - a * xsum) / len
};
};

View File

@@ -0,0 +1,51 @@
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
import { ReferenceDot } from '../cartesian/ReferenceDot';
import { ReferenceLine } from '../cartesian/ReferenceLine';
import { ReferenceArea } from '../cartesian/ReferenceArea';
import { ifOverflowMatches } from './IfOverflowMatches';
import { findAllByType } from './ReactUtils';
import { isNumber } from './DataUtils';
export var detectReferenceElementsDomain = function detectReferenceElementsDomain(children, domain, axisId, axisType, specifiedTicks) {
var lines = findAllByType(children, ReferenceLine);
var dots = findAllByType(children, ReferenceDot);
var elements = [].concat(_toConsumableArray(lines), _toConsumableArray(dots));
var areas = findAllByType(children, ReferenceArea);
var idKey = "".concat(axisType, "Id");
var valueKey = axisType[0];
var finalDomain = domain;
if (elements.length) {
finalDomain = elements.reduce(function (result, el) {
if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && isNumber(el.props[valueKey])) {
var value = el.props[valueKey];
return [Math.min(result[0], value), Math.max(result[1], value)];
}
return result;
}, finalDomain);
}
if (areas.length) {
var key1 = "".concat(valueKey, "1");
var key2 = "".concat(valueKey, "2");
finalDomain = areas.reduce(function (result, el) {
if (el.props[idKey] === axisId && ifOverflowMatches(el.props, 'extendDomain') && isNumber(el.props[key1]) && isNumber(el.props[key2])) {
var value1 = el.props[key1];
var value2 = el.props[key2];
return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];
}
return result;
}, finalDomain);
}
if (specifiedTicks && specifiedTicks.length) {
finalDomain = specifiedTicks.reduce(function (result, tick) {
if (isNumber(tick)) {
return [Math.min(result[0], tick), Math.max(result[1], tick)];
}
return result;
}, finalDomain);
}
return finalDomain;
};

4
node_modules/recharts/es6/util/Events.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import EventEmitter from 'eventemitter3';
var eventCenter = new EventEmitter();
export { eventCenter };
export var SYNC_EVENT = 'recharts.syncMouseEvents';

33
node_modules/recharts/es6/util/FunnelUtils.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from 'react';
import { Shape, getPropsFromShapeOption } from './ActiveShapeUtils';
// Trapezoid props is expecting x, y, height as numbers.
// When props are being spread in from a user defined component in Funnel,
// the prop types of an SVGElement have these typed as string | number.
// This function will return the passed in props along with x, y, height as numbers.
export function typeGuardTrapezoidProps(option, props) {
var xValue = "".concat(props.x || option.x);
var x = parseInt(xValue, 10);
var yValue = "".concat(props.y || option.y);
var y = parseInt(yValue, 10);
var heightValue = "".concat((props === null || props === void 0 ? void 0 : props.height) || (option === null || option === void 0 ? void 0 : option.height));
var height = parseInt(heightValue, 10);
return _objectSpread(_objectSpread(_objectSpread({}, props), getPropsFromShapeOption(option)), {}, {
height: height,
x: x,
y: y
});
}
export function FunnelTrapezoid(props) {
return /*#__PURE__*/React.createElement(Shape, _extends({
shapeType: "trapezoid",
propTransformer: typeGuardTrapezoidProps
}, props));
}

21
node_modules/recharts/es6/util/Global.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
var parseIsSsrByDefault = function parseIsSsrByDefault() {
return !(typeof window !== 'undefined' && window.document && window.document.createElement && window.setTimeout);
};
export var Global = {
isSsr: parseIsSsrByDefault(),
get: function get(key) {
return Global[key];
},
set: function set(key, value) {
if (typeof key === 'string') {
Global[key] = value;
} else {
var keys = Object.keys(key);
if (keys && keys.length) {
keys.forEach(function (k) {
Global[k] = key[k];
});
}
}
}
};

8
node_modules/recharts/es6/util/IfOverflowMatches.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export var ifOverflowMatches = function ifOverflowMatches(props, value) {
var alwaysShow = props.alwaysShow;
var ifOverflow = props.ifOverflow;
if (alwaysShow) {
ifOverflow = 'extendDomain';
}
return ifOverflow === value;
};

22
node_modules/recharts/es6/util/LogUtils.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/* eslint no-console: 0 */
var isDev = process.env.NODE_ENV !== 'production';
export var warn = function warn(condition, format) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (isDev && typeof console !== 'undefined' && console.warn) {
if (format === undefined) {
console.warn('LogUtils requires an error message argument');
}
if (!condition) {
if (format === undefined) {
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var argIndex = 0;
console.warn(format.replace(/%s/g, function () {
return args[argIndex++];
}));
}
}
}
};

208
node_modules/recharts/es6/util/PolarUtils.js generated vendored Normal file
View File

@@ -0,0 +1,208 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import isNil from 'lodash/isNil';
import { isValidElement } from 'react';
import isFunction from 'lodash/isFunction';
import { getPercentValue } from './DataUtils';
import { parseScale, checkDomainOfScale, getTicksOfScale } from './ChartUtils';
export var RADIAN = Math.PI / 180;
export var degreeToRadian = function degreeToRadian(angle) {
return angle * Math.PI / 180;
};
export var radianToDegree = function radianToDegree(angleInRadian) {
return angleInRadian * 180 / Math.PI;
};
export var polarToCartesian = function polarToCartesian(cx, cy, radius, angle) {
return {
x: cx + Math.cos(-RADIAN * angle) * radius,
y: cy + Math.sin(-RADIAN * angle) * radius
};
};
export var getMaxRadius = function getMaxRadius(width, height) {
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
top: 0,
right: 0,
bottom: 0,
left: 0
};
return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;
};
/**
* Calculate the scale function, position, width, height of axes
* @param {Object} props Latest props
* @param {Object} axisMap The configuration of axes
* @param {Object} offset The offset of main part in the svg element
* @param {Object} axisType The type of axes, radius-axis or angle-axis
* @param {String} chartName The name of chart
* @return {Object} Configuration
*/
export var formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {
var width = props.width,
height = props.height;
var startAngle = props.startAngle,
endAngle = props.endAngle;
var cx = getPercentValue(props.cx, width, width / 2);
var cy = getPercentValue(props.cy, height, height / 2);
var maxRadius = getMaxRadius(width, height, offset);
var innerRadius = getPercentValue(props.innerRadius, maxRadius, 0);
var outerRadius = getPercentValue(props.outerRadius, maxRadius, maxRadius * 0.8);
var ids = Object.keys(axisMap);
return ids.reduce(function (result, id) {
var axis = axisMap[id];
var domain = axis.domain,
reversed = axis.reversed;
var range;
if (isNil(axis.range)) {
if (axisType === 'angleAxis') {
range = [startAngle, endAngle];
} else if (axisType === 'radiusAxis') {
range = [innerRadius, outerRadius];
}
if (reversed) {
range = [range[1], range[0]];
}
} else {
range = axis.range;
var _range = range;
var _range2 = _slicedToArray(_range, 2);
startAngle = _range2[0];
endAngle = _range2[1];
}
var _parseScale = parseScale(axis, chartName),
realScaleType = _parseScale.realScaleType,
scale = _parseScale.scale;
scale.domain(domain).range(range);
checkDomainOfScale(scale);
var ticks = getTicksOfScale(scale, _objectSpread(_objectSpread({}, axis), {}, {
realScaleType: realScaleType
}));
var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {
range: range,
radius: outerRadius,
realScaleType: realScaleType,
scale: scale,
cx: cx,
cy: cy,
innerRadius: innerRadius,
outerRadius: outerRadius,
startAngle: startAngle,
endAngle: endAngle
});
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));
}, {});
};
export var distanceBetweenPoints = function distanceBetweenPoints(point, anotherPoint) {
var x1 = point.x,
y1 = point.y;
var x2 = anotherPoint.x,
y2 = anotherPoint.y;
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
};
export var getAngleOfPoint = function getAngleOfPoint(_ref, _ref2) {
var x = _ref.x,
y = _ref.y;
var cx = _ref2.cx,
cy = _ref2.cy;
var radius = distanceBetweenPoints({
x: x,
y: y
}, {
x: cx,
y: cy
});
if (radius <= 0) {
return {
radius: radius
};
}
var cos = (x - cx) / radius;
var angleInRadian = Math.acos(cos);
if (y > cy) {
angleInRadian = 2 * Math.PI - angleInRadian;
}
return {
radius: radius,
angle: radianToDegree(angleInRadian),
angleInRadian: angleInRadian
};
};
export var formatAngleOfSector = function formatAngleOfSector(_ref3) {
var startAngle = _ref3.startAngle,
endAngle = _ref3.endAngle;
var startCnt = Math.floor(startAngle / 360);
var endCnt = Math.floor(endAngle / 360);
var min = Math.min(startCnt, endCnt);
return {
startAngle: startAngle - min * 360,
endAngle: endAngle - min * 360
};
};
var reverseFormatAngleOfSetor = function reverseFormatAngleOfSetor(angle, _ref4) {
var startAngle = _ref4.startAngle,
endAngle = _ref4.endAngle;
var startCnt = Math.floor(startAngle / 360);
var endCnt = Math.floor(endAngle / 360);
var min = Math.min(startCnt, endCnt);
return angle + min * 360;
};
export var inRangeOfSector = function inRangeOfSector(_ref5, sector) {
var x = _ref5.x,
y = _ref5.y;
var _getAngleOfPoint = getAngleOfPoint({
x: x,
y: y
}, sector),
radius = _getAngleOfPoint.radius,
angle = _getAngleOfPoint.angle;
var innerRadius = sector.innerRadius,
outerRadius = sector.outerRadius;
if (radius < innerRadius || radius > outerRadius) {
return false;
}
if (radius === 0) {
return true;
}
var _formatAngleOfSector = formatAngleOfSector(sector),
startAngle = _formatAngleOfSector.startAngle,
endAngle = _formatAngleOfSector.endAngle;
var formatAngle = angle;
var inRange;
if (startAngle <= endAngle) {
while (formatAngle > endAngle) {
formatAngle -= 360;
}
while (formatAngle < startAngle) {
formatAngle += 360;
}
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
} else {
while (formatAngle > startAngle) {
formatAngle -= 360;
}
while (formatAngle < endAngle) {
formatAngle += 360;
}
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
}
if (inRange) {
return _objectSpread(_objectSpread({}, sector), {}, {
radius: radius,
angle: reverseFormatAngleOfSetor(formatAngle, sector)
});
}
return null;
};
export var getTickClassName = function getTickClassName(tick) {
return ! /*#__PURE__*/isValidElement(tick) && !isFunction(tick) && typeof tick !== 'boolean' ? tick.className : '';
};

36
node_modules/recharts/es6/util/RadialBarUtils.js generated vendored Normal file
View File

@@ -0,0 +1,36 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from 'react';
import { Shape } from './ActiveShapeUtils';
export function parseCornerRadius(cornerRadius) {
if (typeof cornerRadius === 'string') {
return parseInt(cornerRadius, 10);
}
return cornerRadius;
}
// Sector props is expecting cx, cy as numbers.
// When props are being spread in from a user defined component in RadialBar,
// the prop types of an SVGElement have these typed as string | number.
// This function will return the passed in props along with cx, cy as numbers.
export function typeGuardSectorProps(option, props) {
var cxValue = "".concat(props.cx || option.cx);
var cx = Number(cxValue);
var cyValue = "".concat(props.cy || option.cy);
var cy = Number(cyValue);
return _objectSpread(_objectSpread(_objectSpread({}, props), option), {}, {
cx: cx,
cy: cy
});
}
export function RadialBarSector(props) {
return /*#__PURE__*/React.createElement(Shape, _extends({
shapeType: "sector",
propTransformer: typeGuardSectorProps
}, props));
}

298
node_modules/recharts/es6/util/ReactUtils.js generated vendored Normal file
View File

@@ -0,0 +1,298 @@
var _excluded = ["children"],
_excluded2 = ["children"];
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import get from 'lodash/get';
import isNil from 'lodash/isNil';
import isString from 'lodash/isString';
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import { Children, isValidElement } from 'react';
import { isFragment } from 'react-is';
import { isNumber } from './DataUtils';
import { shallowEqual } from './ShallowEqual';
import { FilteredElementKeyMap, SVGElementPropKeys, EventKeys } from './types';
var REACT_BROWSER_EVENT_MAP = {
click: 'onClick',
mousedown: 'onMouseDown',
mouseup: 'onMouseUp',
mouseover: 'onMouseOver',
mousemove: 'onMouseMove',
mouseout: 'onMouseOut',
mouseenter: 'onMouseEnter',
mouseleave: 'onMouseLeave',
touchcancel: 'onTouchCancel',
touchend: 'onTouchEnd',
touchmove: 'onTouchMove',
touchstart: 'onTouchStart'
};
export var SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];
export var LEGEND_TYPES = ['plainline', 'line', 'square', 'rect', 'circle', 'cross', 'diamond', 'star', 'triangle', 'wye', 'none'];
export var TOOLTIP_TYPES = ['none'];
/**
* Get the display name of a component
* @param {Object} Comp Specified Component
* @return {String} Display name of Component
*/
export var getDisplayName = function getDisplayName(Comp) {
if (typeof Comp === 'string') {
return Comp;
}
if (!Comp) {
return '';
}
return Comp.displayName || Comp.name || 'Component';
};
// `toArray` gets called multiple times during the render
// so we can memoize last invocation (since reference to `children` is the same)
var lastChildren = null;
var lastResult = null;
export var toArray = function toArray(children) {
if (children === lastChildren && Array.isArray(lastResult)) {
return lastResult;
}
var result = [];
Children.forEach(children, function (child) {
if (isNil(child)) return;
if (isFragment(child)) {
result = result.concat(toArray(child.props.children));
} else {
result.push(child);
}
});
lastResult = result;
lastChildren = children;
return result;
};
/*
* Find and return all matched children by type.
* `type` must be a React.ComponentType
*/
export function findAllByType(children, type) {
var result = [];
var types = [];
if (Array.isArray(type)) {
types = type.map(function (t) {
return getDisplayName(t);
});
} else {
types = [getDisplayName(type)];
}
toArray(children).forEach(function (child) {
var childType = get(child, 'type.displayName') || get(child, 'type.name');
if (types.indexOf(childType) !== -1) {
result.push(child);
}
});
return result;
}
/*
* Return the first matched child by type, return null otherwise.
* `type` must be a React.ComponentType
*/
export function findChildByType(children, type) {
var result = findAllByType(children, type);
return result && result[0];
}
/*
* Create a new array of children excluding the ones matched the type
*/
export var withoutType = function withoutType(children, type) {
var newChildren = [];
var types;
if (Array.isArray(type)) {
types = type.map(function (t) {
return getDisplayName(t);
});
} else {
types = [getDisplayName(type)];
}
toArray(children).forEach(function (child) {
var displayName = get(child, 'type.displayName');
if (displayName && types.indexOf(displayName) !== -1) {
return;
}
newChildren.push(child);
});
return newChildren;
};
/**
* validate the width and height props of a chart element
* @param {Object} el A chart element
* @return {Boolean} true If the props width and height are number, and greater than 0
*/
export var validateWidthHeight = function validateWidthHeight(el) {
if (!el || !el.props) {
return false;
}
var _el$props = el.props,
width = _el$props.width,
height = _el$props.height;
if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0) {
return false;
}
return true;
};
var SVG_TAGS = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColormatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-url', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'lineGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern'];
var isSvgElement = function isSvgElement(child) {
return child && child.type && isString(child.type) && SVG_TAGS.indexOf(child.type) >= 0;
};
export var isDotProps = function isDotProps(dot) {
return dot && _typeof(dot) === 'object' && 'cx' in dot && 'cy' in dot && 'r' in dot;
};
/**
* Checks if the property is valid to spread onto an SVG element or onto a specific component
* @param {unknown} property property value currently being compared
* @param {string} key property key currently being compared
* @param {boolean} includeEvents if events are included in spreadable props
* @param {boolean} svgElementType checks against map of SVG element types to attributes
* @returns {boolean} is prop valid
*/
export var isValidSpreadableProp = function isValidSpreadableProp(property, key, includeEvents, svgElementType) {
var _FilteredElementKeyMa;
/**
* If the svg element type is explicitly included, check against the filtered element key map
* to determine if there are attributes that should only exist on that element type.
* @todo Add an internal cjs version of https://github.com/wooorm/svg-element-attributes for full coverage.
*/
var matchingElementTypeKeys = (_FilteredElementKeyMa = FilteredElementKeyMap === null || FilteredElementKeyMap === void 0 ? void 0 : FilteredElementKeyMap[svgElementType]) !== null && _FilteredElementKeyMa !== void 0 ? _FilteredElementKeyMa : [];
return !isFunction(property) && (svgElementType && matchingElementTypeKeys.includes(key) || SVGElementPropKeys.includes(key)) || includeEvents && EventKeys.includes(key);
};
/**
* Filter all the svg elements of children
* @param {Array} children The children of a react element
* @return {Array} All the svg elements
*/
export var filterSvgElements = function filterSvgElements(children) {
var svgElements = [];
toArray(children).forEach(function (entry) {
if (isSvgElement(entry)) {
svgElements.push(entry);
}
});
return svgElements;
};
export var filterProps = function filterProps(props, includeEvents, svgElementType) {
if (!props || typeof props === 'function' || typeof props === 'boolean') {
return null;
}
var inputProps = props;
if ( /*#__PURE__*/isValidElement(props)) {
inputProps = props.props;
}
if (!isObject(inputProps)) {
return null;
}
var out = {};
/**
* Props are blindly spread onto SVG elements. This loop filters out properties that we don't want to spread.
* Items filtered out are as follows:
* - functions in properties that are SVG attributes (functions are included when includeEvents is true)
* - props that are SVG attributes but don't matched the passed svgElementType
* - any prop that is not in SVGElementPropKeys (or in EventKeys if includeEvents is true)
*/
Object.keys(inputProps).forEach(function (key) {
var _inputProps;
if (isValidSpreadableProp((_inputProps = inputProps) === null || _inputProps === void 0 ? void 0 : _inputProps[key], key, includeEvents, svgElementType)) {
out[key] = inputProps[key];
}
});
return out;
};
/**
* Wether props of children changed
* @param {Object} nextChildren The latest children
* @param {Object} prevChildren The prev children
* @return {Boolean} equal or not
*/
export var isChildrenEqual = function isChildrenEqual(nextChildren, prevChildren) {
if (nextChildren === prevChildren) {
return true;
}
var count = Children.count(nextChildren);
if (count !== Children.count(prevChildren)) {
return false;
}
if (count === 0) {
return true;
}
if (count === 1) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return isSingleChildEqual(Array.isArray(nextChildren) ? nextChildren[0] : nextChildren, Array.isArray(prevChildren) ? prevChildren[0] : prevChildren);
}
for (var i = 0; i < count; i++) {
var nextChild = nextChildren[i];
var prevChild = prevChildren[i];
if (Array.isArray(nextChild) || Array.isArray(prevChild)) {
if (!isChildrenEqual(nextChild, prevChild)) {
return false;
}
// eslint-disable-next-line @typescript-eslint/no-use-before-define
} else if (!isSingleChildEqual(nextChild, prevChild)) {
return false;
}
}
return true;
};
export var isSingleChildEqual = function isSingleChildEqual(nextChild, prevChild) {
if (isNil(nextChild) && isNil(prevChild)) {
return true;
}
if (!isNil(nextChild) && !isNil(prevChild)) {
var _ref = nextChild.props || {},
nextChildren = _ref.children,
nextProps = _objectWithoutProperties(_ref, _excluded);
var _ref2 = prevChild.props || {},
prevChildren = _ref2.children,
prevProps = _objectWithoutProperties(_ref2, _excluded2);
if (nextChildren && prevChildren) {
return shallowEqual(nextProps, prevProps) && isChildrenEqual(nextChildren, prevChildren);
}
if (!nextChildren && !prevChildren) {
return shallowEqual(nextProps, prevProps);
}
return false;
}
return false;
};
export var renderByOrder = function renderByOrder(children, renderMap) {
var elements = [];
var record = {};
toArray(children).forEach(function (child, index) {
if (isSvgElement(child)) {
elements.push(child);
} else if (child) {
var displayName = getDisplayName(child.type);
var _ref3 = renderMap[displayName] || {},
handler = _ref3.handler,
once = _ref3.once;
if (handler && (!once || !record[displayName])) {
var results = handler(child, displayName, index);
elements.push(results);
record[displayName] = true;
}
}
});
return elements;
};
export var getReactEventByType = function getReactEventByType(e) {
var type = e && e.type;
if (type && REACT_BROWSER_EVENT_MAP[type]) {
return REACT_BROWSER_EVENT_MAP[type];
}
return null;
};
export var parseChildIndex = function parseChildIndex(child, children) {
return toArray(children).indexOf(child);
};

174
node_modules/recharts/es6/util/ReduceCSSCalc.js generated vendored Normal file
View File

@@ -0,0 +1,174 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var MULTIPLY_OR_DIVIDE_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
var ADD_OR_SUBTRACT_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
var CSS_LENGTH_UNIT_REGEX = /^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/;
var NUM_SPLIT_REGEX = /(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/;
var CONVERSION_RATES = {
cm: 96 / 2.54,
mm: 96 / 25.4,
pt: 96 / 72,
pc: 96 / 6,
"in": 96,
Q: 96 / (2.54 * 40),
px: 1
};
var FIXED_CSS_LENGTH_UNITS = Object.keys(CONVERSION_RATES);
var STR_NAN = 'NaN';
function convertToPx(value, unit) {
return value * CONVERSION_RATES[unit];
}
var DecimalCSS = /*#__PURE__*/function () {
function DecimalCSS(num, unit) {
_classCallCheck(this, DecimalCSS);
this.num = num;
this.unit = unit;
this.num = num;
this.unit = unit;
if (Number.isNaN(num)) {
this.unit = '';
}
if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) {
this.num = NaN;
this.unit = '';
}
if (FIXED_CSS_LENGTH_UNITS.includes(unit)) {
this.num = convertToPx(num, unit);
this.unit = 'px';
}
}
_createClass(DecimalCSS, [{
key: "add",
value: function add(other) {
if (this.unit !== other.unit) {
return new DecimalCSS(NaN, '');
}
return new DecimalCSS(this.num + other.num, this.unit);
}
}, {
key: "subtract",
value: function subtract(other) {
if (this.unit !== other.unit) {
return new DecimalCSS(NaN, '');
}
return new DecimalCSS(this.num - other.num, this.unit);
}
}, {
key: "multiply",
value: function multiply(other) {
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
return new DecimalCSS(NaN, '');
}
return new DecimalCSS(this.num * other.num, this.unit || other.unit);
}
}, {
key: "divide",
value: function divide(other) {
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
return new DecimalCSS(NaN, '');
}
return new DecimalCSS(this.num / other.num, this.unit || other.unit);
}
}, {
key: "toString",
value: function toString() {
return "".concat(this.num).concat(this.unit);
}
}, {
key: "isNaN",
value: function isNaN() {
return Number.isNaN(this.num);
}
}], [{
key: "parse",
value: function parse(str) {
var _NUM_SPLIT_REGEX$exec;
var _ref = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [],
_ref2 = _slicedToArray(_ref, 3),
numStr = _ref2[1],
unit = _ref2[2];
return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : '');
}
}]);
return DecimalCSS;
}();
function calculateArithmetic(expr) {
if (expr.includes(STR_NAN)) {
return STR_NAN;
}
var newExpr = expr;
while (newExpr.includes('*') || newExpr.includes('/')) {
var _MULTIPLY_OR_DIVIDE_R;
var _ref3 = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [],
_ref4 = _slicedToArray(_ref3, 4),
leftOperand = _ref4[1],
operator = _ref4[2],
rightOperand = _ref4[3];
var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : '');
var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : '');
var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs);
if (result.isNaN()) {
return STR_NAN;
}
newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString());
}
while (newExpr.includes('+') || /.-\d+(?:\.\d+)?/.test(newExpr)) {
var _ADD_OR_SUBTRACT_REGE;
var _ref5 = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [],
_ref6 = _slicedToArray(_ref5, 4),
_leftOperand = _ref6[1],
_operator = _ref6[2],
_rightOperand = _ref6[3];
var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : '');
var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : '');
var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs);
if (_result.isNaN()) {
return STR_NAN;
}
newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString());
}
return newExpr;
}
var PARENTHESES_REGEX = /\(([^()]*)\)/;
function calculateParentheses(expr) {
var newExpr = expr;
while (newExpr.includes('(')) {
var _PARENTHESES_REGEX$ex = PARENTHESES_REGEX.exec(newExpr),
_PARENTHESES_REGEX$ex2 = _slicedToArray(_PARENTHESES_REGEX$ex, 2),
parentheticalExpression = _PARENTHESES_REGEX$ex2[1];
newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression));
}
return newExpr;
}
function evaluateExpression(expression) {
var newExpr = expression.replace(/\s+/g, '');
newExpr = calculateParentheses(newExpr);
newExpr = calculateArithmetic(newExpr);
return newExpr;
}
export function safeEvaluateExpression(expression) {
try {
return evaluateExpression(expression);
} catch (e) {
/* istanbul ignore next */
return STR_NAN;
}
}
export function reduceCSSCalc(expression) {
var result = safeEvaluateExpression(expression.slice(5, -1));
if (result === STR_NAN) {
// notify the user
return '';
}
return result;
}

26
node_modules/recharts/es6/util/ScatterUtils.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
var _excluded = ["option", "isActive"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import { Symbols } from '../shape/Symbols';
import { Shape } from './ActiveShapeUtils';
export function ScatterSymbol(_ref) {
var option = _ref.option,
isActive = _ref.isActive,
props = _objectWithoutProperties(_ref, _excluded);
if (typeof option === 'string') {
return /*#__PURE__*/React.createElement(Shape, _extends({
option: /*#__PURE__*/React.createElement(Symbols, _extends({
type: option
}, props)),
isActive: isActive,
shapeType: "symbols"
}, props));
}
return /*#__PURE__*/React.createElement(Shape, _extends({
option: option,
isActive: isActive,
shapeType: "symbols"
}, props));
}

14
node_modules/recharts/es6/util/ShallowEqual.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export function shallowEqual(a, b) {
/* eslint-disable no-restricted-syntax */
for (var key in a) {
if ({}.hasOwnProperty.call(a, key) && (!{}.hasOwnProperty.call(b, key) || a[key] !== b[key])) {
return false;
}
}
for (var _key in b) {
if ({}.hasOwnProperty.call(b, _key) && !{}.hasOwnProperty.call(a, _key)) {
return false;
}
}
return true;
}

38
node_modules/recharts/es6/util/TickUtils.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
import { getAngledRectangleWidth } from './CartesianUtils';
import { getEveryNthWithCondition } from './getEveryNthWithCondition';
export function getAngledTickWidth(contentSize, unitSize, angle) {
var size = {
width: contentSize.width + unitSize.width,
height: contentSize.height + unitSize.height
};
return getAngledRectangleWidth(size, angle);
}
export function getTickBoundaries(viewBox, sign, sizeKey) {
var isWidth = sizeKey === 'width';
var x = viewBox.x,
y = viewBox.y,
width = viewBox.width,
height = viewBox.height;
if (sign === 1) {
return {
start: isWidth ? x : y,
end: isWidth ? x + width : y + height
};
}
return {
start: isWidth ? x + width : y + height,
end: isWidth ? x : y
};
}
export function isVisible(sign, tickPosition, getSize, start, end) {
/* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating
* the tick's size. */
if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {
return false;
}
var size = getSize();
return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
}
export function getNumberIntervalTicks(ticks, interval) {
return getEveryNthWithCondition(ticks, interval + 1);
}

18
node_modules/recharts/es6/util/calculateViewBox.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import memoize from 'lodash/memoize';
/**
* This is memoized because the viewBox is unlikely to change often
* - but because it is computed from offset, any change to it would re-render all children.
*
* And because we have many readers of the viewBox, and update it only rarely,
* then let's optimize with memoization.
*/
export var calculateViewBox = memoize(function (offset) {
return {
x: offset.left,
y: offset.top,
width: offset.width,
height: offset.height
};
}, function (offset) {
return ['l', offset.left, 't', offset.top, 'w', offset.width, 'h', offset.height].join('');
});

View File

@@ -0,0 +1,39 @@
import { polarToCartesian } from '../PolarUtils';
import { getRadialCursorPoints } from './getRadialCursorPoints';
export function getCursorPoints(layout, activeCoordinate, offset) {
var x1, y1, x2, y2;
if (layout === 'horizontal') {
x1 = activeCoordinate.x;
x2 = x1;
y1 = offset.top;
y2 = offset.top + offset.height;
} else if (layout === 'vertical') {
y1 = activeCoordinate.y;
y2 = y1;
x1 = offset.left;
x2 = offset.left + offset.width;
} else if (activeCoordinate.cx != null && activeCoordinate.cy != null) {
if (layout === 'centric') {
var cx = activeCoordinate.cx,
cy = activeCoordinate.cy,
innerRadius = activeCoordinate.innerRadius,
outerRadius = activeCoordinate.outerRadius,
angle = activeCoordinate.angle;
var innerPoint = polarToCartesian(cx, cy, innerRadius, angle);
var outerPoint = polarToCartesian(cx, cy, outerRadius, angle);
x1 = innerPoint.x;
y1 = innerPoint.y;
x2 = outerPoint.x;
y2 = outerPoint.y;
} else {
return getRadialCursorPoints(activeCoordinate);
}
}
return [{
x: x1,
y: y1
}, {
x: x2,
y: y2
}];
}

View File

@@ -0,0 +1,11 @@
export function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) {
var halfSize = tooltipAxisBandSize / 2;
return {
stroke: 'none',
fill: '#ccc',
x: layout === 'horizontal' ? activeCoordinate.x - halfSize : offset.left + 0.5,
y: layout === 'horizontal' ? offset.top + 0.5 : activeCoordinate.y - halfSize,
width: layout === 'horizontal' ? tooltipAxisBandSize : offset.width - 1,
height: layout === 'horizontal' ? offset.height - 1 : tooltipAxisBandSize
};
}

View File

@@ -0,0 +1,23 @@
import { polarToCartesian } from '../PolarUtils';
/**
* Only applicable for radial layouts
* @param {Object} activeCoordinate ChartCoordinate
* @returns {Object} RadialCursorPoints
*/
export function getRadialCursorPoints(activeCoordinate) {
var cx = activeCoordinate.cx,
cy = activeCoordinate.cy,
radius = activeCoordinate.radius,
startAngle = activeCoordinate.startAngle,
endAngle = activeCoordinate.endAngle;
var startPoint = polarToCartesian(cx, cy, radius, startAngle);
var endPoint = polarToCartesian(cx, cy, radius, endAngle);
return {
points: [startPoint, endPoint],
cx: cx,
cy: cy,
radius: radius,
startAngle: startAngle,
endAngle: endAngle
};
}

View File

@@ -0,0 +1,26 @@
/**
* Given an array and a number N, return a new array which contains every nTh
* element of the input array. For n below 1, an empty array is returned.
* If isValid is provided, all candidates must suffice the condition, else undefined is returned.
* @param {T[]} array An input array.
* @param {integer} n A number
* @param {Function} isValid A function to evaluate a candidate form the array
* @returns {T[]} The result array of the same type as the input array.
*/
export function getEveryNthWithCondition(array, n, isValid) {
if (n < 1) {
return [];
}
if (n === 1 && isValid === undefined) {
return array;
}
var result = [];
for (var i = 0; i < array.length; i += n) {
if (isValid === undefined || isValid(array[i]) === true) {
result.push(array[i]);
} else {
return undefined;
}
}
return result;
}

59
node_modules/recharts/es6/util/getLegendProps.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import { Legend } from '../component/Legend';
import { getMainColorOfGraphicItem } from './ChartUtils';
import { findChildByType } from './ReactUtils';
export var getLegendProps = function getLegendProps(_ref) {
var children = _ref.children,
formattedGraphicalItems = _ref.formattedGraphicalItems,
legendWidth = _ref.legendWidth,
legendContent = _ref.legendContent;
var legendItem = findChildByType(children, Legend);
if (!legendItem) {
return null;
}
var legendData;
if (legendItem.props && legendItem.props.payload) {
legendData = legendItem.props && legendItem.props.payload;
} else if (legendContent === 'children') {
legendData = (formattedGraphicalItems || []).reduce(function (result, _ref2) {
var item = _ref2.item,
props = _ref2.props;
var data = props.sectors || props.data || [];
return result.concat(data.map(function (entry) {
return {
type: legendItem.props.iconType || item.props.legendType,
value: entry.name,
color: entry.fill,
payload: entry
};
}));
}, []);
} else {
legendData = (formattedGraphicalItems || []).map(function (_ref3) {
var item = _ref3.item;
var _item$props = item.props,
dataKey = _item$props.dataKey,
name = _item$props.name,
legendType = _item$props.legendType,
hide = _item$props.hide;
return {
inactive: hide,
dataKey: dataKey,
type: legendItem.props.iconType || legendType || 'square',
color: getMainColorOfGraphicItem(item),
value: name || dataKey,
// @ts-expect-error property strokeDasharray is required in Payload but optional in props
payload: item.props
};
});
}
return _objectSpread(_objectSpread(_objectSpread({}, legendItem.props), Legend.getWithHeight(legendItem, legendWidth)), {}, {
payload: legendData,
item: legendItem
});
};

View File

@@ -0,0 +1,23 @@
import { isNumber } from './DataUtils';
/**
* Takes a domain and user props to determine whether he provided the domain via props or if we need to calculate it.
* @param {AxisDomain} domain The potential domain from props
* @param {Boolean} allowDataOverflow from props
* @param {String} axisType from props
* @returns {Boolean} `true` if domain is specified by user
*/
export function isDomainSpecifiedByUser(domain, allowDataOverflow, axisType) {
if (axisType === 'number' && allowDataOverflow === true && Array.isArray(domain)) {
var domainStart = domain === null || domain === void 0 ? void 0 : domain[0];
var domainEnd = domain === null || domain === void 0 ? void 0 : domain[1];
/*
* The `isNumber` check is needed because the user could also provide strings like "dataMin" via the domain props.
* In such case, we have to compute the domain from the data.
*/
if (!!domainStart && !!domainEnd && isNumber(domainStart) && isNumber(domainEnd)) {
return true;
}
}
return false;
}

View File

@@ -0,0 +1,20 @@
import uniqBy from 'lodash/uniqBy';
import isFunction from 'lodash/isFunction';
/**
* This is configuration option that decides how to filter for unique values only:
*
* - `false` means "no filter"
* - `true` means "use recharts default filter"
* - function means "use return of this function as the default key"
*/
export function getUniqPayload(payload, option, defaultUniqBy) {
if (option === true) {
return uniqBy(payload, defaultUniqBy);
}
if (isFunction(option)) {
return uniqBy(payload, option);
}
return payload;
}

107
node_modules/recharts/es6/util/tooltip/translate.js generated vendored Normal file
View File

@@ -0,0 +1,107 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import clsx from 'clsx';
import { isNumber } from '../DataUtils';
var CSS_CLASS_PREFIX = 'recharts-tooltip-wrapper';
var TOOLTIP_HIDDEN = {
visibility: 'hidden'
};
export function getTooltipCSSClassName(_ref) {
var coordinate = _ref.coordinate,
translateX = _ref.translateX,
translateY = _ref.translateY;
return clsx(CSS_CLASS_PREFIX, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(CSS_CLASS_PREFIX, "-right"), isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX >= coordinate.x), "".concat(CSS_CLASS_PREFIX, "-left"), isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX < coordinate.x), "".concat(CSS_CLASS_PREFIX, "-bottom"), isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY >= coordinate.y), "".concat(CSS_CLASS_PREFIX, "-top"), isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY < coordinate.y));
}
export function getTooltipTranslateXY(_ref2) {
var allowEscapeViewBox = _ref2.allowEscapeViewBox,
coordinate = _ref2.coordinate,
key = _ref2.key,
offsetTopLeft = _ref2.offsetTopLeft,
position = _ref2.position,
reverseDirection = _ref2.reverseDirection,
tooltipDimension = _ref2.tooltipDimension,
viewBox = _ref2.viewBox,
viewBoxDimension = _ref2.viewBoxDimension;
if (position && isNumber(position[key])) {
return position[key];
}
var negative = coordinate[key] - tooltipDimension - offsetTopLeft;
var positive = coordinate[key] + offsetTopLeft;
if (allowEscapeViewBox[key]) {
return reverseDirection[key] ? negative : positive;
}
if (reverseDirection[key]) {
var _tooltipBoundary = negative;
var _viewBoxBoundary = viewBox[key];
if (_tooltipBoundary < _viewBoxBoundary) {
return Math.max(positive, viewBox[key]);
}
return Math.max(negative, viewBox[key]);
}
var tooltipBoundary = positive + tooltipDimension;
var viewBoxBoundary = viewBox[key] + viewBoxDimension;
if (tooltipBoundary > viewBoxBoundary) {
return Math.max(negative, viewBox[key]);
}
return Math.max(positive, viewBox[key]);
}
export function getTransformStyle(_ref3) {
var translateX = _ref3.translateX,
translateY = _ref3.translateY,
useTranslate3d = _ref3.useTranslate3d;
return {
transform: useTranslate3d ? "translate3d(".concat(translateX, "px, ").concat(translateY, "px, 0)") : "translate(".concat(translateX, "px, ").concat(translateY, "px)")
};
}
export function getTooltipTranslate(_ref4) {
var allowEscapeViewBox = _ref4.allowEscapeViewBox,
coordinate = _ref4.coordinate,
offsetTopLeft = _ref4.offsetTopLeft,
position = _ref4.position,
reverseDirection = _ref4.reverseDirection,
tooltipBox = _ref4.tooltipBox,
useTranslate3d = _ref4.useTranslate3d,
viewBox = _ref4.viewBox;
var cssProperties, translateX, translateY;
if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) {
translateX = getTooltipTranslateXY({
allowEscapeViewBox: allowEscapeViewBox,
coordinate: coordinate,
key: 'x',
offsetTopLeft: offsetTopLeft,
position: position,
reverseDirection: reverseDirection,
tooltipDimension: tooltipBox.width,
viewBox: viewBox,
viewBoxDimension: viewBox.width
});
translateY = getTooltipTranslateXY({
allowEscapeViewBox: allowEscapeViewBox,
coordinate: coordinate,
key: 'y',
offsetTopLeft: offsetTopLeft,
position: position,
reverseDirection: reverseDirection,
tooltipDimension: tooltipBox.height,
viewBox: viewBox,
viewBoxDimension: viewBox.height
});
cssProperties = getTransformStyle({
translateX: translateX,
translateY: translateY,
useTranslate3d: useTranslate3d
});
} else {
cssProperties = TOOLTIP_HIDDEN;
}
return {
cssProperties: cssProperties,
cssClasses: getTooltipCSSClassName({
translateX: translateX,
translateY: translateY,
coordinate: coordinate
})
};
}

126
node_modules/recharts/es6/util/types.js generated vendored Normal file
View File

@@ -0,0 +1,126 @@
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
import { isValidElement } from 'react';
import isObject from 'lodash/isObject';
/**
* Determines how values are stacked:
*
* - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap.
* - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle.
* - `wiggle` and `silhouette` tries to keep the chart centered.
* - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives.
* - `positive` ignores all negative values, and then behaves like \`none\`.
*
* Also see https://d3js.org/d3-shape/stack#stack-offsets
* (note that the `diverging` offset in d3 is named `sign` in recharts)
*/
//
// Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props.
//
var SVGContainerPropKeys = ['viewBox', 'children'];
export var SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style',
/*
* removed 'type' SVGElementPropKey because we do not currently use any SVG elements
* that can use it and it conflicts with the recharts prop 'type'
* https://github.com/recharts/recharts/pull/3327
* https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type
*/
// 'type',
'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle'];
var PolyElementKeys = ['points', 'pathLength'];
/** svg element types that have specific attribute filtration requirements */
/** map of svg element types to unique svg attributes that belong to that element */
export var FilteredElementKeyMap = {
svg: SVGContainerPropKeys,
polygon: PolyElementKeys,
polyline: PolyElementKeys
};
export var EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
/** The type of easing function to use for animations */
/** Specifies the duration of animation, the unit of this option is ms. */
/** the offset of a chart, which define the blank space all around */
/**
* The domain of axis.
* This is the definition
*
* Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis.
* Categorical domain is defined as array of all possible values.
*
* Can be specified in many ways:
* - array of numbers
* - with special strings like 'dataMin' and 'dataMax'
* - with special string math like 'dataMin - 100'
* - with keyword 'auto'
* - or a function
* - array of functions
* - or a combination of the above
*/
/**
* NumberDomain is an evaluated {@link AxisDomain}.
* Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number.
* This is after all the keywords and functions were evaluated and what is left is [min, max].
*
* Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible.
*
* There are also `category` axes that have different things than numbers in their domain.
*/
/** The props definition of base axis */
/** Defines how ticks are placed and whether / how tick collisions are handled.
* 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown.
* 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown.
* 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks are always shown.
* 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision.
*/
export var adaptEventHandlers = function adaptEventHandlers(props, newHandler) {
if (!props || typeof props === 'function' || typeof props === 'boolean') {
return null;
}
var inputProps = props;
if ( /*#__PURE__*/isValidElement(props)) {
inputProps = props.props;
}
if (!isObject(inputProps)) {
return null;
}
var out = {};
Object.keys(inputProps).forEach(function (key) {
if (EventKeys.includes(key)) {
out[key] = newHandler || function (e) {
return inputProps[key](inputProps, e);
};
}
});
return out;
};
var getEventHandlerOfChild = function getEventHandlerOfChild(originalHandler, data, index) {
return function (e) {
originalHandler(data, index, e);
return null;
};
};
export var adaptEventsOfChild = function adaptEventsOfChild(props, data, index) {
if (!isObject(props) || _typeof(props) !== 'object') {
return null;
}
var out = null;
Object.keys(props).forEach(function (key) {
var item = props[key];
if (EventKeys.includes(key) && typeof item === 'function') {
if (!out) out = {};
out[key] = getEventHandlerOfChild(item, data, index);
}
});
return out;
};