Add settings page for managing forecasting API key and URL via UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cae411eae7
commit
1c411e402e
19809 changed files with 1962608 additions and 97 deletions
84
frontend/node_modules/recharts/es6/component/ActivePoints.js
generated
vendored
Normal file
84
frontend/node_modules/recharts/es6/component/ActivePoints.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 * as React from 'react';
|
||||
import { cloneElement, isValidElement } from 'react';
|
||||
import { adaptEventHandlers } from '../util/types';
|
||||
import { Dot } from '../shape/Dot';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { useAppSelector } from '../state/hooks';
|
||||
import { selectActiveTooltipIndex } from '../state/selectors/tooltipSelectors';
|
||||
import { useActiveTooltipDataPoints } from '../hooks';
|
||||
import { isNullish } from '../util/DataUtils';
|
||||
import { svgPropertiesNoEventsFromUnknown } from '../util/svgPropertiesNoEvents';
|
||||
import { ZIndexLayer } from '../zIndex/ZIndexLayer';
|
||||
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
||||
var ActivePoint = _ref => {
|
||||
var point = _ref.point,
|
||||
childIndex = _ref.childIndex,
|
||||
mainColor = _ref.mainColor,
|
||||
activeDot = _ref.activeDot,
|
||||
dataKey = _ref.dataKey,
|
||||
clipPath = _ref.clipPath;
|
||||
if (activeDot === false || point.x == null || point.y == null) {
|
||||
return null;
|
||||
}
|
||||
var dotPropsTyped = {
|
||||
index: childIndex,
|
||||
dataKey,
|
||||
cx: point.x,
|
||||
cy: point.y,
|
||||
r: 4,
|
||||
fill: mainColor !== null && mainColor !== void 0 ? mainColor : 'none',
|
||||
strokeWidth: 2,
|
||||
stroke: '#fff',
|
||||
payload: point.payload,
|
||||
value: point.value
|
||||
};
|
||||
|
||||
// @ts-expect-error svgPropertiesNoEventsFromUnknown(activeDot) is contributing unknown props
|
||||
var dotProps = _objectSpread(_objectSpread(_objectSpread({}, dotPropsTyped), svgPropertiesNoEventsFromUnknown(activeDot)), adaptEventHandlers(activeDot));
|
||||
var dot;
|
||||
if (/*#__PURE__*/isValidElement(activeDot)) {
|
||||
// @ts-expect-error we're improperly typing events
|
||||
dot = /*#__PURE__*/cloneElement(activeDot, dotProps);
|
||||
} else if (typeof activeDot === 'function') {
|
||||
dot = activeDot(dotProps);
|
||||
} else {
|
||||
dot = /*#__PURE__*/React.createElement(Dot, dotProps);
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
className: "recharts-active-dot",
|
||||
clipPath: clipPath
|
||||
}, dot);
|
||||
};
|
||||
export function ActivePoints(_ref2) {
|
||||
var points = _ref2.points,
|
||||
mainColor = _ref2.mainColor,
|
||||
activeDot = _ref2.activeDot,
|
||||
itemDataKey = _ref2.itemDataKey,
|
||||
clipPath = _ref2.clipPath,
|
||||
_ref2$zIndex = _ref2.zIndex,
|
||||
zIndex = _ref2$zIndex === void 0 ? DefaultZIndexes.activeDot : _ref2$zIndex;
|
||||
var activeTooltipIndex = useAppSelector(selectActiveTooltipIndex);
|
||||
var activeDataPoints = useActiveTooltipDataPoints();
|
||||
if (points == null || activeDataPoints == null) {
|
||||
return null;
|
||||
}
|
||||
var activePoint = points.find(p => activeDataPoints.includes(p.payload));
|
||||
if (isNullish(activePoint)) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
||||
zIndex: zIndex
|
||||
}, /*#__PURE__*/React.createElement(ActivePoint, {
|
||||
point: activePoint,
|
||||
childIndex: Number(activeTooltipIndex),
|
||||
mainColor: mainColor,
|
||||
dataKey: itemDataKey,
|
||||
activeDot: activeDot,
|
||||
clipPath: clipPath
|
||||
}));
|
||||
}
|
||||
15
frontend/node_modules/recharts/es6/component/Cell.js
generated
vendored
Normal file
15
frontend/node_modules/recharts/es6/component/Cell.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* Cell component used to define colors and styles of chart elements.
|
||||
*
|
||||
* This component is now deprecated and will be removed in Recharts 4.0.
|
||||
*
|
||||
* Please use the `shape` prop or `content` prop on the respective chart components
|
||||
* to customize the rendering of chart elements instead of using `Cell`.
|
||||
*
|
||||
* @see {@link https://recharts.github.io/en-US/guide/cell/ Guide: Migrate from Cell component to shape prop}
|
||||
*
|
||||
* @deprecated
|
||||
* @consumes CellReader
|
||||
*/
|
||||
export var Cell = _props => null;
|
||||
Cell.displayName = 'Cell';
|
||||
132
frontend/node_modules/recharts/es6/component/Cursor.js
generated
vendored
Normal file
132
frontend/node_modules/recharts/es6/component/Cursor.js
generated
vendored
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 * as React from 'react';
|
||||
import { cloneElement, createElement, isValidElement } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { isPolarCoordinate } from '../util/types';
|
||||
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 { useChartLayout, useOffsetInternal } from '../context/chartLayoutContext';
|
||||
import { useTooltipAxisBandSize } from '../context/useTooltipAxis';
|
||||
import { useChartName } from '../state/selectors/selectors';
|
||||
import { svgPropertiesNoEventsFromUnknown } from '../util/svgPropertiesNoEvents';
|
||||
import { ZIndexLayer } from '../zIndex/ZIndexLayer';
|
||||
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
||||
|
||||
/**
|
||||
* If set false, no cursor will be drawn when tooltip is active.
|
||||
* If set an object, the option is the configuration of cursor.
|
||||
* If set a React element, the option is the custom react element of drawing cursor
|
||||
*/
|
||||
|
||||
function RenderCursor(_ref) {
|
||||
var cursor = _ref.cursor,
|
||||
cursorComp = _ref.cursorComp,
|
||||
cursorProps = _ref.cursorProps;
|
||||
if (/*#__PURE__*/isValidElement(cursor)) {
|
||||
return /*#__PURE__*/cloneElement(cursor, cursorProps);
|
||||
}
|
||||
return /*#__PURE__*/createElement(cursorComp, cursorProps);
|
||||
}
|
||||
export function CursorInternal(props) {
|
||||
var _props$zIndex;
|
||||
var coordinate = props.coordinate,
|
||||
payload = props.payload,
|
||||
index = props.index,
|
||||
offset = props.offset,
|
||||
tooltipAxisBandSize = props.tooltipAxisBandSize,
|
||||
layout = props.layout,
|
||||
cursor = props.cursor,
|
||||
tooltipEventType = props.tooltipEventType,
|
||||
chartName = props.chartName;
|
||||
|
||||
// The cursor is a part of the Tooltip, and it should be shown (by default) when the Tooltip is active.
|
||||
var activeCoordinate = coordinate;
|
||||
var activePayload = payload;
|
||||
var activeTooltipIndex = index;
|
||||
if (!cursor || !activeCoordinate || chartName !== 'ScatterChart' && tooltipEventType !== 'axis') {
|
||||
return null;
|
||||
}
|
||||
var restProps, cursorComp, preferredZIndex;
|
||||
if (chartName === 'ScatterChart') {
|
||||
restProps = activeCoordinate;
|
||||
cursorComp = Cross;
|
||||
preferredZIndex = DefaultZIndexes.cursorLine;
|
||||
} else if (chartName === 'BarChart') {
|
||||
restProps = getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize);
|
||||
cursorComp = Rectangle;
|
||||
preferredZIndex = DefaultZIndexes.cursorRectangle;
|
||||
} else if (layout === 'radial' && isPolarCoordinate(activeCoordinate)) {
|
||||
var _getRadialCursorPoint = getRadialCursorPoints(activeCoordinate),
|
||||
cx = _getRadialCursorPoint.cx,
|
||||
cy = _getRadialCursorPoint.cy,
|
||||
radius = _getRadialCursorPoint.radius,
|
||||
startAngle = _getRadialCursorPoint.startAngle,
|
||||
endAngle = _getRadialCursorPoint.endAngle;
|
||||
restProps = {
|
||||
cx,
|
||||
cy,
|
||||
startAngle,
|
||||
endAngle,
|
||||
innerRadius: radius,
|
||||
outerRadius: radius
|
||||
};
|
||||
cursorComp = Sector;
|
||||
preferredZIndex = DefaultZIndexes.cursorLine;
|
||||
} else {
|
||||
restProps = {
|
||||
points: getCursorPoints(layout, activeCoordinate, offset)
|
||||
};
|
||||
cursorComp = Curve;
|
||||
preferredZIndex = DefaultZIndexes.cursorLine;
|
||||
}
|
||||
var extraClassName = typeof cursor === 'object' && 'className' in cursor ? cursor.className : undefined;
|
||||
var cursorProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
||||
stroke: '#ccc',
|
||||
pointerEvents: 'none'
|
||||
}, offset), restProps), svgPropertiesNoEventsFromUnknown(cursor)), {}, {
|
||||
payload: activePayload,
|
||||
payloadIndex: activeTooltipIndex,
|
||||
className: clsx('recharts-tooltip-cursor', extraClassName)
|
||||
});
|
||||
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
||||
zIndex: (_props$zIndex = props.zIndex) !== null && _props$zIndex !== void 0 ? _props$zIndex : preferredZIndex
|
||||
}, /*#__PURE__*/React.createElement(RenderCursor, {
|
||||
cursor: cursor,
|
||||
cursorComp: cursorComp,
|
||||
cursorProps: cursorProps
|
||||
}));
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 tooltipAxisBandSize = useTooltipAxisBandSize();
|
||||
var offset = useOffsetInternal();
|
||||
var layout = useChartLayout();
|
||||
var chartName = useChartName();
|
||||
if (tooltipAxisBandSize == null || offset == null || layout == null || chartName == null) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(CursorInternal, _extends({}, props, {
|
||||
offset: offset,
|
||||
layout: layout,
|
||||
tooltipAxisBandSize: tooltipAxisBandSize,
|
||||
chartName: chartName
|
||||
}));
|
||||
}
|
||||
37
frontend/node_modules/recharts/es6/component/Customized.js
generated
vendored
Normal file
37
frontend/node_modules/recharts/es6/component/Customized.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
var _excluded = ["component"];
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
/**
|
||||
* @fileOverview Customized
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { isValidElement, cloneElement, createElement } from 'react';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { warn } from '../util/LogUtils';
|
||||
/**
|
||||
* Customized component used to be necessary to render custom elements in Recharts 2.x.
|
||||
* Starting from Recharts 3.x, all charts are able to render arbitrary elements anywhere,
|
||||
* and Customized is no longer needed.
|
||||
*
|
||||
* @example Before: `<Customized component={<MyCustomComponent />} />`
|
||||
* @example After: `<MyCustomComponent />`
|
||||
*
|
||||
* @deprecated Just render your components directly. Will be removed in 4.0
|
||||
*/
|
||||
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 (typeof component === 'function') {
|
||||
// @ts-expect-error TS cannot verify that C is FunctionComponent<P> here
|
||||
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';
|
||||
166
frontend/node_modules/recharts/es6/component/DefaultLegendContent.js
generated
vendored
Normal file
166
frontend/node_modules/recharts/es6/component/DefaultLegendContent.js
generated
vendored
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 * as React from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { Surface } from '../container/Surface';
|
||||
import { Symbols } from '../shape/Symbols';
|
||||
import { adaptEventsOfChild } from '../util/types';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
var SIZE = 32;
|
||||
export var defaultLegendContentDefaultProps = {
|
||||
align: 'center',
|
||||
iconSize: 14,
|
||||
inactiveColor: '#ccc',
|
||||
layout: 'horizontal',
|
||||
verticalAlign: 'middle',
|
||||
labelStyle: {}
|
||||
};
|
||||
function getStrokeDasharray(input) {
|
||||
if (typeof input === 'object' && input !== null && 'strokeDasharray' in input) {
|
||||
return String(input.strokeDasharray);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function Icon(_ref) {
|
||||
var data = _ref.data,
|
||||
iconType = _ref.iconType,
|
||||
inactiveColor = _ref.inactiveColor;
|
||||
var halfSize = SIZE / 2;
|
||||
var sixthSize = SIZE / 6;
|
||||
var thirdSize = SIZE / 3;
|
||||
var color = data.inactive ? inactiveColor : data.color;
|
||||
var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
|
||||
if (preferredIcon === 'none') {
|
||||
return null;
|
||||
}
|
||||
if (preferredIcon === 'plainline') {
|
||||
return /*#__PURE__*/React.createElement("line", {
|
||||
strokeWidth: 4,
|
||||
fill: "none",
|
||||
stroke: color,
|
||||
strokeDasharray: getStrokeDasharray(data.payload),
|
||||
x1: 0,
|
||||
y1: halfSize,
|
||||
x2: SIZE,
|
||||
y2: halfSize,
|
||||
className: "recharts-legend-icon"
|
||||
});
|
||||
}
|
||||
if (preferredIcon === '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 (preferredIcon === '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: preferredIcon
|
||||
});
|
||||
}
|
||||
function Items(props) {
|
||||
var payload = props.payload,
|
||||
iconSize = props.iconSize,
|
||||
layout = props.layout,
|
||||
formatter = props.formatter,
|
||||
inactiveColor = props.inactiveColor,
|
||||
iconType = props.iconType,
|
||||
labelStyle = props.labelStyle;
|
||||
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((entry, i) => {
|
||||
var finalFormatter = entry.formatter || formatter;
|
||||
var className = clsx({
|
||||
'recharts-legend-item': true,
|
||||
["legend-item-".concat(i)]: true,
|
||||
inactive: entry.inactive
|
||||
});
|
||||
if (entry.type === 'none') {
|
||||
return null;
|
||||
}
|
||||
var finalLabelStyle = typeof labelStyle === 'object' ? _objectSpread({}, labelStyle) : {};
|
||||
finalLabelStyle.color = entry.inactive ? inactiveColor : finalLabelStyle.color || entry.color;
|
||||
var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
|
||||
return /*#__PURE__*/React.createElement("li", _extends({
|
||||
className: className,
|
||||
style: itemStyle,
|
||||
key: "legend-item-".concat(i)
|
||||
}, adaptEventsOfChild(props, entry, i)), /*#__PURE__*/React.createElement(Surface, {
|
||||
width: iconSize,
|
||||
height: iconSize,
|
||||
viewBox: viewBox,
|
||||
style: svgStyle,
|
||||
"aria-label": entry.value == null ? 'legend icon' : "".concat(entry.value, " legend icon")
|
||||
}, /*#__PURE__*/React.createElement(Icon, {
|
||||
data: entry,
|
||||
iconType: iconType,
|
||||
inactiveColor: inactiveColor
|
||||
})), /*#__PURE__*/React.createElement("span", {
|
||||
className: "recharts-legend-item-text",
|
||||
style: finalLabelStyle
|
||||
}, finalValue));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This component is by default rendered inside the {@link Legend} component. You would not use it directly.
|
||||
*
|
||||
* You can use this component to customize the content of the legend,
|
||||
* or you can provide your own completely independent content.
|
||||
*/
|
||||
export var DefaultLegendContent = outsideProps => {
|
||||
var props = resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
|
||||
var payload = props.payload,
|
||||
layout = props.layout,
|
||||
align = props.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
|
||||
}, /*#__PURE__*/React.createElement(Items, _extends({}, props, {
|
||||
payload: payload
|
||||
})));
|
||||
};
|
||||
151
frontend/node_modules/recharts/es6/component/DefaultTooltipContent.js
generated
vendored
Normal file
151
frontend/node_modules/recharts/es6/component/DefaultTooltipContent.js
generated
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
/**
|
||||
* @fileOverview Default Tooltip Content
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import sortBy from 'es-toolkit/compat/sortBy';
|
||||
import { clsx } from 'clsx';
|
||||
import { isNullish, isNumOrStr } from '../util/DataUtils';
|
||||
function defaultFormatter(value) {
|
||||
return Array.isArray(value) && isNumOrStr(value[0]) && isNumOrStr(value[1]) ? value.join(' ~ ') : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
export var defaultDefaultTooltipContentProps = {
|
||||
separator: ' : ',
|
||||
contentStyle: {
|
||||
margin: 0,
|
||||
padding: 10,
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #ccc',
|
||||
whiteSpace: 'nowrap'
|
||||
},
|
||||
itemStyle: {
|
||||
display: 'block',
|
||||
paddingTop: 4,
|
||||
paddingBottom: 4,
|
||||
color: '#000'
|
||||
},
|
||||
labelStyle: {},
|
||||
accessibilityLayer: false
|
||||
};
|
||||
function lodashLikeSortBy(array, itemSorter) {
|
||||
if (itemSorter == null) {
|
||||
return array;
|
||||
}
|
||||
// @ts-expect-error sortBy types somehow are returning a number type.
|
||||
return sortBy(array, itemSorter);
|
||||
}
|
||||
|
||||
/**
|
||||
* This component is by default rendered inside the {@link Tooltip} component. You would not use it directly.
|
||||
*
|
||||
* You can use this component to customize the content of the tooltip,
|
||||
* or you can provide your own completely independent content.
|
||||
*/
|
||||
export var DefaultTooltipContent = props => {
|
||||
var _props$separator = props.separator,
|
||||
separator = _props$separator === void 0 ? defaultDefaultTooltipContentProps.separator : _props$separator,
|
||||
contentStyle = props.contentStyle,
|
||||
itemStyle = props.itemStyle,
|
||||
_props$labelStyle = props.labelStyle,
|
||||
labelStyle = _props$labelStyle === void 0 ? defaultDefaultTooltipContentProps.labelStyle : _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 ? defaultDefaultTooltipContentProps.accessibilityLayer : _props$accessibilityL;
|
||||
var renderContent = () => {
|
||||
if (payload && payload.length) {
|
||||
var listStyle = {
|
||||
padding: 0,
|
||||
margin: 0
|
||||
};
|
||||
var sortedPayload = lodashLikeSortBy(payload, itemSorter);
|
||||
var items = sortedPayload.map((entry, i) => {
|
||||
if (!entry || entry.type === 'none') {
|
||||
return null;
|
||||
}
|
||||
var finalFormatter = entry.formatter || formatter || defaultFormatter;
|
||||
var value = entry.value,
|
||||
name = entry.name;
|
||||
var finalValue = value;
|
||||
var finalName = name;
|
||||
if (finalFormatter) {
|
||||
var formatted = finalFormatter(value, name, entry, i, payload);
|
||||
if (Array.isArray(formatted)) {
|
||||
var _formatted = _slicedToArray(formatted, 2);
|
||||
finalValue = _formatted[0];
|
||||
finalName = _formatted[1];
|
||||
} else if (formatted != null) {
|
||||
finalValue = formatted;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
var finalItemStyle = _objectSpread(_objectSpread({}, defaultDefaultTooltipContentProps.itemStyle), {}, {
|
||||
color: entry.color || defaultDefaultTooltipContentProps.itemStyle.color
|
||||
}, itemStyle);
|
||||
return /*#__PURE__*/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(_objectSpread({}, defaultDefaultTooltipContentProps.contentStyle), contentStyle);
|
||||
var finalLabelStyle = _objectSpread({
|
||||
margin: 0
|
||||
}, labelStyle);
|
||||
var hasLabel = !isNullish(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());
|
||||
};
|
||||
92
frontend/node_modules/recharts/es6/component/Dots.js
generated
vendored
Normal file
92
frontend/node_modules/recharts/es6/component/Dots.js
generated
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
var _excluded = ["points"];
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
import * as React from 'react';
|
||||
import { cloneElement, isValidElement } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { Dot } from '../shape/Dot';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { isClipDot } from '../util/ReactUtils';
|
||||
import { svgPropertiesAndEventsFromUnknown } from '../util/svgPropertiesAndEvents';
|
||||
import { ZIndexLayer } from '../zIndex/ZIndexLayer';
|
||||
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
||||
function DotItem(_ref) {
|
||||
var option = _ref.option,
|
||||
dotProps = _ref.dotProps,
|
||||
className = _ref.className;
|
||||
if (/*#__PURE__*/isValidElement(option)) {
|
||||
// @ts-expect-error we can't type check element cloning properly
|
||||
return /*#__PURE__*/cloneElement(option, dotProps);
|
||||
}
|
||||
if (typeof option === 'function') {
|
||||
return option(dotProps);
|
||||
}
|
||||
var finalClassName = clsx(className, typeof option !== 'boolean' ? option.className : '');
|
||||
var _ref2 = dotProps !== null && dotProps !== void 0 ? dotProps : {},
|
||||
points = _ref2.points,
|
||||
props = _objectWithoutProperties(_ref2, _excluded);
|
||||
return /*#__PURE__*/React.createElement(Dot, _extends({}, props, {
|
||||
className: finalClassName
|
||||
}));
|
||||
}
|
||||
function shouldRenderDots(points, dot) {
|
||||
if (points == null) {
|
||||
return false;
|
||||
}
|
||||
if (dot) {
|
||||
return true;
|
||||
}
|
||||
return points.length === 1;
|
||||
}
|
||||
export function Dots(_ref3) {
|
||||
var points = _ref3.points,
|
||||
dot = _ref3.dot,
|
||||
className = _ref3.className,
|
||||
dotClassName = _ref3.dotClassName,
|
||||
dataKey = _ref3.dataKey,
|
||||
baseProps = _ref3.baseProps,
|
||||
needClip = _ref3.needClip,
|
||||
clipPathId = _ref3.clipPathId,
|
||||
_ref3$zIndex = _ref3.zIndex,
|
||||
zIndex = _ref3$zIndex === void 0 ? DefaultZIndexes.scatter : _ref3$zIndex;
|
||||
if (!shouldRenderDots(points, dot)) {
|
||||
return null;
|
||||
}
|
||||
var clipDot = isClipDot(dot);
|
||||
var customDotProps = svgPropertiesAndEventsFromUnknown(dot);
|
||||
var dots = points.map((entry, i) => {
|
||||
var _entry$x, _entry$y;
|
||||
var dotProps = _objectSpread(_objectSpread(_objectSpread({
|
||||
r: 3
|
||||
}, baseProps), customDotProps), {}, {
|
||||
index: i,
|
||||
cx: (_entry$x = entry.x) !== null && _entry$x !== void 0 ? _entry$x : undefined,
|
||||
cy: (_entry$y = entry.y) !== null && _entry$y !== void 0 ? _entry$y : undefined,
|
||||
dataKey,
|
||||
value: entry.value,
|
||||
payload: entry.payload,
|
||||
points
|
||||
});
|
||||
return /*#__PURE__*/React.createElement(DotItem, {
|
||||
key: "dot-".concat(i),
|
||||
option: dot,
|
||||
dotProps: dotProps,
|
||||
className: dotClassName
|
||||
});
|
||||
});
|
||||
var layerProps = {};
|
||||
if (needClip && clipPathId != null) {
|
||||
layerProps.clipPath = "url(#clipPath-".concat(clipDot ? '' : 'dots-').concat(clipPathId, ")");
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
||||
zIndex: zIndex
|
||||
}, /*#__PURE__*/React.createElement(Layer, _extends({
|
||||
className: className
|
||||
}, layerProps), dots));
|
||||
}
|
||||
389
frontend/node_modules/recharts/es6/component/Label.js
generated
vendored
Normal file
389
frontend/node_modules/recharts/es6/component/Label.js
generated
vendored
Normal file
|
|
@ -0,0 +1,389 @@
|
|||
var _excluded = ["labelRef"],
|
||||
_excluded2 = ["content"];
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
import * as React from 'react';
|
||||
import { cloneElement, createContext, createElement, isValidElement, useContext, useMemo } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { isValidTextAnchor, Text } from './Text';
|
||||
import { isNullish, isNumber, isNumOrStr, mathSign, uniqueId } from '../util/DataUtils';
|
||||
import { polarToCartesian } from '../util/PolarUtils';
|
||||
import { cartesianViewBoxToTrapezoid, useViewBox } from '../context/chartLayoutContext';
|
||||
import { useAppSelector } from '../state/hooks';
|
||||
import { selectPolarViewBox } from '../state/selectors/polarAxisSelectors';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
|
||||
import { ZIndexLayer } from '../zIndex/ZIndexLayer';
|
||||
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
||||
import { getCartesianPosition } from '../cartesian/getCartesianPosition';
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
var CartesianLabelContext = /*#__PURE__*/createContext(null);
|
||||
export var CartesianLabelContextProvider = _ref => {
|
||||
var x = _ref.x,
|
||||
y = _ref.y,
|
||||
upperWidth = _ref.upperWidth,
|
||||
lowerWidth = _ref.lowerWidth,
|
||||
width = _ref.width,
|
||||
height = _ref.height,
|
||||
children = _ref.children;
|
||||
var viewBox = useMemo(() => ({
|
||||
x,
|
||||
y,
|
||||
upperWidth,
|
||||
lowerWidth,
|
||||
width,
|
||||
height
|
||||
}), [x, y, upperWidth, lowerWidth, width, height]);
|
||||
return /*#__PURE__*/React.createElement(CartesianLabelContext.Provider, {
|
||||
value: viewBox
|
||||
}, children);
|
||||
};
|
||||
var useCartesianLabelContext = () => {
|
||||
var labelChildContext = useContext(CartesianLabelContext);
|
||||
var chartContext = useViewBox();
|
||||
return labelChildContext || (chartContext ? cartesianViewBoxToTrapezoid(chartContext) : undefined);
|
||||
};
|
||||
var PolarLabelContext = /*#__PURE__*/createContext(null);
|
||||
export var PolarLabelContextProvider = _ref2 => {
|
||||
var cx = _ref2.cx,
|
||||
cy = _ref2.cy,
|
||||
innerRadius = _ref2.innerRadius,
|
||||
outerRadius = _ref2.outerRadius,
|
||||
startAngle = _ref2.startAngle,
|
||||
endAngle = _ref2.endAngle,
|
||||
clockWise = _ref2.clockWise,
|
||||
children = _ref2.children;
|
||||
var viewBox = useMemo(() => ({
|
||||
cx,
|
||||
cy,
|
||||
innerRadius,
|
||||
outerRadius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
clockWise
|
||||
}), [cx, cy, innerRadius, outerRadius, startAngle, endAngle, clockWise]);
|
||||
return /*#__PURE__*/React.createElement(PolarLabelContext.Provider, {
|
||||
value: viewBox
|
||||
}, children);
|
||||
};
|
||||
export var usePolarLabelContext = () => {
|
||||
var labelChildContext = useContext(PolarLabelContext);
|
||||
var chartContext = useAppSelector(selectPolarViewBox);
|
||||
return labelChildContext || chartContext;
|
||||
};
|
||||
var getLabel = props => {
|
||||
var value = props.value,
|
||||
formatter = props.formatter;
|
||||
var label = isNullish(props.children) ? value : props.children;
|
||||
if (typeof formatter === 'function') {
|
||||
return formatter(label);
|
||||
}
|
||||
return label;
|
||||
};
|
||||
export var isLabelContentAFunction = content => {
|
||||
return content != null && typeof content === 'function';
|
||||
};
|
||||
var getDeltaAngle = (startAngle, endAngle) => {
|
||||
var sign = mathSign(endAngle - startAngle);
|
||||
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
|
||||
return sign * deltaAngle;
|
||||
};
|
||||
var renderRadialLabel = (labelProps, position, label, attrs, viewBox) => {
|
||||
var offset = labelProps.offset,
|
||||
className = labelProps.className;
|
||||
var cx = viewBox.cx,
|
||||
cy = viewBox.cy,
|
||||
innerRadius = viewBox.innerRadius,
|
||||
outerRadius = viewBox.outerRadius,
|
||||
startAngle = viewBox.startAngle,
|
||||
endAngle = viewBox.endAngle,
|
||||
clockWise = viewBox.clockWise;
|
||||
var radius = (innerRadius + outerRadius) / 2;
|
||||
var deltaAngle = getDeltaAngle(startAngle, endAngle);
|
||||
var sign = deltaAngle >= 0 ? 1 : -1;
|
||||
var labelAngle, direction;
|
||||
switch (position) {
|
||||
case 'insideStart':
|
||||
labelAngle = startAngle + sign * offset;
|
||||
direction = clockWise;
|
||||
break;
|
||||
case 'insideEnd':
|
||||
labelAngle = endAngle - sign * offset;
|
||||
direction = !clockWise;
|
||||
break;
|
||||
case 'end':
|
||||
labelAngle = endAngle + sign * offset;
|
||||
direction = clockWise;
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unsupported position ".concat(position));
|
||||
}
|
||||
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 = isNullish(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 = (viewBox, offset, position) => {
|
||||
var cx = viewBox.cx,
|
||||
cy = viewBox.cy,
|
||||
innerRadius = viewBox.innerRadius,
|
||||
outerRadius = viewBox.outerRadius,
|
||||
startAngle = viewBox.startAngle,
|
||||
endAngle = viewBox.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,
|
||||
y,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
};
|
||||
var isPolar = viewBox => viewBox != null && 'cx' in viewBox && isNumber(viewBox.cx);
|
||||
export var defaultLabelProps = {
|
||||
angle: 0,
|
||||
offset: 5,
|
||||
zIndex: DefaultZIndexes.label,
|
||||
position: 'middle',
|
||||
textBreakAll: false
|
||||
};
|
||||
function polarViewBoxToTrapezoid(viewBox) {
|
||||
if (!isPolar(viewBox)) {
|
||||
return viewBox;
|
||||
}
|
||||
var cx = viewBox.cx,
|
||||
cy = viewBox.cy,
|
||||
outerRadius = viewBox.outerRadius;
|
||||
var diameter = outerRadius * 2;
|
||||
return {
|
||||
x: cx - outerRadius,
|
||||
y: cy - outerRadius,
|
||||
width: diameter,
|
||||
upperWidth: diameter,
|
||||
lowerWidth: diameter,
|
||||
height: diameter
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @consumes CartesianViewBoxContext
|
||||
* @consumes PolarViewBoxContext
|
||||
* @consumes CartesianLabelContext
|
||||
* @consumes PolarLabelContext
|
||||
*/
|
||||
export function Label(outerProps) {
|
||||
var props = resolveDefaultProps(outerProps, defaultLabelProps);
|
||||
var viewBoxFromProps = props.viewBox,
|
||||
parentViewBox = props.parentViewBox,
|
||||
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,
|
||||
labelRef = props.labelRef;
|
||||
var polarViewBox = usePolarLabelContext();
|
||||
var cartesianViewBox = useCartesianLabelContext();
|
||||
|
||||
/*
|
||||
* I am not proud about this solution, but it's a quick fix for https://github.com/recharts/recharts/issues/6030#issuecomment-3155352460.
|
||||
* What we should really do is split Label into two components: CartesianLabel and PolarLabel and then handle their respective viewBoxes separately.
|
||||
* Also other components should set its own viewBox in a context so that we can fix https://github.com/recharts/recharts/issues/6156
|
||||
*/
|
||||
var resolvedViewBox = position === 'center' ? cartesianViewBox : polarViewBox !== null && polarViewBox !== void 0 ? polarViewBox : cartesianViewBox;
|
||||
var viewBox, label, positionAttrs;
|
||||
if (viewBoxFromProps == null) {
|
||||
viewBox = resolvedViewBox;
|
||||
} else if (isPolar(viewBoxFromProps)) {
|
||||
viewBox = viewBoxFromProps;
|
||||
} else {
|
||||
viewBox = cartesianViewBoxToTrapezoid(viewBoxFromProps);
|
||||
}
|
||||
var cartesianBox = polarViewBoxToTrapezoid(viewBox);
|
||||
if (!viewBox || isNullish(value) && isNullish(children) && ! /*#__PURE__*/isValidElement(content) && typeof content !== 'function') {
|
||||
return null;
|
||||
}
|
||||
var propsWithViewBox = _objectSpread(_objectSpread({}, props), {}, {
|
||||
viewBox
|
||||
});
|
||||
if (/*#__PURE__*/isValidElement(content)) {
|
||||
var _ = propsWithViewBox.labelRef,
|
||||
propsWithoutLabelRef = _objectWithoutProperties(propsWithViewBox, _excluded);
|
||||
return /*#__PURE__*/cloneElement(content, propsWithoutLabelRef);
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
var _2 = propsWithViewBox.content,
|
||||
propsForContent = _objectWithoutProperties(propsWithViewBox, _excluded2);
|
||||
// @ts-expect-error we're not checking if the content component returns something that Text is able to render
|
||||
label = /*#__PURE__*/createElement(content, propsForContent);
|
||||
if (/*#__PURE__*/isValidElement(label)) {
|
||||
return label;
|
||||
}
|
||||
} else {
|
||||
label = getLabel(props);
|
||||
}
|
||||
var attrs = svgPropertiesAndEvents(props);
|
||||
if (isPolar(viewBox)) {
|
||||
// TODO: Generic Polar Hook
|
||||
if (position === 'insideStart' || position === 'insideEnd' || position === 'end') {
|
||||
return renderRadialLabel(props, position, label, attrs, viewBox);
|
||||
}
|
||||
positionAttrs = getAttrsOfPolarLabel(viewBox, props.offset, props.position);
|
||||
} else {
|
||||
if (!cartesianBox) {
|
||||
return null;
|
||||
}
|
||||
var cartesianResult = getCartesianPosition({
|
||||
viewBox: cartesianBox,
|
||||
position,
|
||||
offset: props.offset,
|
||||
parentViewBox: isPolar(parentViewBox) ? undefined : parentViewBox,
|
||||
clamp: true
|
||||
});
|
||||
positionAttrs = _objectSpread(_objectSpread({
|
||||
x: cartesianResult.x,
|
||||
y: cartesianResult.y,
|
||||
textAnchor: cartesianResult.horizontalAnchor,
|
||||
verticalAnchor: cartesianResult.verticalAnchor
|
||||
}, cartesianResult.width !== undefined ? {
|
||||
width: cartesianResult.width
|
||||
} : {}), cartesianResult.height !== undefined ? {
|
||||
height: cartesianResult.height
|
||||
} : {});
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
||||
zIndex: props.zIndex
|
||||
}, /*#__PURE__*/React.createElement(Text, _extends({
|
||||
ref: labelRef,
|
||||
className: clsx('recharts-label', className)
|
||||
}, attrs, positionAttrs, {
|
||||
/*
|
||||
* textAnchor is decided by default based on the `position`
|
||||
* but we allow overriding via props for precise control.
|
||||
*/
|
||||
textAnchor: isValidTextAnchor(attrs.textAnchor) ? attrs.textAnchor : positionAttrs.textAnchor,
|
||||
breakAll: textBreakAll
|
||||
}), label));
|
||||
}
|
||||
Label.displayName = 'Label';
|
||||
var parseLabel = (label, viewBox, labelRef) => {
|
||||
if (!label) {
|
||||
return null;
|
||||
}
|
||||
var commonProps = {
|
||||
viewBox,
|
||||
labelRef
|
||||
};
|
||||
if (label === true) {
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({
|
||||
key: "label-implicit"
|
||||
}, commonProps));
|
||||
}
|
||||
if (isNumOrStr(label)) {
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({
|
||||
key: "label-implicit",
|
||||
value: label
|
||||
}, commonProps));
|
||||
}
|
||||
if (/*#__PURE__*/isValidElement(label)) {
|
||||
if (label.type === Label) {
|
||||
return /*#__PURE__*/cloneElement(label, _objectSpread({
|
||||
key: 'label-implicit'
|
||||
}, commonProps));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({
|
||||
key: "label-implicit",
|
||||
content: label
|
||||
}, commonProps));
|
||||
}
|
||||
if (isLabelContentAFunction(label)) {
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({
|
||||
key: "label-implicit",
|
||||
content: label
|
||||
}, commonProps));
|
||||
}
|
||||
if (label && typeof label === 'object') {
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({}, label, {
|
||||
key: "label-implicit"
|
||||
}, commonProps));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
export function CartesianLabelFromLabelProp(_ref3) {
|
||||
var label = _ref3.label,
|
||||
labelRef = _ref3.labelRef;
|
||||
var viewBox = useCartesianLabelContext();
|
||||
return parseLabel(label, viewBox, labelRef) || null;
|
||||
}
|
||||
export function PolarLabelFromLabelProp(_ref4) {
|
||||
var label = _ref4.label;
|
||||
var viewBox = usePolarLabelContext();
|
||||
return parseLabel(label, viewBox) || null;
|
||||
}
|
||||
143
frontend/node_modules/recharts/es6/component/LabelList.js
generated
vendored
Normal file
143
frontend/node_modules/recharts/es6/component/LabelList.js
generated
vendored
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
var _excluded = ["valueAccessor"],
|
||||
_excluded2 = ["dataKey", "clockWise", "id", "textBreakAll", "zIndex"];
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
import * as React from 'react';
|
||||
import { createContext, useContext } from 'react';
|
||||
import { isLabelContentAFunction, Label } from './Label';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { getValueByDataKey } from '../util/ChartUtils';
|
||||
import { isNullish } from '../util/DataUtils';
|
||||
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
|
||||
import { ZIndexLayer } from '../zIndex/ZIndexLayer';
|
||||
import { DefaultZIndexes } from '../zIndex/DefaultZIndexes';
|
||||
import { isRenderableText } from './Text';
|
||||
|
||||
/**
|
||||
* This is public API because we expose it as the valueAccessor parameter.
|
||||
*
|
||||
* The properties of "viewBox" are repeated as the root props of the entry object.
|
||||
* So it doesn't matter if you read entry.x or entry.viewBox.x, they are the same.
|
||||
*
|
||||
* It's not necessary to pass redundant data, but we keep it for backward compatibility.
|
||||
*/
|
||||
|
||||
/**
|
||||
* LabelList props do not allow refs because the same props are reused in multiple elements so we don't have a good single place to ref to.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the type accepted for the `label` prop on various graphical items.
|
||||
* It accepts:
|
||||
*
|
||||
* boolean:
|
||||
* true = labels show,
|
||||
* false = labels don't show
|
||||
* React element:
|
||||
* will be cloned with extra props
|
||||
* function:
|
||||
* is used as <Label content={function} />, so this will be called once for each individual label (so typically once for each data point)
|
||||
* object:
|
||||
* the props to be passed to a LabelList component
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
var defaultAccessor = entry => {
|
||||
var val = Array.isArray(entry.value) ? entry.value[entry.value.length - 1] : entry.value;
|
||||
if (isRenderableText(val)) {
|
||||
return val;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
var CartesianLabelListContext = /*#__PURE__*/createContext(undefined);
|
||||
export var CartesianLabelListContextProvider = CartesianLabelListContext.Provider;
|
||||
var PolarLabelListContext = /*#__PURE__*/createContext(undefined);
|
||||
export var PolarLabelListContextProvider = PolarLabelListContext.Provider;
|
||||
function useCartesianLabelListContext() {
|
||||
return useContext(CartesianLabelListContext);
|
||||
}
|
||||
function usePolarLabelListContext() {
|
||||
return useContext(PolarLabelListContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @consumes LabelListContext
|
||||
*/
|
||||
export function LabelList(_ref) {
|
||||
var _ref$valueAccessor = _ref.valueAccessor,
|
||||
valueAccessor = _ref$valueAccessor === void 0 ? defaultAccessor : _ref$valueAccessor,
|
||||
restProps = _objectWithoutProperties(_ref, _excluded);
|
||||
var dataKey = restProps.dataKey,
|
||||
clockWise = restProps.clockWise,
|
||||
id = restProps.id,
|
||||
textBreakAll = restProps.textBreakAll,
|
||||
zIndex = restProps.zIndex,
|
||||
others = _objectWithoutProperties(restProps, _excluded2);
|
||||
var cartesianData = useCartesianLabelListContext();
|
||||
var polarData = usePolarLabelListContext();
|
||||
var data = cartesianData || polarData;
|
||||
if (!data || !data.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(ZIndexLayer, {
|
||||
zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : DefaultZIndexes.label
|
||||
}, /*#__PURE__*/React.createElement(Layer, {
|
||||
className: "recharts-label-list"
|
||||
}, data.map((entry, index) => {
|
||||
var _restProps$fill;
|
||||
var value = isNullish(dataKey) ? valueAccessor(entry, index) : getValueByDataKey(entry.payload, dataKey);
|
||||
var idProps = isNullish(id) ? {} : {
|
||||
id: "".concat(id, "-").concat(index)
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(Label, _extends({
|
||||
key: "label-".concat(index)
|
||||
}, svgPropertiesAndEvents(entry), others, idProps, {
|
||||
/*
|
||||
* Prefer to use the explicit fill from LabelList props.
|
||||
* Only in an absence of that, fall back to the fill of the entry.
|
||||
* The entry fill can be quite difficult to see especially in Bar, Pie, RadialBar in inside positions.
|
||||
* On the other hand it's quite convenient in Scatter, Line, or when the position is outside the Bar, Pie filled shapes.
|
||||
*/
|
||||
fill: (_restProps$fill = restProps.fill) !== null && _restProps$fill !== void 0 ? _restProps$fill : entry.fill,
|
||||
parentViewBox: entry.parentViewBox,
|
||||
value: value,
|
||||
textBreakAll: textBreakAll,
|
||||
viewBox: entry.viewBox,
|
||||
index: index
|
||||
/*
|
||||
* Here we don't want to use the default Label zIndex,
|
||||
* we want it to inherit the zIndex of the LabelList itself
|
||||
* which means just rendering as a regular child, without portaling anywhere.
|
||||
*/,
|
||||
zIndex: 0
|
||||
}));
|
||||
})));
|
||||
}
|
||||
LabelList.displayName = 'LabelList';
|
||||
export function LabelListFromLabelProp(_ref2) {
|
||||
var label = _ref2.label;
|
||||
if (!label) {
|
||||
return null;
|
||||
}
|
||||
if (label === true) {
|
||||
return /*#__PURE__*/React.createElement(LabelList, {
|
||||
key: "labelList-implicit"
|
||||
});
|
||||
}
|
||||
if (/*#__PURE__*/React.isValidElement(label) || isLabelContentAFunction(label)) {
|
||||
return /*#__PURE__*/React.createElement(LabelList, {
|
||||
key: "labelList-implicit",
|
||||
content: label
|
||||
});
|
||||
}
|
||||
if (typeof label === 'object') {
|
||||
return /*#__PURE__*/React.createElement(LabelList, _extends({
|
||||
key: "labelList-implicit"
|
||||
}, label, {
|
||||
type: String(label.type)
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
196
frontend/node_modules/recharts/es6/component/Legend.js
generated
vendored
Normal file
196
frontend/node_modules/recharts/es6/component/Legend.js
generated
vendored
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
var _excluded = ["contextPayload"];
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
import * as React from 'react';
|
||||
import { useLayoutEffect } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { useLegendPortal } from '../context/legendPortalContext';
|
||||
import { DefaultLegendContent } from './DefaultLegendContent';
|
||||
import { getUniqPayload } from '../util/payload/getUniqPayload';
|
||||
import { useLegendPayload } from '../context/legendPayloadContext';
|
||||
import { useElementOffset } from '../util/useElementOffset';
|
||||
import { useChartHeight, useChartWidth, useMargin } from '../context/chartLayoutContext';
|
||||
import { setLegendSettings, setLegendSize } from '../state/legendSlice';
|
||||
import { useAppDispatch } from '../state/hooks';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { propsAreEqual } from '../util/propsAreEqual';
|
||||
function defaultUniqBy(entry) {
|
||||
return entry.value;
|
||||
}
|
||||
function LegendContent(props) {
|
||||
var contextPayload = props.contextPayload,
|
||||
otherProps = _objectWithoutProperties(props, _excluded);
|
||||
var finalPayload = getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
|
||||
var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, {
|
||||
payload: finalPayload
|
||||
});
|
||||
if (/*#__PURE__*/React.isValidElement(props.content)) {
|
||||
return /*#__PURE__*/React.cloneElement(props.content, contentProps);
|
||||
}
|
||||
if (typeof props.content === 'function') {
|
||||
return /*#__PURE__*/React.createElement(props.content, contentProps);
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(DefaultLegendContent, contentProps);
|
||||
}
|
||||
function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
|
||||
var layout = props.layout,
|
||||
align = props.align,
|
||||
verticalAlign = props.verticalAlign;
|
||||
var hPos, vPos;
|
||||
if (!style || (style.left === undefined || style.left === null) && (style.right === undefined || style.right === null)) {
|
||||
if (align === 'center' && layout === 'vertical') {
|
||||
hPos = {
|
||||
left: ((chartWidth || 0) - box.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') {
|
||||
vPos = {
|
||||
top: ((chartHeight || 0) - box.height) / 2
|
||||
};
|
||||
} else {
|
||||
vPos = verticalAlign === 'bottom' ? {
|
||||
bottom: margin && margin.bottom || 0
|
||||
} : {
|
||||
top: margin && margin.top || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, hPos), vPos);
|
||||
}
|
||||
function LegendSettingsDispatcher(_ref) {
|
||||
var align = _ref.align,
|
||||
layout = _ref.layout,
|
||||
verticalAlign = _ref.verticalAlign,
|
||||
itemSorter = _ref.itemSorter;
|
||||
var dispatch = useAppDispatch();
|
||||
useLayoutEffect(() => {
|
||||
dispatch(setLegendSettings({
|
||||
align,
|
||||
layout,
|
||||
verticalAlign,
|
||||
itemSorter
|
||||
}));
|
||||
}, [dispatch, align, layout, verticalAlign, itemSorter]);
|
||||
return null;
|
||||
}
|
||||
function LegendSizeDispatcher(_ref2) {
|
||||
var width = _ref2.width,
|
||||
height = _ref2.height;
|
||||
var dispatch = useAppDispatch();
|
||||
useLayoutEffect(() => {
|
||||
dispatch(setLegendSize({
|
||||
width,
|
||||
height
|
||||
}));
|
||||
}, [dispatch, width, height]);
|
||||
useLayoutEffect(() => {
|
||||
return () => {
|
||||
dispatch(setLegendSize({
|
||||
width: 0,
|
||||
height: 0
|
||||
}));
|
||||
};
|
||||
}, [dispatch]);
|
||||
return null;
|
||||
}
|
||||
function getWidthOrHeight(layout, height, width, maxWidth) {
|
||||
if (layout === 'vertical' && height != null) {
|
||||
return {
|
||||
height
|
||||
};
|
||||
}
|
||||
if (layout === 'horizontal') {
|
||||
return {
|
||||
width: width || maxWidth
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
export var legendDefaultProps = {
|
||||
align: 'center',
|
||||
iconSize: 14,
|
||||
inactiveColor: '#ccc',
|
||||
itemSorter: 'value',
|
||||
labelStyle: {},
|
||||
layout: 'horizontal',
|
||||
verticalAlign: 'bottom'
|
||||
};
|
||||
|
||||
/**
|
||||
* @consumes CartesianChartContext
|
||||
* @consumes PolarChartContext
|
||||
*/
|
||||
function LegendImpl(outsideProps) {
|
||||
var props = resolveDefaultProps(outsideProps, legendDefaultProps);
|
||||
var contextPayload = useLegendPayload();
|
||||
var legendPortalFromContext = useLegendPortal();
|
||||
var margin = useMargin();
|
||||
var widthFromProps = props.width,
|
||||
heightFromProps = props.height,
|
||||
wrapperStyle = props.wrapperStyle,
|
||||
portalFromProps = props.portal;
|
||||
// The contextPayload is not used directly inside the hook, but we need the onBBoxUpdate call
|
||||
// when the payload changes, therefore it's here as a dependency.
|
||||
var _useElementOffset = useElementOffset([contextPayload]),
|
||||
_useElementOffset2 = _slicedToArray(_useElementOffset, 2),
|
||||
lastBoundingBox = _useElementOffset2[0],
|
||||
updateBoundingBox = _useElementOffset2[1];
|
||||
var chartWidth = useChartWidth();
|
||||
var chartHeight = useChartHeight();
|
||||
if (chartWidth == null || chartHeight == null) {
|
||||
return null;
|
||||
}
|
||||
var maxWidth = chartWidth - ((margin === null || margin === void 0 ? void 0 : margin.left) || 0) - ((margin === null || margin === void 0 ? void 0 : margin.right) || 0);
|
||||
var widthOrHeight = getWidthOrHeight(props.layout, heightFromProps, widthFromProps, maxWidth);
|
||||
// if the user supplies their own portal, only use their defined wrapper styles
|
||||
var outerStyle = portalFromProps ? wrapperStyle : _objectSpread(_objectSpread({
|
||||
position: 'absolute',
|
||||
width: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.width) || widthFromProps || 'auto',
|
||||
height: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.height) || heightFromProps || 'auto'
|
||||
}, getDefaultPosition(wrapperStyle, props, margin, chartWidth, chartHeight, lastBoundingBox)), wrapperStyle);
|
||||
var legendPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : legendPortalFromContext;
|
||||
if (legendPortal == null || contextPayload == null) {
|
||||
return null;
|
||||
}
|
||||
var legendElement = /*#__PURE__*/React.createElement("div", {
|
||||
className: "recharts-legend-wrapper",
|
||||
style: outerStyle,
|
||||
ref: updateBoundingBox
|
||||
}, /*#__PURE__*/React.createElement(LegendSettingsDispatcher, {
|
||||
layout: props.layout,
|
||||
align: props.align,
|
||||
verticalAlign: props.verticalAlign,
|
||||
itemSorter: props.itemSorter
|
||||
}), !portalFromProps && /*#__PURE__*/React.createElement(LegendSizeDispatcher, {
|
||||
width: lastBoundingBox.width,
|
||||
height: lastBoundingBox.height
|
||||
}), /*#__PURE__*/React.createElement(LegendContent, _extends({}, props, widthOrHeight, {
|
||||
margin: margin,
|
||||
chartWidth: chartWidth,
|
||||
chartHeight: chartHeight,
|
||||
contextPayload: contextPayload
|
||||
})));
|
||||
return /*#__PURE__*/createPortal(legendElement, legendPortal);
|
||||
}
|
||||
export var Legend = /*#__PURE__*/React.memo(LegendImpl, propsAreEqual);
|
||||
Legend.displayName = 'Legend';
|
||||
226
frontend/node_modules/recharts/es6/component/ResponsiveContainer.js
generated
vendored
Normal file
226
frontend/node_modules/recharts/es6/component/ResponsiveContainer.js
generated
vendored
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
var _excluded = ["aspect", "initialDimension", "width", "height", "minWidth", "minHeight", "maxHeight", "children", "debounce", "id", "className", "onResize", "style"];
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
import { clsx } from 'clsx';
|
||||
import * as React from 'react';
|
||||
import { createContext, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
||||
import throttle from 'es-toolkit/compat/throttle';
|
||||
import { isNumber, noop } from '../util/DataUtils';
|
||||
import { warn } from '../util/LogUtils';
|
||||
import { calculateChartDimensions, defaultResponsiveContainerProps, getDefaultWidthAndHeight, getInnerDivStyle } from './responsiveContainerUtils';
|
||||
import { isPositiveNumber } from '../util/isWellBehavedNumber';
|
||||
var ResponsiveContainerContext = /*#__PURE__*/createContext(defaultResponsiveContainerProps.initialDimension);
|
||||
function isAcceptableSize(size) {
|
||||
return isPositiveNumber(size.width) && isPositiveNumber(size.height);
|
||||
}
|
||||
function ResponsiveContainerContextProvider(_ref) {
|
||||
var children = _ref.children,
|
||||
width = _ref.width,
|
||||
height = _ref.height;
|
||||
var size = useMemo(() => ({
|
||||
width,
|
||||
height
|
||||
}), [width, height]);
|
||||
if (!isAcceptableSize(size)) {
|
||||
/*
|
||||
* Don't render the container if width or height is non-positive because
|
||||
* in that case the chart will not be rendered properly anyway.
|
||||
* We will instead wait for the next resize event to provide the correct dimensions.
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(ResponsiveContainerContext.Provider, {
|
||||
value: size
|
||||
}, children);
|
||||
}
|
||||
export var useResponsiveContainerContext = () => useContext(ResponsiveContainerContext);
|
||||
var SizeDetectorContainer = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
||||
var aspect = _ref2.aspect,
|
||||
_ref2$initialDimensio = _ref2.initialDimension,
|
||||
initialDimension = _ref2$initialDimensio === void 0 ? defaultResponsiveContainerProps.initialDimension : _ref2$initialDimensio,
|
||||
width = _ref2.width,
|
||||
height = _ref2.height,
|
||||
_ref2$minWidth = _ref2.minWidth,
|
||||
minWidth = _ref2$minWidth === void 0 ? defaultResponsiveContainerProps.minWidth : _ref2$minWidth,
|
||||
minHeight = _ref2.minHeight,
|
||||
maxHeight = _ref2.maxHeight,
|
||||
children = _ref2.children,
|
||||
_ref2$debounce = _ref2.debounce,
|
||||
debounce = _ref2$debounce === void 0 ? defaultResponsiveContainerProps.debounce : _ref2$debounce,
|
||||
id = _ref2.id,
|
||||
className = _ref2.className,
|
||||
onResize = _ref2.onResize,
|
||||
_ref2$style = _ref2.style,
|
||||
style = _ref2$style === void 0 ? {} : _ref2$style,
|
||||
others = _objectWithoutProperties(_ref2, _excluded);
|
||||
var containerRef = useRef(null);
|
||||
/*
|
||||
* We are using a ref to avoid re-creating the ResizeObserver when the onResize function changes.
|
||||
* The ref is updated on every render, so the latest onResize function is always available in the effect.
|
||||
*/
|
||||
var onResizeRef = useRef();
|
||||
onResizeRef.current = onResize;
|
||||
useImperativeHandle(ref, () => containerRef.current);
|
||||
var _useState = useState({
|
||||
containerWidth: initialDimension.width,
|
||||
containerHeight: initialDimension.height
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
sizes = _useState2[0],
|
||||
setSizes = _useState2[1];
|
||||
var setContainerSize = useCallback((newWidth, newHeight) => {
|
||||
setSizes(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(() => {
|
||||
if (containerRef.current == null || typeof ResizeObserver === 'undefined') {
|
||||
return noop;
|
||||
}
|
||||
var callback = entries => {
|
||||
var _onResizeRef$current;
|
||||
var entry = entries[0];
|
||||
if (entry == null) {
|
||||
return;
|
||||
}
|
||||
var _entry$contentRect = entry.contentRect,
|
||||
containerWidth = _entry$contentRect.width,
|
||||
containerHeight = _entry$contentRect.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 () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [setContainerSize, debounce]);
|
||||
var containerWidth = sizes.containerWidth,
|
||||
containerHeight = sizes.containerHeight;
|
||||
warn(!aspect || aspect > 0, 'The aspect(%s) must be greater than zero.', aspect);
|
||||
var _calculateChartDimens = calculateChartDimensions(containerWidth, containerHeight, {
|
||||
width,
|
||||
height,
|
||||
aspect,
|
||||
maxHeight
|
||||
}),
|
||||
calculatedWidth = _calculateChartDimens.calculatedWidth,
|
||||
calculatedHeight = _calculateChartDimens.calculatedHeight;
|
||||
warn(containerWidth < 0 || containerHeight < 0 || calculatedWidth != null && calculatedWidth > 0 || calculatedHeight != null && 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);
|
||||
return /*#__PURE__*/React.createElement("div", _extends({
|
||||
id: id ? "".concat(id) : undefined,
|
||||
className: clsx('recharts-responsive-container', className),
|
||||
style: _objectSpread(_objectSpread({}, style), {}, {
|
||||
width,
|
||||
height,
|
||||
minWidth,
|
||||
minHeight,
|
||||
maxHeight
|
||||
}),
|
||||
ref: containerRef
|
||||
}, others), /*#__PURE__*/React.createElement("div", {
|
||||
style: getInnerDivStyle({
|
||||
width,
|
||||
height
|
||||
})
|
||||
}, /*#__PURE__*/React.createElement(ResponsiveContainerContextProvider, {
|
||||
width: calculatedWidth,
|
||||
height: calculatedHeight
|
||||
}, children)));
|
||||
});
|
||||
|
||||
/**
|
||||
* The `ResponsiveContainer` component is a container that adjusts its width and height based on the size of its parent element.
|
||||
* It is used to create responsive charts that adapt to different screen sizes.
|
||||
*
|
||||
* This component uses the {@link https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver ResizeObserver} API to monitor changes to the size of its parent element.
|
||||
* If you need to support older browsers that do not support this API, you may need to include a polyfill.
|
||||
*
|
||||
* @see {@link https://recharts.github.io/en-US/guide/sizes/ Chart size guide}
|
||||
*
|
||||
* @provides ResponsiveContainerContext
|
||||
*/
|
||||
export var ResponsiveContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var responsiveContainerContext = useResponsiveContainerContext();
|
||||
if (isPositiveNumber(responsiveContainerContext.width) && isPositiveNumber(responsiveContainerContext.height)) {
|
||||
/*
|
||||
* If we detect that we are already inside another ResponsiveContainer,
|
||||
* we do not attempt to add another layer of responsiveness.
|
||||
*/
|
||||
return props.children;
|
||||
}
|
||||
var _getDefaultWidthAndHe = getDefaultWidthAndHeight({
|
||||
width: props.width,
|
||||
height: props.height,
|
||||
aspect: props.aspect
|
||||
}),
|
||||
width = _getDefaultWidthAndHe.width,
|
||||
height = _getDefaultWidthAndHe.height;
|
||||
|
||||
/*
|
||||
* Let's try to get the calculated dimensions without having the div container set up.
|
||||
* Sometimes this does produce fixed, positive dimensions. If so, we can skip rendering the div and monitoring its size.
|
||||
*/
|
||||
var _calculateChartDimens2 = calculateChartDimensions(undefined, undefined, {
|
||||
width,
|
||||
height,
|
||||
aspect: props.aspect,
|
||||
maxHeight: props.maxHeight
|
||||
}),
|
||||
calculatedWidth = _calculateChartDimens2.calculatedWidth,
|
||||
calculatedHeight = _calculateChartDimens2.calculatedHeight;
|
||||
if (isNumber(calculatedWidth) && isNumber(calculatedHeight)) {
|
||||
/*
|
||||
* If it just so happens that the combination of width, height, and aspect ratio
|
||||
* results in fixed dimensions, then we don't need to monitor the container's size.
|
||||
* We can just provide these fixed dimensions to the context.
|
||||
*
|
||||
* Note that here we are not checking for positive numbers;
|
||||
* if the user provides a zero or negative width/height, we will just pass that along
|
||||
* as whatever size we detect won't be helping anyway.
|
||||
*/
|
||||
return /*#__PURE__*/React.createElement(ResponsiveContainerContextProvider, {
|
||||
width: calculatedWidth,
|
||||
height: calculatedHeight
|
||||
}, props.children);
|
||||
}
|
||||
/*
|
||||
* Static analysis did not produce fixed dimensions,
|
||||
* so we need to render a special div and monitor its size.
|
||||
*/
|
||||
return /*#__PURE__*/React.createElement(SizeDetectorContainer, _extends({}, props, {
|
||||
width: width,
|
||||
height: height,
|
||||
ref: ref
|
||||
}));
|
||||
});
|
||||
283
frontend/node_modules/recharts/es6/component/Text.js
generated
vendored
Normal file
283
frontend/node_modules/recharts/es6/component/Text.js
generated
vendored
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
var _excluded = ["x", "y", "lineHeight", "capHeight", "fill", "scaleToFit", "textAnchor", "verticalAnchor"],
|
||||
_excluded2 = ["dx", "dy", "angle", "className", "breakAll"];
|
||||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
import * as React from 'react';
|
||||
import { useMemo, forwardRef } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { isNullish, isNumber, isNumOrStr } from '../util/DataUtils';
|
||||
import { Global } from '../util/Global';
|
||||
import { getStringSize } from '../util/DOMUtils';
|
||||
import { reduceCSSCalc } from '../util/ReduceCSSCalc';
|
||||
import { svgPropertiesAndEvents } from '../util/svgPropertiesAndEvents';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { isWellBehavedNumber } from '../util/isWellBehavedNumber';
|
||||
var BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
|
||||
var calculateWordWidths = _ref => {
|
||||
var children = _ref.children,
|
||||
breakAll = _ref.breakAll,
|
||||
style = _ref.style;
|
||||
try {
|
||||
var words = [];
|
||||
if (!isNullish(children)) {
|
||||
if (breakAll) {
|
||||
words = children.toString().split('');
|
||||
} else {
|
||||
words = children.toString().split(BREAKING_SPACES);
|
||||
}
|
||||
}
|
||||
var wordsWithComputedWidth = words.map(word => ({
|
||||
word,
|
||||
width: getStringSize(word, style).width
|
||||
}));
|
||||
var spaceWidth = breakAll ? 0 : getStringSize('\u00A0', style).width;
|
||||
return {
|
||||
wordsWithComputedWidth,
|
||||
spaceWidth
|
||||
};
|
||||
} catch (_unused) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
export function isValidTextAnchor(value) {
|
||||
return value === 'start' || value === 'middle' || value === 'end' || value === 'inherit';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
export function isRenderableText(val) {
|
||||
return isNullish(val) || typeof val === 'string' || typeof val === 'number' || typeof val === 'boolean';
|
||||
}
|
||||
var calculate = (words, lineWidth, spaceWidth, scaleToFit) => words.reduce((result, _ref2) => {
|
||||
var word = _ref2.word,
|
||||
width = _ref2.width;
|
||||
var currentLine = result[result.length - 1];
|
||||
if (currentLine && width != null && (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
|
||||
};
|
||||
result.push(newLine);
|
||||
}
|
||||
return result;
|
||||
}, []);
|
||||
var findLongestLine = words => words.reduce((a, b) => a.width > b.width ? a : b);
|
||||
var suffix = '…';
|
||||
var checkOverflow = (text, index, breakAll, style, maxLines, lineWidth, spaceWidth, scaleToFit) => {
|
||||
var tempText = text.slice(0, index);
|
||||
var words = calculateWordWidths({
|
||||
breakAll,
|
||||
style,
|
||||
children: tempText + suffix
|
||||
});
|
||||
if (!words) {
|
||||
return [false, []];
|
||||
}
|
||||
var result = calculate(words.wordsWithComputedWidth, lineWidth, spaceWidth, scaleToFit);
|
||||
var doesOverflow = result.length > maxLines || findLongestLine(result).width > Number(lineWidth);
|
||||
return [doesOverflow, result];
|
||||
};
|
||||
var calculateWordsByLines = (_ref3, initialWordsWithComputedWith, spaceWidth, lineWidth, scaleToFit) => {
|
||||
var maxLines = _ref3.maxLines,
|
||||
children = _ref3.children,
|
||||
style = _ref3.style,
|
||||
breakAll = _ref3.breakAll;
|
||||
var shouldLimitLines = isNumber(maxLines);
|
||||
var text = String(children);
|
||||
var originalResult = calculate(initialWordsWithComputedWith, lineWidth, spaceWidth, scaleToFit);
|
||||
if (!shouldLimitLines || scaleToFit) {
|
||||
return originalResult;
|
||||
}
|
||||
var overflows = originalResult.length > maxLines || findLongestLine(originalResult).width > Number(lineWidth);
|
||||
if (!overflows) {
|
||||
return originalResult;
|
||||
}
|
||||
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(text, prev, breakAll, style, maxLines, lineWidth, spaceWidth, scaleToFit),
|
||||
_checkOverflow2 = _slicedToArray(_checkOverflow, 2),
|
||||
doesPrevOverflow = _checkOverflow2[0],
|
||||
result = _checkOverflow2[1];
|
||||
var _checkOverflow3 = checkOverflow(text, middle, breakAll, style, maxLines, lineWidth, spaceWidth, scaleToFit),
|
||||
_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 = children => {
|
||||
var words = !isNullish(children) ? children.toString().split(BREAKING_SPACES) : [];
|
||||
return [{
|
||||
words,
|
||||
width: undefined
|
||||
}];
|
||||
};
|
||||
export var 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,
|
||||
children,
|
||||
style
|
||||
});
|
||||
if (wordWidths) {
|
||||
var wcw = wordWidths.wordsWithComputedWidth,
|
||||
sw = wordWidths.spaceWidth;
|
||||
wordsWithComputedWidth = wcw;
|
||||
spaceWidth = sw;
|
||||
} else {
|
||||
return getWordsWithoutCalculate(children);
|
||||
}
|
||||
return calculateWordsByLines({
|
||||
breakAll,
|
||||
children,
|
||||
maxLines,
|
||||
style
|
||||
}, wordsWithComputedWidth, spaceWidth, width, Boolean(scaleToFit));
|
||||
}
|
||||
return getWordsWithoutCalculate(children);
|
||||
};
|
||||
var DEFAULT_FILL = '#808080';
|
||||
export var textDefaultProps = {
|
||||
angle: 0,
|
||||
breakAll: false,
|
||||
// Magic number from d3
|
||||
capHeight: '0.71em',
|
||||
fill: DEFAULT_FILL,
|
||||
lineHeight: '1em',
|
||||
scaleToFit: false,
|
||||
textAnchor: 'start',
|
||||
// Maintain compat with existing charts / default SVG behavior
|
||||
verticalAnchor: 'end',
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
export var Text = /*#__PURE__*/forwardRef((outsideProps, ref) => {
|
||||
var _resolveDefaultProps = resolveDefaultProps(outsideProps, textDefaultProps),
|
||||
propsX = _resolveDefaultProps.x,
|
||||
propsY = _resolveDefaultProps.y,
|
||||
lineHeight = _resolveDefaultProps.lineHeight,
|
||||
capHeight = _resolveDefaultProps.capHeight,
|
||||
fill = _resolveDefaultProps.fill,
|
||||
scaleToFit = _resolveDefaultProps.scaleToFit,
|
||||
textAnchor = _resolveDefaultProps.textAnchor,
|
||||
verticalAnchor = _resolveDefaultProps.verticalAnchor,
|
||||
props = _objectWithoutProperties(_resolveDefaultProps, _excluded);
|
||||
var wordsByLines = useMemo(() => {
|
||||
return getWordsByLines({
|
||||
breakAll: props.breakAll,
|
||||
children: props.children,
|
||||
maxLines: props.maxLines,
|
||||
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) || wordsByLines.length === 0) {
|
||||
return null;
|
||||
}
|
||||
var x = Number(propsX) + (isNumber(dx) ? dx : 0);
|
||||
var y = Number(propsY) + (isNumber(dy) ? dy : 0);
|
||||
if (!isWellBehavedNumber(x) || !isWellBehavedNumber(y)) {
|
||||
return null;
|
||||
}
|
||||
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 = [];
|
||||
var firstLine = wordsByLines[0];
|
||||
if (scaleToFit && firstLine != null) {
|
||||
var lineWidth = firstLine.width;
|
||||
var width = props.width;
|
||||
transforms.push("scale(".concat(isNumber(width) && isNumber(lineWidth) ? width / lineWidth : 1, ")"));
|
||||
}
|
||||
if (angle) {
|
||||
transforms.push("rotate(".concat(angle, ", ").concat(x, ", ").concat(y, ")"));
|
||||
}
|
||||
if (transforms.length) {
|
||||
textProps.transform = transforms.join(' ');
|
||||
}
|
||||
return /*#__PURE__*/React.createElement("text", _extends({}, svgPropertiesAndEvents(textProps), {
|
||||
ref: ref,
|
||||
x: x,
|
||||
y: y,
|
||||
className: clsx('recharts-text', className),
|
||||
textAnchor: textAnchor,
|
||||
fill: fill.includes('url') ? DEFAULT_FILL : fill
|
||||
}), wordsByLines.map((line, index) => {
|
||||
var words = line.words.join(breakAll ? '' : ' ');
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// duplicate words will cause duplicate keys which is why we add the array index here
|
||||
React.createElement("tspan", {
|
||||
x: x,
|
||||
dy: index === 0 ? startDy : lineHeight,
|
||||
key: "".concat(words, "-").concat(index)
|
||||
}, words)
|
||||
);
|
||||
}));
|
||||
});
|
||||
Text.displayName = 'Text';
|
||||
184
frontend/node_modules/recharts/es6/component/Tooltip.js
generated
vendored
Normal file
184
frontend/node_modules/recharts/es6/component/Tooltip.js
generated
vendored
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
import * as React from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { DefaultTooltipContent } from './DefaultTooltipContent';
|
||||
import { TooltipBoundingBox } from './TooltipBoundingBox';
|
||||
import { getUniqPayload } from '../util/payload/getUniqPayload';
|
||||
import { useViewBox } from '../context/chartLayoutContext';
|
||||
import { useAccessibilityLayer } from '../context/accessibilityContext';
|
||||
import { useElementOffset } from '../util/useElementOffset';
|
||||
import { Cursor } from './Cursor';
|
||||
import { selectActiveCoordinate, selectActiveLabel, selectIsTooltipActive, selectTooltipPayload } from '../state/selectors/selectors';
|
||||
import { useTooltipPortal } from '../context/tooltipPortalContext';
|
||||
import { useAppDispatch, useAppSelector } from '../state/hooks';
|
||||
import { setTooltipSettingsState } from '../state/tooltipSlice';
|
||||
import { useTooltipChartSynchronisation } from '../synchronisation/useChartSynchronisation';
|
||||
import { useTooltipEventType } from '../state/selectors/selectTooltipEventType';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
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);
|
||||
}
|
||||
var emptyPayload = [];
|
||||
export var defaultTooltipProps = {
|
||||
allowEscapeViewBox: {
|
||||
x: false,
|
||||
y: false
|
||||
},
|
||||
animationDuration: 400,
|
||||
animationEasing: 'ease',
|
||||
axisId: 0,
|
||||
contentStyle: {},
|
||||
cursor: true,
|
||||
filterNull: true,
|
||||
includeHidden: false,
|
||||
isAnimationActive: 'auto',
|
||||
itemSorter: 'name',
|
||||
itemStyle: {},
|
||||
labelStyle: {},
|
||||
offset: 10,
|
||||
reverseDirection: {
|
||||
x: false,
|
||||
y: false
|
||||
},
|
||||
separator: ' : ',
|
||||
trigger: 'hover',
|
||||
useTranslate3d: false,
|
||||
wrapperStyle: {}
|
||||
};
|
||||
|
||||
/**
|
||||
* The Tooltip component displays a floating box with data values when hovering over or clicking on chart elements.
|
||||
*
|
||||
* It can be configured to show information for individual data points or for all points at a specific axis coordinate.
|
||||
* The appearance and content of the tooltip can be customized via props.
|
||||
*
|
||||
* @see {@link https://github.com/recharts/recharts/wiki/Tooltip-event-type-and-shared-prop Tooltip event type and shared prop wiki page}
|
||||
* @see {@link https://recharts.github.io/en-US/guide/activeIndex/ Active index replacement when migrating from Recharts v2 to v3}
|
||||
*
|
||||
* @consumes CartesianChartContext
|
||||
* @consumes PolarChartContext
|
||||
* @consumes TooltipEntrySettings
|
||||
*/
|
||||
export function Tooltip(outsideProps) {
|
||||
var _useAppSelector, _ref2;
|
||||
var props = resolveDefaultProps(outsideProps, defaultTooltipProps);
|
||||
var activeFromProps = props.active,
|
||||
allowEscapeViewBox = props.allowEscapeViewBox,
|
||||
animationDuration = props.animationDuration,
|
||||
animationEasing = props.animationEasing,
|
||||
content = props.content,
|
||||
filterNull = props.filterNull,
|
||||
isAnimationActive = props.isAnimationActive,
|
||||
offset = props.offset,
|
||||
payloadUniqBy = props.payloadUniqBy,
|
||||
position = props.position,
|
||||
reverseDirection = props.reverseDirection,
|
||||
useTranslate3d = props.useTranslate3d,
|
||||
wrapperStyle = props.wrapperStyle,
|
||||
cursor = props.cursor,
|
||||
shared = props.shared,
|
||||
trigger = props.trigger,
|
||||
defaultIndex = props.defaultIndex,
|
||||
portalFromProps = props.portal,
|
||||
axisId = props.axisId;
|
||||
var dispatch = useAppDispatch();
|
||||
var defaultIndexAsString = typeof defaultIndex === 'number' ? String(defaultIndex) : defaultIndex;
|
||||
useEffect(() => {
|
||||
dispatch(setTooltipSettingsState({
|
||||
shared,
|
||||
trigger,
|
||||
axisId,
|
||||
active: activeFromProps,
|
||||
defaultIndex: defaultIndexAsString
|
||||
}));
|
||||
}, [dispatch, shared, trigger, axisId, activeFromProps, defaultIndexAsString]);
|
||||
var viewBox = useViewBox();
|
||||
var accessibilityLayer = useAccessibilityLayer();
|
||||
var tooltipEventType = useTooltipEventType(shared);
|
||||
var _ref = (_useAppSelector = useAppSelector(state => selectIsTooltipActive(state, tooltipEventType, trigger, defaultIndexAsString))) !== null && _useAppSelector !== void 0 ? _useAppSelector : {},
|
||||
activeIndex = _ref.activeIndex,
|
||||
isActive = _ref.isActive;
|
||||
var payloadFromRedux = useAppSelector(state => selectTooltipPayload(state, tooltipEventType, trigger, defaultIndexAsString));
|
||||
var labelFromRedux = useAppSelector(state => selectActiveLabel(state, tooltipEventType, trigger, defaultIndexAsString));
|
||||
var coordinate = useAppSelector(state => selectActiveCoordinate(state, tooltipEventType, trigger, defaultIndexAsString));
|
||||
var payload = payloadFromRedux;
|
||||
var tooltipPortalFromContext = useTooltipPortal();
|
||||
/*
|
||||
* The user can set `active=true` on the Tooltip in which case the Tooltip will stay always active,
|
||||
* or `active=false` in which case the Tooltip never shows.
|
||||
*
|
||||
* If the `active` prop is not defined then it will show and hide based on mouse or keyboard activity.
|
||||
*/
|
||||
var finalIsActive = (_ref2 = activeFromProps !== null && activeFromProps !== void 0 ? activeFromProps : isActive) !== null && _ref2 !== void 0 ? _ref2 : false;
|
||||
var _useElementOffset = useElementOffset([payload, finalIsActive]),
|
||||
_useElementOffset2 = _slicedToArray(_useElementOffset, 2),
|
||||
lastBoundingBox = _useElementOffset2[0],
|
||||
updateBoundingBox = _useElementOffset2[1];
|
||||
var finalLabel = tooltipEventType === 'axis' ? labelFromRedux : undefined;
|
||||
useTooltipChartSynchronisation(tooltipEventType, trigger, coordinate, finalLabel, activeIndex, finalIsActive);
|
||||
var tooltipPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : tooltipPortalFromContext;
|
||||
if (tooltipPortal == null || viewBox == null || tooltipEventType == null) {
|
||||
return null;
|
||||
}
|
||||
var finalPayload = payload !== null && payload !== void 0 ? payload : emptyPayload;
|
||||
if (!finalIsActive) {
|
||||
finalPayload = emptyPayload;
|
||||
}
|
||||
if (filterNull && finalPayload.length) {
|
||||
finalPayload = getUniqPayload(finalPayload.filter(entry => entry.value != null && (entry.hide !== true || props.includeHidden)), payloadUniqBy, defaultUniqBy);
|
||||
}
|
||||
var hasPayload = finalPayload.length > 0;
|
||||
var tooltipContentProps = _objectSpread(_objectSpread({}, props), {}, {
|
||||
payload: finalPayload,
|
||||
label: finalLabel,
|
||||
active: finalIsActive,
|
||||
activeIndex,
|
||||
coordinate,
|
||||
accessibilityLayer
|
||||
});
|
||||
var tooltipElement = /*#__PURE__*/React.createElement(TooltipBoundingBox, {
|
||||
allowEscapeViewBox: allowEscapeViewBox,
|
||||
animationDuration: animationDuration,
|
||||
animationEasing: animationEasing,
|
||||
isAnimationActive: isAnimationActive,
|
||||
active: finalIsActive,
|
||||
coordinate: coordinate,
|
||||
hasPayload: hasPayload,
|
||||
offset: offset,
|
||||
position: position,
|
||||
reverseDirection: reverseDirection,
|
||||
useTranslate3d: useTranslate3d,
|
||||
viewBox: viewBox,
|
||||
wrapperStyle: wrapperStyle,
|
||||
lastBoundingBox: lastBoundingBox,
|
||||
innerRef: updateBoundingBox,
|
||||
hasPortalFromProps: Boolean(portalFromProps)
|
||||
}, renderContent(content, tooltipContentProps));
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createPortal(tooltipElement, tooltipPortal), finalIsActive && /*#__PURE__*/React.createElement(Cursor, {
|
||||
cursor: cursor,
|
||||
tooltipEventType: tooltipEventType,
|
||||
coordinate: coordinate,
|
||||
payload: finalPayload,
|
||||
index: activeIndex
|
||||
}));
|
||||
}
|
||||
103
frontend/node_modules/recharts/es6/component/TooltipBoundingBox.js
generated
vendored
Normal file
103
frontend/node_modules/recharts/es6/component/TooltipBoundingBox.js
generated
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
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(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _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(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
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(r) { if (Array.isArray(r)) return r; }
|
||||
import * as React from 'react';
|
||||
import { getTooltipTranslate } from '../util/tooltip/translate';
|
||||
import { usePrefersReducedMotion } from '../util/usePrefersReducedMotion';
|
||||
function resolveTransitionProperty(args) {
|
||||
if (args.prefersReducedMotion && args.isAnimationActive === 'auto') {
|
||||
return undefined;
|
||||
}
|
||||
if (args.isAnimationActive && args.active) {
|
||||
var easing = typeof args.animationEasing === 'string' ? args.animationEasing : 'ease';
|
||||
return "transform ".concat(args.animationDuration, "ms ").concat(easing);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function TooltipBoundingBoxImpl(props) {
|
||||
var _props$coordinate3, _props$coordinate4, _props$coordinate$x2, _props$coordinate5, _props$coordinate$y2, _props$coordinate6;
|
||||
var prefersReducedMotion = usePrefersReducedMotion();
|
||||
var _React$useState = React.useState(() => ({
|
||||
dismissed: false,
|
||||
dismissedAtCoordinate: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
})),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 2),
|
||||
state = _React$useState2[0],
|
||||
setState = _React$useState2[1];
|
||||
React.useEffect(() => {
|
||||
var handleKeyDown = event => {
|
||||
if (event.key === 'Escape') {
|
||||
var _props$coordinate$x, _props$coordinate, _props$coordinate$y, _props$coordinate2;
|
||||
setState({
|
||||
dismissed: true,
|
||||
dismissedAtCoordinate: {
|
||||
x: (_props$coordinate$x = (_props$coordinate = props.coordinate) === null || _props$coordinate === void 0 ? void 0 : _props$coordinate.x) !== null && _props$coordinate$x !== void 0 ? _props$coordinate$x : 0,
|
||||
y: (_props$coordinate$y = (_props$coordinate2 = props.coordinate) === null || _props$coordinate2 === void 0 ? void 0 : _props$coordinate2.y) !== null && _props$coordinate$y !== void 0 ? _props$coordinate$y : 0
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
return () => {
|
||||
document.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, [(_props$coordinate3 = props.coordinate) === null || _props$coordinate3 === void 0 ? void 0 : _props$coordinate3.x, (_props$coordinate4 = props.coordinate) === null || _props$coordinate4 === void 0 ? void 0 : _props$coordinate4.y]);
|
||||
if (state.dismissed && (((_props$coordinate$x2 = (_props$coordinate5 = props.coordinate) === null || _props$coordinate5 === void 0 ? void 0 : _props$coordinate5.x) !== null && _props$coordinate$x2 !== void 0 ? _props$coordinate$x2 : 0) !== state.dismissedAtCoordinate.x || ((_props$coordinate$y2 = (_props$coordinate6 = props.coordinate) === null || _props$coordinate6 === void 0 ? void 0 : _props$coordinate6.y) !== null && _props$coordinate$y2 !== void 0 ? _props$coordinate$y2 : 0) !== state.dismissedAtCoordinate.y)) {
|
||||
setState(_objectSpread(_objectSpread({}, state), {}, {
|
||||
dismissed: false
|
||||
}));
|
||||
}
|
||||
var _getTooltipTranslate = getTooltipTranslate({
|
||||
allowEscapeViewBox: props.allowEscapeViewBox,
|
||||
coordinate: props.coordinate,
|
||||
offsetLeft: typeof props.offset === 'number' ? props.offset : props.offset.x,
|
||||
offsetTop: typeof props.offset === 'number' ? props.offset : props.offset.y,
|
||||
position: props.position,
|
||||
reverseDirection: props.reverseDirection,
|
||||
tooltipBox: {
|
||||
height: props.lastBoundingBox.height,
|
||||
width: props.lastBoundingBox.width
|
||||
},
|
||||
useTranslate3d: props.useTranslate3d,
|
||||
viewBox: props.viewBox
|
||||
}),
|
||||
cssClasses = _getTooltipTranslate.cssClasses,
|
||||
cssProperties = _getTooltipTranslate.cssProperties;
|
||||
var positionStyle = props.hasPortalFromProps ? {} : _objectSpread(_objectSpread({
|
||||
transition: resolveTransitionProperty({
|
||||
prefersReducedMotion,
|
||||
isAnimationActive: props.isAnimationActive,
|
||||
active: props.active,
|
||||
animationDuration: props.animationDuration,
|
||||
animationEasing: props.animationEasing
|
||||
})
|
||||
}, cssProperties), {}, {
|
||||
pointerEvents: 'none',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0
|
||||
});
|
||||
var outerStyle = _objectSpread(_objectSpread({}, positionStyle), {}, {
|
||||
visibility: !state.dismissed && props.active && props.hasPayload ? 'visible' : 'hidden'
|
||||
}, props.wrapperStyle);
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
// @ts-expect-error typescript library does not recognize xmlns attribute, but it's required for an HTML chunk inside SVG.
|
||||
xmlns: "http://www.w3.org/1999/xhtml",
|
||||
tabIndex: -1,
|
||||
className: cssClasses,
|
||||
style: outerStyle,
|
||||
ref: props.innerRef
|
||||
}, props.children);
|
||||
}
|
||||
export var TooltipBoundingBox = /*#__PURE__*/React.memo(TooltipBoundingBoxImpl);
|
||||
109
frontend/node_modules/recharts/es6/component/responsiveContainerUtils.js
generated
vendored
Normal file
109
frontend/node_modules/recharts/es6/component/responsiveContainerUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
import { isPercent } from '../util/DataUtils';
|
||||
export var defaultResponsiveContainerProps = {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
debounce: 0,
|
||||
minWidth: 0,
|
||||
initialDimension: {
|
||||
width: -1,
|
||||
height: -1
|
||||
}
|
||||
};
|
||||
export var calculateChartDimensions = (containerWidth, containerHeight, props) => {
|
||||
var _props$width = props.width,
|
||||
width = _props$width === void 0 ? defaultResponsiveContainerProps.width : _props$width,
|
||||
_props$height = props.height,
|
||||
height = _props$height === void 0 ? defaultResponsiveContainerProps.height : _props$height,
|
||||
aspect = props.aspect,
|
||||
maxHeight = props.maxHeight;
|
||||
|
||||
/*
|
||||
* The containerWidth and containerHeight are already percentage based because it's set as that percentage in CSS.
|
||||
* Means we don't have to calculate percentages here.
|
||||
*/
|
||||
var calculatedWidth = isPercent(width) ? containerWidth : Number(width);
|
||||
var calculatedHeight = isPercent(height) ? containerHeight : Number(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 != null && calculatedHeight > maxHeight) {
|
||||
calculatedHeight = maxHeight;
|
||||
}
|
||||
}
|
||||
return {
|
||||
calculatedWidth,
|
||||
calculatedHeight
|
||||
};
|
||||
};
|
||||
var bothOverflow = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
overflow: 'visible'
|
||||
};
|
||||
var overflowX = {
|
||||
width: 0,
|
||||
overflowX: 'visible'
|
||||
};
|
||||
var overflowY = {
|
||||
height: 0,
|
||||
overflowY: 'visible'
|
||||
};
|
||||
var noStyle = {};
|
||||
|
||||
/**
|
||||
* This zero-size, overflow-visible is required to allow the chart to shrink.
|
||||
* Without it, the chart itself will fill the ResponsiveContainer, and while it allows the chart to grow,
|
||||
* it would always keep the container at the size of the chart,
|
||||
* and ResizeObserver would never fire.
|
||||
* With this zero-size element, the chart itself never actually fills the container,
|
||||
* it just so happens that it is visible because it overflows.
|
||||
* I learned this trick from the `react-virtualized` library: https://github.com/bvaughn/react-virtualized-auto-sizer/blob/master/src/AutoSizer.ts
|
||||
* See https://github.com/recharts/recharts/issues/172 and also https://github.com/bvaughn/react-virtualized/issues/68
|
||||
*
|
||||
* Also, we don't need to apply the zero-size style if the dimension is a fixed number (or undefined),
|
||||
* because in that case the chart can't shrink in that dimension anyway.
|
||||
* This fixes defining the dimensions using aspect ratio: https://github.com/recharts/recharts/issues/6245
|
||||
*/
|
||||
export var getInnerDivStyle = props => {
|
||||
var width = props.width,
|
||||
height = props.height;
|
||||
var isWidthPercent = isPercent(width);
|
||||
var isHeightPercent = isPercent(height);
|
||||
if (isWidthPercent && isHeightPercent) {
|
||||
return bothOverflow;
|
||||
}
|
||||
if (isWidthPercent) {
|
||||
return overflowX;
|
||||
}
|
||||
if (isHeightPercent) {
|
||||
return overflowY;
|
||||
}
|
||||
return noStyle;
|
||||
};
|
||||
export function getDefaultWidthAndHeight(_ref) {
|
||||
var width = _ref.width,
|
||||
height = _ref.height,
|
||||
aspect = _ref.aspect;
|
||||
var calculatedWidth = width;
|
||||
var calculatedHeight = height;
|
||||
if (calculatedWidth === undefined && calculatedHeight === undefined) {
|
||||
calculatedWidth = defaultResponsiveContainerProps.width;
|
||||
calculatedHeight = defaultResponsiveContainerProps.height;
|
||||
} else if (calculatedWidth === undefined) {
|
||||
calculatedWidth = aspect && aspect > 0 ? undefined : defaultResponsiveContainerProps.width;
|
||||
} else if (calculatedHeight === undefined) {
|
||||
calculatedHeight = aspect && aspect > 0 ? undefined : defaultResponsiveContainerProps.height;
|
||||
}
|
||||
return {
|
||||
width: calculatedWidth,
|
||||
height: calculatedHeight
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue