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

8
node_modules/recharts/es6/component/Cell.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* @fileOverview Cross
*/
export var Cell = function Cell(_props) {
return null;
};
Cell.displayName = 'Cell';

78
node_modules/recharts/es6/component/Cursor.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
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 { cloneElement, createElement, isValidElement } from 'react';
import clsx from 'clsx';
import { Curve } from '../shape/Curve';
import { Cross } from '../shape/Cross';
import { getCursorRectangle } from '../util/cursor/getCursorRectangle';
import { Rectangle } from '../shape/Rectangle';
import { getRadialCursorPoints } from '../util/cursor/getRadialCursorPoints';
import { Sector } from '../shape/Sector';
import { getCursorPoints } from '../util/cursor/getCursorPoints';
import { filterProps } from '../util/ReactUtils';
/*
* Cursor is the background, or a highlight,
* that shows when user mouses over or activates
* an area.
*
* It usually shows together with a tooltip
* to emphasise which part of the chart does the tooltip refer to.
*/
export function Cursor(props) {
var element = props.element,
tooltipEventType = props.tooltipEventType,
isActive = props.isActive,
activeCoordinate = props.activeCoordinate,
activePayload = props.activePayload,
offset = props.offset,
activeTooltipIndex = props.activeTooltipIndex,
tooltipAxisBandSize = props.tooltipAxisBandSize,
layout = props.layout,
chartName = props.chartName;
if (!element || !element.props.cursor || !isActive || !activeCoordinate || chartName !== 'ScatterChart' && tooltipEventType !== 'axis') {
return null;
}
var restProps;
var cursorComp = Curve;
if (chartName === 'ScatterChart') {
restProps = activeCoordinate;
cursorComp = Cross;
} else if (chartName === 'BarChart') {
restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize);
cursorComp = Rectangle;
} else if (layout === 'radial') {
var _getRadialCursorPoint = getRadialCursorPoints(activeCoordinate),
cx = _getRadialCursorPoint.cx,
cy = _getRadialCursorPoint.cy,
radius = _getRadialCursorPoint.radius,
startAngle = _getRadialCursorPoint.startAngle,
endAngle = _getRadialCursorPoint.endAngle;
restProps = {
cx: cx,
cy: cy,
startAngle: startAngle,
endAngle: endAngle,
innerRadius: radius,
outerRadius: radius
};
cursorComp = Sector;
} else {
restProps = {
points: getCursorPoints(layout, activeCoordinate, offset)
};
cursorComp = Curve;
}
var cursorProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
stroke: '#ccc',
pointerEvents: 'none'
}, offset), restProps), filterProps(element.props.cursor, false)), {}, {
payload: activePayload,
payloadIndex: activeTooltipIndex,
className: clsx('recharts-tooltip-cursor', element.props.cursor.className)
});
return /*#__PURE__*/isValidElement(element.props.cursor) ? /*#__PURE__*/cloneElement(element.props.cursor, cursorProps) : /*#__PURE__*/createElement(cursorComp, cursorProps);
}

31
node_modules/recharts/es6/component/Customized.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
var _excluded = ["component"];
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; }
/**
* @fileOverview Customized
*/
import React, { isValidElement, cloneElement, createElement } from 'react';
import isFunction from 'lodash/isFunction';
import { Layer } from '../container/Layer';
import { warn } from '../util/LogUtils';
/**
* custom svg elements by rechart instance props and state.
* @returns {Object} svg elements
*/
export function Customized(_ref) {
var component = _ref.component,
props = _objectWithoutProperties(_ref, _excluded);
var child;
if ( /*#__PURE__*/isValidElement(component)) {
child = /*#__PURE__*/cloneElement(component, props);
} else if (isFunction(component)) {
child = /*#__PURE__*/createElement(component, props);
} else {
warn(false, "Customized's props `component` must be React.element or Function, but got %s.", _typeof(component));
}
return /*#__PURE__*/React.createElement(Layer, {
className: "recharts-customized-wrapper"
}, child);
}
Customized.displayName = 'Customized';

View File

@@ -0,0 +1,186 @@
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 _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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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); }
/**
* @fileOverview Default Legend Content
*/
import React, { PureComponent } from 'react';
import isFunction from 'lodash/isFunction';
import clsx from 'clsx';
import { warn } from '../util/LogUtils';
import { Surface } from '../container/Surface';
import { Symbols } from '../shape/Symbols';
import { adaptEventsOfChild } from '../util/types';
var SIZE = 32;
export var DefaultLegendContent = /*#__PURE__*/function (_PureComponent) {
_inherits(DefaultLegendContent, _PureComponent);
function DefaultLegendContent() {
_classCallCheck(this, DefaultLegendContent);
return _callSuper(this, DefaultLegendContent, arguments);
}
_createClass(DefaultLegendContent, [{
key: "renderIcon",
value:
/**
* Render the path of icon
* @param {Object} data Data of each legend item
* @return {String} Path element
*/
function renderIcon(data) {
var inactiveColor = this.props.inactiveColor;
var halfSize = SIZE / 2;
var sixthSize = SIZE / 6;
var thirdSize = SIZE / 3;
var color = data.inactive ? inactiveColor : data.color;
if (data.type === 'plainline') {
return /*#__PURE__*/React.createElement("line", {
strokeWidth: 4,
fill: "none",
stroke: color,
strokeDasharray: data.payload.strokeDasharray,
x1: 0,
y1: halfSize,
x2: SIZE,
y2: halfSize,
className: "recharts-legend-icon"
});
}
if (data.type === 'line') {
return /*#__PURE__*/React.createElement("path", {
strokeWidth: 4,
fill: "none",
stroke: color,
d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
className: "recharts-legend-icon"
});
}
if (data.type === 'rect') {
return /*#__PURE__*/React.createElement("path", {
stroke: "none",
fill: color,
d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
className: "recharts-legend-icon"
});
}
if ( /*#__PURE__*/React.isValidElement(data.legendIcon)) {
var iconProps = _objectSpread({}, data);
delete iconProps.legendIcon;
return /*#__PURE__*/React.cloneElement(data.legendIcon, iconProps);
}
return /*#__PURE__*/React.createElement(Symbols, {
fill: color,
cx: halfSize,
cy: halfSize,
size: SIZE,
sizeType: "diameter",
type: data.type
});
}
/**
* Draw items of legend
* @return {ReactElement} Items
*/
}, {
key: "renderItems",
value: function renderItems() {
var _this = this;
var _this$props = this.props,
payload = _this$props.payload,
iconSize = _this$props.iconSize,
layout = _this$props.layout,
formatter = _this$props.formatter,
inactiveColor = _this$props.inactiveColor;
var viewBox = {
x: 0,
y: 0,
width: SIZE,
height: SIZE
};
var itemStyle = {
display: layout === 'horizontal' ? 'inline-block' : 'block',
marginRight: 10
};
var svgStyle = {
display: 'inline-block',
verticalAlign: 'middle',
marginRight: 4
};
return payload.map(function (entry, i) {
var finalFormatter = entry.formatter || formatter;
var className = clsx(_defineProperty(_defineProperty({
'recharts-legend-item': true
}, "legend-item-".concat(i), true), "inactive", entry.inactive));
if (entry.type === 'none') {
return null;
}
// Do not render entry.value as functions. Always require static string properties.
var entryValue = !isFunction(entry.value) ? entry.value : null;
warn(!isFunction(entry.value), "The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name=\"Name of my Data\"/>" // eslint-disable-line max-len
);
var color = entry.inactive ? inactiveColor : entry.color;
return /*#__PURE__*/React.createElement("li", _extends({
className: className,
style: itemStyle
// eslint-disable-next-line react/no-array-index-key
,
key: "legend-item-".concat(i)
}, adaptEventsOfChild(_this.props, entry, i)), /*#__PURE__*/React.createElement(Surface, {
width: iconSize,
height: iconSize,
viewBox: viewBox,
style: svgStyle
}, _this.renderIcon(entry)), /*#__PURE__*/React.createElement("span", {
className: "recharts-legend-item-text",
style: {
color: color
}
}, finalFormatter ? finalFormatter(entryValue, entry, i) : entryValue));
});
}
}, {
key: "render",
value: function render() {
var _this$props2 = this.props,
payload = _this$props2.payload,
layout = _this$props2.layout,
align = _this$props2.align;
if (!payload || !payload.length) {
return null;
}
var finalStyle = {
padding: 0,
margin: 0,
textAlign: layout === 'horizontal' ? align : 'left'
};
return /*#__PURE__*/React.createElement("ul", {
className: "recharts-default-legend",
style: finalStyle
}, this.renderItems());
}
}]);
return DefaultLegendContent;
}(PureComponent);
_defineProperty(DefaultLegendContent, "displayName", 'Legend');
_defineProperty(DefaultLegendContent, "defaultProps", {
iconSize: 14,
layout: 'horizontal',
align: 'center',
verticalAlign: 'middle',
inactiveColor: '#ccc'
});

View File

@@ -0,0 +1,128 @@
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 _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 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); }
/**
* @fileOverview Default Tooltip Content
*/
import React from 'react';
import sortBy from 'lodash/sortBy';
import isNil from 'lodash/isNil';
import clsx from 'clsx';
import { isNumOrStr } from '../util/DataUtils';
function defaultFormatter(value) {
return Array.isArray(value) && isNumOrStr(value[0]) && isNumOrStr(value[1]) ? value.join(' ~ ') : value;
}
export var DefaultTooltipContent = function DefaultTooltipContent(props) {
var _props$separator = props.separator,
separator = _props$separator === void 0 ? ' : ' : _props$separator,
_props$contentStyle = props.contentStyle,
contentStyle = _props$contentStyle === void 0 ? {} : _props$contentStyle,
_props$itemStyle = props.itemStyle,
itemStyle = _props$itemStyle === void 0 ? {} : _props$itemStyle,
_props$labelStyle = props.labelStyle,
labelStyle = _props$labelStyle === void 0 ? {} : _props$labelStyle,
payload = props.payload,
formatter = props.formatter,
itemSorter = props.itemSorter,
wrapperClassName = props.wrapperClassName,
labelClassName = props.labelClassName,
label = props.label,
labelFormatter = props.labelFormatter,
_props$accessibilityL = props.accessibilityLayer,
accessibilityLayer = _props$accessibilityL === void 0 ? false : _props$accessibilityL;
var renderContent = function renderContent() {
if (payload && payload.length) {
var listStyle = {
padding: 0,
margin: 0
};
var items = (itemSorter ? sortBy(payload, itemSorter) : payload).map(function (entry, i) {
if (entry.type === 'none') {
return null;
}
var finalItemStyle = _objectSpread({
display: 'block',
paddingTop: 4,
paddingBottom: 4,
color: entry.color || '#000'
}, itemStyle);
var finalFormatter = entry.formatter || formatter || defaultFormatter;
var value = entry.value,
name = entry.name;
var finalValue = value;
var finalName = name;
if (finalFormatter && finalValue != null && finalName != null) {
var formatted = finalFormatter(value, name, entry, i, payload);
if (Array.isArray(formatted)) {
var _formatted = _slicedToArray(formatted, 2);
finalValue = _formatted[0];
finalName = _formatted[1];
} else {
finalValue = formatted;
}
}
return (
/*#__PURE__*/
// eslint-disable-next-line react/no-array-index-key
React.createElement("li", {
className: "recharts-tooltip-item",
key: "tooltip-item-".concat(i),
style: finalItemStyle
}, isNumOrStr(finalName) ? /*#__PURE__*/React.createElement("span", {
className: "recharts-tooltip-item-name"
}, finalName) : null, isNumOrStr(finalName) ? /*#__PURE__*/React.createElement("span", {
className: "recharts-tooltip-item-separator"
}, separator) : null, /*#__PURE__*/React.createElement("span", {
className: "recharts-tooltip-item-value"
}, finalValue), /*#__PURE__*/React.createElement("span", {
className: "recharts-tooltip-item-unit"
}, entry.unit || ''))
);
});
return /*#__PURE__*/React.createElement("ul", {
className: "recharts-tooltip-item-list",
style: listStyle
}, items);
}
return null;
};
var finalStyle = _objectSpread({
margin: 0,
padding: 10,
backgroundColor: '#fff',
border: '1px solid #ccc',
whiteSpace: 'nowrap'
}, contentStyle);
var finalLabelStyle = _objectSpread({
margin: 0
}, labelStyle);
var hasLabel = !isNil(label);
var finalLabel = hasLabel ? label : '';
var wrapperCN = clsx('recharts-default-tooltip', wrapperClassName);
var labelCN = clsx('recharts-tooltip-label', labelClassName);
if (hasLabel && labelFormatter && payload !== undefined && payload !== null) {
finalLabel = labelFormatter(label, payload);
}
var accessibilityAttributes = accessibilityLayer ? {
role: 'status',
'aria-live': 'assertive'
} : {};
return /*#__PURE__*/React.createElement("div", _extends({
className: wrapperCN,
style: finalStyle
}, accessibilityAttributes), /*#__PURE__*/React.createElement("p", {
className: labelCN,
style: finalLabelStyle
}, /*#__PURE__*/React.isValidElement(finalLabel) ? finalLabel : "".concat(finalLabel)), renderContent());
};

469
node_modules/recharts/es6/component/Label.js generated vendored Normal file
View File

@@ -0,0 +1,469 @@
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); }
var _excluded = ["offset"];
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; }
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); }
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); }
import React, { cloneElement, isValidElement, createElement } from 'react';
import isNil from 'lodash/isNil';
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import clsx from 'clsx';
import { Text } from './Text';
import { findAllByType, filterProps } from '../util/ReactUtils';
import { isNumOrStr, isNumber, isPercent, getPercentValue, uniqueId, mathSign } from '../util/DataUtils';
import { polarToCartesian } from '../util/PolarUtils';
var getLabel = function getLabel(props) {
var value = props.value,
formatter = props.formatter;
var label = isNil(props.children) ? value : props.children;
if (isFunction(formatter)) {
return formatter(label);
}
return label;
};
var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {
var sign = mathSign(endAngle - startAngle);
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
return sign * deltaAngle;
};
var renderRadialLabel = function renderRadialLabel(labelProps, label, attrs) {
var position = labelProps.position,
viewBox = labelProps.viewBox,
offset = labelProps.offset,
className = labelProps.className;
var _ref = viewBox,
cx = _ref.cx,
cy = _ref.cy,
innerRadius = _ref.innerRadius,
outerRadius = _ref.outerRadius,
startAngle = _ref.startAngle,
endAngle = _ref.endAngle,
clockWise = _ref.clockWise;
var radius = (innerRadius + outerRadius) / 2;
var deltaAngle = getDeltaAngle(startAngle, endAngle);
var sign = deltaAngle >= 0 ? 1 : -1;
var labelAngle, direction;
if (position === 'insideStart') {
labelAngle = startAngle + sign * offset;
direction = clockWise;
} else if (position === 'insideEnd') {
labelAngle = endAngle - sign * offset;
direction = !clockWise;
} else if (position === 'end') {
labelAngle = endAngle + sign * offset;
direction = clockWise;
}
direction = deltaAngle <= 0 ? direction : !direction;
var startPoint = polarToCartesian(cx, cy, radius, labelAngle);
var endPoint = polarToCartesian(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359);
var path = "M".concat(startPoint.x, ",").concat(startPoint.y, "\n A").concat(radius, ",").concat(radius, ",0,1,").concat(direction ? 0 : 1, ",\n ").concat(endPoint.x, ",").concat(endPoint.y);
var id = isNil(labelProps.id) ? uniqueId('recharts-radial-line-') : labelProps.id;
return /*#__PURE__*/React.createElement("text", _extends({}, attrs, {
dominantBaseline: "central",
className: clsx('recharts-radial-bar-label', className)
}), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("path", {
id: id,
d: path
})), /*#__PURE__*/React.createElement("textPath", {
xlinkHref: "#".concat(id)
}, label));
};
var getAttrsOfPolarLabel = function getAttrsOfPolarLabel(props) {
var viewBox = props.viewBox,
offset = props.offset,
position = props.position;
var _ref2 = viewBox,
cx = _ref2.cx,
cy = _ref2.cy,
innerRadius = _ref2.innerRadius,
outerRadius = _ref2.outerRadius,
startAngle = _ref2.startAngle,
endAngle = _ref2.endAngle;
var midAngle = (startAngle + endAngle) / 2;
if (position === 'outside') {
var _polarToCartesian = polarToCartesian(cx, cy, outerRadius + offset, midAngle),
_x = _polarToCartesian.x,
_y = _polarToCartesian.y;
return {
x: _x,
y: _y,
textAnchor: _x >= cx ? 'start' : 'end',
verticalAnchor: 'middle'
};
}
if (position === 'center') {
return {
x: cx,
y: cy,
textAnchor: 'middle',
verticalAnchor: 'middle'
};
}
if (position === 'centerTop') {
return {
x: cx,
y: cy,
textAnchor: 'middle',
verticalAnchor: 'start'
};
}
if (position === 'centerBottom') {
return {
x: cx,
y: cy,
textAnchor: 'middle',
verticalAnchor: 'end'
};
}
var r = (innerRadius + outerRadius) / 2;
var _polarToCartesian2 = polarToCartesian(cx, cy, r, midAngle),
x = _polarToCartesian2.x,
y = _polarToCartesian2.y;
return {
x: x,
y: y,
textAnchor: 'middle',
verticalAnchor: 'middle'
};
};
var getAttrsOfCartesianLabel = function getAttrsOfCartesianLabel(props) {
var viewBox = props.viewBox,
parentViewBox = props.parentViewBox,
offset = props.offset,
position = props.position;
var _ref3 = viewBox,
x = _ref3.x,
y = _ref3.y,
width = _ref3.width,
height = _ref3.height;
// Define vertical offsets and position inverts based on the value being positive or negative
var verticalSign = height >= 0 ? 1 : -1;
var verticalOffset = verticalSign * offset;
var verticalEnd = verticalSign > 0 ? 'end' : 'start';
var verticalStart = verticalSign > 0 ? 'start' : 'end';
// Define horizontal offsets and position inverts based on the value being positive or negative
var horizontalSign = width >= 0 ? 1 : -1;
var horizontalOffset = horizontalSign * offset;
var horizontalEnd = horizontalSign > 0 ? 'end' : 'start';
var horizontalStart = horizontalSign > 0 ? 'start' : 'end';
if (position === 'top') {
var attrs = {
x: x + width / 2,
y: y - verticalSign * offset,
textAnchor: 'middle',
verticalAnchor: verticalEnd
};
return _objectSpread(_objectSpread({}, attrs), parentViewBox ? {
height: Math.max(y - parentViewBox.y, 0),
width: width
} : {});
}
if (position === 'bottom') {
var _attrs = {
x: x + width / 2,
y: y + height + verticalOffset,
textAnchor: 'middle',
verticalAnchor: verticalStart
};
return _objectSpread(_objectSpread({}, _attrs), parentViewBox ? {
height: Math.max(parentViewBox.y + parentViewBox.height - (y + height), 0),
width: width
} : {});
}
if (position === 'left') {
var _attrs2 = {
x: x - horizontalOffset,
y: y + height / 2,
textAnchor: horizontalEnd,
verticalAnchor: 'middle'
};
return _objectSpread(_objectSpread({}, _attrs2), parentViewBox ? {
width: Math.max(_attrs2.x - parentViewBox.x, 0),
height: height
} : {});
}
if (position === 'right') {
var _attrs3 = {
x: x + width + horizontalOffset,
y: y + height / 2,
textAnchor: horizontalStart,
verticalAnchor: 'middle'
};
return _objectSpread(_objectSpread({}, _attrs3), parentViewBox ? {
width: Math.max(parentViewBox.x + parentViewBox.width - _attrs3.x, 0),
height: height
} : {});
}
var sizeAttrs = parentViewBox ? {
width: width,
height: height
} : {};
if (position === 'insideLeft') {
return _objectSpread({
x: x + horizontalOffset,
y: y + height / 2,
textAnchor: horizontalStart,
verticalAnchor: 'middle'
}, sizeAttrs);
}
if (position === 'insideRight') {
return _objectSpread({
x: x + width - horizontalOffset,
y: y + height / 2,
textAnchor: horizontalEnd,
verticalAnchor: 'middle'
}, sizeAttrs);
}
if (position === 'insideTop') {
return _objectSpread({
x: x + width / 2,
y: y + verticalOffset,
textAnchor: 'middle',
verticalAnchor: verticalStart
}, sizeAttrs);
}
if (position === 'insideBottom') {
return _objectSpread({
x: x + width / 2,
y: y + height - verticalOffset,
textAnchor: 'middle',
verticalAnchor: verticalEnd
}, sizeAttrs);
}
if (position === 'insideTopLeft') {
return _objectSpread({
x: x + horizontalOffset,
y: y + verticalOffset,
textAnchor: horizontalStart,
verticalAnchor: verticalStart
}, sizeAttrs);
}
if (position === 'insideTopRight') {
return _objectSpread({
x: x + width - horizontalOffset,
y: y + verticalOffset,
textAnchor: horizontalEnd,
verticalAnchor: verticalStart
}, sizeAttrs);
}
if (position === 'insideBottomLeft') {
return _objectSpread({
x: x + horizontalOffset,
y: y + height - verticalOffset,
textAnchor: horizontalStart,
verticalAnchor: verticalEnd
}, sizeAttrs);
}
if (position === 'insideBottomRight') {
return _objectSpread({
x: x + width - horizontalOffset,
y: y + height - verticalOffset,
textAnchor: horizontalEnd,
verticalAnchor: verticalEnd
}, sizeAttrs);
}
if (isObject(position) && (isNumber(position.x) || isPercent(position.x)) && (isNumber(position.y) || isPercent(position.y))) {
return _objectSpread({
x: x + getPercentValue(position.x, width),
y: y + getPercentValue(position.y, height),
textAnchor: 'end',
verticalAnchor: 'end'
}, sizeAttrs);
}
return _objectSpread({
x: x + width / 2,
y: y + height / 2,
textAnchor: 'middle',
verticalAnchor: 'middle'
}, sizeAttrs);
};
var isPolar = function isPolar(viewBox) {
return 'cx' in viewBox && isNumber(viewBox.cx);
};
export function Label(_ref4) {
var _ref4$offset = _ref4.offset,
offset = _ref4$offset === void 0 ? 5 : _ref4$offset,
restProps = _objectWithoutProperties(_ref4, _excluded);
var props = _objectSpread({
offset: offset
}, restProps);
var viewBox = props.viewBox,
position = props.position,
value = props.value,
children = props.children,
content = props.content,
_props$className = props.className,
className = _props$className === void 0 ? '' : _props$className,
textBreakAll = props.textBreakAll;
if (!viewBox || isNil(value) && isNil(children) && ! /*#__PURE__*/isValidElement(content) && !isFunction(content)) {
return null;
}
if ( /*#__PURE__*/isValidElement(content)) {
return /*#__PURE__*/cloneElement(content, props);
}
var label;
if (isFunction(content)) {
label = /*#__PURE__*/createElement(content, props);
if ( /*#__PURE__*/isValidElement(label)) {
return label;
}
} else {
label = getLabel(props);
}
var isPolarLabel = isPolar(viewBox);
var attrs = filterProps(props, true);
if (isPolarLabel && (position === 'insideStart' || position === 'insideEnd' || position === 'end')) {
return renderRadialLabel(props, label, attrs);
}
var positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props) : getAttrsOfCartesianLabel(props);
return /*#__PURE__*/React.createElement(Text, _extends({
className: clsx('recharts-label', className)
}, attrs, positionAttrs, {
breakAll: textBreakAll
}), label);
}
Label.displayName = 'Label';
var parseViewBox = function parseViewBox(props) {
var cx = props.cx,
cy = props.cy,
angle = props.angle,
startAngle = props.startAngle,
endAngle = props.endAngle,
r = props.r,
radius = props.radius,
innerRadius = props.innerRadius,
outerRadius = props.outerRadius,
x = props.x,
y = props.y,
top = props.top,
left = props.left,
width = props.width,
height = props.height,
clockWise = props.clockWise,
labelViewBox = props.labelViewBox;
if (labelViewBox) {
return labelViewBox;
}
if (isNumber(width) && isNumber(height)) {
if (isNumber(x) && isNumber(y)) {
return {
x: x,
y: y,
width: width,
height: height
};
}
if (isNumber(top) && isNumber(left)) {
return {
x: top,
y: left,
width: width,
height: height
};
}
}
if (isNumber(x) && isNumber(y)) {
return {
x: x,
y: y,
width: 0,
height: 0
};
}
if (isNumber(cx) && isNumber(cy)) {
return {
cx: cx,
cy: cy,
startAngle: startAngle || angle || 0,
endAngle: endAngle || angle || 0,
innerRadius: innerRadius || 0,
outerRadius: outerRadius || radius || r || 0,
clockWise: clockWise
};
}
if (props.viewBox) {
return props.viewBox;
}
return {};
};
var parseLabel = function parseLabel(label, viewBox) {
if (!label) {
return null;
}
if (label === true) {
return /*#__PURE__*/React.createElement(Label, {
key: "label-implicit",
viewBox: viewBox
});
}
if (isNumOrStr(label)) {
return /*#__PURE__*/React.createElement(Label, {
key: "label-implicit",
viewBox: viewBox,
value: label
});
}
if ( /*#__PURE__*/isValidElement(label)) {
if (label.type === Label) {
return /*#__PURE__*/cloneElement(label, {
key: 'label-implicit',
viewBox: viewBox
});
}
return /*#__PURE__*/React.createElement(Label, {
key: "label-implicit",
content: label,
viewBox: viewBox
});
}
if (isFunction(label)) {
return /*#__PURE__*/React.createElement(Label, {
key: "label-implicit",
content: label,
viewBox: viewBox
});
}
if (isObject(label)) {
return /*#__PURE__*/React.createElement(Label, _extends({
viewBox: viewBox
}, label, {
key: "label-implicit"
}));
}
return null;
};
var renderCallByParent = function renderCallByParent(parentProps, viewBox) {
var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {
return null;
}
var children = parentProps.children;
var parentViewBox = parseViewBox(parentProps);
var explicitChildren = findAllByType(children, Label).map(function (child, index) {
return /*#__PURE__*/cloneElement(child, {
viewBox: viewBox || parentViewBox,
// eslint-disable-next-line react/no-array-index-key
key: "label-".concat(index)
});
});
if (!checkPropsLabel) {
return explicitChildren;
}
var implicitLabel = parseLabel(parentProps.label, viewBox || parentViewBox);
return [implicitLabel].concat(_toConsumableArray(explicitChildren));
};
Label.parseViewBox = parseViewBox;
Label.renderCallByParent = renderCallByParent;

109
node_modules/recharts/es6/component/LabelList.js generated vendored Normal file
View File

@@ -0,0 +1,109 @@
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); }
var _excluded = ["valueAccessor"],
_excluded2 = ["data", "dataKey", "clockWise", "id", "textBreakAll"];
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; }
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, { cloneElement } from 'react';
import isNil from 'lodash/isNil';
import isObject from 'lodash/isObject';
import isFunction from 'lodash/isFunction';
import last from 'lodash/last';
import { Label } from './Label';
import { Layer } from '../container/Layer';
import { findAllByType, filterProps } from '../util/ReactUtils';
import { getValueByDataKey } from '../util/ChartUtils';
var defaultAccessor = function defaultAccessor(entry) {
return Array.isArray(entry.value) ? last(entry.value) : entry.value;
};
export function LabelList(_ref) {
var _ref$valueAccessor = _ref.valueAccessor,
valueAccessor = _ref$valueAccessor === void 0 ? defaultAccessor : _ref$valueAccessor,
restProps = _objectWithoutProperties(_ref, _excluded);
var data = restProps.data,
dataKey = restProps.dataKey,
clockWise = restProps.clockWise,
id = restProps.id,
textBreakAll = restProps.textBreakAll,
others = _objectWithoutProperties(restProps, _excluded2);
if (!data || !data.length) {
return null;
}
return /*#__PURE__*/React.createElement(Layer, {
className: "recharts-label-list"
}, data.map(function (entry, index) {
var value = isNil(dataKey) ? valueAccessor(entry, index) : getValueByDataKey(entry && entry.payload, dataKey);
var idProps = isNil(id) ? {} : {
id: "".concat(id, "-").concat(index)
};
return /*#__PURE__*/React.createElement(Label, _extends({}, filterProps(entry, true), others, idProps, {
parentViewBox: entry.parentViewBox,
value: value,
textBreakAll: textBreakAll,
viewBox: Label.parseViewBox(isNil(clockWise) ? entry : _objectSpread(_objectSpread({}, entry), {}, {
clockWise: clockWise
})),
key: "label-".concat(index) // eslint-disable-line react/no-array-index-key
,
index: index
}));
}));
}
LabelList.displayName = 'LabelList';
function parseLabelList(label, data) {
if (!label) {
return null;
}
if (label === true) {
return /*#__PURE__*/React.createElement(LabelList, {
key: "labelList-implicit",
data: data
});
}
if ( /*#__PURE__*/React.isValidElement(label) || isFunction(label)) {
return /*#__PURE__*/React.createElement(LabelList, {
key: "labelList-implicit",
data: data,
content: label
});
}
if (isObject(label)) {
return /*#__PURE__*/React.createElement(LabelList, _extends({
data: data
}, label, {
key: "labelList-implicit"
}));
}
return null;
}
function renderCallByParent(parentProps, data) {
var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {
return null;
}
var children = parentProps.children;
var explicitChildren = findAllByType(children, LabelList).map(function (child, index) {
return /*#__PURE__*/cloneElement(child, {
data: data,
// eslint-disable-next-line react/no-array-index-key
key: "labelList-".concat(index)
});
});
if (!checkPropsLabel) {
return explicitChildren;
}
var implicitLabelList = parseLabelList(parentProps.label, data);
return [implicitLabelList].concat(_toConsumableArray(explicitChildren));
}
LabelList.renderCallByParent = renderCallByParent;

202
node_modules/recharts/es6/component/Legend.js generated vendored Normal file
View File

@@ -0,0 +1,202 @@
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); }
var _excluded = ["ref"];
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 _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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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; }
/**
* @fileOverview Legend
*/
import React, { PureComponent } from 'react';
import { DefaultLegendContent } from './DefaultLegendContent';
import { isNumber } from '../util/DataUtils';
import { getUniqPayload } from '../util/payload/getUniqPayload';
function defaultUniqBy(entry) {
return entry.value;
}
function renderContent(content, props) {
if ( /*#__PURE__*/React.isValidElement(content)) {
return /*#__PURE__*/React.cloneElement(content, props);
}
if (typeof content === 'function') {
return /*#__PURE__*/React.createElement(content, props);
}
var ref = props.ref,
otherProps = _objectWithoutProperties(props, _excluded);
return /*#__PURE__*/React.createElement(DefaultLegendContent, otherProps);
}
var EPS = 1;
export var Legend = /*#__PURE__*/function (_PureComponent) {
_inherits(Legend, _PureComponent);
function Legend() {
var _this;
_classCallCheck(this, Legend);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, Legend, [].concat(args));
_defineProperty(_assertThisInitialized(_this), "lastBoundingBox", {
width: -1,
height: -1
});
return _this;
}
_createClass(Legend, [{
key: "componentDidMount",
value: function componentDidMount() {
this.updateBBox();
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
this.updateBBox();
}
}, {
key: "getBBox",
value: function getBBox() {
if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {
var _box = this.wrapperNode.getBoundingClientRect();
_box.height = this.wrapperNode.offsetHeight;
_box.width = this.wrapperNode.offsetWidth;
return _box;
}
return null;
}
}, {
key: "updateBBox",
value: function updateBBox() {
var onBBoxUpdate = this.props.onBBoxUpdate;
var box = this.getBBox();
if (box) {
if (Math.abs(box.width - this.lastBoundingBox.width) > EPS || Math.abs(box.height - this.lastBoundingBox.height) > EPS) {
this.lastBoundingBox.width = box.width;
this.lastBoundingBox.height = box.height;
if (onBBoxUpdate) {
onBBoxUpdate(box);
}
}
} else if (this.lastBoundingBox.width !== -1 || this.lastBoundingBox.height !== -1) {
this.lastBoundingBox.width = -1;
this.lastBoundingBox.height = -1;
if (onBBoxUpdate) {
onBBoxUpdate(null);
}
}
}
}, {
key: "getBBoxSnapshot",
value: function getBBoxSnapshot() {
if (this.lastBoundingBox.width >= 0 && this.lastBoundingBox.height >= 0) {
return _objectSpread({}, this.lastBoundingBox);
}
return {
width: 0,
height: 0
};
}
}, {
key: "getDefaultPosition",
value: function getDefaultPosition(style) {
var _this$props = this.props,
layout = _this$props.layout,
align = _this$props.align,
verticalAlign = _this$props.verticalAlign,
margin = _this$props.margin,
chartWidth = _this$props.chartWidth,
chartHeight = _this$props.chartHeight;
var hPos, vPos;
if (!style || (style.left === undefined || style.left === null) && (style.right === undefined || style.right === null)) {
if (align === 'center' && layout === 'vertical') {
var _box2 = this.getBBoxSnapshot();
hPos = {
left: ((chartWidth || 0) - _box2.width) / 2
};
} else {
hPos = align === 'right' ? {
right: margin && margin.right || 0
} : {
left: margin && margin.left || 0
};
}
}
if (!style || (style.top === undefined || style.top === null) && (style.bottom === undefined || style.bottom === null)) {
if (verticalAlign === 'middle') {
var _box3 = this.getBBoxSnapshot();
vPos = {
top: ((chartHeight || 0) - _box3.height) / 2
};
} else {
vPos = verticalAlign === 'bottom' ? {
bottom: margin && margin.bottom || 0
} : {
top: margin && margin.top || 0
};
}
}
return _objectSpread(_objectSpread({}, hPos), vPos);
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props2 = this.props,
content = _this$props2.content,
width = _this$props2.width,
height = _this$props2.height,
wrapperStyle = _this$props2.wrapperStyle,
payloadUniqBy = _this$props2.payloadUniqBy,
payload = _this$props2.payload;
var outerStyle = _objectSpread(_objectSpread({
position: 'absolute',
width: width || 'auto',
height: height || 'auto'
}, this.getDefaultPosition(wrapperStyle)), wrapperStyle);
return /*#__PURE__*/React.createElement("div", {
className: "recharts-legend-wrapper",
style: outerStyle,
ref: function ref(node) {
_this2.wrapperNode = node;
}
}, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {
payload: getUniqPayload(payload, payloadUniqBy, defaultUniqBy)
})));
}
}], [{
key: "getWithHeight",
value: function getWithHeight(item, chartWidth) {
var layout = item.props.layout;
if (layout === 'vertical' && isNumber(item.props.height)) {
return {
height: item.props.height
};
}
if (layout === 'horizontal') {
return {
width: item.props.width || chartWidth
};
}
return null;
}
}]);
return Legend;
}(PureComponent);
_defineProperty(Legend, "displayName", 'Legend');
_defineProperty(Legend, "defaultProps", {
iconSize: 14,
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom'
});

View File

@@ -0,0 +1,160 @@
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; }
/**
* @fileOverview Wrapper component to make charts adapt to the size of parent * DOM
*/
import clsx from 'clsx';
import React, { forwardRef, cloneElement, useState, useImperativeHandle, useRef, useEffect, useMemo, useCallback } from 'react';
import throttle from 'lodash/throttle';
import { isElement } from 'react-is';
import { isPercent } from '../util/DataUtils';
import { warn } from '../util/LogUtils';
import { getDisplayName } from '../util/ReactUtils';
export var ResponsiveContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
var aspect = _ref.aspect,
_ref$initialDimension = _ref.initialDimension,
initialDimension = _ref$initialDimension === void 0 ? {
width: -1,
height: -1
} : _ref$initialDimension,
_ref$width = _ref.width,
width = _ref$width === void 0 ? '100%' : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? '100%' : _ref$height,
_ref$minWidth = _ref.minWidth,
minWidth = _ref$minWidth === void 0 ? 0 : _ref$minWidth,
minHeight = _ref.minHeight,
maxHeight = _ref.maxHeight,
children = _ref.children,
_ref$debounce = _ref.debounce,
debounce = _ref$debounce === void 0 ? 0 : _ref$debounce,
id = _ref.id,
className = _ref.className,
onResize = _ref.onResize,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style;
var containerRef = useRef(null);
var onResizeRef = useRef();
onResizeRef.current = onResize;
useImperativeHandle(ref, function () {
return Object.defineProperty(containerRef.current, 'current', {
get: function get() {
// eslint-disable-next-line no-console
console.warn('The usage of ref.current.current is deprecated and will no longer be supported.');
return containerRef.current;
},
configurable: true
});
});
var _useState = useState({
containerWidth: initialDimension.width,
containerHeight: initialDimension.height
}),
_useState2 = _slicedToArray(_useState, 2),
sizes = _useState2[0],
setSizes = _useState2[1];
var setContainerSize = useCallback(function (newWidth, newHeight) {
setSizes(function (prevState) {
var roundedWidth = Math.round(newWidth);
var roundedHeight = Math.round(newHeight);
if (prevState.containerWidth === roundedWidth && prevState.containerHeight === roundedHeight) {
return prevState;
}
return {
containerWidth: roundedWidth,
containerHeight: roundedHeight
};
});
}, []);
useEffect(function () {
var callback = function callback(entries) {
var _onResizeRef$current;
var _entries$0$contentRec = entries[0].contentRect,
containerWidth = _entries$0$contentRec.width,
containerHeight = _entries$0$contentRec.height;
setContainerSize(containerWidth, containerHeight);
(_onResizeRef$current = onResizeRef.current) === null || _onResizeRef$current === void 0 || _onResizeRef$current.call(onResizeRef, containerWidth, containerHeight);
};
if (debounce > 0) {
callback = throttle(callback, debounce, {
trailing: true,
leading: false
});
}
var observer = new ResizeObserver(callback);
var _containerRef$current = containerRef.current.getBoundingClientRect(),
containerWidth = _containerRef$current.width,
containerHeight = _containerRef$current.height;
setContainerSize(containerWidth, containerHeight);
observer.observe(containerRef.current);
return function () {
observer.disconnect();
};
}, [setContainerSize, debounce]);
var chartContent = useMemo(function () {
var containerWidth = sizes.containerWidth,
containerHeight = sizes.containerHeight;
if (containerWidth < 0 || containerHeight < 0) {
return null;
}
warn(isPercent(width) || isPercent(height), "The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.", width, height);
warn(!aspect || aspect > 0, 'The aspect(%s) must be greater than zero.', aspect);
var calculatedWidth = isPercent(width) ? containerWidth : width;
var calculatedHeight = isPercent(height) ? containerHeight : height;
if (aspect && aspect > 0) {
// Preserve the desired aspect ratio
if (calculatedWidth) {
// Will default to using width for aspect ratio
calculatedHeight = calculatedWidth / aspect;
} else if (calculatedHeight) {
// But we should also take height into consideration
calculatedWidth = calculatedHeight * aspect;
}
// if maxHeight is set, overwrite if calculatedHeight is greater than maxHeight
if (maxHeight && calculatedHeight > maxHeight) {
calculatedHeight = maxHeight;
}
}
warn(calculatedWidth > 0 || calculatedHeight > 0, "The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.", calculatedWidth, calculatedHeight, width, height, minWidth, minHeight, aspect);
var isCharts = !Array.isArray(children) && isElement(children) && getDisplayName(children.type).endsWith('Chart');
return React.Children.map(children, function (child) {
if (isElement(child)) {
return /*#__PURE__*/cloneElement(child, _objectSpread({
width: calculatedWidth,
height: calculatedHeight
}, isCharts ? {
style: _objectSpread({
height: '100%',
width: '100%',
maxHeight: calculatedHeight,
maxWidth: calculatedWidth
}, child.props.style)
} : {}));
}
return child;
});
}, [aspect, children, height, maxHeight, minHeight, minWidth, sizes, width]);
return /*#__PURE__*/React.createElement("div", {
id: id ? "".concat(id) : undefined,
className: clsx('recharts-responsive-container', className),
style: _objectSpread(_objectSpread({}, style), {}, {
width: width,
height: height,
minWidth: minWidth,
minHeight: minHeight,
maxHeight: maxHeight
}),
ref: containerRef
}, chartContent);
});

245
node_modules/recharts/es6/component/Text.js generated vendored Normal file
View File

@@ -0,0 +1,245 @@
var _excluded = ["x", "y", "lineHeight", "capHeight", "scaleToFit", "textAnchor", "verticalAnchor", "fill"],
_excluded2 = ["dx", "dy", "angle", "className", "breakAll"];
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; }
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 React, { useMemo } from 'react';
import isNil from 'lodash/isNil';
import clsx from 'clsx';
import { isNumber, isNumOrStr } from '../util/DataUtils';
import { Global } from '../util/Global';
import { filterProps } from '../util/ReactUtils';
import { getStringSize } from '../util/DOMUtils';
import { reduceCSSCalc } from '../util/ReduceCSSCalc';
var BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
var calculateWordWidths = function calculateWordWidths(_ref) {
var children = _ref.children,
breakAll = _ref.breakAll,
style = _ref.style;
try {
var words = [];
if (!isNil(children)) {
if (breakAll) {
words = children.toString().split('');
} else {
words = children.toString().split(BREAKING_SPACES);
}
}
var wordsWithComputedWidth = words.map(function (word) {
return {
word: word,
width: getStringSize(word, style).width
};
});
var spaceWidth = breakAll ? 0 : getStringSize("\xA0", style).width;
return {
wordsWithComputedWidth: wordsWithComputedWidth,
spaceWidth: spaceWidth
};
} catch (e) {
return null;
}
};
var calculateWordsByLines = function calculateWordsByLines(_ref2, initialWordsWithComputedWith, spaceWidth, lineWidth, scaleToFit) {
var maxLines = _ref2.maxLines,
children = _ref2.children,
style = _ref2.style,
breakAll = _ref2.breakAll;
var shouldLimitLines = isNumber(maxLines);
var text = children;
var calculate = function calculate() {
var words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return words.reduce(function (result, _ref3) {
var word = _ref3.word,
width = _ref3.width;
var currentLine = result[result.length - 1];
if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {
// Word can be added to an existing line
currentLine.words.push(word);
currentLine.width += width + spaceWidth;
} else {
// Add first word to line or word is too long to scaleToFit on existing line
var newLine = {
words: [word],
width: width
};
result.push(newLine);
}
return result;
}, []);
};
var originalResult = calculate(initialWordsWithComputedWith);
var findLongestLine = function findLongestLine(words) {
return words.reduce(function (a, b) {
return a.width > b.width ? a : b;
});
};
if (!shouldLimitLines) {
return originalResult;
}
var suffix = '…';
var checkOverflow = function checkOverflow(index) {
var tempText = text.slice(0, index);
var words = calculateWordWidths({
breakAll: breakAll,
style: style,
children: tempText + suffix
}).wordsWithComputedWidth;
var result = calculate(words);
var doesOverflow = result.length > maxLines || findLongestLine(result).width > Number(lineWidth);
return [doesOverflow, result];
};
var start = 0;
var end = text.length - 1;
var iterations = 0;
var trimmedResult;
while (start <= end && iterations <= text.length - 1) {
var middle = Math.floor((start + end) / 2);
var prev = middle - 1;
var _checkOverflow = checkOverflow(prev),
_checkOverflow2 = _slicedToArray(_checkOverflow, 2),
doesPrevOverflow = _checkOverflow2[0],
result = _checkOverflow2[1];
var _checkOverflow3 = checkOverflow(middle),
_checkOverflow4 = _slicedToArray(_checkOverflow3, 1),
doesMiddleOverflow = _checkOverflow4[0];
if (!doesPrevOverflow && !doesMiddleOverflow) {
start = middle + 1;
}
if (doesPrevOverflow && doesMiddleOverflow) {
end = middle - 1;
}
if (!doesPrevOverflow && doesMiddleOverflow) {
trimmedResult = result;
break;
}
iterations++;
}
// Fallback to originalResult (result without trimming) if we cannot find the
// where to trim. This should not happen :tm:
return trimmedResult || originalResult;
};
var getWordsWithoutCalculate = function getWordsWithoutCalculate(children) {
var words = !isNil(children) ? children.toString().split(BREAKING_SPACES) : [];
return [{
words: words
}];
};
var getWordsByLines = function getWordsByLines(_ref4) {
var width = _ref4.width,
scaleToFit = _ref4.scaleToFit,
children = _ref4.children,
style = _ref4.style,
breakAll = _ref4.breakAll,
maxLines = _ref4.maxLines;
// Only perform calculations if using features that require them (multiline, scaleToFit)
if ((width || scaleToFit) && !Global.isSsr) {
var wordsWithComputedWidth, spaceWidth;
var wordWidths = calculateWordWidths({
breakAll: breakAll,
children: children,
style: style
});
if (wordWidths) {
var wcw = wordWidths.wordsWithComputedWidth,
sw = wordWidths.spaceWidth;
wordsWithComputedWidth = wcw;
spaceWidth = sw;
} else {
return getWordsWithoutCalculate(children);
}
return calculateWordsByLines({
breakAll: breakAll,
children: children,
maxLines: maxLines,
style: style
}, wordsWithComputedWidth, spaceWidth, width, scaleToFit);
}
return getWordsWithoutCalculate(children);
};
var DEFAULT_FILL = '#808080';
export var Text = function Text(_ref5) {
var _ref5$x = _ref5.x,
propsX = _ref5$x === void 0 ? 0 : _ref5$x,
_ref5$y = _ref5.y,
propsY = _ref5$y === void 0 ? 0 : _ref5$y,
_ref5$lineHeight = _ref5.lineHeight,
lineHeight = _ref5$lineHeight === void 0 ? '1em' : _ref5$lineHeight,
_ref5$capHeight = _ref5.capHeight,
capHeight = _ref5$capHeight === void 0 ? '0.71em' : _ref5$capHeight,
_ref5$scaleToFit = _ref5.scaleToFit,
scaleToFit = _ref5$scaleToFit === void 0 ? false : _ref5$scaleToFit,
_ref5$textAnchor = _ref5.textAnchor,
textAnchor = _ref5$textAnchor === void 0 ? 'start' : _ref5$textAnchor,
_ref5$verticalAnchor = _ref5.verticalAnchor,
verticalAnchor = _ref5$verticalAnchor === void 0 ? 'end' : _ref5$verticalAnchor,
_ref5$fill = _ref5.fill,
fill = _ref5$fill === void 0 ? DEFAULT_FILL : _ref5$fill,
props = _objectWithoutProperties(_ref5, _excluded);
var wordsByLines = useMemo(function () {
return getWordsByLines({
breakAll: props.breakAll,
children: props.children,
maxLines: props.maxLines,
scaleToFit: scaleToFit,
style: props.style,
width: props.width
});
}, [props.breakAll, props.children, props.maxLines, scaleToFit, props.style, props.width]);
var dx = props.dx,
dy = props.dy,
angle = props.angle,
className = props.className,
breakAll = props.breakAll,
textProps = _objectWithoutProperties(props, _excluded2);
if (!isNumOrStr(propsX) || !isNumOrStr(propsY)) {
return null;
}
var x = propsX + (isNumber(dx) ? dx : 0);
var y = propsY + (isNumber(dy) ? dy : 0);
var startDy;
switch (verticalAnchor) {
case 'start':
startDy = reduceCSSCalc("calc(".concat(capHeight, ")"));
break;
case 'middle':
startDy = reduceCSSCalc("calc(".concat((wordsByLines.length - 1) / 2, " * -").concat(lineHeight, " + (").concat(capHeight, " / 2))"));
break;
default:
startDy = reduceCSSCalc("calc(".concat(wordsByLines.length - 1, " * -").concat(lineHeight, ")"));
break;
}
var transforms = [];
if (scaleToFit) {
var lineWidth = wordsByLines[0].width;
var width = props.width;
transforms.push("scale(".concat((isNumber(width) ? width / lineWidth : 1) / lineWidth, ")"));
}
if (angle) {
transforms.push("rotate(".concat(angle, ", ").concat(x, ", ").concat(y, ")"));
}
if (transforms.length) {
textProps.transform = transforms.join(' ');
}
return /*#__PURE__*/React.createElement("text", _extends({}, filterProps(textProps, true), {
x: x,
y: y,
className: clsx('recharts-text', className),
textAnchor: textAnchor,
fill: fill.includes('url') ? DEFAULT_FILL : fill
}), wordsByLines.map(function (line, index) {
var words = line.words.join(breakAll ? '' : ' ');
return /*#__PURE__*/React.createElement("tspan", {
x: x,
dy: index === 0 ? startDy : lineHeight,
key: words
}, words);
}));
};

127
node_modules/recharts/es6/component/Tooltip.js generated vendored Normal file
View File

@@ -0,0 +1,127 @@
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 _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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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); }
/**
* @fileOverview Tooltip
*/
import React, { PureComponent } from 'react';
import { DefaultTooltipContent } from './DefaultTooltipContent';
import { TooltipBoundingBox } from './TooltipBoundingBox';
import { Global } from '../util/Global';
import { getUniqPayload } from '../util/payload/getUniqPayload';
function defaultUniqBy(entry) {
return entry.dataKey;
}
function renderContent(content, props) {
if ( /*#__PURE__*/React.isValidElement(content)) {
return /*#__PURE__*/React.cloneElement(content, props);
}
if (typeof content === 'function') {
return /*#__PURE__*/React.createElement(content, props);
}
return /*#__PURE__*/React.createElement(DefaultTooltipContent, props);
}
export var Tooltip = /*#__PURE__*/function (_PureComponent) {
_inherits(Tooltip, _PureComponent);
function Tooltip() {
_classCallCheck(this, Tooltip);
return _callSuper(this, Tooltip, arguments);
}
_createClass(Tooltip, [{
key: "render",
value: function render() {
var _this = this;
var _this$props = this.props,
active = _this$props.active,
allowEscapeViewBox = _this$props.allowEscapeViewBox,
animationDuration = _this$props.animationDuration,
animationEasing = _this$props.animationEasing,
content = _this$props.content,
coordinate = _this$props.coordinate,
filterNull = _this$props.filterNull,
isAnimationActive = _this$props.isAnimationActive,
offset = _this$props.offset,
payload = _this$props.payload,
payloadUniqBy = _this$props.payloadUniqBy,
position = _this$props.position,
reverseDirection = _this$props.reverseDirection,
useTranslate3d = _this$props.useTranslate3d,
viewBox = _this$props.viewBox,
wrapperStyle = _this$props.wrapperStyle;
var finalPayload = payload !== null && payload !== void 0 ? payload : [];
if (filterNull && finalPayload.length) {
finalPayload = getUniqPayload(payload.filter(function (entry) {
return entry.value != null && (entry.hide !== true || _this.props.includeHidden);
}), payloadUniqBy, defaultUniqBy);
}
var hasPayload = finalPayload.length > 0;
return /*#__PURE__*/React.createElement(TooltipBoundingBox, {
allowEscapeViewBox: allowEscapeViewBox,
animationDuration: animationDuration,
animationEasing: animationEasing,
isAnimationActive: isAnimationActive,
active: active,
coordinate: coordinate,
hasPayload: hasPayload,
offset: offset,
position: position,
reverseDirection: reverseDirection,
useTranslate3d: useTranslate3d,
viewBox: viewBox,
wrapperStyle: wrapperStyle
}, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {
payload: finalPayload
})));
}
}]);
return Tooltip;
}(PureComponent);
_defineProperty(Tooltip, "displayName", 'Tooltip');
_defineProperty(Tooltip, "defaultProps", {
accessibilityLayer: false,
allowEscapeViewBox: {
x: false,
y: false
},
animationDuration: 400,
animationEasing: 'ease',
contentStyle: {},
coordinate: {
x: 0,
y: 0
},
cursor: true,
cursorStyle: {},
filterNull: true,
isAnimationActive: !Global.isSsr,
itemStyle: {},
labelStyle: {},
offset: 10,
reverseDirection: {
x: false,
y: false
},
separator: ' : ',
trigger: 'hover',
useTranslate3d: false,
viewBox: {
x: 0,
y: 0,
height: 0,
width: 0
},
wrapperStyle: {}
});

View File

@@ -0,0 +1,157 @@
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 _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 _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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, { PureComponent } from 'react';
import { getTooltipTranslate } from '../util/tooltip/translate';
var EPSILON = 1;
export var TooltipBoundingBox = /*#__PURE__*/function (_PureComponent) {
_inherits(TooltipBoundingBox, _PureComponent);
function TooltipBoundingBox() {
var _this;
_classCallCheck(this, TooltipBoundingBox);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _callSuper(this, TooltipBoundingBox, [].concat(args));
_defineProperty(_assertThisInitialized(_this), "state", {
dismissed: false,
dismissedAtCoordinate: {
x: 0,
y: 0
},
lastBoundingBox: {
width: -1,
height: -1
}
});
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
if (event.key === 'Escape') {
var _this$props$coordinat, _this$props$coordinat2, _this$props$coordinat3, _this$props$coordinat4;
_this.setState({
dismissed: true,
dismissedAtCoordinate: {
x: (_this$props$coordinat = (_this$props$coordinat2 = _this.props.coordinate) === null || _this$props$coordinat2 === void 0 ? void 0 : _this$props$coordinat2.x) !== null && _this$props$coordinat !== void 0 ? _this$props$coordinat : 0,
y: (_this$props$coordinat3 = (_this$props$coordinat4 = _this.props.coordinate) === null || _this$props$coordinat4 === void 0 ? void 0 : _this$props$coordinat4.y) !== null && _this$props$coordinat3 !== void 0 ? _this$props$coordinat3 : 0
}
});
}
});
return _this;
}
_createClass(TooltipBoundingBox, [{
key: "updateBBox",
value: function updateBBox() {
if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {
var box = this.wrapperNode.getBoundingClientRect();
if (Math.abs(box.width - this.state.lastBoundingBox.width) > EPSILON || Math.abs(box.height - this.state.lastBoundingBox.height) > EPSILON) {
this.setState({
lastBoundingBox: {
width: box.width,
height: box.height
}
});
}
} else if (this.state.lastBoundingBox.width !== -1 || this.state.lastBoundingBox.height !== -1) {
this.setState({
lastBoundingBox: {
width: -1,
height: -1
}
});
}
}
}, {
key: "componentDidMount",
value: function componentDidMount() {
document.addEventListener('keydown', this.handleKeyDown);
this.updateBBox();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
document.removeEventListener('keydown', this.handleKeyDown);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
var _this$props$coordinat5, _this$props$coordinat6;
if (this.props.active) {
this.updateBBox();
}
if (!this.state.dismissed) {
return;
}
if (((_this$props$coordinat5 = this.props.coordinate) === null || _this$props$coordinat5 === void 0 ? void 0 : _this$props$coordinat5.x) !== this.state.dismissedAtCoordinate.x || ((_this$props$coordinat6 = this.props.coordinate) === null || _this$props$coordinat6 === void 0 ? void 0 : _this$props$coordinat6.y) !== this.state.dismissedAtCoordinate.y) {
this.state.dismissed = false;
}
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props = this.props,
active = _this$props.active,
allowEscapeViewBox = _this$props.allowEscapeViewBox,
animationDuration = _this$props.animationDuration,
animationEasing = _this$props.animationEasing,
children = _this$props.children,
coordinate = _this$props.coordinate,
hasPayload = _this$props.hasPayload,
isAnimationActive = _this$props.isAnimationActive,
offset = _this$props.offset,
position = _this$props.position,
reverseDirection = _this$props.reverseDirection,
useTranslate3d = _this$props.useTranslate3d,
viewBox = _this$props.viewBox,
wrapperStyle = _this$props.wrapperStyle;
var _getTooltipTranslate = getTooltipTranslate({
allowEscapeViewBox: allowEscapeViewBox,
coordinate: coordinate,
offsetTopLeft: offset,
position: position,
reverseDirection: reverseDirection,
tooltipBox: this.state.lastBoundingBox,
useTranslate3d: useTranslate3d,
viewBox: viewBox
}),
cssClasses = _getTooltipTranslate.cssClasses,
cssProperties = _getTooltipTranslate.cssProperties;
var outerStyle = _objectSpread(_objectSpread({
transition: isAnimationActive && active ? "transform ".concat(animationDuration, "ms ").concat(animationEasing) : undefined
}, cssProperties), {}, {
pointerEvents: 'none',
visibility: !this.state.dismissed && active && hasPayload ? 'visible' : 'hidden',
position: 'absolute',
top: 0,
left: 0
}, wrapperStyle);
return (
/*#__PURE__*/
// This element allow listening to the `Escape` key.
// See https://github.com/recharts/recharts/pull/2925
React.createElement("div", {
tabIndex: -1,
className: cssClasses,
style: outerStyle,
ref: function ref(node) {
_this2.wrapperNode = node;
}
}, children)
);
}
}]);
return TooltipBoundingBox;
}(PureComponent);