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/util/ActiveShapeUtils.js
generated
vendored
Normal file
84
frontend/node_modules/recharts/es6/util/ActiveShapeUtils.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 { Layer } from '../container/Layer';
|
||||
|
||||
/**
|
||||
* This is an abstraction for rendering a user defined prop for a customized shape in several forms.
|
||||
*
|
||||
* <Shape /> is the root and will handle taking in:
|
||||
* - an object of svg properties
|
||||
* - a boolean
|
||||
* - a render prop(inline function that returns jsx)
|
||||
* - a React element
|
||||
*
|
||||
* The concrete default shape is supplied by the caller so this helper does not
|
||||
* import unrelated shapes and accidentally couple bundles together.
|
||||
*/
|
||||
|
||||
function mergeShapeProps(option, props) {
|
||||
return _objectSpread(_objectSpread({}, props), option);
|
||||
}
|
||||
export function getPropsFromShapeOption(option) {
|
||||
if (/*#__PURE__*/isValidElement(option)) {
|
||||
return option.props;
|
||||
}
|
||||
return option;
|
||||
}
|
||||
function renderWithShapeElement(option, props) {
|
||||
return /*#__PURE__*/cloneElement(option, mergeShapeProps(getPropsFromShapeOption(option), props));
|
||||
}
|
||||
function getShapeIndex(shapeProps) {
|
||||
if (!('index' in shapeProps)) {
|
||||
return undefined;
|
||||
}
|
||||
var index = shapeProps.index;
|
||||
return typeof index === 'number' || typeof index === 'string' ? index : undefined;
|
||||
}
|
||||
function isActiveShape(shapeProps) {
|
||||
return 'isActive' in shapeProps && shapeProps.isActive === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the user-provided active shape option while keeping each runtime branch aligned with its TypeScript type.
|
||||
*
|
||||
* The `option` prop supports four shapes:
|
||||
* - React element: clone it and let its own props override the injected ones
|
||||
* - function: call it with the forwarded props and optional index
|
||||
* - plain object: merge it into the default shape props
|
||||
* - boolean / undefined: ignore it and render the default shape with the forwarded props
|
||||
*/
|
||||
export function Shape(_ref) {
|
||||
var option = _ref.option,
|
||||
DefaultShape = _ref.DefaultShape,
|
||||
shapeProps = _ref.shapeProps,
|
||||
_ref$activeClassName = _ref.activeClassName,
|
||||
activeClassName = _ref$activeClassName === void 0 ? 'recharts-active-shape' : _ref$activeClassName,
|
||||
_ref$inActiveClassNam = _ref.inActiveClassName,
|
||||
inActiveClassName = _ref$inActiveClassNam === void 0 ? 'recharts-shape' : _ref$inActiveClassNam;
|
||||
var index = getShapeIndex(shapeProps);
|
||||
var shape;
|
||||
if (/*#__PURE__*/isValidElement(option)) {
|
||||
shape = renderWithShapeElement(option, shapeProps);
|
||||
} else if (option === DefaultShape) {
|
||||
shape = /*#__PURE__*/React.createElement(DefaultShape, shapeProps);
|
||||
} else if (typeof option === 'function') {
|
||||
shape = option(shapeProps, index);
|
||||
} else if (typeof option === 'object') {
|
||||
shape = /*#__PURE__*/React.createElement(DefaultShape, mergeShapeProps(option, shapeProps));
|
||||
} else {
|
||||
shape = /*#__PURE__*/React.createElement(DefaultShape, shapeProps);
|
||||
}
|
||||
if (isActiveShape(shapeProps)) {
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
className: activeClassName
|
||||
}, shape);
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
className: inActiveClassName
|
||||
}, shape);
|
||||
}
|
||||
38
frontend/node_modules/recharts/es6/util/BarUtils.js
generated
vendored
Normal file
38
frontend/node_modules/recharts/es6/util/BarUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
var _excluded = ["option"];
|
||||
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 invariant from 'tiny-invariant';
|
||||
import { Rectangle } from '../shape/Rectangle';
|
||||
import { Shape } from './ActiveShapeUtils';
|
||||
import { isNullish, isNumber } from './DataUtils';
|
||||
export var defaultBarShape = Rectangle;
|
||||
export function BarRectangle(_ref) {
|
||||
var option = _ref.option,
|
||||
shapeProps = _objectWithoutProperties(_ref, _excluded);
|
||||
return /*#__PURE__*/React.createElement(Shape, {
|
||||
option: option,
|
||||
DefaultShape: defaultBarShape,
|
||||
shapeProps: shapeProps,
|
||||
activeClassName: "recharts-active-bar",
|
||||
inActiveClassName: "recharts-inactive-bar"
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Safely gets minPointSize from the minPointSize prop if it is a function
|
||||
* @param minPointSize minPointSize as passed to the Bar component
|
||||
* @param defaultValue default minPointSize
|
||||
* @returns minPointSize
|
||||
*/
|
||||
export var minPointSizeCallback = function minPointSizeCallback(minPointSize) {
|
||||
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
return (value, index) => {
|
||||
if (isNumber(minPointSize)) return minPointSize;
|
||||
var isValueNumberOrNil = isNumber(value) || isNullish(value);
|
||||
if (isValueNumberOrNil) {
|
||||
return minPointSize(value, index);
|
||||
}
|
||||
!isValueNumberOrNil ? true ? invariant(false, "minPointSize callback function received a value with type of ".concat(typeof value, ". Currently only numbers or null/undefined are supported.")) : invariant(false) : void 0;
|
||||
return defaultValue;
|
||||
};
|
||||
};
|
||||
58
frontend/node_modules/recharts/es6/util/CartesianUtils.js
generated
vendored
Normal file
58
frontend/node_modules/recharts/es6/util/CartesianUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
export var rectWithPoints = (_ref, _ref2) => {
|
||||
var x1 = _ref.x,
|
||||
y1 = _ref.y;
|
||||
var x2 = _ref2.x,
|
||||
y2 = _ref2.y;
|
||||
return {
|
||||
x: Math.min(x1, x2),
|
||||
y: Math.min(y1, y2),
|
||||
width: Math.abs(x2 - x1),
|
||||
height: Math.abs(y2 - y1)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the x, y, width, and height of a box from two reference points.
|
||||
* @param {Object} coords x1, x2, y1, and y2
|
||||
* @return {Object} object
|
||||
*/
|
||||
export var rectWithCoords = _ref3 => {
|
||||
var x1 = _ref3.x1,
|
||||
y1 = _ref3.y1,
|
||||
x2 = _ref3.x2,
|
||||
y2 = _ref3.y2;
|
||||
return rectWithPoints({
|
||||
x: x1,
|
||||
y: y1
|
||||
}, {
|
||||
x: x2,
|
||||
y: y2
|
||||
});
|
||||
};
|
||||
|
||||
/** Normalizes the angle so that 0 <= angle < 180.
|
||||
* @param {number} angle Angle in degrees.
|
||||
* @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */
|
||||
export function normalizeAngle(angle) {
|
||||
return (angle % 180 + 180) % 180;
|
||||
}
|
||||
|
||||
/** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
||||
* @param {Object} size Width and height of the text in a horizontal position.
|
||||
* @param {number} angle Angle in degrees in which the text is displayed.
|
||||
* @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
||||
*/
|
||||
export var getAngledRectangleWidth = function getAngledRectangleWidth(_ref4) {
|
||||
var width = _ref4.width,
|
||||
height = _ref4.height;
|
||||
var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
// Ensure angle is >= 0 && < 180
|
||||
var normalizedAngle = normalizeAngle(angle);
|
||||
var angleRadians = normalizedAngle * Math.PI / 180;
|
||||
|
||||
/* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled
|
||||
* width. This threshold defines when each formula should kick in. */
|
||||
var angleThreshold = Math.atan(height / width);
|
||||
var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);
|
||||
return Math.abs(angledWidth);
|
||||
};
|
||||
506
frontend/node_modules/recharts/es6/util/ChartUtils.js
generated
vendored
Normal file
506
frontend/node_modules/recharts/es6/util/ChartUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,506 @@
|
|||
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 sortBy from 'es-toolkit/compat/sortBy';
|
||||
import get from 'es-toolkit/compat/get';
|
||||
import { stack as shapeStack, stackOffsetExpand, stackOffsetNone, stackOffsetSilhouette, stackOffsetWiggle, stackOrderNone } from 'victory-vendor/d3-shape';
|
||||
import { findEntryInArray, isNan, isNotNil, isNullish, isNumber, isNumOrStr, mathSign } from './DataUtils';
|
||||
import { getSliced } from './getSliced';
|
||||
import { isWellBehavedNumber } from './isWellBehavedNumber';
|
||||
export function getValueByDataKey(obj, dataKey, defaultValue) {
|
||||
if (isNullish(obj) || isNullish(dataKey)) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (isNumOrStr(dataKey)) {
|
||||
return get(obj, dataKey, defaultValue);
|
||||
}
|
||||
if (typeof dataKey === 'function') {
|
||||
return dataKey(obj);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
export var appendOffsetOfLegend = (offset, legendSettings, legendSize) => {
|
||||
if (legendSettings && legendSize) {
|
||||
var boxWidth = legendSize.width,
|
||||
boxHeight = legendSize.height;
|
||||
var align = legendSettings.align,
|
||||
verticalAlign = legendSettings.verticalAlign,
|
||||
layout = legendSettings.layout;
|
||||
if ((layout === 'vertical' || layout === 'horizontal' && verticalAlign === 'middle') && align !== 'center' && isNumber(offset[align])) {
|
||||
return _objectSpread(_objectSpread({}, offset), {}, {
|
||||
[align]: offset[align] + (boxWidth || 0)
|
||||
});
|
||||
}
|
||||
if ((layout === 'horizontal' || layout === 'vertical' && align === 'center') && verticalAlign !== 'middle' && isNumber(offset[verticalAlign])) {
|
||||
return _objectSpread(_objectSpread({}, offset), {}, {
|
||||
[verticalAlign]: offset[verticalAlign] + (boxHeight || 0)
|
||||
});
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
};
|
||||
export var isCategoricalAxis = (layout, axisType) => layout === 'horizontal' && axisType === 'xAxis' || layout === 'vertical' && axisType === 'yAxis' || layout === 'centric' && axisType === 'angleAxis' || layout === 'radial' && axisType === 'radiusAxis';
|
||||
|
||||
/**
|
||||
* Calculate the Coordinates of grid
|
||||
* @param {Array} ticks The ticks in axis
|
||||
* @param {Number} minValue The minimum value of axis
|
||||
* @param {Number} maxValue The maximum value of axis
|
||||
* @param {boolean} syncWithTicks Synchronize grid lines with ticks or not
|
||||
* @return {Array} Coordinates
|
||||
*/
|
||||
export var getCoordinatesOfGrid = (ticks, minValue, maxValue, syncWithTicks) => {
|
||||
if (syncWithTicks) {
|
||||
return ticks.map(entry => entry.coordinate);
|
||||
}
|
||||
var hasMin, hasMax;
|
||||
var values = ticks.map(entry => {
|
||||
if (entry.coordinate === minValue) {
|
||||
hasMin = true;
|
||||
}
|
||||
if (entry.coordinate === maxValue) {
|
||||
hasMax = true;
|
||||
}
|
||||
return entry.coordinate;
|
||||
});
|
||||
if (!hasMin) {
|
||||
values.push(minValue);
|
||||
}
|
||||
if (!hasMax) {
|
||||
values.push(maxValue);
|
||||
}
|
||||
return values;
|
||||
};
|
||||
/**
|
||||
* Of on four almost identical implementations of tick generation.
|
||||
* The four horsemen of tick generation are:
|
||||
* - {@link selectTooltipAxisTicks}
|
||||
* - {@link combineAxisTicks}
|
||||
* - {@link getTicksOfAxis}.
|
||||
* - {@link combineGraphicalItemTicks}
|
||||
*/
|
||||
export var getTicksOfAxis = (axis, isGrid, isAll) => {
|
||||
if (!axis) {
|
||||
return null;
|
||||
}
|
||||
var duplicateDomain = axis.duplicateDomain,
|
||||
type = axis.type,
|
||||
range = axis.range,
|
||||
scale = axis.scale,
|
||||
realScaleType = axis.realScaleType,
|
||||
isCategorical = axis.isCategorical,
|
||||
categoricalDomain = axis.categoricalDomain,
|
||||
tickCount = axis.tickCount,
|
||||
ticks = axis.ticks,
|
||||
niceTicks = axis.niceTicks,
|
||||
axisType = axis.axisType;
|
||||
if (!scale) {
|
||||
return null;
|
||||
}
|
||||
var offsetForBand = realScaleType === 'scaleBand' && scale.bandwidth ? scale.bandwidth() / 2 : 2;
|
||||
var offset = (isGrid || isAll) && type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
||||
offset = axisType === 'angleAxis' && range && range.length >= 2 ? mathSign(range[0] - range[1]) * 2 * offset : offset;
|
||||
|
||||
// The ticks set by user should only affect the ticks adjacent to axis line
|
||||
if (isGrid && (ticks || niceTicks)) {
|
||||
var result = (ticks || niceTicks || []).map((entry, index) => {
|
||||
var scaleContent = duplicateDomain ? duplicateDomain.indexOf(entry) : entry;
|
||||
var scaled = scale.map(scaleContent);
|
||||
if (!isWellBehavedNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
// If the scaleContent is not a number, the coordinate will be NaN.
|
||||
// That could be the case for example with a PointScale and a string as domain.
|
||||
coordinate: scaled + offset,
|
||||
value: entry,
|
||||
offset,
|
||||
index
|
||||
};
|
||||
}).filter(isNotNil);
|
||||
return result;
|
||||
}
|
||||
|
||||
// When axis is a categorical axis, but the type of axis is number or the scale of axis is not "auto"
|
||||
// For type='number' with niceTicks available, skip this branch so ticks are evenly spaced (GitHub issue #4271)
|
||||
if (isCategorical && categoricalDomain) {
|
||||
return categoricalDomain.map((entry, index) => {
|
||||
var scaled = scale.map(entry);
|
||||
if (!isWellBehavedNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
coordinate: scaled + offset,
|
||||
value: entry,
|
||||
index,
|
||||
offset
|
||||
};
|
||||
}).filter(isNotNil);
|
||||
}
|
||||
if (scale.ticks && !isAll && tickCount != null) {
|
||||
return scale.ticks(tickCount).map((entry, index) => {
|
||||
var scaled = scale.map(entry);
|
||||
if (!isWellBehavedNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
coordinate: scaled + offset,
|
||||
value: entry,
|
||||
index,
|
||||
offset
|
||||
};
|
||||
}).filter(isNotNil);
|
||||
}
|
||||
|
||||
// When axis has duplicated text, serial numbers are used to generate scale
|
||||
return scale.domain().map((entry, index) => {
|
||||
var scaled = scale.map(entry);
|
||||
if (!isWellBehavedNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
coordinate: scaled + offset,
|
||||
// @ts-expect-error can't use Date as an index
|
||||
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
||||
index,
|
||||
offset
|
||||
};
|
||||
}).filter(isNotNil);
|
||||
};
|
||||
|
||||
/**
|
||||
* Both value and domain are tuples of two numbers
|
||||
* - but the type stays as array of numbers until we have better support in rest of the app
|
||||
* @param value input that will be truncated
|
||||
* @param domain boundaries
|
||||
* @returns tuple of two numbers
|
||||
*/
|
||||
export var truncateByDomain = (value, domain) => {
|
||||
if (!domain || domain.length !== 2 || !isNumber(domain[0]) || !isNumber(domain[1])) {
|
||||
return value;
|
||||
}
|
||||
var minValue = Math.min(domain[0], domain[1]);
|
||||
var maxValue = Math.max(domain[0], domain[1]);
|
||||
var result = [value[0], value[1]];
|
||||
if (!isNumber(value[0]) || value[0] < minValue) {
|
||||
result[0] = minValue;
|
||||
}
|
||||
if (!isNumber(value[1]) || value[1] > maxValue) {
|
||||
result[1] = maxValue;
|
||||
}
|
||||
if (result[0] > maxValue) {
|
||||
result[0] = maxValue;
|
||||
}
|
||||
if (result[1] < minValue) {
|
||||
result[1] = minValue;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Stacks all positive numbers above zero and all negative numbers below zero.
|
||||
*
|
||||
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
||||
*
|
||||
* @param {Array} series from d3-shape Stack
|
||||
* @return {Array} series with applied offset
|
||||
*/
|
||||
export var offsetSign = series => {
|
||||
var _series$;
|
||||
var n = series.length;
|
||||
if (n <= 0) {
|
||||
return;
|
||||
}
|
||||
var m = (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.length;
|
||||
if (m == null || m <= 0) {
|
||||
return;
|
||||
}
|
||||
for (var j = 0; j < m; ++j) {
|
||||
var positive = 0;
|
||||
var negative = 0;
|
||||
for (var i = 0; i < n; ++i) {
|
||||
var row = series[i];
|
||||
var col = row === null || row === void 0 ? void 0 : row[j];
|
||||
if (col == null) {
|
||||
continue;
|
||||
}
|
||||
var series1 = col[1];
|
||||
var series0 = col[0];
|
||||
var value = isNan(series1) ? series0 : series1;
|
||||
if (value >= 0) {
|
||||
col[0] = positive;
|
||||
positive += value;
|
||||
col[1] = positive;
|
||||
} else {
|
||||
col[0] = negative;
|
||||
negative += value;
|
||||
col[1] = negative;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces all negative values with zero when stacking data.
|
||||
*
|
||||
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
||||
*
|
||||
* @param {Array} series from d3-shape Stack
|
||||
* @return {Array} series with applied offset
|
||||
*/
|
||||
export var offsetPositive = series => {
|
||||
var _series$2;
|
||||
var n = series.length;
|
||||
if (n <= 0) {
|
||||
return;
|
||||
}
|
||||
var m = (_series$2 = series[0]) === null || _series$2 === void 0 ? void 0 : _series$2.length;
|
||||
if (m == null || m <= 0) {
|
||||
return;
|
||||
}
|
||||
for (var j = 0; j < m; ++j) {
|
||||
var positive = 0;
|
||||
for (var i = 0; i < n; ++i) {
|
||||
var row = series[i];
|
||||
var col = row === null || row === void 0 ? void 0 : row[j];
|
||||
if (col == null) {
|
||||
continue;
|
||||
}
|
||||
var value = isNan(col[1]) ? col[0] : col[1];
|
||||
if (value >= 0) {
|
||||
col[0] = positive;
|
||||
positive += value;
|
||||
col[1] = positive;
|
||||
} else {
|
||||
col[0] = 0;
|
||||
col[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function type to compute offset for stacked data.
|
||||
*
|
||||
* d3-shape has something fishy going on with its types.
|
||||
* In @definitelytyped/d3-shape, this function (the offset accessor) is typed as Series<> => void.
|
||||
* However! When I actually open the storybook I can see that the offset accessor actually receives Array<Series<>>.
|
||||
* The same I can see in the source code itself:
|
||||
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
||||
* That one unfortunately has no types but we can tell it passes three-dimensional array.
|
||||
*
|
||||
* Which leads me to believe that definitelytyped is wrong on this one.
|
||||
* There's open discussion on this topic without much attention:
|
||||
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
||||
*/
|
||||
|
||||
var STACK_OFFSET_MAP = {
|
||||
sign: offsetSign,
|
||||
// @ts-expect-error definitelytyped types are incorrect
|
||||
expand: stackOffsetExpand,
|
||||
// @ts-expect-error definitelytyped types are incorrect
|
||||
none: stackOffsetNone,
|
||||
// @ts-expect-error definitelytyped types are incorrect
|
||||
silhouette: stackOffsetSilhouette,
|
||||
// @ts-expect-error definitelytyped types are incorrect
|
||||
wiggle: stackOffsetWiggle,
|
||||
positive: offsetPositive
|
||||
};
|
||||
export var getStackedData = (data, dataKeys, offsetType) => {
|
||||
var _STACK_OFFSET_MAP$off;
|
||||
var offsetAccessor = (_STACK_OFFSET_MAP$off = STACK_OFFSET_MAP[offsetType]) !== null && _STACK_OFFSET_MAP$off !== void 0 ? _STACK_OFFSET_MAP$off : stackOffsetNone;
|
||||
var stack = shapeStack().keys(dataKeys).value((d, key) => Number(getValueByDataKey(d, key, 0))).order(stackOrderNone)
|
||||
// @ts-expect-error definitelytyped types are incorrect
|
||||
.offset(offsetAccessor);
|
||||
var result = stack(data);
|
||||
|
||||
// Post-process ranged data: if value is an array of two numbers, use them directly without stacking
|
||||
result.forEach((series, seriesIndex) => {
|
||||
series.forEach((point, pointIndex) => {
|
||||
var value = getValueByDataKey(data[pointIndex], dataKeys[seriesIndex], 0);
|
||||
if (Array.isArray(value) && value.length === 2 && isNumber(value[0]) && isNumber(value[1])) {
|
||||
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
||||
point[0] = value[0];
|
||||
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
||||
point[1] = value[1];
|
||||
}
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Externally, we accept both strings and numbers as stack IDs
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stack IDs in the external props allow numbers; but internally we use it as an object key
|
||||
* and object keys are always strings. Also, it would be kinda confusing if stackId=8 and stackId='8' were different stacks
|
||||
* so let's just force a string.
|
||||
*/
|
||||
|
||||
export function getNormalizedStackId(publicStackId) {
|
||||
return publicStackId == null ? undefined : String(publicStackId);
|
||||
}
|
||||
export function getCateCoordinateOfLine(_ref) {
|
||||
var axis = _ref.axis,
|
||||
ticks = _ref.ticks,
|
||||
bandSize = _ref.bandSize,
|
||||
entry = _ref.entry,
|
||||
index = _ref.index,
|
||||
dataKey = _ref.dataKey;
|
||||
if (axis.type === 'category') {
|
||||
// find coordinate of category axis by the value of category
|
||||
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
||||
if (!axis.allowDuplicatedCategory && axis.dataKey && !isNullish(entry[axis.dataKey])) {
|
||||
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
||||
var matchedTick = findEntryInArray(ticks, 'value', entry[axis.dataKey]);
|
||||
if (matchedTick) {
|
||||
return matchedTick.coordinate + bandSize / 2;
|
||||
}
|
||||
}
|
||||
return ticks !== null && ticks !== void 0 && ticks[index] ? ticks[index].coordinate + bandSize / 2 : null;
|
||||
}
|
||||
var value = getValueByDataKey(entry, !isNullish(dataKey) ? dataKey : axis.dataKey);
|
||||
var scaled = axis.scale.map(value);
|
||||
if (!isNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return scaled;
|
||||
}
|
||||
export var getCateCoordinateOfBar = _ref2 => {
|
||||
var axis = _ref2.axis,
|
||||
ticks = _ref2.ticks,
|
||||
offset = _ref2.offset,
|
||||
bandSize = _ref2.bandSize,
|
||||
entry = _ref2.entry,
|
||||
index = _ref2.index;
|
||||
if (axis.type === 'category') {
|
||||
return ticks[index] ? ticks[index].coordinate + offset : null;
|
||||
}
|
||||
// getValueByDataKey does not validate the output type
|
||||
var value = getValueByDataKey(entry, axis.dataKey, axis.scale.domain()[index]);
|
||||
if (isNullish(value)) {
|
||||
return null;
|
||||
}
|
||||
var scaled = axis.scale.map(value);
|
||||
if (!isNumber(scaled)) {
|
||||
return null;
|
||||
}
|
||||
return scaled - bandSize / 2 + offset;
|
||||
};
|
||||
export var getBaseValueOfBar = _ref3 => {
|
||||
var numericAxis = _ref3.numericAxis;
|
||||
var domain = numericAxis.scale.domain();
|
||||
if (numericAxis.type === 'number') {
|
||||
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
||||
var minValue = Math.min(domain[0], domain[1]);
|
||||
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
||||
var maxValue = Math.max(domain[0], domain[1]);
|
||||
if (minValue <= 0 && maxValue >= 0) {
|
||||
return 0;
|
||||
}
|
||||
if (maxValue < 0) {
|
||||
return maxValue;
|
||||
}
|
||||
return minValue;
|
||||
}
|
||||
return domain[0];
|
||||
};
|
||||
var getDomainOfSingle = data => {
|
||||
var flat = data.flat(2).filter(isNumber);
|
||||
return [Math.min(...flat), Math.max(...flat)];
|
||||
};
|
||||
var makeDomainFinite = domain => {
|
||||
return [domain[0] === Infinity ? 0 : domain[0], domain[1] === -Infinity ? 0 : domain[1]];
|
||||
};
|
||||
export var getDomainOfStackGroups = (stackGroups, startIndex, endIndex) => {
|
||||
if (stackGroups == null || Object.keys(stackGroups).length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
return makeDomainFinite(Object.keys(stackGroups).reduce((result, stackId) => {
|
||||
var group = stackGroups[stackId];
|
||||
if (!group) {
|
||||
return result;
|
||||
}
|
||||
var stackedData = group.stackedData;
|
||||
var domain = stackedData.reduce((res, entry) => {
|
||||
var sliced = getSliced(entry, startIndex, endIndex);
|
||||
var s = getDomainOfSingle(sliced);
|
||||
if (!isWellBehavedNumber(s[0]) || !isWellBehavedNumber(s[1])) {
|
||||
return res;
|
||||
}
|
||||
return [Math.min(res[0], s[0]), Math.max(res[1], s[1])];
|
||||
}, [Infinity, -Infinity]);
|
||||
return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])];
|
||||
}, [Infinity, -Infinity]));
|
||||
};
|
||||
export var MIN_VALUE_REG = /^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
||||
export var MAX_VALUE_REG = /^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
||||
|
||||
/**
|
||||
* Calculate the size between two category
|
||||
* @param {Object} axis The options of axis
|
||||
* @param {Array} ticks The ticks of axis
|
||||
* @param {Boolean} isBar if items in axis are bars
|
||||
* @return {Number} Size
|
||||
*/
|
||||
export var getBandSizeOfAxis = (axis, ticks, isBar) => {
|
||||
if (axis && axis.scale && axis.scale.bandwidth) {
|
||||
var bandWidth = axis.scale.bandwidth();
|
||||
if (!isBar || bandWidth > 0) {
|
||||
return bandWidth;
|
||||
}
|
||||
}
|
||||
if (axis && ticks && ticks.length >= 2) {
|
||||
var orderedTicks = sortBy(ticks, o => o.coordinate);
|
||||
var bandSize = Infinity;
|
||||
for (var i = 1, len = orderedTicks.length; i < len; i++) {
|
||||
var cur = orderedTicks[i];
|
||||
var prev = orderedTicks[i - 1];
|
||||
bandSize = Math.min(((cur === null || cur === void 0 ? void 0 : cur.coordinate) || 0) - ((prev === null || prev === void 0 ? void 0 : prev.coordinate) || 0), bandSize);
|
||||
}
|
||||
return bandSize === Infinity ? 0 : bandSize;
|
||||
}
|
||||
return isBar ? undefined : 0;
|
||||
};
|
||||
export function getTooltipEntry(_ref4) {
|
||||
var tooltipEntrySettings = _ref4.tooltipEntrySettings,
|
||||
dataKey = _ref4.dataKey,
|
||||
payload = _ref4.payload,
|
||||
value = _ref4.value,
|
||||
name = _ref4.name;
|
||||
return _objectSpread(_objectSpread({}, tooltipEntrySettings), {}, {
|
||||
dataKey,
|
||||
payload,
|
||||
value,
|
||||
name
|
||||
});
|
||||
}
|
||||
export function getTooltipNameProp(nameFromItem, dataKey) {
|
||||
if (nameFromItem != null) {
|
||||
return String(nameFromItem);
|
||||
}
|
||||
if (typeof dataKey === 'string') {
|
||||
return dataKey;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export var calculateCartesianTooltipPos = (coordinate, layout) => {
|
||||
if (layout === 'horizontal') {
|
||||
return coordinate.relativeX;
|
||||
}
|
||||
if (layout === 'vertical') {
|
||||
return coordinate.relativeY;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
export var calculatePolarTooltipPos = (rangeObj, layout) => {
|
||||
if (layout === 'centric') {
|
||||
return rangeObj.angle;
|
||||
}
|
||||
return rangeObj.radius;
|
||||
};
|
||||
15
frontend/node_modules/recharts/es6/util/Constants.js
generated
vendored
Normal file
15
frontend/node_modules/recharts/es6/util/Constants.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
export var COLOR_PANEL = ['#1890FF', '#66B5FF', '#41D9C7', '#2FC25B', '#6EDB8F', '#9AE65C', '#FACC14', '#E6965C', '#57AD71', '#223273', '#738AE6', '#7564CC', '#8543E0', '#A877ED', '#5C8EE6', '#13C2C2', '#70E0E0', '#5CA3E6', '#3436C7', '#8082FF', '#DD81E6', '#F04864', '#FA7D92', '#D598D9'];
|
||||
|
||||
/**
|
||||
* We use this attribute to identify which element is the one that the user is touching.
|
||||
* The index is the position of the element in the data array.
|
||||
* This can be either a number (for array-based charts) or a string (for the charts that have a matrix-shaped data).
|
||||
*/
|
||||
export var DATA_ITEM_INDEX_ATTRIBUTE_NAME = 'data-recharts-item-index';
|
||||
|
||||
/**
|
||||
* We use this attribute to identify which element is the one that the user is touching.
|
||||
* Unlike dataKey, or name, it is always unique.
|
||||
*/
|
||||
export var DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME = 'data-recharts-item-id';
|
||||
export var DEFAULT_Y_AXIS_WIDTH = 60;
|
||||
17
frontend/node_modules/recharts/es6/util/CssPrefixUtils.js
generated
vendored
Normal file
17
frontend/node_modules/recharts/es6/util/CssPrefixUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
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); }
|
||||
var PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms'];
|
||||
export var generatePrefixStyle = (name, value) => {
|
||||
if (!name) {
|
||||
return undefined;
|
||||
}
|
||||
var camelName = name.replace(/(\w)/, v => v.toUpperCase());
|
||||
var result = PREFIX_LIST.reduce((res, entry) => _objectSpread(_objectSpread({}, res), {}, {
|
||||
[entry + camelName]: value
|
||||
}), {});
|
||||
result[name] = value;
|
||||
return result;
|
||||
};
|
||||
127
frontend/node_modules/recharts/es6/util/DOMUtils.js
generated
vendored
Normal file
127
frontend/node_modules/recharts/es6/util/DOMUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
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 { Global } from './Global';
|
||||
import { LRUCache } from './LRUCache';
|
||||
var defaultConfig = {
|
||||
cacheSize: 2000,
|
||||
enableCache: true
|
||||
};
|
||||
var currentConfig = _objectSpread({}, defaultConfig);
|
||||
var stringCache = new LRUCache(currentConfig.cacheSize);
|
||||
var SPAN_STYLE = {
|
||||
position: 'absolute',
|
||||
top: '-20000px',
|
||||
left: 0,
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
border: 'none',
|
||||
whiteSpace: 'pre'
|
||||
};
|
||||
var MEASUREMENT_SPAN_ID = 'recharts_measurement_span';
|
||||
function createCacheKey(text, style) {
|
||||
// Simple string concatenation for better performance than JSON.stringify
|
||||
var fontSize = style.fontSize || '';
|
||||
var fontFamily = style.fontFamily || '';
|
||||
var fontWeight = style.fontWeight || '';
|
||||
var fontStyle = style.fontStyle || '';
|
||||
var letterSpacing = style.letterSpacing || '';
|
||||
var textTransform = style.textTransform || '';
|
||||
return "".concat(text, "|").concat(fontSize, "|").concat(fontFamily, "|").concat(fontWeight, "|").concat(fontStyle, "|").concat(letterSpacing, "|").concat(textTransform);
|
||||
}
|
||||
|
||||
/**
|
||||
* Measure text using DOM (accurate but slower)
|
||||
* @param text - The text to measure
|
||||
* @param style - CSS style properties to apply
|
||||
* @returns The size of the text
|
||||
*/
|
||||
var measureTextWithDOM = (text, style) => {
|
||||
try {
|
||||
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
||||
if (!measurementSpan) {
|
||||
measurementSpan = document.createElement('span');
|
||||
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
||||
measurementSpan.setAttribute('aria-hidden', 'true');
|
||||
document.body.appendChild(measurementSpan);
|
||||
}
|
||||
|
||||
// Apply styles directly without unnecessary object creation
|
||||
Object.assign(measurementSpan.style, SPAN_STYLE, style);
|
||||
measurementSpan.textContent = "".concat(text);
|
||||
var rect = measurementSpan.getBoundingClientRect();
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
} catch (_unused) {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
};
|
||||
export var getStringSize = function getStringSize(text) {
|
||||
var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
if (text === undefined || text === null || Global.isSsr) {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
|
||||
// If caching is disabled, measure directly
|
||||
if (!currentConfig.enableCache) {
|
||||
return measureTextWithDOM(text, style);
|
||||
}
|
||||
var cacheKey = createCacheKey(text, style);
|
||||
var cachedResult = stringCache.get(cacheKey);
|
||||
if (cachedResult) {
|
||||
return cachedResult;
|
||||
}
|
||||
|
||||
// Measure using DOM
|
||||
var result = measureTextWithDOM(text, style);
|
||||
|
||||
// Store in LRU cache
|
||||
stringCache.set(cacheKey, result);
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Configure text measurement behavior
|
||||
* @param config - Partial configuration to apply
|
||||
* @returns void
|
||||
*/
|
||||
export var configureTextMeasurement = config => {
|
||||
var newConfig = _objectSpread(_objectSpread({}, currentConfig), config);
|
||||
if (newConfig.cacheSize !== currentConfig.cacheSize) {
|
||||
stringCache = new LRUCache(newConfig.cacheSize);
|
||||
}
|
||||
currentConfig = newConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get current text measurement configuration
|
||||
* @returns Current configuration
|
||||
*/
|
||||
export var getTextMeasurementConfig = () => _objectSpread({}, currentConfig);
|
||||
|
||||
/**
|
||||
* Clear the string size cache. Useful for testing or memory management.
|
||||
* @returns void
|
||||
*/
|
||||
export var clearStringCache = () => {
|
||||
stringCache.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get cache statistics for debugging purposes.
|
||||
* @returns Cache statistics including size and max size
|
||||
*/
|
||||
export var getStringCacheStats = () => ({
|
||||
size: stringCache.size(),
|
||||
maxSize: currentConfig.cacheSize
|
||||
});
|
||||
186
frontend/node_modules/recharts/es6/util/DataUtils.js
generated
vendored
Normal file
186
frontend/node_modules/recharts/es6/util/DataUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
import get from 'es-toolkit/compat/get';
|
||||
import { round } from './round';
|
||||
export var mathSign = value => {
|
||||
if (value === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (value > 0) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
export var isNan = value => {
|
||||
// eslint-disable-next-line eqeqeq
|
||||
return typeof value == 'number' && value != +value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value is a percent string.
|
||||
* A valid percent string must end with '%' and have at least one character before the '%'.
|
||||
*
|
||||
* @param {string | number | undefined} value The value to check
|
||||
* @returns {boolean} true if the value is a percent string
|
||||
*/
|
||||
export var isPercent = value => typeof value === 'string' && value.length > 1 && value.indexOf('%') === value.length - 1;
|
||||
export var isNumber = value => (typeof value === 'number' || value instanceof Number) && !isNan(value);
|
||||
export var isNumOrStr = value => isNumber(value) || typeof value === 'string';
|
||||
var idCounter = 0;
|
||||
export var uniqueId = prefix => {
|
||||
var id = ++idCounter;
|
||||
return "".concat(prefix || '').concat(id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculates the numeric value represented by a percent string or number, based on a total value.
|
||||
*
|
||||
* - If `percent` is not a number or string, returns `defaultValue`.
|
||||
* - If `percent` is a percent string but `totalValue` is null/undefined, returns `defaultValue`.
|
||||
* - If the result is NaN, returns `defaultValue`.
|
||||
* - If `validate` is true and the result exceeds `totalValue`, returns `totalValue`.
|
||||
*
|
||||
* @param percent - The percent value to convert. Can be a number (e.g. 25) or a string ending with '%' (e.g. '25%').
|
||||
* If a string, it must end with '%' to be treated as a percent; otherwise, it is parsed as a number.
|
||||
* @param totalValue - The total value to calculate the percent of. Required if `percent` is a percent string.
|
||||
* @param defaultValue - The value returned if `percent` is undefined, invalid, or cannot be converted to a number.
|
||||
* @param validate - If true, ensures the result does not exceed `totalValue` (when provided).
|
||||
* @returns The calculated value, or `defaultValue` for invalid input.
|
||||
*/
|
||||
export var getPercentValue = function getPercentValue(percent, totalValue) {
|
||||
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
if (!isNumber(percent) && typeof percent !== 'string') {
|
||||
return defaultValue;
|
||||
}
|
||||
var value;
|
||||
if (isPercent(percent)) {
|
||||
if (totalValue == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
var index = percent.indexOf('%');
|
||||
value = totalValue * parseFloat(percent.slice(0, index)) / 100;
|
||||
} else {
|
||||
value = +percent;
|
||||
}
|
||||
if (isNan(value)) {
|
||||
value = defaultValue;
|
||||
}
|
||||
if (validate && totalValue != null && value > totalValue) {
|
||||
value = totalValue;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
export var hasDuplicate = ary => {
|
||||
if (!Array.isArray(ary)) {
|
||||
return false;
|
||||
}
|
||||
var len = ary.length;
|
||||
var cache = {};
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!cache[String(ary[i])]) {
|
||||
cache[String(ary[i])] = true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function to interpolate between two numbers.
|
||||
* If both start and end are numbers, it calculates the interpolated value based on the parameter animationElapsedTime (0 to 1).
|
||||
* If either start or end is not a number, it returns the end value directly.
|
||||
*
|
||||
* You will typically use this function when implementing custom animations.
|
||||
*
|
||||
* `animationElapsedTime` can be outside the (0, 1) range, depending on easing.
|
||||
*
|
||||
* This one interpolates only numbers;
|
||||
* if you want to interpolate colors or strings then perhaps see {@link https://d3js.org/d3-interpolate d3-interpolate}.
|
||||
* @param start the starting value (when animationElapsedTime=0)
|
||||
* @param end the final value (when animationElapsedTime=1)
|
||||
* @param animationElapsedTime interpolation factor; values in [0, 1] interpolate between start and end, and values outside that range extrapolate
|
||||
*
|
||||
* @since 3.9
|
||||
*/
|
||||
|
||||
export function interpolate(start, end, animationElapsedTime) {
|
||||
if (isNumber(start) && isNumber(end)) {
|
||||
return round(start + animationElapsedTime * (end - start));
|
||||
}
|
||||
return end;
|
||||
}
|
||||
export function findEntryInArray(ary, specifiedKey, specifiedValue) {
|
||||
if (!ary || !ary.length) {
|
||||
return undefined;
|
||||
}
|
||||
return ary.find(entry => entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : get(entry, specifiedKey)) === specifiedValue);
|
||||
}
|
||||
/**
|
||||
* The least square linear regression
|
||||
* @param {Array} data The array of points
|
||||
* @returns {Object} The domain of x, and the parameter of linear function
|
||||
*/
|
||||
export var getLinearRegression = data => {
|
||||
var len = data.length;
|
||||
var xsum = 0;
|
||||
var ysum = 0;
|
||||
var xysum = 0;
|
||||
var xxsum = 0;
|
||||
var xmin = Infinity;
|
||||
var xmax = -Infinity;
|
||||
var xcurrent = 0;
|
||||
var ycurrent = 0;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var _data$i, _data$i2;
|
||||
xcurrent = ((_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i.cx) || 0;
|
||||
ycurrent = ((_data$i2 = data[i]) === null || _data$i2 === void 0 ? void 0 : _data$i2.cy) || 0;
|
||||
xsum += xcurrent;
|
||||
ysum += ycurrent;
|
||||
xysum += xcurrent * ycurrent;
|
||||
xxsum += xcurrent * xcurrent;
|
||||
xmin = Math.min(xmin, xcurrent);
|
||||
xmax = Math.max(xmax, xcurrent);
|
||||
}
|
||||
var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
|
||||
return {
|
||||
xmin,
|
||||
xmax,
|
||||
a,
|
||||
b: (ysum - a * xsum) / len
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Checks if the value is null or undefined
|
||||
* @param value The value to check
|
||||
* @returns true if the value is null or undefined
|
||||
*/
|
||||
export var isNullish = value => {
|
||||
return value === null || typeof value === 'undefined';
|
||||
};
|
||||
|
||||
/**
|
||||
* Uppercase the first letter of a string
|
||||
* @param {string} value The string to uppercase
|
||||
* @returns {string} The uppercased string
|
||||
*/
|
||||
export var upperFirst = value => {
|
||||
if (isNullish(value)) {
|
||||
return value;
|
||||
}
|
||||
return "".concat(value.charAt(0).toUpperCase()).concat(value.slice(1));
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the value is not null nor undefined.
|
||||
* @param value The value to check
|
||||
* @returns true if the value is not null nor undefined
|
||||
*/
|
||||
export function isNotNil(value) {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* No-operation function that does nothing.
|
||||
* Useful as a placeholder or default callback function.
|
||||
*/
|
||||
export function noop() {}
|
||||
5
frontend/node_modules/recharts/es6/util/Events.js
generated
vendored
Normal file
5
frontend/node_modules/recharts/es6/util/Events.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import EventEmitter from 'eventemitter3';
|
||||
var eventCenter = new EventEmitter();
|
||||
export { eventCenter };
|
||||
export var TOOLTIP_SYNC_EVENT = 'recharts.syncEvent.tooltip';
|
||||
export var BRUSH_SYNC_EVENT = 'recharts.syncEvent.brush';
|
||||
16
frontend/node_modules/recharts/es6/util/FunnelUtils.js
generated
vendored
Normal file
16
frontend/node_modules/recharts/es6/util/FunnelUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
var _excluded = ["option"];
|
||||
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 { Trapezoid } from '../shape/Trapezoid';
|
||||
import { Shape } from './ActiveShapeUtils';
|
||||
export var defaultFunnelShape = Trapezoid;
|
||||
export function FunnelTrapezoid(_ref) {
|
||||
var option = _ref.option,
|
||||
shapeProps = _objectWithoutProperties(_ref, _excluded);
|
||||
return /*#__PURE__*/React.createElement(Shape, {
|
||||
option: option,
|
||||
DefaultShape: defaultFunnelShape,
|
||||
shapeProps: shapeProps
|
||||
});
|
||||
}
|
||||
5
frontend/node_modules/recharts/es6/util/Global.js
generated
vendored
Normal file
5
frontend/node_modules/recharts/es6/util/Global.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
var parseIsSsrByDefault = () => !(typeof window !== 'undefined' && window.document && Boolean(window.document.createElement) && window.setTimeout);
|
||||
export var Global = {
|
||||
devToolsEnabled: true,
|
||||
isSsr: parseIsSsrByDefault()
|
||||
};
|
||||
1
frontend/node_modules/recharts/es6/util/IfOverflow.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/util/IfOverflow.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
37
frontend/node_modules/recharts/es6/util/LRUCache.js
generated
vendored
Normal file
37
frontend/node_modules/recharts/es6/util/LRUCache.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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); }
|
||||
/**
|
||||
* Simple LRU (Least Recently Used) cache implementation
|
||||
*/
|
||||
export class LRUCache {
|
||||
constructor(maxSize) {
|
||||
_defineProperty(this, "cache", new Map());
|
||||
this.maxSize = maxSize;
|
||||
}
|
||||
get(key) {
|
||||
var value = this.cache.get(key);
|
||||
if (value !== undefined) {
|
||||
this.cache.delete(key);
|
||||
this.cache.set(key, value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
set(key, value) {
|
||||
if (this.cache.has(key)) {
|
||||
this.cache.delete(key);
|
||||
} else if (this.cache.size >= this.maxSize) {
|
||||
var firstKey = this.cache.keys().next().value;
|
||||
if (firstKey != null) {
|
||||
this.cache.delete(firstKey);
|
||||
}
|
||||
}
|
||||
this.cache.set(key, value);
|
||||
}
|
||||
clear() {
|
||||
this.cache.clear();
|
||||
}
|
||||
size() {
|
||||
return this.cache.size;
|
||||
}
|
||||
}
|
||||
20
frontend/node_modules/recharts/es6/util/LogUtils.js
generated
vendored
Normal file
20
frontend/node_modules/recharts/es6/util/LogUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* eslint no-console: 0 */
|
||||
var isDev = true;
|
||||
export var warn = function warn(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
if (isDev && typeof console !== 'undefined' && console.warn) {
|
||||
if (format === undefined) {
|
||||
console.warn('LogUtils requires an error message argument');
|
||||
}
|
||||
if (!condition) {
|
||||
if (format === undefined) {
|
||||
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
console.warn(format.replace(/%s/g, () => args[argIndex++]));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
126
frontend/node_modules/recharts/es6/util/PolarUtils.js
generated
vendored
Normal file
126
frontend/node_modules/recharts/es6/util/PolarUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
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); }
|
||||
export var RADIAN = Math.PI / 180;
|
||||
export var degreeToRadian = angle => angle * Math.PI / 180;
|
||||
export var radianToDegree = angleInRadian => angleInRadian * 180 / Math.PI;
|
||||
export var polarToCartesian = (cx, cy, radius, angle) => ({
|
||||
x: cx + Math.cos(-RADIAN * angle) * radius,
|
||||
y: cy + Math.sin(-RADIAN * angle) * radius
|
||||
});
|
||||
export var getMaxRadius = function getMaxRadius(width, height) {
|
||||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
brushBottom: 0
|
||||
};
|
||||
return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;
|
||||
};
|
||||
var distanceBetweenPoints = (point, anotherPoint) => {
|
||||
var x1 = point.x,
|
||||
y1 = point.y;
|
||||
var x2 = anotherPoint.x,
|
||||
y2 = anotherPoint.y;
|
||||
return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
|
||||
};
|
||||
var getAngleOfPoint = (_ref, _ref2) => {
|
||||
var x = _ref.x,
|
||||
y = _ref.y;
|
||||
var cx = _ref2.cx,
|
||||
cy = _ref2.cy;
|
||||
var radius = distanceBetweenPoints({
|
||||
x,
|
||||
y
|
||||
}, {
|
||||
x: cx,
|
||||
y: cy
|
||||
});
|
||||
if (radius <= 0) {
|
||||
return {
|
||||
radius,
|
||||
angle: 0
|
||||
};
|
||||
}
|
||||
var cos = (x - cx) / radius;
|
||||
var angleInRadian = Math.acos(cos);
|
||||
if (y > cy) {
|
||||
angleInRadian = 2 * Math.PI - angleInRadian;
|
||||
}
|
||||
return {
|
||||
radius,
|
||||
angle: radianToDegree(angleInRadian),
|
||||
angleInRadian
|
||||
};
|
||||
};
|
||||
var formatAngleOfSector = _ref3 => {
|
||||
var startAngle = _ref3.startAngle,
|
||||
endAngle = _ref3.endAngle;
|
||||
var startCnt = Math.floor(startAngle / 360);
|
||||
var endCnt = Math.floor(endAngle / 360);
|
||||
var min = Math.min(startCnt, endCnt);
|
||||
return {
|
||||
startAngle: startAngle - min * 360,
|
||||
endAngle: endAngle - min * 360
|
||||
};
|
||||
};
|
||||
var reverseFormatAngleOfSector = (angle, _ref4) => {
|
||||
var startAngle = _ref4.startAngle,
|
||||
endAngle = _ref4.endAngle;
|
||||
var startCnt = Math.floor(startAngle / 360);
|
||||
var endCnt = Math.floor(endAngle / 360);
|
||||
var min = Math.min(startCnt, endCnt);
|
||||
return angle + min * 360;
|
||||
};
|
||||
export var inRangeOfSector = (_ref5, viewBox) => {
|
||||
var x = _ref5.relativeX,
|
||||
y = _ref5.relativeY;
|
||||
var _getAngleOfPoint = getAngleOfPoint({
|
||||
x,
|
||||
y
|
||||
}, viewBox),
|
||||
radius = _getAngleOfPoint.radius,
|
||||
angle = _getAngleOfPoint.angle;
|
||||
var innerRadius = viewBox.innerRadius,
|
||||
outerRadius = viewBox.outerRadius;
|
||||
if (radius < innerRadius || radius > outerRadius) {
|
||||
return null;
|
||||
}
|
||||
if (radius === 0) {
|
||||
return null;
|
||||
}
|
||||
var _formatAngleOfSector = formatAngleOfSector(viewBox),
|
||||
startAngle = _formatAngleOfSector.startAngle,
|
||||
endAngle = _formatAngleOfSector.endAngle;
|
||||
var formatAngle = angle;
|
||||
var inRange;
|
||||
if (startAngle <= endAngle) {
|
||||
while (formatAngle > endAngle) {
|
||||
formatAngle -= 360;
|
||||
}
|
||||
while (formatAngle < startAngle) {
|
||||
formatAngle += 360;
|
||||
}
|
||||
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
|
||||
} else {
|
||||
while (formatAngle > startAngle) {
|
||||
formatAngle -= 360;
|
||||
}
|
||||
while (formatAngle < endAngle) {
|
||||
formatAngle += 360;
|
||||
}
|
||||
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
|
||||
}
|
||||
if (inRange) {
|
||||
return _objectSpread(_objectSpread({}, viewBox), {}, {
|
||||
radius,
|
||||
angle: reverseFormatAngleOfSector(formatAngle, viewBox)
|
||||
});
|
||||
}
|
||||
return null;
|
||||
};
|
||||
22
frontend/node_modules/recharts/es6/util/RadialBarUtils.js
generated
vendored
Normal file
22
frontend/node_modules/recharts/es6/util/RadialBarUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
var _excluded = ["option"];
|
||||
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 { Sector } from '../shape/Sector';
|
||||
import { Shape } from './ActiveShapeUtils';
|
||||
export var defaultRadialBarShape = Sector;
|
||||
export function parseCornerRadius(cornerRadius) {
|
||||
if (typeof cornerRadius === 'string') {
|
||||
return parseInt(cornerRadius, 10);
|
||||
}
|
||||
return cornerRadius;
|
||||
}
|
||||
export function RadialBarSector(_ref) {
|
||||
var option = _ref.option,
|
||||
shapeProps = _objectWithoutProperties(_ref, _excluded);
|
||||
return /*#__PURE__*/React.createElement(Shape, {
|
||||
option: option,
|
||||
DefaultShape: defaultRadialBarShape,
|
||||
shapeProps: shapeProps
|
||||
});
|
||||
}
|
||||
85
frontend/node_modules/recharts/es6/util/ReactUtils.js
generated
vendored
Normal file
85
frontend/node_modules/recharts/es6/util/ReactUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
import get from 'es-toolkit/compat/get';
|
||||
import { Children } from 'react';
|
||||
import { isFragment } from 'react-is';
|
||||
import { isNullish } from './DataUtils';
|
||||
export var SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];
|
||||
|
||||
/**
|
||||
* @deprecated instead find another approach that does not depend on displayName.
|
||||
* Get the display name of a component
|
||||
* @param {Object} Comp Specified Component
|
||||
* @return {String} Display name of Component
|
||||
*/
|
||||
export var getDisplayName = Comp => {
|
||||
if (typeof Comp === 'string') {
|
||||
return Comp;
|
||||
}
|
||||
if (!Comp) {
|
||||
return '';
|
||||
}
|
||||
return Comp.displayName || Comp.name || 'Component';
|
||||
};
|
||||
|
||||
// `toArray` gets called multiple times during the render
|
||||
// so we can memoize last invocation (since reference to `children` is the same)
|
||||
var lastChildren = null;
|
||||
var lastResult = null;
|
||||
|
||||
/**
|
||||
* @deprecated instead find another approach that does not require reading React Elements from DOM.
|
||||
*
|
||||
* @param children do not use
|
||||
* @return deprecated do not use
|
||||
*/
|
||||
export var toArray = children => {
|
||||
if (children === lastChildren && Array.isArray(lastResult)) {
|
||||
return lastResult;
|
||||
}
|
||||
var result = [];
|
||||
Children.forEach(children, child => {
|
||||
if (isNullish(child)) return;
|
||||
if (isFragment(child)) {
|
||||
result = result.concat(toArray(child.props.children));
|
||||
} else {
|
||||
// @ts-expect-error this could still be Iterable<ReactNode> and TS does not like that
|
||||
result.push(child);
|
||||
}
|
||||
});
|
||||
lastResult = result;
|
||||
lastChildren = children;
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated instead find another approach that does not require reading React Elements from DOM.
|
||||
*
|
||||
* Find and return all matched children by type.
|
||||
* `type` must be a React.ComponentType
|
||||
*
|
||||
* @param children do not use
|
||||
* @param type do not use
|
||||
* @return deprecated do not use
|
||||
*/
|
||||
export function findAllByType(children, type) {
|
||||
var result = [];
|
||||
var types = [];
|
||||
if (Array.isArray(type)) {
|
||||
types = type.map(t => getDisplayName(t));
|
||||
} else {
|
||||
types = [getDisplayName(type)];
|
||||
}
|
||||
toArray(children).forEach(child => {
|
||||
// @ts-expect-error toArray and lodash.get are not compatible. Let's get rid of the whole findAllByType function
|
||||
var childType = get(child, 'type.displayName') || get(child, 'type.name');
|
||||
if (childType && types.indexOf(childType) !== -1) {
|
||||
result.push(child);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
export var isClipDot = dot => {
|
||||
if (dot && typeof dot === 'object' && 'clipDot' in dot) {
|
||||
return Boolean(dot.clipDot);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
164
frontend/node_modules/recharts/es6/util/ReduceCSSCalc.js
generated
vendored
Normal file
164
frontend/node_modules/recharts/es6/util/ReduceCSSCalc.js
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
var _DecimalCSS;
|
||||
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 _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 { isNan } from './DataUtils';
|
||||
var MULTIPLY_OR_DIVIDE_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
||||
var ADD_OR_SUBTRACT_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
||||
var CSS_LENGTH_UNIT_REGEX = /^(px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q)$/;
|
||||
var NUM_SPLIT_REGEX = /(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/;
|
||||
var CONVERSION_RATES = {
|
||||
cm: 96 / 2.54,
|
||||
mm: 96 / 25.4,
|
||||
pt: 96 / 72,
|
||||
pc: 96 / 6,
|
||||
in: 96,
|
||||
Q: 96 / (2.54 * 40),
|
||||
px: 1
|
||||
};
|
||||
var FIXED_CSS_LENGTH_UNITS = ['cm', 'mm', 'pt', 'pc', 'in', 'Q', 'px'];
|
||||
function isSupportedUnit(unit) {
|
||||
return FIXED_CSS_LENGTH_UNITS.includes(unit);
|
||||
}
|
||||
var STR_NAN = 'NaN';
|
||||
function convertToPx(value, unit) {
|
||||
return value * CONVERSION_RATES[unit];
|
||||
}
|
||||
class DecimalCSS {
|
||||
static parse(str) {
|
||||
var _NUM_SPLIT_REGEX$exec;
|
||||
var _ref = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [],
|
||||
_ref2 = _slicedToArray(_ref, 3),
|
||||
numStr = _ref2[1],
|
||||
unit = _ref2[2];
|
||||
if (numStr == null) {
|
||||
return DecimalCSS.NaN;
|
||||
}
|
||||
return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : '');
|
||||
}
|
||||
constructor(num, unit) {
|
||||
this.num = num;
|
||||
this.unit = unit;
|
||||
this.num = num;
|
||||
this.unit = unit;
|
||||
if (isNan(num)) {
|
||||
this.unit = '';
|
||||
}
|
||||
if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) {
|
||||
this.num = NaN;
|
||||
this.unit = '';
|
||||
}
|
||||
if (isSupportedUnit(unit)) {
|
||||
this.num = convertToPx(num, unit);
|
||||
this.unit = 'px';
|
||||
}
|
||||
}
|
||||
add(other) {
|
||||
if (this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num + other.num, this.unit);
|
||||
}
|
||||
subtract(other) {
|
||||
if (this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num - other.num, this.unit);
|
||||
}
|
||||
multiply(other) {
|
||||
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num * other.num, this.unit || other.unit);
|
||||
}
|
||||
divide(other) {
|
||||
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num / other.num, this.unit || other.unit);
|
||||
}
|
||||
toString() {
|
||||
return "".concat(this.num).concat(this.unit);
|
||||
}
|
||||
isNaN() {
|
||||
return isNan(this.num);
|
||||
}
|
||||
}
|
||||
_DecimalCSS = DecimalCSS;
|
||||
_defineProperty(DecimalCSS, "NaN", new _DecimalCSS(NaN, ''));
|
||||
function calculateArithmetic(expr) {
|
||||
if (expr == null || expr.includes(STR_NAN)) {
|
||||
return STR_NAN;
|
||||
}
|
||||
var newExpr = expr;
|
||||
while (newExpr.includes('*') || newExpr.includes('/')) {
|
||||
var _MULTIPLY_OR_DIVIDE_R;
|
||||
var _ref3 = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [],
|
||||
_ref4 = _slicedToArray(_ref3, 4),
|
||||
leftOperand = _ref4[1],
|
||||
operator = _ref4[2],
|
||||
rightOperand = _ref4[3];
|
||||
var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : '');
|
||||
var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : '');
|
||||
var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs);
|
||||
if (result.isNaN()) {
|
||||
return STR_NAN;
|
||||
}
|
||||
newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString());
|
||||
}
|
||||
while (newExpr.includes('+') || /.-\d+(?:\.\d+)?/.test(newExpr)) {
|
||||
var _ADD_OR_SUBTRACT_REGE;
|
||||
var _ref5 = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [],
|
||||
_ref6 = _slicedToArray(_ref5, 4),
|
||||
_leftOperand = _ref6[1],
|
||||
_operator = _ref6[2],
|
||||
_rightOperand = _ref6[3];
|
||||
var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : '');
|
||||
var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : '');
|
||||
var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs);
|
||||
if (_result.isNaN()) {
|
||||
return STR_NAN;
|
||||
}
|
||||
newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString());
|
||||
}
|
||||
return newExpr;
|
||||
}
|
||||
var PARENTHESES_REGEX = /\(([^()]*)\)/;
|
||||
function calculateParentheses(expr) {
|
||||
var newExpr = expr;
|
||||
var match;
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
while ((match = PARENTHESES_REGEX.exec(newExpr)) != null) {
|
||||
var _match = match,
|
||||
_match2 = _slicedToArray(_match, 2),
|
||||
parentheticalExpression = _match2[1];
|
||||
newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression));
|
||||
}
|
||||
return newExpr;
|
||||
}
|
||||
function evaluateExpression(expression) {
|
||||
var newExpr = expression.replace(/\s+/g, '');
|
||||
newExpr = calculateParentheses(newExpr);
|
||||
newExpr = calculateArithmetic(newExpr);
|
||||
return newExpr;
|
||||
}
|
||||
export function safeEvaluateExpression(expression) {
|
||||
try {
|
||||
return evaluateExpression(expression);
|
||||
} catch (_unused) {
|
||||
return STR_NAN;
|
||||
}
|
||||
}
|
||||
export function reduceCSSCalc(expression) {
|
||||
var result = safeEvaluateExpression(expression.slice(5, -1));
|
||||
if (result === STR_NAN) {
|
||||
return '';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
29
frontend/node_modules/recharts/es6/util/ScatterUtils.js
generated
vendored
Normal file
29
frontend/node_modules/recharts/es6/util/ScatterUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
var _excluded = ["option"];
|
||||
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 { Symbols } from '../shape/Symbols';
|
||||
import { Shape } from './ActiveShapeUtils';
|
||||
import { DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME } from './Constants';
|
||||
function renderSymbols(props) {
|
||||
return /*#__PURE__*/React.createElement(Symbols, props);
|
||||
}
|
||||
export function ScatterSymbol(_ref) {
|
||||
var option = _ref.option,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
if (typeof option === 'string') {
|
||||
return /*#__PURE__*/React.createElement(Shape, {
|
||||
option: /*#__PURE__*/React.createElement(Symbols, _extends({
|
||||
type: option
|
||||
}, props)),
|
||||
DefaultShape: renderSymbols,
|
||||
shapeProps: props
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(Shape, {
|
||||
option: option,
|
||||
DefaultShape: renderSymbols,
|
||||
shapeProps: props
|
||||
});
|
||||
}
|
||||
38
frontend/node_modules/recharts/es6/util/TickUtils.js
generated
vendored
Normal file
38
frontend/node_modules/recharts/es6/util/TickUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { getAngledRectangleWidth } from './CartesianUtils';
|
||||
import { getEveryNth } from './getEveryNth';
|
||||
export function getAngledTickWidth(contentSize, unitSize, angle) {
|
||||
var size = {
|
||||
width: contentSize.width + unitSize.width,
|
||||
height: contentSize.height + unitSize.height
|
||||
};
|
||||
return getAngledRectangleWidth(size, angle);
|
||||
}
|
||||
export function getTickBoundaries(viewBox, sign, sizeKey) {
|
||||
var isWidth = sizeKey === 'width';
|
||||
var x = viewBox.x,
|
||||
y = viewBox.y,
|
||||
width = viewBox.width,
|
||||
height = viewBox.height;
|
||||
if (sign === 1) {
|
||||
return {
|
||||
start: isWidth ? x : y,
|
||||
end: isWidth ? x + width : y + height
|
||||
};
|
||||
}
|
||||
return {
|
||||
start: isWidth ? x + width : y + height,
|
||||
end: isWidth ? x : y
|
||||
};
|
||||
}
|
||||
export function isVisible(sign, tickPosition, getSize, start, end) {
|
||||
/* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating
|
||||
* the tick's size. */
|
||||
if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {
|
||||
return false;
|
||||
}
|
||||
var size = getSize();
|
||||
return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
|
||||
}
|
||||
export function getNumberIntervalTicks(ticks, interval) {
|
||||
return getEveryNth(ticks, interval + 1);
|
||||
}
|
||||
41
frontend/node_modules/recharts/es6/util/YAxisUtils.js
generated
vendored
Normal file
41
frontend/node_modules/recharts/es6/util/YAxisUtils.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Calculates the width of the Y-axis based on the tick labels and the axis label.
|
||||
* @param params - The parameters object.
|
||||
* @param [params.ticks] - An array-like object of tick elements, each with a `getBoundingClientRect` method.
|
||||
* @param [params.label] - The axis label element, with a `getBoundingClientRect` method.
|
||||
* @param [params.labelGapWithTick=5] - The gap between the label and the tick.
|
||||
* @param [params.tickSize=0] - The length of the tick line.
|
||||
* @param [params.tickMargin=0] - The margin between the tick line and the tick text.
|
||||
* @returns The calculated width of the Y-axis.
|
||||
*/
|
||||
export var getCalculatedYAxisWidth = _ref => {
|
||||
var ticks = _ref.ticks,
|
||||
label = _ref.label,
|
||||
_ref$labelGapWithTick = _ref.labelGapWithTick,
|
||||
labelGapWithTick = _ref$labelGapWithTick === void 0 ? 5 : _ref$labelGapWithTick,
|
||||
_ref$tickSize = _ref.tickSize,
|
||||
tickSize = _ref$tickSize === void 0 ? 0 : _ref$tickSize,
|
||||
_ref$tickMargin = _ref.tickMargin,
|
||||
tickMargin = _ref$tickMargin === void 0 ? 0 : _ref$tickMargin;
|
||||
// find the max width of the tick labels
|
||||
var maxTickWidth = 0;
|
||||
if (ticks) {
|
||||
Array.from(ticks).forEach(tickNode => {
|
||||
if (tickNode) {
|
||||
var bbox = tickNode.getBoundingClientRect();
|
||||
if (bbox.width > maxTickWidth) {
|
||||
maxTickWidth = bbox.width;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// calculate width of the axis label
|
||||
var labelWidth = label ? label.getBoundingClientRect().width : 0;
|
||||
var tickWidth = tickSize + tickMargin;
|
||||
|
||||
// calculate the updated width of the y-axis
|
||||
var updatedYAxisWidth = maxTickWidth + tickWidth + labelWidth + (label ? labelGapWithTick : 0);
|
||||
return Math.round(updatedYAxisWidth);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
41
frontend/node_modules/recharts/es6/util/axisPropsAreEqual.js
generated
vendored
Normal file
41
frontend/node_modules/recharts/es6/util/axisPropsAreEqual.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
var _excluded = ["domain", "range"],
|
||||
_excluded2 = ["domain", "range"];
|
||||
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 { propsAreEqual } from './propsAreEqual';
|
||||
function shortArraysAreEqual(arr1, arr2) {
|
||||
if (arr1 === arr2) {
|
||||
return true;
|
||||
}
|
||||
if (Array.isArray(arr1) && arr1.length === 2 && Array.isArray(arr2) && arr2.length === 2) {
|
||||
return arr1[0] === arr2[0] && arr1[1] === arr2[1];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Usually we would not compare array props deeply for performance consideration.
|
||||
* However, for axis props, domain is sometimes defined as a two-elements array, and range is always
|
||||
* a two-elements array. So we can do a shallow comparison for the rest props and a shallow
|
||||
* comparison for these two array props.
|
||||
* @param prevProps
|
||||
* @param nextProps
|
||||
*/
|
||||
export function axisPropsAreEqual(prevProps, nextProps) {
|
||||
if (prevProps === nextProps) {
|
||||
return true;
|
||||
}
|
||||
var prevDomain = prevProps.domain,
|
||||
prevRange = prevProps.range,
|
||||
prevRest = _objectWithoutProperties(prevProps, _excluded);
|
||||
var nextDomain = nextProps.domain,
|
||||
nextRange = nextProps.range,
|
||||
nextRest = _objectWithoutProperties(nextProps, _excluded2);
|
||||
if (!shortArraysAreEqual(prevDomain, nextDomain)) {
|
||||
return false;
|
||||
}
|
||||
if (!shortArraysAreEqual(prevRange, nextRange)) {
|
||||
return false;
|
||||
}
|
||||
return propsAreEqual(prevRest, nextRest);
|
||||
}
|
||||
111
frontend/node_modules/recharts/es6/util/createCartesianCharts.js
generated
vendored
Normal file
111
frontend/node_modules/recharts/es6/util/createCartesianCharts.js
generated
vendored
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
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 { AreaChart as OriginalAreaChart } from '../chart/AreaChart';
|
||||
import { BarChart as OriginalBarChart } from '../chart/BarChart';
|
||||
import { LineChart as OriginalLineChart } from '../chart/LineChart';
|
||||
import { ComposedChart as OriginalComposedChart } from '../chart/ComposedChart';
|
||||
import { ScatterChart as OriginalScatterChart } from '../chart/ScatterChart';
|
||||
import { FunnelChart as OriginalFunnelChart } from '../chart/FunnelChart';
|
||||
var createCartesianCharts = layout => ({
|
||||
AreaChart: props => /*#__PURE__*/React.createElement(OriginalAreaChart, _extends({}, props, {
|
||||
layout: layout
|
||||
})),
|
||||
BarChart: props => /*#__PURE__*/React.createElement(OriginalBarChart, _extends({}, props, {
|
||||
layout: layout
|
||||
})),
|
||||
LineChart: props => /*#__PURE__*/React.createElement(OriginalLineChart, _extends({}, props, {
|
||||
layout: layout
|
||||
})),
|
||||
ComposedChart: props => /*#__PURE__*/React.createElement(OriginalComposedChart, _extends({}, props, {
|
||||
layout: layout
|
||||
})),
|
||||
ScatterChart: props => /*#__PURE__*/React.createElement(OriginalScatterChart, _extends({}, props, {
|
||||
layout: layout
|
||||
}))
|
||||
});
|
||||
/**
|
||||
* Creates a typed context for horizontal Cartesian charts.
|
||||
*
|
||||
* **Motivation:**
|
||||
* Recharts components fall back to `any` by default. While explicit typing using Generics (e.g. `<Area<MyDataType, number>>`)
|
||||
* works per-component, it becomes tedious and error-prone across an entire chart.
|
||||
*
|
||||
* This Chart Helper allows you to perfectly align your data properties and ensure all your charts, axes, and lines work in harmony.
|
||||
* Once you define the helper with your generic requirements, all returned components strictly enforce your data structure,
|
||||
* catching `dataKey` typos and shape errors early.
|
||||
*
|
||||
* **Layout Binding:**
|
||||
* Curries the chart definition to statically bind the `layout="horizontal"` property at the component level.
|
||||
* By stripping `layout` from the configuration options of generated wrapper components, developers avoid accidentally
|
||||
* overriding chart alignments. Evaluates `TComponents` generics at compile-time to reject strictly vertical components
|
||||
* natively (`Funnel`, `FunnelChart`) from being passed.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // 1. Lock in the Generics: Data = MyData, X-Axis = string, Y-Axis = number
|
||||
* const TypedCharts = createHorizontalChart<MyData, string, number>()({
|
||||
* AreaChart,
|
||||
* Area,
|
||||
* XAxis,
|
||||
* YAxis,
|
||||
* });
|
||||
* // 2. TypedCharts.AreaChart is now strictly horizontal.
|
||||
* // 3. TypedCharts.Area strictly expects string/number keys matching MyData.
|
||||
* ```
|
||||
*
|
||||
* @since 3.8
|
||||
* @see {@link https://recharts.github.io/en-US/guide/typescript/ Guide: Strong typing for Recharts components}
|
||||
*/
|
||||
export function createHorizontalChart() {
|
||||
return function withComponents(components) {
|
||||
return _objectSpread(_objectSpread({}, createCartesianCharts('horizontal')), components);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a typed context for vertical Cartesian charts.
|
||||
*
|
||||
* **Motivation:**
|
||||
* Recharts components fall back to `any` by default. While explicit typing using Generics (e.g. `<Area<MyDataType, number>>`)
|
||||
* works per-component, it becomes tedious and error-prone across an entire chart.
|
||||
*
|
||||
* This Chart Helper allows you to perfectly align your data properties and ensure all your charts, axes, and lines work in harmony.
|
||||
* Once you define the helper with your generic requirements, all returned components strictly enforce your data structure,
|
||||
* catching `dataKey` typos and shape errors early.
|
||||
*
|
||||
* **Layout Binding:**
|
||||
* Curries the chart definition to statically bind the `layout="vertical"` property at the component level.
|
||||
* By stripping `layout` from the configuration options of generated wrapper components, developers avoid accidentally
|
||||
* overriding chart alignments. Natively supports strictly vertical components like `Funnel` and `FunnelChart`.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // 1. Lock in the Generics: Data = MyData, X-Axis = number, Y-Axis = string
|
||||
* const TypedCharts = createVerticalChart<MyData, number, string>()({
|
||||
* BarChart,
|
||||
* Bar,
|
||||
* Funnel,
|
||||
* XAxis,
|
||||
* YAxis,
|
||||
* });
|
||||
* // 2. TypedCharts.BarChart is now strictly vertical.
|
||||
* // 3. `Funnel` evaluates safely inside vertical contexts exclusively and enforces MyData limits.
|
||||
* ```
|
||||
*
|
||||
* @since 3.8
|
||||
* @see {@link https://recharts.github.io/en-US/guide/typescript/ Guide: Strong typing for Recharts components}
|
||||
*/
|
||||
export function createVerticalChart() {
|
||||
return function withComponents(components) {
|
||||
return _objectSpread(_objectSpread({}, createCartesianCharts('vertical')), {}, {
|
||||
FunnelChart: props => /*#__PURE__*/React.createElement(OriginalFunnelChart, _extends({}, props, {
|
||||
layout: "vertical"
|
||||
}))
|
||||
}, components);
|
||||
};
|
||||
}
|
||||
16
frontend/node_modules/recharts/es6/util/createEventProxy.js
generated
vendored
Normal file
16
frontend/node_modules/recharts/es6/util/createEventProxy.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export function createEventProxy(reactEvent) {
|
||||
reactEvent.persist();
|
||||
var currentTarget = reactEvent.currentTarget;
|
||||
return new Proxy(reactEvent, {
|
||||
get: (target, prop) => {
|
||||
if (prop === 'currentTarget') {
|
||||
return currentTarget;
|
||||
}
|
||||
var value = Reflect.get(target, prop);
|
||||
if (typeof value === 'function') {
|
||||
return value.bind(target);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
92
frontend/node_modules/recharts/es6/util/createPolarCharts.js
generated
vendored
Normal file
92
frontend/node_modules/recharts/es6/util/createPolarCharts.js
generated
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
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 { RadialBarChart as OriginalRadialBarChart } from '../chart/RadialBarChart';
|
||||
import { RadarChart as OriginalRadarChart } from '../chart/RadarChart';
|
||||
import { PieChart as OriginalPieChart } from '../chart/PieChart';
|
||||
/**
|
||||
* Creates a typed context for centric Polar charts.
|
||||
*
|
||||
* **Motivation:**
|
||||
* Recharts components fall back to `any` by default. While explicit typing using Generics works per-component,
|
||||
* it becomes tedious and error-prone across an entire chart.
|
||||
*
|
||||
* This Chart Helper allows you to perfectly align your data properties and ensure all your charts and axes work in harmony.
|
||||
* Once you define the helper with your generic requirements, all returned components strictly enforce your data structure,
|
||||
* catching `dataKey` typos and shape errors early.
|
||||
*
|
||||
* **Layout Binding:**
|
||||
* Curries chart definitions to strictly bind `layout="centric"` prop behavior statically onto components.
|
||||
* By wrapping the chart implementations, it completely masks the `layout` prop on initialization to prevent regressions.
|
||||
* Evaluates `TComponents` generics at compile-time to reject radial-only elements natively (`RadialBar`, `Pie`, etc.)
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // 1. Lock in the Generics: Data = MyData
|
||||
* const TypedCentric = createCentricChart<MyData, string, number>()({
|
||||
* RadarChart,
|
||||
* Radar,
|
||||
* });
|
||||
* // 2. `layout` is permanently bound to "centric".
|
||||
* // 3. Passing `Pie` or `RadialBar` into the components map will explicitly trigger a TS error.
|
||||
* ```
|
||||
*
|
||||
* @since 3.8
|
||||
* @see {@link https://recharts.github.io/en-US/guide/typescript/ Guide: Strong typing for Recharts components}
|
||||
*/
|
||||
export function createCentricChart() {
|
||||
return function withComponents(components) {
|
||||
return _objectSpread({
|
||||
RadarChart: props => /*#__PURE__*/React.createElement(OriginalRadarChart, _extends({}, props, {
|
||||
layout: "centric"
|
||||
}))
|
||||
}, components);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a typed context for radial Polar charts.
|
||||
*
|
||||
* **Motivation:**
|
||||
* Recharts components fall back to `any` by default. While explicit typing using Generics works per-component,
|
||||
* it becomes tedious and error-prone across an entire chart.
|
||||
*
|
||||
* This Chart Helper allows you to perfectly align your data properties and ensure all your charts and layers work in harmony.
|
||||
* Once you define the helper with your generic requirements, all returned components strictly enforce your data structure,
|
||||
* catching `dataKey` typos and shape errors early.
|
||||
*
|
||||
* **Layout Binding:**
|
||||
* Curries chart definitions to strictly bind `layout="radial"` prop behavior statically onto components.
|
||||
* By wrapping the chart implementations, it completely masks the `layout` prop on initialization to prevent runtime faults.
|
||||
* Evaluates `TComponents` generics at compile-time to reject centric-only elements natively (`Radar`, `RadarChart`, etc.)
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // 1. Lock in the Generics: Data = MyData
|
||||
* const TypedRadial = createRadialChart<MyData, string, number>()({
|
||||
* RadialBarChart,
|
||||
* RadialBar,
|
||||
* });
|
||||
* // 2. `layout` is permanently bound to "radial".
|
||||
* // 3. Passing `Radar` or `RadarChart` into the components map will explicitly trigger a TS error.
|
||||
* ```
|
||||
*
|
||||
* @since 3.8
|
||||
* @see {@link https://recharts.github.io/en-US/guide/typescript/ Guide: Strong typing for Recharts components}
|
||||
*/
|
||||
export function createRadialChart() {
|
||||
return function withComponents(components) {
|
||||
return _objectSpread({
|
||||
RadialBarChart: props => /*#__PURE__*/React.createElement(OriginalRadialBarChart, _extends({}, props, {
|
||||
layout: "radial"
|
||||
})),
|
||||
PieChart: props => /*#__PURE__*/React.createElement(OriginalPieChart, _extends({}, props, {
|
||||
layout: "radial"
|
||||
}))
|
||||
}, components);
|
||||
};
|
||||
}
|
||||
43
frontend/node_modules/recharts/es6/util/cursor/getCursorPoints.js
generated
vendored
Normal file
43
frontend/node_modules/recharts/es6/util/cursor/getCursorPoints.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { polarToCartesian } from '../PolarUtils';
|
||||
import { isPolarCoordinate } from '../types';
|
||||
import { getRadialCursorPoints } from './getRadialCursorPoints';
|
||||
export function getCursorPoints(layout, activeCoordinate, offset) {
|
||||
if (layout === 'horizontal') {
|
||||
return [{
|
||||
x: activeCoordinate.x,
|
||||
y: offset.top
|
||||
}, {
|
||||
x: activeCoordinate.x,
|
||||
y: offset.top + offset.height
|
||||
}];
|
||||
}
|
||||
if (layout === 'vertical') {
|
||||
return [{
|
||||
x: offset.left,
|
||||
y: activeCoordinate.y
|
||||
}, {
|
||||
x: offset.left + offset.width,
|
||||
y: activeCoordinate.y
|
||||
}];
|
||||
}
|
||||
if (isPolarCoordinate(activeCoordinate)) {
|
||||
if (layout === 'centric') {
|
||||
var cx = activeCoordinate.cx,
|
||||
cy = activeCoordinate.cy,
|
||||
innerRadius = activeCoordinate.innerRadius,
|
||||
outerRadius = activeCoordinate.outerRadius,
|
||||
angle = activeCoordinate.angle;
|
||||
var innerPoint = polarToCartesian(cx, cy, innerRadius, angle);
|
||||
var outerPoint = polarToCartesian(cx, cy, outerRadius, angle);
|
||||
return [{
|
||||
x: innerPoint.x,
|
||||
y: innerPoint.y
|
||||
}, {
|
||||
x: outerPoint.x,
|
||||
y: outerPoint.y
|
||||
}];
|
||||
}
|
||||
return getRadialCursorPoints(activeCoordinate);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
11
frontend/node_modules/recharts/es6/util/cursor/getCursorRectangle.js
generated
vendored
Normal file
11
frontend/node_modules/recharts/es6/util/cursor/getCursorRectangle.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) {
|
||||
var halfSize = tooltipAxisBandSize / 2;
|
||||
return {
|
||||
stroke: 'none',
|
||||
fill: '#ccc',
|
||||
x: layout === 'horizontal' ? activeCoordinate.x - halfSize : offset.left + 0.5,
|
||||
y: layout === 'horizontal' ? offset.top + 0.5 : activeCoordinate.y - halfSize,
|
||||
width: layout === 'horizontal' ? tooltipAxisBandSize : offset.width - 1,
|
||||
height: layout === 'horizontal' ? offset.height - 1 : tooltipAxisBandSize
|
||||
};
|
||||
}
|
||||
23
frontend/node_modules/recharts/es6/util/cursor/getRadialCursorPoints.js
generated
vendored
Normal file
23
frontend/node_modules/recharts/es6/util/cursor/getRadialCursorPoints.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { polarToCartesian } from '../PolarUtils';
|
||||
/**
|
||||
* Only applicable for radial layouts
|
||||
* @param {Object} activeCoordinate ChartCoordinate
|
||||
* @returns {Object} RadialCursorPoints
|
||||
*/
|
||||
export function getRadialCursorPoints(activeCoordinate) {
|
||||
var cx = activeCoordinate.cx,
|
||||
cy = activeCoordinate.cy,
|
||||
radius = activeCoordinate.radius,
|
||||
startAngle = activeCoordinate.startAngle,
|
||||
endAngle = activeCoordinate.endAngle;
|
||||
var startPoint = polarToCartesian(cx, cy, radius, startAngle);
|
||||
var endPoint = polarToCartesian(cx, cy, radius, endAngle);
|
||||
return {
|
||||
points: [startPoint, endPoint],
|
||||
cx,
|
||||
cy,
|
||||
radius,
|
||||
startAngle,
|
||||
endAngle
|
||||
};
|
||||
}
|
||||
8
frontend/node_modules/recharts/es6/util/excludeEventProps.js
generated
vendored
Normal file
8
frontend/node_modules/recharts/es6/util/excludeEventProps.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
var EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
|
||||
export function isEventKey(key) {
|
||||
if (typeof key !== 'string') {
|
||||
return false;
|
||||
}
|
||||
var allowedEventKeys = EventKeys;
|
||||
return allowedEventKeys.includes(key);
|
||||
}
|
||||
146
frontend/node_modules/recharts/es6/util/getActiveCoordinate.js
generated
vendored
Normal file
146
frontend/node_modules/recharts/es6/util/getActiveCoordinate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
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 { polarToCartesian } from './PolarUtils';
|
||||
import { mathSign } from './DataUtils';
|
||||
export var getActiveCartesianCoordinate = (layout, tooltipTicks, activeIndex, pointer) => {
|
||||
var entry = tooltipTicks.find(tick => tick && tick.index === activeIndex);
|
||||
if (entry) {
|
||||
if (layout === 'horizontal') {
|
||||
return {
|
||||
x: entry.coordinate,
|
||||
y: pointer.relativeY
|
||||
};
|
||||
}
|
||||
if (layout === 'vertical') {
|
||||
return {
|
||||
x: pointer.relativeX,
|
||||
y: entry.coordinate
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the active coordinate in polar coordinate system.
|
||||
* Internally we only really use x and y, but this returned object is part of public API
|
||||
* (because it goes straight to the tooltip content) so we keep all the other properties
|
||||
* for backwards compatibility.
|
||||
*
|
||||
* @param layout - The polar layout type ('centric' or 'radial').
|
||||
* @param tooltipTicks - Array of tick items used for tooltips.
|
||||
* @param activeIndex - The index of the active tick.
|
||||
* @param rangeObj - The range object containing polar chart properties.
|
||||
* @returns The active coordinate object with polar properties.
|
||||
*/
|
||||
export var getActivePolarCoordinate = (layout, tooltipTicks, activeIndex, rangeObj) => {
|
||||
var entry = tooltipTicks.find(tick => tick && tick.index === activeIndex);
|
||||
if (entry) {
|
||||
if (layout === 'centric') {
|
||||
var _angle = entry.coordinate;
|
||||
var _radius = rangeObj.radius;
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, _radius, _angle)), {}, {
|
||||
angle: _angle,
|
||||
radius: _radius
|
||||
});
|
||||
}
|
||||
var radius = entry.coordinate;
|
||||
var angle = rangeObj.angle;
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, rangeObj), polarToCartesian(rangeObj.cx, rangeObj.cy, radius, angle)), {}, {
|
||||
angle,
|
||||
radius
|
||||
});
|
||||
}
|
||||
return {
|
||||
angle: 0,
|
||||
clockWise: false,
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
endAngle: 0,
|
||||
innerRadius: 0,
|
||||
outerRadius: 0,
|
||||
radius: 0,
|
||||
startAngle: 0,
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
};
|
||||
export function isInCartesianRange(pointer, offset) {
|
||||
var x = pointer.relativeX,
|
||||
y = pointer.relativeY;
|
||||
return x >= offset.left && x <= offset.left + offset.width && y >= offset.top && y <= offset.top + offset.height;
|
||||
}
|
||||
export var calculateActiveTickIndex = (coordinate, ticks, unsortedTicks, axisType, range) => {
|
||||
var _ticks$length;
|
||||
var len = (_ticks$length = ticks === null || ticks === void 0 ? void 0 : ticks.length) !== null && _ticks$length !== void 0 ? _ticks$length : 0;
|
||||
|
||||
// if there are 1 or fewer ticks or if there is no coordinate then the active tick is at index 0
|
||||
if (len <= 1 || coordinate == null) {
|
||||
return 0;
|
||||
}
|
||||
if (axisType === 'angleAxis' && range != null && Math.abs(Math.abs(range[1] - range[0]) - 360) <= 1e-6) {
|
||||
// ticks are distributed in a circle
|
||||
for (var i = 0; i < len; i++) {
|
||||
var _unsortedTicks, _unsortedTicks2, _unsortedTicks$i, _unsortedTicks$, _unsortedTicks3;
|
||||
var before = i > 0 ? (_unsortedTicks = unsortedTicks[i - 1]) === null || _unsortedTicks === void 0 ? void 0 : _unsortedTicks.coordinate : (_unsortedTicks2 = unsortedTicks[len - 1]) === null || _unsortedTicks2 === void 0 ? void 0 : _unsortedTicks2.coordinate;
|
||||
var cur = (_unsortedTicks$i = unsortedTicks[i]) === null || _unsortedTicks$i === void 0 ? void 0 : _unsortedTicks$i.coordinate;
|
||||
var after = i >= len - 1 ? (_unsortedTicks$ = unsortedTicks[0]) === null || _unsortedTicks$ === void 0 ? void 0 : _unsortedTicks$.coordinate : (_unsortedTicks3 = unsortedTicks[i + 1]) === null || _unsortedTicks3 === void 0 ? void 0 : _unsortedTicks3.coordinate;
|
||||
var sameDirectionCoord = void 0;
|
||||
if (before == null || cur == null || after == null) {
|
||||
continue;
|
||||
}
|
||||
if (mathSign(cur - before) !== mathSign(after - cur)) {
|
||||
var diffInterval = [];
|
||||
if (mathSign(after - cur) === mathSign(range[1] - range[0])) {
|
||||
sameDirectionCoord = after;
|
||||
var curInRange = cur + range[1] - range[0];
|
||||
diffInterval[0] = Math.min(curInRange, (curInRange + before) / 2);
|
||||
diffInterval[1] = Math.max(curInRange, (curInRange + before) / 2);
|
||||
} else {
|
||||
sameDirectionCoord = before;
|
||||
var afterInRange = after + range[1] - range[0];
|
||||
diffInterval[0] = Math.min(cur, (afterInRange + cur) / 2);
|
||||
diffInterval[1] = Math.max(cur, (afterInRange + cur) / 2);
|
||||
}
|
||||
var sameInterval = [Math.min(cur, (sameDirectionCoord + cur) / 2), Math.max(cur, (sameDirectionCoord + cur) / 2)];
|
||||
if (coordinate > sameInterval[0] && coordinate <= sameInterval[1] || coordinate >= diffInterval[0] && coordinate <= diffInterval[1]) {
|
||||
var _unsortedTicks$i2;
|
||||
return (_unsortedTicks$i2 = unsortedTicks[i]) === null || _unsortedTicks$i2 === void 0 ? void 0 : _unsortedTicks$i2.index;
|
||||
}
|
||||
} else {
|
||||
var minValue = Math.min(before, after);
|
||||
var maxValue = Math.max(before, after);
|
||||
if (coordinate > (minValue + cur) / 2 && coordinate <= (maxValue + cur) / 2) {
|
||||
var _unsortedTicks$i3;
|
||||
return (_unsortedTicks$i3 = unsortedTicks[i]) === null || _unsortedTicks$i3 === void 0 ? void 0 : _unsortedTicks$i3.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ticks) {
|
||||
// ticks are distributed in a single direction
|
||||
for (var _i = 0; _i < len; _i++) {
|
||||
var curr = ticks[_i];
|
||||
if (curr == null) {
|
||||
continue;
|
||||
}
|
||||
var next = ticks[_i + 1];
|
||||
var prev = ticks[_i - 1];
|
||||
if (_i === 0 && next != null && coordinate <= (curr.coordinate + next.coordinate) / 2) {
|
||||
return curr.index;
|
||||
}
|
||||
if (_i === len - 1 && prev != null && coordinate > (curr.coordinate + prev.coordinate) / 2) {
|
||||
return curr.index;
|
||||
}
|
||||
if (_i > 0 && _i < len - 1 && prev != null && next != null && coordinate > (curr.coordinate + prev.coordinate) / 2 && coordinate <= (curr.coordinate + next.coordinate) / 2) {
|
||||
return curr.index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
15
frontend/node_modules/recharts/es6/util/getAxisTypeBasedOnLayout.js
generated
vendored
Normal file
15
frontend/node_modules/recharts/es6/util/getAxisTypeBasedOnLayout.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { isCategoricalAxis } from './ChartUtils';
|
||||
|
||||
/**
|
||||
* This function evaluates the "auto" axis domain type based on the chart layout and axis type.
|
||||
* It outputs a definitive axis domain type that can be used for further processing.
|
||||
*/
|
||||
export function getAxisTypeBasedOnLayout(layout, axisType, axisDomainType) {
|
||||
if (axisDomainType !== 'auto') {
|
||||
return axisDomainType;
|
||||
}
|
||||
if (layout == null) {
|
||||
return undefined;
|
||||
}
|
||||
return isCategoricalAxis(layout, axisType) ? 'category' : 'number';
|
||||
}
|
||||
6
frontend/node_modules/recharts/es6/util/getClassNameFromUnknown.js
generated
vendored
Normal file
6
frontend/node_modules/recharts/es6/util/getClassNameFromUnknown.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export function getClassNameFromUnknown(u) {
|
||||
if (u && typeof u === 'object' && 'className' in u && typeof u.className === 'string') {
|
||||
return u.className;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
27
frontend/node_modules/recharts/es6/util/getEveryNth.js
generated
vendored
Normal file
27
frontend/node_modules/recharts/es6/util/getEveryNth.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Given an array and a number N, return a new array which contains every nTh
|
||||
* element of the input array. For n below 1, an empty array is returned.
|
||||
* For n equal to 1, the input array is returned as is.
|
||||
* For n greater than the length of the array, an array containing the first element
|
||||
* and every nTh element after that (if any) is returned.
|
||||
*
|
||||
* @param array An input array.
|
||||
* @param n A number specifying which elements to take.
|
||||
* @returns The result array of the same type as the input array.
|
||||
*/
|
||||
export function getEveryNth(array, n) {
|
||||
if (n < 1) {
|
||||
return [];
|
||||
}
|
||||
if (n === 1) {
|
||||
return array;
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < array.length; i += n) {
|
||||
var item = array[i];
|
||||
if (item !== undefined) {
|
||||
result.push(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
26
frontend/node_modules/recharts/es6/util/getRadiusAndStrokeWidthFromDot.js
generated
vendored
Normal file
26
frontend/node_modules/recharts/es6/util/getRadiusAndStrokeWidthFromDot.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { svgPropertiesNoEventsFromUnknown } from './svgPropertiesNoEvents';
|
||||
export function getRadiusAndStrokeWidthFromDot(dot) {
|
||||
var props = svgPropertiesNoEventsFromUnknown(dot);
|
||||
var defaultR = 3;
|
||||
var defaultStrokeWidth = 2;
|
||||
if (props != null) {
|
||||
var r = props.r,
|
||||
strokeWidth = props.strokeWidth;
|
||||
var realR = Number(r);
|
||||
var realStrokeWidth = Number(strokeWidth);
|
||||
if (Number.isNaN(realR) || realR < 0) {
|
||||
realR = defaultR;
|
||||
}
|
||||
if (Number.isNaN(realStrokeWidth) || realStrokeWidth < 0) {
|
||||
realStrokeWidth = defaultStrokeWidth;
|
||||
}
|
||||
return {
|
||||
r: realR,
|
||||
strokeWidth: realStrokeWidth
|
||||
};
|
||||
}
|
||||
return {
|
||||
r: defaultR,
|
||||
strokeWidth: defaultStrokeWidth
|
||||
};
|
||||
}
|
||||
94
frontend/node_modules/recharts/es6/util/getRelativeCoordinate.js
generated
vendored
Normal file
94
frontend/node_modules/recharts/es6/util/getRelativeCoordinate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* Type guard to check if the pointer event is from an SVG element.
|
||||
*/
|
||||
function isSvgPointer(pointer) {
|
||||
return 'getBBox' in pointer.currentTarget && typeof pointer.currentTarget.getBBox === 'function';
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes relative element coordinates from mouse or touch event.
|
||||
*
|
||||
* The output coordinates are relative to the top-left corner of the active element (= currentTarget),
|
||||
* where the top-left corner is (0, 0).
|
||||
* Moving right, the x-coordinate increases, and moving down, the y-coordinate increases.
|
||||
*
|
||||
* The coordinates are rounded to the nearest integer and account for CSS transform scale.
|
||||
* So element that's scaled will return the same coordinates as element that's not scaled.
|
||||
*
|
||||
* In other words: you zoom in or out, numbers stay the same.
|
||||
*
|
||||
* This function works with both HTML elements and SVG elements.
|
||||
*
|
||||
* It works with both Mouse and Touch events.
|
||||
* For Touch events, it returns an array of coordinates, one for each touch point.
|
||||
* For Mouse events, it returns a single coordinate object.
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // In an HTML element event handler. Legend passes the native event as the 3rd argument.
|
||||
* <Legend onMouseMove={(_data, _i, e) => {
|
||||
* // These coordinates are relative to the top-left corner of the Legend element
|
||||
* const { relativeX, relativeY } = getRelativeCoordinate(e);
|
||||
* console.log(`Mouse at Legend position: (${relativeX}, ${relativeY})`);
|
||||
* }}>
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // In an SVG element event handler. Area is an SVG element, and passes the event as second argument.
|
||||
* <Area onMouseMove={(_, e) => {
|
||||
* const { relativeX, relativeY } = getRelativeCoordinate(e);
|
||||
* console.log(`Mouse at Area position: (${relativeX}, ${relativeY})`);
|
||||
* // Here you can call usePlotArea to convert to chart coordinates
|
||||
* }}>
|
||||
* ```
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* // In a chart root touch handler. Chart root passes the event as second argument.
|
||||
* <LineChart onTouchMove={(_, e) => {
|
||||
* const touchPoints = getRelativeCoordinate(e);
|
||||
* touchPoints.forEach(({ relativeX, relativeY }, index) => {
|
||||
* console.log(`Touch point ${index} at LineChart position: (${relativeX}, ${relativeY})`);
|
||||
* });
|
||||
* }}>
|
||||
* ```
|
||||
*
|
||||
* @since 3.8
|
||||
* @param event The mouse or touch event from React event handlers (works with both HTML and SVG elements)
|
||||
* @returns Coordinates relative to the top-left corner of the element. Single object for Mouse events, array of objects for Touch events.
|
||||
*/
|
||||
|
||||
export function getRelativeCoordinate(event) {
|
||||
var rect = event.currentTarget.getBoundingClientRect();
|
||||
var scaleX, scaleY;
|
||||
if (isSvgPointer(event)) {
|
||||
// For SVG elements, use getBBox() to get the intrinsic size in SVG coordinates
|
||||
var bbox = event.currentTarget.getBBox();
|
||||
scaleX = bbox.width > 0 ? rect.width / bbox.width : 1;
|
||||
scaleY = bbox.height > 0 ? rect.height / bbox.height : 1;
|
||||
} else {
|
||||
// For HTML elements, use offsetWidth/offsetHeight
|
||||
var element = event.currentTarget;
|
||||
scaleX = element.offsetWidth > 0 ? rect.width / element.offsetWidth : 1;
|
||||
scaleY = element.offsetHeight > 0 ? rect.height / element.offsetHeight : 1;
|
||||
}
|
||||
var getCoordinates = (clientX, clientY) => ({
|
||||
/*
|
||||
* Here it's important to use:
|
||||
* - event.clientX and event.clientY to get the mouse position relative to the viewport, including scroll.
|
||||
* - pageX and pageY are not used because they are relative to the whole document, and ignore scroll.
|
||||
* - rect.left and rect.top are used to get the position of the chart relative to the viewport.
|
||||
* - offsetX and offsetY are not used because they are relative to the offset parent
|
||||
* which may or may not be the same as the clientX and clientY, depending on the position of the chart in the DOM
|
||||
* and surrounding element styles. CSS position: relative, absolute, fixed, will change the offset parent.
|
||||
* - scaleX and scaleY are necessary for when the chart element is scaled using CSS `transform: scale(N)`.
|
||||
*/
|
||||
relativeX: Math.round((clientX - rect.left) / scaleX),
|
||||
relativeY: Math.round((clientY - rect.top) / scaleY)
|
||||
});
|
||||
if ('touches' in event) {
|
||||
return Array.from(event.touches).map(touch => getCoordinates(touch.clientX, touch.clientY));
|
||||
}
|
||||
return getCoordinates(event.clientX, event.clientY);
|
||||
}
|
||||
9
frontend/node_modules/recharts/es6/util/getSliced.js
generated
vendored
Normal file
9
frontend/node_modules/recharts/es6/util/getSliced.js
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export function getSliced(arr, startIndex, endIndex) {
|
||||
if (!Array.isArray(arr)) {
|
||||
return arr;
|
||||
}
|
||||
if (arr && startIndex + endIndex !== 0) {
|
||||
return arr.slice(startIndex, endIndex + 1);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
189
frontend/node_modules/recharts/es6/util/isDomainSpecifiedByUser.js
generated
vendored
Normal file
189
frontend/node_modules/recharts/es6/util/isDomainSpecifiedByUser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
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 { MAX_VALUE_REG, MIN_VALUE_REG } from './ChartUtils';
|
||||
import { isNumber } from './DataUtils';
|
||||
import { isWellBehavedNumber } from './isWellBehavedNumber';
|
||||
export function isWellFormedNumberDomain(v) {
|
||||
if (Array.isArray(v) && v.length === 2) {
|
||||
var _v = _slicedToArray(v, 2),
|
||||
min = _v[0],
|
||||
max = _v[1];
|
||||
if (isWellBehavedNumber(min) && isWellBehavedNumber(max)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
export function extendDomain(providedDomain, boundaryDomain, allowDataOverflow) {
|
||||
if (allowDataOverflow) {
|
||||
// If the data are allowed to overflow - we're fine with whatever user provided
|
||||
return providedDomain;
|
||||
}
|
||||
/*
|
||||
* If the data are not allowed to overflow - we need to extend the domain.
|
||||
* Means that effectively the user is allowed to make the domain larger
|
||||
* but not smaller.
|
||||
*/
|
||||
return [Math.min(providedDomain[0], boundaryDomain[0]), Math.max(providedDomain[1], boundaryDomain[1])];
|
||||
}
|
||||
|
||||
/**
|
||||
* So Recharts allows users to provide their own domains,
|
||||
* but it also places some expectations on what the domain is.
|
||||
* We can improve on the typescript typing, but we also need a runtime test
|
||||
to observe that the user-provided domain is well-formed,
|
||||
* that is: an array with exactly two numbers.
|
||||
*
|
||||
* This function does not accept data as an argument.
|
||||
* This is to enable a performance optimization - if the domain is there,
|
||||
* and we know what it is without traversing all the data,
|
||||
* then we don't have to traverse all the data!
|
||||
*
|
||||
* If the user-provided domain is not well-formed,
|
||||
* this function will return undefined - in which case we should traverse the data to calculate the real domain.
|
||||
*
|
||||
* This function is for parsing the numerical domain only.
|
||||
*
|
||||
* @param userDomain external prop, user provided, before validation. Can have various shapes: array, function, special magical strings inside too.
|
||||
* @param allowDataOverflow boolean, provided by users. If true then the data domain wins
|
||||
*
|
||||
* @return [min, max] domain if it's well-formed; undefined if the domain is invalid
|
||||
*/
|
||||
export function numericalDomainSpecifiedWithoutRequiringData(userDomain, allowDataOverflow) {
|
||||
if (!allowDataOverflow) {
|
||||
// Cannot compute data overflow if the data is not provided
|
||||
return undefined;
|
||||
}
|
||||
if (typeof userDomain === 'function') {
|
||||
// The user function expects the data to be provided as an argument
|
||||
return undefined;
|
||||
}
|
||||
if (Array.isArray(userDomain) && userDomain.length === 2) {
|
||||
var _userDomain = _slicedToArray(userDomain, 2),
|
||||
providedMin = _userDomain[0],
|
||||
providedMax = _userDomain[1];
|
||||
var finalMin, finalMax;
|
||||
if (isWellBehavedNumber(providedMin)) {
|
||||
finalMin = providedMin;
|
||||
} else if (typeof providedMin === 'function') {
|
||||
// The user function expects the data to be provided as an argument
|
||||
return undefined;
|
||||
}
|
||||
if (isWellBehavedNumber(providedMax)) {
|
||||
finalMax = providedMax;
|
||||
} else if (typeof providedMax === 'function') {
|
||||
// The user function expects the data to be provided as an argument
|
||||
return undefined;
|
||||
}
|
||||
var candidate = [finalMin, finalMax];
|
||||
if (isWellFormedNumberDomain(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* So Recharts allows users to provide their own domains,
|
||||
* but it also places some expectations on what the domain is.
|
||||
* We can improve on the typescript typing, but we also need a runtime test
|
||||
* to observe that the user-provided domain is well-formed,
|
||||
* that is: an array with exactly two numbers.
|
||||
* If the user-provided domain is not well-formed,
|
||||
* this function will return undefined - in which case we should traverse the data to calculate the real domain.
|
||||
*
|
||||
* This function is for parsing the numerical domain only.
|
||||
*
|
||||
* You are probably thinking, why does domain need tick count?
|
||||
* Well it adjusts the domain based on where the "nice ticks" land, and nice ticks depend on the tick count.
|
||||
*
|
||||
* @param userDomain external prop, user provided, before validation. Can have various shapes: array, function, special magical strings inside too.
|
||||
* @param dataDomain calculated from data. Can be undefined, as an option for performance optimization
|
||||
* @param allowDataOverflow provided by users. If true then the data domain wins
|
||||
*
|
||||
* @return [min, max] domain if it's well-formed; undefined if the domain is invalid
|
||||
*/
|
||||
export function parseNumericalUserDomain(userDomain, dataDomain, allowDataOverflow) {
|
||||
if (!allowDataOverflow && dataDomain == null) {
|
||||
// Cannot compute data overflow if the data is not provided
|
||||
return undefined;
|
||||
}
|
||||
if (typeof userDomain === 'function' && dataDomain != null) {
|
||||
try {
|
||||
var result = userDomain(dataDomain, allowDataOverflow);
|
||||
if (isWellFormedNumberDomain(result)) {
|
||||
return extendDomain(result, dataDomain, allowDataOverflow);
|
||||
}
|
||||
} catch (_unused) {
|
||||
/* ignore the exception and compute domain from data later */
|
||||
}
|
||||
}
|
||||
if (Array.isArray(userDomain) && userDomain.length === 2) {
|
||||
var _userDomain2 = _slicedToArray(userDomain, 2),
|
||||
providedMin = _userDomain2[0],
|
||||
providedMax = _userDomain2[1];
|
||||
var finalMin, finalMax;
|
||||
if (providedMin === 'auto') {
|
||||
if (dataDomain != null) {
|
||||
finalMin = Math.min(...dataDomain);
|
||||
}
|
||||
} else if (isNumber(providedMin)) {
|
||||
finalMin = providedMin;
|
||||
} else if (typeof providedMin === 'function') {
|
||||
try {
|
||||
if (dataDomain != null) {
|
||||
finalMin = providedMin(dataDomain === null || dataDomain === void 0 ? void 0 : dataDomain[0]);
|
||||
}
|
||||
} catch (_unused2) {
|
||||
/* ignore the exception and compute domain from data later */
|
||||
}
|
||||
} else if (typeof providedMin === 'string' && MIN_VALUE_REG.test(providedMin)) {
|
||||
var match = MIN_VALUE_REG.exec(providedMin);
|
||||
if (match == null || match[1] == null || dataDomain == null) {
|
||||
finalMin = undefined;
|
||||
} else {
|
||||
var value = +match[1];
|
||||
finalMin = dataDomain[0] - value;
|
||||
}
|
||||
} else {
|
||||
finalMin = dataDomain === null || dataDomain === void 0 ? void 0 : dataDomain[0];
|
||||
}
|
||||
if (providedMax === 'auto') {
|
||||
if (dataDomain != null) {
|
||||
finalMax = Math.max(...dataDomain);
|
||||
}
|
||||
} else if (isNumber(providedMax)) {
|
||||
finalMax = providedMax;
|
||||
} else if (typeof providedMax === 'function') {
|
||||
try {
|
||||
if (dataDomain != null) {
|
||||
finalMax = providedMax(dataDomain === null || dataDomain === void 0 ? void 0 : dataDomain[1]);
|
||||
}
|
||||
} catch (_unused3) {
|
||||
/* ignore the exception and compute domain from data later */
|
||||
}
|
||||
} else if (typeof providedMax === 'string' && MAX_VALUE_REG.test(providedMax)) {
|
||||
var _match = MAX_VALUE_REG.exec(providedMax);
|
||||
if (_match == null || _match[1] == null || dataDomain == null) {
|
||||
finalMax = undefined;
|
||||
} else {
|
||||
var _value = +_match[1];
|
||||
finalMax = dataDomain[1] + _value;
|
||||
}
|
||||
} else {
|
||||
finalMax = dataDomain === null || dataDomain === void 0 ? void 0 : dataDomain[1];
|
||||
}
|
||||
var candidate = [finalMin, finalMax];
|
||||
if (isWellFormedNumberDomain(candidate)) {
|
||||
if (dataDomain == null) {
|
||||
return candidate;
|
||||
}
|
||||
return extendDomain(candidate, dataDomain, allowDataOverflow);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
6
frontend/node_modules/recharts/es6/util/isWellBehavedNumber.js
generated
vendored
Normal file
6
frontend/node_modules/recharts/es6/util/isWellBehavedNumber.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export function isWellBehavedNumber(n) {
|
||||
return Number.isFinite(n);
|
||||
}
|
||||
export function isPositiveNumber(n) {
|
||||
return typeof n === 'number' && n > 0 && Number.isFinite(n);
|
||||
}
|
||||
19
frontend/node_modules/recharts/es6/util/payload/getUniqPayload.js
generated
vendored
Normal file
19
frontend/node_modules/recharts/es6/util/payload/getUniqPayload.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import uniqBy from 'es-toolkit/compat/uniqBy';
|
||||
|
||||
/**
|
||||
* This is configuration option that decides how to filter for unique values only:
|
||||
*
|
||||
* - `false` means "no filter"
|
||||
* - `true` means "use recharts default filter"
|
||||
* - function means "use return of this function as the default key"
|
||||
*/
|
||||
|
||||
export function getUniqPayload(payload, option, defaultUniqBy) {
|
||||
if (option === true) {
|
||||
return uniqBy(payload, defaultUniqBy);
|
||||
}
|
||||
if (typeof option === 'function') {
|
||||
return uniqBy(payload, option);
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
72
frontend/node_modules/recharts/es6/util/propsAreEqual.js
generated
vendored
Normal file
72
frontend/node_modules/recharts/es6/util/propsAreEqual.js
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import { shallowEqual } from 'react-redux';
|
||||
var propsToShallowCompare = new Set(['axisLine', 'tickLine', 'activeBar', 'activeDot', 'activeLabel', 'activeShape', 'allowEscapeViewBox', 'background', 'cursor', 'dot', 'label', 'line', 'margin', 'padding', 'position', 'shape', 'style', 'tick', 'wrapperStyle',
|
||||
// radius can be an array of 4 numbers, easy to compare shallowly
|
||||
'radius', 'throttledEvents']);
|
||||
|
||||
/**
|
||||
* When comparing two values, returns true if they are the same value or
|
||||
* are both NaN.
|
||||
*
|
||||
* If we used just a simple triple equals, we would get false negatives for two NaNs
|
||||
* which could cause extra re-renders so let's have this instead.
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness#same-value-zero_equality
|
||||
*
|
||||
* @param x first value to compare
|
||||
* @param y second value to compare
|
||||
* return true if the same, false if different
|
||||
*/
|
||||
function sameValueZero(x, y) {
|
||||
if (x == null && y == null) {
|
||||
/*
|
||||
* treat null and undefined as equal. Internally in Recharts we make no difference between these two
|
||||
* so there is no need to re-render.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
if (typeof x === 'number' && typeof y === 'number') {
|
||||
// x and y are equal (this is true for -0 and 0) or they are both NaN
|
||||
// eslint-disable-next-line no-self-compare
|
||||
return x === y || x !== x && y !== y;
|
||||
}
|
||||
return x === y;
|
||||
}
|
||||
|
||||
/**
|
||||
* So usually React would compare only the first level of props using Object.is.
|
||||
* However, in our case many props are objects or arrays, and our own docs recommend to do that!
|
||||
* Therefore, we need a custom comparison function that does a shallow comparison of each prop value.
|
||||
*
|
||||
* Because charts can and do receive large props (typically the data array),
|
||||
* we only limit this to a subset of known props that are likely to be objects/arrays.
|
||||
*
|
||||
* @param prevProps
|
||||
* @param nextProps
|
||||
*/
|
||||
export function propsAreEqual(prevProps, nextProps) {
|
||||
var allKeys = new Set([...Object.keys(prevProps), ...Object.keys(nextProps)]);
|
||||
for (var key of allKeys) {
|
||||
/*
|
||||
* If a key is on a special allowlist, go one level deeper
|
||||
* and do a shallow comparison of the values.
|
||||
*/
|
||||
if (propsToShallowCompare.has(key)) {
|
||||
if (prevProps[key] == null && nextProps[key] == null) {
|
||||
/*
|
||||
* treat null and undefined as equal. Internally in Recharts we make no difference between these two
|
||||
* so there is no need to re-render.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (!shallowEqual(prevProps[key], nextProps[key])) {
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
* Otherwise do a simple same-value comparison (with NaN support).
|
||||
*/
|
||||
} else if (!sameValueZero(prevProps[key], nextProps[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
85
frontend/node_modules/recharts/es6/util/resolveDefaultProps.js
generated
vendored
Normal file
85
frontend/node_modules/recharts/es6/util/resolveDefaultProps.js
generated
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
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); }
|
||||
/**
|
||||
* This function mimics the behavior of the `defaultProps` static property in React.
|
||||
* Functional components do not have a defaultProps property, so this function is useful to resolve default props.
|
||||
*
|
||||
* The common recommendation is to use ES6 destructuring with default values in the function signature,
|
||||
* but you need to be careful there and make sure you destructure all the individual properties
|
||||
* and not the whole object. See the test file for example.
|
||||
*
|
||||
* And because destructuring all properties one by one is a faff, and it's easy to miss one property,
|
||||
* this function exists.
|
||||
*
|
||||
* @param realProps - the props object passed to the component by the user
|
||||
* @param defaultProps - the default props object defined in the component by Recharts
|
||||
* @returns - the props object with all the default props resolved. All `undefined` values are replaced with the default value.
|
||||
*/
|
||||
export function resolveDefaultProps(realProps, defaultProps) {
|
||||
/*
|
||||
* To avoid mutating the original `realProps` object passed to the function, create a shallow copy of it.
|
||||
* `resolvedProps` will be modified directly with the defaults.
|
||||
*/
|
||||
var resolvedProps = _objectSpread({}, realProps);
|
||||
/*
|
||||
* Since the function guarantees `D extends Partial<T>`, this assignment is safe.
|
||||
* It allows TypeScript to work with the well-defined `Partial<T>` type inside the loop,
|
||||
* making subsequent type inference (especially for `dp[key]`) much more straightforward for the compiler.
|
||||
* This is a key step to improve type safety *without* value assertions later.
|
||||
*/
|
||||
var dp = defaultProps;
|
||||
/*
|
||||
* `Object.keys` doesn't preserve strong key types - it always returns Array<string>.
|
||||
* However, due to the `D extends Partial<T>` constraint,
|
||||
* we know these keys *must* also be valid keys of `T`.
|
||||
* This assertion informs TypeScript of this relationship, avoiding type errors when using `key` to index `acc` (type T).
|
||||
*
|
||||
* Type assertions are not sound but in this case it's necessary
|
||||
* as `Object.keys` does not do what we want it to do.
|
||||
*/
|
||||
var keys = Object.keys(defaultProps);
|
||||
var withDefaults = keys.reduce((acc, key) => {
|
||||
if (acc[key] === undefined && dp[key] !== undefined) {
|
||||
acc[key] = dp[key];
|
||||
}
|
||||
return acc;
|
||||
}, resolvedProps);
|
||||
/*
|
||||
* And again type assertions are not safe but here we have done the runtime work
|
||||
* so let's bypass the lack of static type safety and tell the compiler what happened.
|
||||
*/
|
||||
return withDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper type to extract the keys of T that are required.
|
||||
* It iterates through each key K in T. If Pick<T, K> cannot be assigned an empty object {},
|
||||
* it means K is required, so we keep K; otherwise, we discard it (never).
|
||||
* [keyof T] at the end creates a union of the kept keys.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper type to extract the keys of T that are optional.
|
||||
* It iterates through each key K in T. If Pick<T, K> can be assigned an empty object {},
|
||||
* it means K is optional (or potentially missing), so we keep K; otherwise, we discard it (never).
|
||||
* [keyof T] at the end creates a union of the kept keys.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper type to ensure keys of D exist in T.
|
||||
* For each key K in D, if K is also a key of T, keep the type D[K].
|
||||
* If K is NOT a key of T, map it to type `never`.
|
||||
* An object cannot have a property of type `never`, effectively disallowing extra keys.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This type will take a source type `Props` and a default type `Defaults` and will return a new type
|
||||
* where all properties that are optional in `Props` but required in `Defaults` are made required in the result.
|
||||
* Properties that are required in `Props` and optional in `Defaults` will remain required.
|
||||
* Properties that are optional in both `Props` and `Defaults` will remain optional.
|
||||
*
|
||||
* This is useful for creating a type that represents the resolved props of a component with default props.
|
||||
*/
|
||||
32
frontend/node_modules/recharts/es6/util/round.js
generated
vendored
Normal file
32
frontend/node_modules/recharts/es6/util/round.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// if you go lower than 3, wild wild things happen during rendering
|
||||
var defaultRoundPrecision = 4;
|
||||
export function round(num) {
|
||||
var roundPrecision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultRoundPrecision;
|
||||
var factor = 10 ** roundPrecision;
|
||||
var rounded = Math.round(num * factor) / factor;
|
||||
if (Object.is(rounded, -0)) {
|
||||
return 0;
|
||||
}
|
||||
return rounded;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will accept a string template literal and for each
|
||||
* variable placeholder, it will round the value to avoid long float numbers in
|
||||
* the SVG path which might cause rendering issues in some browsers.
|
||||
*/
|
||||
export function roundTemplateLiteral(strings) {
|
||||
for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
values[_key - 1] = arguments[_key];
|
||||
}
|
||||
return strings.reduce((result, string, i) => {
|
||||
var value = values[i - 1];
|
||||
if (typeof value === 'string') {
|
||||
return result + value + string;
|
||||
}
|
||||
if (value !== undefined) {
|
||||
return result + round(value) + string;
|
||||
}
|
||||
return result + string;
|
||||
}, '');
|
||||
}
|
||||
58
frontend/node_modules/recharts/es6/util/scale/CartesianScaleHelper.js
generated
vendored
Normal file
58
frontend/node_modules/recharts/es6/util/scale/CartesianScaleHelper.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Groups X and Y scale functions together and provides helper methods.
|
||||
*/
|
||||
export class CartesianScaleHelperImpl {
|
||||
constructor(_ref) {
|
||||
var x = _ref.x,
|
||||
y = _ref.y;
|
||||
this.xAxisScale = x;
|
||||
this.yAxisScale = y;
|
||||
}
|
||||
map(value, _ref2) {
|
||||
var _this$xAxisScale$map, _this$yAxisScale$map;
|
||||
var position = _ref2.position;
|
||||
return {
|
||||
x: (_this$xAxisScale$map = this.xAxisScale.map(value.x, {
|
||||
position
|
||||
})) !== null && _this$xAxisScale$map !== void 0 ? _this$xAxisScale$map : 0,
|
||||
y: (_this$yAxisScale$map = this.yAxisScale.map(value.y, {
|
||||
position
|
||||
})) !== null && _this$yAxisScale$map !== void 0 ? _this$yAxisScale$map : 0
|
||||
};
|
||||
}
|
||||
mapWithFallback(value, _ref3) {
|
||||
var _this$xAxisScale$map2, _this$yAxisScale$map2;
|
||||
var position = _ref3.position,
|
||||
fallback = _ref3.fallback;
|
||||
var fallbackY, fallbackX;
|
||||
if (fallback === 'rangeMin') {
|
||||
fallbackY = this.yAxisScale.rangeMin();
|
||||
} else if (fallback === 'rangeMax') {
|
||||
fallbackY = this.yAxisScale.rangeMax();
|
||||
} else {
|
||||
fallbackY = 0;
|
||||
}
|
||||
if (fallback === 'rangeMin') {
|
||||
fallbackX = this.xAxisScale.rangeMin();
|
||||
} else if (fallback === 'rangeMax') {
|
||||
fallbackX = this.xAxisScale.rangeMax();
|
||||
} else {
|
||||
fallbackX = 0;
|
||||
}
|
||||
return {
|
||||
x: (_this$xAxisScale$map2 = this.xAxisScale.map(value.x, {
|
||||
position
|
||||
})) !== null && _this$xAxisScale$map2 !== void 0 ? _this$xAxisScale$map2 : fallbackX,
|
||||
y: (_this$yAxisScale$map2 = this.yAxisScale.map(value.y, {
|
||||
position
|
||||
})) !== null && _this$yAxisScale$map2 !== void 0 ? _this$yAxisScale$map2 : fallbackY
|
||||
};
|
||||
}
|
||||
isInRange(_ref4) {
|
||||
var x = _ref4.x,
|
||||
y = _ref4.y;
|
||||
var xInRange = x == null || this.xAxisScale.isInRange(x);
|
||||
var yInRange = y == null || this.yAxisScale.isInRange(y);
|
||||
return xInRange && yInRange;
|
||||
}
|
||||
}
|
||||
1
frontend/node_modules/recharts/es6/util/scale/CustomScaleDefinition.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/util/scale/CustomScaleDefinition.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
66
frontend/node_modules/recharts/es6/util/scale/RechartsScale.js
generated
vendored
Normal file
66
frontend/node_modules/recharts/es6/util/scale/RechartsScale.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* This is internal representation of scale used in Recharts.
|
||||
* Users will provide CustomScaleDefinition or a string, which we will parse into RechartsScale.
|
||||
* Most importantly, RechartsScale is fully immutable - there are no setters that mutate the scale in place.
|
||||
* This is important for React integration - if the scale changes, we want to trigger re-renders.
|
||||
* Mutating the scale in place would not trigger re-renders, leading to stale UI.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Position within a band for banded scales.
|
||||
* In scales that are not banded, this parameter is ignored.
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
export function rechartsScaleFactory(d3Scale) {
|
||||
if (d3Scale == null) {
|
||||
return undefined;
|
||||
}
|
||||
var ticksFn = d3Scale.ticks;
|
||||
var bandwidthFn = d3Scale.bandwidth;
|
||||
var d3Range = d3Scale.range();
|
||||
var range = [Math.min(...d3Range), Math.max(...d3Range)];
|
||||
return {
|
||||
domain: () => d3Scale.domain(),
|
||||
range: function (_range) {
|
||||
function range() {
|
||||
return _range.apply(this, arguments);
|
||||
}
|
||||
range.toString = function () {
|
||||
return _range.toString();
|
||||
};
|
||||
return range;
|
||||
}(() => range),
|
||||
rangeMin: () => range[0],
|
||||
rangeMax: () => range[1],
|
||||
isInRange(value) {
|
||||
var first = range[0];
|
||||
var last = range[1];
|
||||
return first <= last ? value >= first && value <= last : value >= last && value <= first;
|
||||
},
|
||||
bandwidth: bandwidthFn ? () => bandwidthFn.call(d3Scale) : undefined,
|
||||
ticks: ticksFn ? count => ticksFn.call(d3Scale, count) : undefined,
|
||||
map: (input, options) => {
|
||||
var baseValue = d3Scale(input);
|
||||
if (baseValue == null) {
|
||||
return undefined;
|
||||
}
|
||||
if (d3Scale.bandwidth && options !== null && options !== void 0 && options.position) {
|
||||
var bandWidth = d3Scale.bandwidth();
|
||||
switch (options.position) {
|
||||
case 'middle':
|
||||
baseValue += bandWidth / 2;
|
||||
break;
|
||||
case 'end':
|
||||
baseValue += bandWidth;
|
||||
break;
|
||||
default:
|
||||
// 'start' requires no adjustment
|
||||
break;
|
||||
}
|
||||
}
|
||||
return baseValue;
|
||||
}
|
||||
};
|
||||
}
|
||||
66
frontend/node_modules/recharts/es6/util/scale/createCategoricalInverse.js
generated
vendored
Normal file
66
frontend/node_modules/recharts/es6/util/scale/createCategoricalInverse.js
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Binary search to find the index where x would fit in array a.
|
||||
* Works for arrays that are sorted both ascending and descending.
|
||||
*
|
||||
* Unlike d3.bisect, this implementation handles both ascending and descending arrays.
|
||||
*
|
||||
* @param haystack Sorted array of numbers
|
||||
* @param needle Number to find the insertion index for
|
||||
* @returns Index where x would fit in array a
|
||||
*/
|
||||
export function bisect(haystack, needle) {
|
||||
var lo = 0;
|
||||
var hi = haystack.length;
|
||||
var ascending = haystack[0] < haystack[haystack.length - 1];
|
||||
while (lo < hi) {
|
||||
var mid = Math.floor((lo + hi) / 2);
|
||||
if (ascending ? haystack[mid] < needle : haystack[mid] > needle) {
|
||||
lo = mid + 1;
|
||||
} else {
|
||||
hi = mid;
|
||||
}
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes an inverse scale function for categorical/ordinal scales.
|
||||
* Uses bisect to find the closest domain value for a given pixel coordinate.
|
||||
*/
|
||||
export function createCategoricalInverse(scale, allDataPointsOnAxis) {
|
||||
if (!scale) {
|
||||
return undefined;
|
||||
}
|
||||
var domain = allDataPointsOnAxis !== null && allDataPointsOnAxis !== void 0 ? allDataPointsOnAxis : scale.domain();
|
||||
// Build an array of pixel positions for each domain value
|
||||
// @ts-expect-error we're attempting to scale unknown without having guarantee that it is a Domain type
|
||||
var pixelPositions = domain.map(d => {
|
||||
var _scale;
|
||||
return (_scale = scale(d)) !== null && _scale !== void 0 ? _scale : 0;
|
||||
});
|
||||
var range = scale.range();
|
||||
if (domain.length === 0 || range.length < 2) {
|
||||
return undefined;
|
||||
}
|
||||
return pixelValue => {
|
||||
var _pixelPositions, _pixelPositions$index;
|
||||
// Find the closest domain value using bisect
|
||||
var index = bisect(pixelPositions, pixelValue);
|
||||
|
||||
// Clamp to valid range
|
||||
if (index <= 0) {
|
||||
return domain[0];
|
||||
}
|
||||
if (index >= domain.length) {
|
||||
return domain[domain.length - 1];
|
||||
}
|
||||
|
||||
// Check which neighbor is closer
|
||||
var leftPixel = (_pixelPositions = pixelPositions[index - 1]) !== null && _pixelPositions !== void 0 ? _pixelPositions : 0;
|
||||
var rightPixel = (_pixelPositions$index = pixelPositions[index]) !== null && _pixelPositions$index !== void 0 ? _pixelPositions$index : 0;
|
||||
if (Math.abs(pixelValue - leftPixel) <= Math.abs(pixelValue - rightPixel)) {
|
||||
return domain[index - 1];
|
||||
}
|
||||
return domain[index];
|
||||
};
|
||||
}
|
||||
285
frontend/node_modules/recharts/es6/util/scale/getNiceTickValues.js
generated
vendored
Normal file
285
frontend/node_modules/recharts/es6/util/scale/getNiceTickValues.js
generated
vendored
Normal file
|
|
@ -0,0 +1,285 @@
|
|||
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 calculate tick values of scale
|
||||
* @author xile611, arcthur
|
||||
* @date 2015-09-17
|
||||
*/
|
||||
import Decimal from 'decimal.js-light';
|
||||
import { getDigitCount, rangeStep } from './util/arithmetic';
|
||||
/**
|
||||
* Calculate a interval of a minimum value and a maximum value
|
||||
*
|
||||
* @param {Number} min The minimum value
|
||||
* @param {Number} max The maximum value
|
||||
* @return {Array} An interval
|
||||
*/
|
||||
export var getValidInterval = _ref => {
|
||||
var _ref2 = _slicedToArray(_ref, 2),
|
||||
min = _ref2[0],
|
||||
max = _ref2[1];
|
||||
var validMin = min,
|
||||
validMax = max;
|
||||
|
||||
// exchange
|
||||
if (min > max) {
|
||||
validMin = max;
|
||||
validMax = min;
|
||||
}
|
||||
return [validMin, validMax];
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the step which is easy to understand between ticks, like 10, 20, 25
|
||||
*
|
||||
* @param roughStep The rough step calculated by dividing the difference by the tickCount
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @param correctionFactor A correction factor
|
||||
* @return The step which is easy to understand between two ticks
|
||||
*/
|
||||
export var getAdaptiveStep = (roughStep, allowDecimals, correctionFactor) => {
|
||||
if (roughStep.lte(0)) {
|
||||
return new Decimal(0);
|
||||
}
|
||||
var digitCount = getDigitCount(roughStep.toNumber());
|
||||
// The ratio between the rough step and the smallest number which has a bigger
|
||||
// order of magnitudes than the rough step
|
||||
var digitCountValue = new Decimal(10).pow(digitCount);
|
||||
var stepRatio = roughStep.div(digitCountValue);
|
||||
// When an integer and a float multiplied, the accuracy of result may be wrong
|
||||
var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
|
||||
var amendStepRatio = new Decimal(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
|
||||
var formatStep = amendStepRatio.mul(digitCountValue);
|
||||
return allowDecimals ? new Decimal(formatStep.toNumber()) : new Decimal(Math.ceil(formatStep.toNumber()));
|
||||
};
|
||||
/**
|
||||
* The snap125 step algorithm snaps to nice numbers (1, 2, 2.5, 5) at each
|
||||
* order of magnitude, producing human-friendly tick intervals like
|
||||
* 0, 5, 10, 15, 20 instead of 0, 4, 8, 12, 16.
|
||||
*
|
||||
* This is opt-in and can be enabled via the `niceTicks` prop on axis components.
|
||||
*
|
||||
* @param roughStep The rough step calculated by dividing the difference by the tickCount
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @param correctionFactor A correction factor
|
||||
* @return The step which is easy to understand between two ticks
|
||||
*/
|
||||
export var getSnap125Step = (roughStep, allowDecimals, correctionFactor) => {
|
||||
var _NICE_STEPS$niceIdx;
|
||||
if (roughStep.lte(0)) {
|
||||
return new Decimal(0);
|
||||
}
|
||||
var NICE_STEPS = [1, 2, 2.5, 5];
|
||||
var roughNum = roughStep.toNumber();
|
||||
var exponent = Math.floor(new Decimal(roughNum).abs().log(10).toNumber());
|
||||
var magnitude = new Decimal(10).pow(exponent);
|
||||
|
||||
// normalized is in the range [1, 10)
|
||||
var normalized = roughStep.div(magnitude).toNumber();
|
||||
|
||||
// Find the smallest nice step >= normalized (ceiling)
|
||||
var niceIdx = NICE_STEPS.findIndex(s => s >= normalized - 1e-10);
|
||||
if (niceIdx === -1) {
|
||||
// normalized > 5 (e.g. 7.3), move to next order of magnitude
|
||||
magnitude = magnitude.mul(10);
|
||||
niceIdx = 0;
|
||||
}
|
||||
|
||||
// Apply correction factor by stepping through the nice number sequence
|
||||
niceIdx += correctionFactor;
|
||||
if (niceIdx >= NICE_STEPS.length) {
|
||||
var extraMag = Math.floor(niceIdx / NICE_STEPS.length);
|
||||
niceIdx %= NICE_STEPS.length;
|
||||
magnitude = magnitude.mul(new Decimal(10).pow(extraMag));
|
||||
}
|
||||
var niceStep = (_NICE_STEPS$niceIdx = NICE_STEPS[niceIdx]) !== null && _NICE_STEPS$niceIdx !== void 0 ? _NICE_STEPS$niceIdx : 1;
|
||||
var formatStep = new Decimal(niceStep).mul(magnitude);
|
||||
return allowDecimals ? formatStep : new Decimal(Math.ceil(formatStep.toNumber()));
|
||||
};
|
||||
|
||||
/**
|
||||
* calculate the ticks when the minimum value equals to the maximum value
|
||||
*
|
||||
* @param value The minimum value which is also the maximum value
|
||||
* @param tickCount The count of ticks
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @return array of ticks
|
||||
*/
|
||||
export var getTickOfSingleValue = (value, tickCount, allowDecimals) => {
|
||||
var step = new Decimal(1);
|
||||
// calculate the middle value of ticks
|
||||
var middle = new Decimal(value);
|
||||
if (!middle.isint() && allowDecimals) {
|
||||
var absVal = Math.abs(value);
|
||||
if (absVal < 1) {
|
||||
// The step should be a float number when the difference is smaller than 1
|
||||
step = new Decimal(10).pow(getDigitCount(value) - 1);
|
||||
middle = new Decimal(Math.floor(middle.div(step).toNumber())).mul(step);
|
||||
} else if (absVal > 1) {
|
||||
// Return the maximum integer which is smaller than 'value' when 'value' is greater than 1
|
||||
middle = new Decimal(Math.floor(value));
|
||||
}
|
||||
} else if (value === 0) {
|
||||
middle = new Decimal(Math.floor((tickCount - 1) / 2));
|
||||
} else if (!allowDecimals) {
|
||||
middle = new Decimal(Math.floor(value));
|
||||
}
|
||||
var middleIndex = Math.floor((tickCount - 1) / 2);
|
||||
var ticks = [];
|
||||
for (var i = 0; i < tickCount; i++) {
|
||||
ticks.push(middle.add(new Decimal(i - middleIndex).mul(step)).toNumber());
|
||||
}
|
||||
return ticks;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the step
|
||||
*
|
||||
* @param min The minimum value of an interval
|
||||
* @param max The maximum value of an interval
|
||||
* @param tickCount The count of ticks
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @param correctionFactor A correction factor
|
||||
* @return The step, minimum value of ticks, maximum value of ticks
|
||||
*/
|
||||
var _calculateStep = function calculateStep(min, max, tickCount, allowDecimals) {
|
||||
var correctionFactor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
||||
var stepFn = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : getAdaptiveStep;
|
||||
// dirty hack (for recharts' test)
|
||||
if (!Number.isFinite((max - min) / (tickCount - 1))) {
|
||||
return {
|
||||
step: new Decimal(0),
|
||||
tickMin: new Decimal(0),
|
||||
tickMax: new Decimal(0)
|
||||
};
|
||||
}
|
||||
|
||||
// The step which is easy to understand between two ticks
|
||||
var step = stepFn(new Decimal(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor);
|
||||
|
||||
// A medial value of ticks
|
||||
var middle;
|
||||
|
||||
// When 0 is inside the interval, 0 should be a tick
|
||||
if (min <= 0 && max >= 0) {
|
||||
middle = new Decimal(0);
|
||||
} else {
|
||||
// calculate the middle value
|
||||
middle = new Decimal(min).add(max).div(2);
|
||||
// minus modulo value
|
||||
middle = middle.sub(new Decimal(middle).mod(step));
|
||||
}
|
||||
var belowCount = Math.ceil(middle.sub(min).div(step).toNumber());
|
||||
var upCount = Math.ceil(new Decimal(max).sub(middle).div(step).toNumber());
|
||||
var scaleCount = belowCount + upCount + 1;
|
||||
if (scaleCount > tickCount) {
|
||||
// When more ticks need to cover the interval, step should be bigger.
|
||||
return _calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1, stepFn);
|
||||
}
|
||||
if (scaleCount < tickCount) {
|
||||
// When less ticks can cover the interval, we should add some additional ticks
|
||||
upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;
|
||||
belowCount = max > 0 ? belowCount : belowCount + (tickCount - scaleCount);
|
||||
}
|
||||
return {
|
||||
step,
|
||||
tickMin: middle.sub(new Decimal(belowCount).mul(step)),
|
||||
tickMax: middle.add(new Decimal(upCount).mul(step))
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the ticks of an interval. Ticks can appear outside the interval
|
||||
* if it makes them more rounded and nice.
|
||||
*
|
||||
* @param tuple of [min,max] min: The minimum value, max: The maximum value
|
||||
* @param tickCount The count of ticks
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @param niceTicksMode The algorithm to use for calculating nice ticks.
|
||||
* @return array of ticks
|
||||
*/
|
||||
export { _calculateStep as calculateStep };
|
||||
export var getNiceTickValues = function getNiceTickValues(_ref3) {
|
||||
var _ref4 = _slicedToArray(_ref3, 2),
|
||||
min = _ref4[0],
|
||||
max = _ref4[1];
|
||||
var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
|
||||
var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||||
var niceTicksMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'auto';
|
||||
// More than two ticks should be return
|
||||
var count = Math.max(tickCount, 2);
|
||||
var _getValidInterval = getValidInterval([min, max]),
|
||||
_getValidInterval2 = _slicedToArray(_getValidInterval, 2),
|
||||
cormin = _getValidInterval2[0],
|
||||
cormax = _getValidInterval2[1];
|
||||
if (cormin === -Infinity || cormax === Infinity) {
|
||||
var _values = cormax === Infinity ? [cormin, ...Array(tickCount - 1).fill(Infinity)] : [...Array(tickCount - 1).fill(-Infinity), cormax];
|
||||
return min > max ? _values.reverse() : _values;
|
||||
}
|
||||
if (cormin === cormax) {
|
||||
return getTickOfSingleValue(cormin, tickCount, allowDecimals);
|
||||
}
|
||||
var stepFn = niceTicksMode === 'snap125' ? getSnap125Step : getAdaptiveStep;
|
||||
|
||||
// Get the step between two ticks
|
||||
var _calculateStep2 = _calculateStep(cormin, cormax, count, allowDecimals, 0, stepFn),
|
||||
step = _calculateStep2.step,
|
||||
tickMin = _calculateStep2.tickMin,
|
||||
tickMax = _calculateStep2.tickMax;
|
||||
var values = rangeStep(tickMin, tickMax.add(new Decimal(0.1).mul(step)), step);
|
||||
return min > max ? values.reverse() : values;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the ticks of an interval.
|
||||
* Ticks will be constrained to the interval [min, max] even if it makes them less rounded and nice.
|
||||
*
|
||||
* @param tuple of [min,max] min: The minimum value, max: The maximum value
|
||||
* @param tickCount The count of ticks. This function may return less than tickCount ticks if the interval is too small.
|
||||
* @param allowDecimals Allow the ticks to be decimals or not
|
||||
* @param niceTicksMode The algorithm to use for calculating nice ticks. See {@link NiceTicksAlgorithm}.
|
||||
* @return array of ticks
|
||||
*/
|
||||
export var getTickValuesFixedDomain = function getTickValuesFixedDomain(_ref5, tickCount) {
|
||||
var _ref6 = _slicedToArray(_ref5, 2),
|
||||
min = _ref6[0],
|
||||
max = _ref6[1];
|
||||
var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||||
var niceTicksMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'auto';
|
||||
// More than two ticks should be return
|
||||
var _getValidInterval3 = getValidInterval([min, max]),
|
||||
_getValidInterval4 = _slicedToArray(_getValidInterval3, 2),
|
||||
cormin = _getValidInterval4[0],
|
||||
cormax = _getValidInterval4[1];
|
||||
if (cormin === -Infinity || cormax === Infinity) {
|
||||
return [min, max];
|
||||
}
|
||||
if (cormin === cormax) {
|
||||
return [cormin];
|
||||
}
|
||||
var stepFn = niceTicksMode === 'snap125' ? getSnap125Step : getAdaptiveStep;
|
||||
var count = Math.max(tickCount, 2);
|
||||
var step = stepFn(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
|
||||
var values = [...rangeStep(new Decimal(cormin), new Decimal(cormax), step), cormax];
|
||||
if (allowDecimals === false) {
|
||||
/*
|
||||
* allowDecimals is false means that we want to have integer ticks.
|
||||
* The step is guaranteed to be an integer in the code above which is great start
|
||||
* but when the first step is not an integer, it will start stepping from a decimal value anyway.
|
||||
* So we need to round all the values to integers after the fact.
|
||||
* The domain boundary (cormax) is appended after the rangeStep values. When
|
||||
* cormax rounds down to the same integer as the last rangeStep value, we end up
|
||||
* with a duplicate trailing tick. Remove it.
|
||||
*/
|
||||
values = values.map(value => Math.round(value));
|
||||
var last = values.length - 1;
|
||||
if (last > 0 && values[last] === values[last - 1]) {
|
||||
values = values.slice(0, last);
|
||||
}
|
||||
}
|
||||
return min > max ? values.reverse() : values;
|
||||
};
|
||||
1
frontend/node_modules/recharts/es6/util/scale/index.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/util/scale/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { getNiceTickValues, getTickValuesFixedDomain } from './getNiceTickValues';
|
||||
49
frontend/node_modules/recharts/es6/util/scale/util/arithmetic.js
generated
vendored
Normal file
49
frontend/node_modules/recharts/es6/util/scale/util/arithmetic.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* @fileOverview Some common arithmetic methods
|
||||
* @author xile611
|
||||
* @date 2015-09-17
|
||||
*/
|
||||
import Decimal from 'decimal.js-light';
|
||||
|
||||
/**
|
||||
* Get the digit count of a number.
|
||||
* If the absolute value is in the interval [0.1, 1), the result is 0.
|
||||
* If the absolute value is in the interval [0.01, 0.1), the digit count is -1.
|
||||
* If the absolute value is in the interval [0.001, 0.01), the digit count is -2.
|
||||
*
|
||||
* @param {Number} value The number
|
||||
* @return {Integer} Digit count
|
||||
*/
|
||||
function getDigitCount(value) {
|
||||
var result;
|
||||
if (value === 0) {
|
||||
result = 1;
|
||||
} else {
|
||||
result = Math.floor(new Decimal(value).abs().log(10).toNumber()) + 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data in the interval [start, end) with a fixed step.
|
||||
* Also handles JS calculation precision issues.
|
||||
*
|
||||
* @param {Decimal} start Start point
|
||||
* @param {Decimal} end End point, not included
|
||||
* @param {Decimal} step Step size
|
||||
* @return {Array} Array of numbers
|
||||
*/
|
||||
function rangeStep(start, end, step) {
|
||||
var num = new Decimal(start);
|
||||
var i = 0;
|
||||
var result = [];
|
||||
|
||||
// magic number to prevent infinite loop
|
||||
while (num.lt(end) && i < 100000) {
|
||||
result.push(num.toNumber());
|
||||
num = num.add(step);
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
export { rangeStep, getDigitCount };
|
||||
8
frontend/node_modules/recharts/es6/util/stacks/getStackSeriesIdentifier.js
generated
vendored
Normal file
8
frontend/node_modules/recharts/es6/util/stacks/getStackSeriesIdentifier.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Returns identifier for stack series which is one individual graphical item in the stack.
|
||||
* @param graphicalItem - The graphical item representing the series in the stack.
|
||||
* @return The identifier for the series in the stack
|
||||
*/
|
||||
export function getStackSeriesIdentifier(graphicalItem) {
|
||||
return graphicalItem === null || graphicalItem === void 0 ? void 0 : graphicalItem.id;
|
||||
}
|
||||
1
frontend/node_modules/recharts/es6/util/stacks/stackTypes.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/util/stacks/stackTypes.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
50
frontend/node_modules/recharts/es6/util/svgPropertiesAndEvents.js
generated
vendored
Normal file
50
frontend/node_modules/recharts/es6/util/svgPropertiesAndEvents.js
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { isValidElement } from 'react';
|
||||
import { isEventKey } from './excludeEventProps';
|
||||
import { isDataAttribute, isSvgElementPropKey } from './svgPropertiesNoEvents';
|
||||
/**
|
||||
* Filters an object to only include SVG properties, data attributes, and event handlers.
|
||||
* @param obj - The object to filter.
|
||||
* @returns A new object containing only valid SVG properties, data attributes, and event handlers.
|
||||
*/
|
||||
export function svgPropertiesAndEvents(obj) {
|
||||
var result = {};
|
||||
// for ... in loop is 10x faster than Object.entries + filter + Object.fromEntries in Chrome
|
||||
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
if (isSvgElementPropKey(key) || isDataAttribute(key) || isEventKey(key)) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to filter SVG properties from various input types.
|
||||
* The input types can be:
|
||||
* - A record of string keys to any values, in which case it returns a record of only SVG properties
|
||||
* - A React element, in which case it returns the props of the element filtered to only SVG properties
|
||||
* - Anything else, in which case it returns null
|
||||
*
|
||||
* This function has a wide-open return type, because it will read and filter the props of an arbitrary React element.
|
||||
* This can be SVG, HTML, whatnot, with arbitrary values, so we can't type it more specifically.
|
||||
*
|
||||
* If you wish to have a type-safe version, use svgPropertiesNoEvents directly with a typed object.
|
||||
*
|
||||
* @param input - The input to filter, which can be a record, a React element, or other types.
|
||||
* @returns A record of SVG properties if the input is a record or React element, otherwise null.
|
||||
*/
|
||||
export function svgPropertiesAndEventsFromUnknown(input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
if (/*#__PURE__*/isValidElement(input)) {
|
||||
// @ts-expect-error we can't type this better because input can be any React element
|
||||
return svgPropertiesAndEvents(input.props);
|
||||
}
|
||||
if (typeof input === 'object' && !Array.isArray(input)) {
|
||||
return svgPropertiesAndEvents(input);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
74
frontend/node_modules/recharts/es6/util/svgPropertiesNoEvents.js
generated
vendored
Normal file
74
frontend/node_modules/recharts/es6/util/svgPropertiesNoEvents.js
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
import { isValidElement } from 'react';
|
||||
var SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style',
|
||||
/*
|
||||
* removed 'type' SVGElementPropKey because we do not currently use any SVG elements
|
||||
* that can use it, and it conflicts with the recharts prop 'type'
|
||||
* https://github.com/recharts/recharts/pull/3327
|
||||
* https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type
|
||||
*/
|
||||
// 'type',
|
||||
'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle'];
|
||||
var SVGElementPropKeySet = new Set(SVGElementPropKeys);
|
||||
export function isSvgElementPropKey(key) {
|
||||
if (typeof key !== 'string') {
|
||||
return false;
|
||||
}
|
||||
return SVGElementPropKeySet.has(key);
|
||||
}
|
||||
/**
|
||||
* Checks if the property is a data attribute.
|
||||
* @param key The property key.
|
||||
* @returns True if the key starts with 'data-', false otherwise.
|
||||
*/
|
||||
export function isDataAttribute(key) {
|
||||
return typeof key === 'string' && key.startsWith('data-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters an object to only include SVG properties. Removes all event handlers too.
|
||||
* @param obj - The object to filter
|
||||
* @returns A new object containing only valid SVG properties, excluding event handlers.
|
||||
*/
|
||||
export function svgPropertiesNoEvents(obj) {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return {};
|
||||
}
|
||||
var result = {};
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
if (isSvgElementPropKey(key) || isDataAttribute(key)) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to filter SVG properties from various input types.
|
||||
* The input types can be:
|
||||
* - A record of string keys to any values, in which case it returns a record of only SVG properties
|
||||
* - A React element, in which case it returns the props of the element filtered to only SVG properties
|
||||
* - Anything else, in which case it returns null
|
||||
*
|
||||
* This function has a wide-open return type, because it will read and filter the props of an arbitrary React element.
|
||||
* This can be SVG, HTML, whatnot, with arbitrary values, so we can't type it more specifically.
|
||||
*
|
||||
* If you wish to have a type-safe version, use svgPropertiesNoEvents directly with a typed object.
|
||||
*
|
||||
* @param input - The input to filter, which can be a record, a React element, or other types.
|
||||
* @returns A record of SVG properties if the input is a record or React element, otherwise null.
|
||||
*/
|
||||
export function svgPropertiesNoEventsFromUnknown(input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
if (/*#__PURE__*/isValidElement(input) && typeof input.props === 'object' && input.props !== null) {
|
||||
var p = input.props;
|
||||
return svgPropertiesNoEvents(p);
|
||||
}
|
||||
if (typeof input === 'object' && !Array.isArray(input)) {
|
||||
return svgPropertiesNoEvents(input);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
116
frontend/node_modules/recharts/es6/util/tooltip/translate.js
generated
vendored
Normal file
116
frontend/node_modules/recharts/es6/util/tooltip/translate.js
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
import { clsx } from 'clsx';
|
||||
import { isNumber } from '../DataUtils';
|
||||
var CSS_CLASS_PREFIX = 'recharts-tooltip-wrapper';
|
||||
var TOOLTIP_HIDDEN = {
|
||||
visibility: 'hidden'
|
||||
};
|
||||
export function getTooltipCSSClassName(_ref) {
|
||||
var coordinate = _ref.coordinate,
|
||||
translateX = _ref.translateX,
|
||||
translateY = _ref.translateY;
|
||||
return clsx(CSS_CLASS_PREFIX, {
|
||||
["".concat(CSS_CLASS_PREFIX, "-right")]: isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX >= coordinate.x,
|
||||
["".concat(CSS_CLASS_PREFIX, "-left")]: isNumber(translateX) && coordinate && isNumber(coordinate.x) && translateX < coordinate.x,
|
||||
["".concat(CSS_CLASS_PREFIX, "-bottom")]: isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY >= coordinate.y,
|
||||
["".concat(CSS_CLASS_PREFIX, "-top")]: isNumber(translateY) && coordinate && isNumber(coordinate.y) && translateY < coordinate.y
|
||||
});
|
||||
}
|
||||
export function getTooltipTranslateXY(_ref2) {
|
||||
var allowEscapeViewBox = _ref2.allowEscapeViewBox,
|
||||
coordinate = _ref2.coordinate,
|
||||
key = _ref2.key,
|
||||
offset = _ref2.offset,
|
||||
position = _ref2.position,
|
||||
reverseDirection = _ref2.reverseDirection,
|
||||
tooltipDimension = _ref2.tooltipDimension,
|
||||
viewBox = _ref2.viewBox,
|
||||
viewBoxDimension = _ref2.viewBoxDimension;
|
||||
if (position && isNumber(position[key])) {
|
||||
return position[key];
|
||||
}
|
||||
var negative = coordinate[key] - tooltipDimension - (offset > 0 ? offset : 0);
|
||||
var positive = coordinate[key] + offset;
|
||||
if (allowEscapeViewBox[key]) {
|
||||
return reverseDirection[key] ? negative : positive;
|
||||
}
|
||||
var viewBoxKey = viewBox[key];
|
||||
if (viewBoxKey == null) {
|
||||
return 0;
|
||||
}
|
||||
if (reverseDirection[key]) {
|
||||
var _tooltipBoundary = negative;
|
||||
var _viewBoxBoundary = viewBoxKey;
|
||||
if (_tooltipBoundary < _viewBoxBoundary) {
|
||||
return Math.max(positive, viewBoxKey);
|
||||
}
|
||||
return Math.max(negative, viewBoxKey);
|
||||
}
|
||||
if (viewBoxDimension == null) {
|
||||
return 0;
|
||||
}
|
||||
var tooltipBoundary = positive + tooltipDimension;
|
||||
var viewBoxBoundary = viewBoxKey + viewBoxDimension;
|
||||
if (tooltipBoundary > viewBoxBoundary) {
|
||||
return Math.max(negative, viewBoxKey);
|
||||
}
|
||||
return Math.max(positive, viewBoxKey);
|
||||
}
|
||||
export function getTransformStyle(_ref3) {
|
||||
var translateX = _ref3.translateX,
|
||||
translateY = _ref3.translateY,
|
||||
useTranslate3d = _ref3.useTranslate3d;
|
||||
return {
|
||||
transform: useTranslate3d ? "translate3d(".concat(translateX, "px, ").concat(translateY, "px, 0)") : "translate(".concat(translateX, "px, ").concat(translateY, "px)")
|
||||
};
|
||||
}
|
||||
export function getTooltipTranslate(_ref4) {
|
||||
var allowEscapeViewBox = _ref4.allowEscapeViewBox,
|
||||
coordinate = _ref4.coordinate,
|
||||
offsetTop = _ref4.offsetTop,
|
||||
offsetLeft = _ref4.offsetLeft,
|
||||
position = _ref4.position,
|
||||
reverseDirection = _ref4.reverseDirection,
|
||||
tooltipBox = _ref4.tooltipBox,
|
||||
useTranslate3d = _ref4.useTranslate3d,
|
||||
viewBox = _ref4.viewBox;
|
||||
var cssProperties, translateX, translateY;
|
||||
if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) {
|
||||
translateX = getTooltipTranslateXY({
|
||||
allowEscapeViewBox,
|
||||
coordinate,
|
||||
key: 'x',
|
||||
offset: offsetLeft,
|
||||
position,
|
||||
reverseDirection,
|
||||
tooltipDimension: tooltipBox.width,
|
||||
viewBox,
|
||||
viewBoxDimension: viewBox.width
|
||||
});
|
||||
translateY = getTooltipTranslateXY({
|
||||
allowEscapeViewBox,
|
||||
coordinate,
|
||||
key: 'y',
|
||||
offset: offsetTop,
|
||||
position,
|
||||
reverseDirection,
|
||||
tooltipDimension: tooltipBox.height,
|
||||
viewBox,
|
||||
viewBoxDimension: viewBox.height
|
||||
});
|
||||
cssProperties = getTransformStyle({
|
||||
translateX,
|
||||
translateY,
|
||||
useTranslate3d
|
||||
});
|
||||
} else {
|
||||
cssProperties = TOOLTIP_HIDDEN;
|
||||
}
|
||||
return {
|
||||
cssProperties,
|
||||
cssClasses: getTooltipCSSClassName({
|
||||
translateX,
|
||||
translateY,
|
||||
coordinate
|
||||
})
|
||||
};
|
||||
}
|
||||
1
frontend/node_modules/recharts/es6/util/typedDataKey.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/util/typedDataKey.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
299
frontend/node_modules/recharts/es6/util/types.js
generated
vendored
Normal file
299
frontend/node_modules/recharts/es6/util/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
import { isValidElement } from 'react';
|
||||
import { isEventKey } from './excludeEventProps';
|
||||
|
||||
/**
|
||||
* Determines how values are stacked:
|
||||
*
|
||||
* - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap.
|
||||
* - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle.
|
||||
* - `wiggle` and `silhouette` tries to keep the chart centered.
|
||||
* - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives.
|
||||
* - `positive` ignores all negative values, and then behaves like \`none\`.
|
||||
*
|
||||
* @see {@link https://d3js.org/d3-shape/stack#stack-offsets}
|
||||
* (note that the `diverging` offset in d3 is named `sign` in recharts)
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated use either `CartesianLayout` or `PolarLayout` instead.
|
||||
* Mixing both charts families leads to ambiguity in the type system.
|
||||
* These two layouts share very few properties, so it is best to keep them separate.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The type of axis.
|
||||
*
|
||||
* `category`: Treats data as distinct values.
|
||||
* Each value is in the same distance from its neighbors, regardless of their actual numeric difference.
|
||||
*
|
||||
* `number`: Treats data as continuous range.
|
||||
* Values that are numerically closer are placed closer together on the axis.
|
||||
*
|
||||
* `auto`: the type is inferred based on the chart layout.
|
||||
*
|
||||
* This is external type - users will provide this type in props.
|
||||
* Internally we will evaluate it to either 'category' or 'number' based on the layout,
|
||||
* before sending it to the store.
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Individual axes are responsible for resolving the 'auto' type to either 'number' or 'category',
|
||||
* based on the chart layout and axis kind. Then they can start using this type.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extracts values from data objects.
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated do not use: too many properties, mixing too many concepts, cartesian and polar together, everything optional.
|
||||
* Instead, use either `Coordinate` or `PolarCoordinate`.
|
||||
*/
|
||||
|
||||
export var isPolarCoordinate = c => {
|
||||
return 'radius' in c && 'startAngle' in c && 'endAngle' in c;
|
||||
};
|
||||
|
||||
/**
|
||||
* String shortcuts for scale types.
|
||||
* In case none of these does what you want you can also provide your own scale function
|
||||
* @see {@link CustomScaleDefinition}
|
||||
*/
|
||||
|
||||
//
|
||||
// Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props.
|
||||
//
|
||||
|
||||
/**
|
||||
* The type of easing function to use for animations
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/** @deprecated Use EasingInput instead */
|
||||
|
||||
/** Specifies the duration of animation, the unit of this option is ms. */
|
||||
|
||||
/**
|
||||
* This object defines the offset of the chart area and width and height and brush and ... it's a bit too much information all in one.
|
||||
* We use it internally but let's not expose it to the outside world.
|
||||
* If you are looking for this information, instead import `ChartOffset` or `PlotArea` from `recharts`.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The domain of axis.
|
||||
* This is the definition
|
||||
*
|
||||
* Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis.
|
||||
* Categorical domain is defined as array of all possible values.
|
||||
*
|
||||
* Can be specified in many ways:
|
||||
* - array of numbers
|
||||
* - with special strings like 'dataMin' and 'dataMax'
|
||||
* - with special string math like 'dataMin - 100'
|
||||
* - with keyword 'auto'
|
||||
* - or a function
|
||||
* - array of functions
|
||||
* - or a combination of the above
|
||||
*/
|
||||
|
||||
/**
|
||||
* NumberDomain is an evaluated {@link AxisDomain}.
|
||||
* Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number.
|
||||
* This is after all the keywords and functions were evaluated and what is left is [min, max].
|
||||
*
|
||||
* Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible.
|
||||
*
|
||||
* There are also `category` axes that have different things than numbers in their domain.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Props shared in all renderable axes - meaning the ones that are drawn on the chart,
|
||||
* can have ticks, axis line, etc.
|
||||
*/
|
||||
|
||||
/** Defines how ticks are placed and whether / how tick collisions are handled.
|
||||
* 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown.
|
||||
* 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown.
|
||||
* 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks always show.
|
||||
* 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision.
|
||||
* 'equidistantPreserveEnd' selects a number N such that every nTh tick will be shown, ensuring the last tick is always visible.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Ticks can be any type when the axis is the type of category.
|
||||
*
|
||||
* Ticks must be numbers when the axis is the type of number.
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* @inline
|
||||
*/
|
||||
|
||||
export var adaptEventHandlers = (props, newHandler) => {
|
||||
if (!props || typeof props === 'function' || typeof props === 'boolean') {
|
||||
return null;
|
||||
}
|
||||
var inputProps = props;
|
||||
if (/*#__PURE__*/isValidElement(props)) {
|
||||
inputProps = props.props;
|
||||
}
|
||||
if (typeof inputProps !== 'object' && typeof inputProps !== 'function') {
|
||||
return null;
|
||||
}
|
||||
var out = {};
|
||||
Object.keys(inputProps).forEach(key => {
|
||||
if (isEventKey(key) && typeof inputProps[key] === 'function') {
|
||||
out[key] = newHandler || (e => inputProps[key](inputProps, e));
|
||||
}
|
||||
});
|
||||
return out;
|
||||
};
|
||||
var getEventHandlerOfChild = (originalHandler, data, index) => e => {
|
||||
originalHandler(data, index, e);
|
||||
return null;
|
||||
};
|
||||
export var adaptEventsOfChild = (props, data, index) => {
|
||||
if (props === null || typeof props !== 'object' && typeof props !== 'function') {
|
||||
return null;
|
||||
}
|
||||
var out = null;
|
||||
Object.keys(props).forEach(key => {
|
||||
var item = props[key];
|
||||
if (isEventKey(key) && typeof item === 'function') {
|
||||
if (!out) out = {};
|
||||
out[key] = getEventHandlerOfChild(item, data, index);
|
||||
}
|
||||
});
|
||||
return out;
|
||||
};
|
||||
|
||||
/**
|
||||
* 'axis' means that all graphical items belonging to this axis tick will be highlighted,
|
||||
* and all will be present in the tooltip.
|
||||
* Tooltip with 'axis' will display when hovering on the chart background.
|
||||
*
|
||||
* 'item' means only the one graphical item being hovered will show in the tooltip.
|
||||
* Tooltip with 'item' will display when hovering over individual graphical items.
|
||||
*
|
||||
* This is calculated internally;
|
||||
* charts have a `defaultTooltipEventType` and `validateTooltipEventTypes` options.
|
||||
*
|
||||
* Users then use <Tooltip shared={true} /> or <Tooltip shared={false} /> to control their preference,
|
||||
* and charts will then see what is allowed and what is not.
|
||||
*/
|
||||
|
||||
/**
|
||||
* These are the props we are going to pass to an `activeDot` or `dot` if it is a function or a custom Component
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the type of `activeDot` prop on:
|
||||
* - Area
|
||||
* - Line
|
||||
* - Radar
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Inside the dot event handlers we provide extra information about the dot point
|
||||
* that the Dot component itself does not need but users might find useful.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the type of `dot` prop on:
|
||||
* - Area
|
||||
* - Line
|
||||
* - Radar
|
||||
*
|
||||
* @inline
|
||||
*/
|
||||
|
||||
/**
|
||||
* Animation metadata forwarded to custom chart shapes.
|
||||
*
|
||||
* These props let a shape react to the current animation state without needing
|
||||
* to know how its parent chart component computes the animated geometry.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simplified version of the MouseEvent so that we don't have to mock the whole thing in tests.
|
||||
*
|
||||
* This is meant to represent the React.MouseEvent
|
||||
* which is a wrapper on top of https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simplified version of the MouseEvent for SVG elements.
|
||||
*
|
||||
* Similar to MousePointer but uses SVGGraphicsElement properties instead of HTMLElement properties.
|
||||
* SVG elements use getBBox() to get the intrinsic size instead of offsetWidth/offsetHeight.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Recharts accepts mouse events from both HTML and SVG elements.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Coordinates relative to the top-left corner of the active element.
|
||||
* Also include scale which means that element that's scaled will return the same coordinates as element that's not scaled.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data provider means that this component accepts a `data` prop which is where you can input your data into the chart state.
|
||||
* The data is an array of objects, where each object represents a data point.
|
||||
*
|
||||
* DataPointType is the type of each data point object in the data array.
|
||||
*
|
||||
* The data is reused in multiple charts and components. Meaning if you provide data on the chart level,
|
||||
* then all child components, graphical items, legend, tooltip, axes ... will be able to access the data.
|
||||
*
|
||||
* Same goes for the graphical item. If you provide data on the graphical item level,
|
||||
* then that data is visible for the main chart, and all axes, tooltip, legend ... in the whole chart.
|
||||
* This is not scoped to the graphical item only.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data consumer means that this component accepts a `dataKey` prop which is how you specify
|
||||
* which dimension of the data to use for this component.
|
||||
*
|
||||
* DataPointType is the type of each data point object in the data array.
|
||||
* DataValueType is the type of the value that this dataKey extracts from each data point.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Props shared with all Cartesian and Polar charts.
|
||||
* There are three charts that do not use these base props, and define their own:
|
||||
* - Treemap
|
||||
* - Sunburst
|
||||
* - Sankey
|
||||
*/
|
||||
|
||||
export var isNonEmptyArray = arr => {
|
||||
return Array.isArray(arr) && arr.length > 0;
|
||||
};
|
||||
27
frontend/node_modules/recharts/es6/util/useAnimationId.js
generated
vendored
Normal file
27
frontend/node_modules/recharts/es6/util/useAnimationId.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { useRef } from 'react';
|
||||
import { uniqueId } from './DataUtils';
|
||||
|
||||
/**
|
||||
* This hook returns a unique animation id for the object input.
|
||||
* If input changes (as in, reference equality is different), the animation id will change.
|
||||
* If input does not change, the animation id will not change.
|
||||
*
|
||||
* This is useful for animations. The Animate component
|
||||
* does have a `shouldReAnimate` prop but that doesn't seem to be doing what the name implies.
|
||||
* Also, we don't always want to re-animate on every render;
|
||||
* we only want to re-animate when the input changes. Not the internal state (e.g. `isAnimating`).
|
||||
*
|
||||
* @param input The object to check for changes. Uses reference equality (=== operator)
|
||||
* @param prefix Optional prefix to use for the animation id
|
||||
* @returns A unique animation id
|
||||
*/
|
||||
export function useAnimationId(input) {
|
||||
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'animation-';
|
||||
var animationId = useRef(uniqueId(prefix));
|
||||
var prevProps = useRef(input);
|
||||
if (prevProps.current !== input) {
|
||||
animationId.current = uniqueId(prefix);
|
||||
prevProps.current = input;
|
||||
}
|
||||
return animationId.current;
|
||||
}
|
||||
114
frontend/node_modules/recharts/es6/util/useElementOffset.js
generated
vendored
Normal file
114
frontend/node_modules/recharts/es6/util/useElementOffset.js
generated
vendored
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
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 { useCallback, useEffect, useRef, useState } from 'react';
|
||||
var EPS = 1;
|
||||
|
||||
/**
|
||||
* Stores the dimensions and position of a DOM element as returned by `getBoundingClientRect()`.
|
||||
*
|
||||
* Values are viewport-relative and may be fractional (subpixel precision).
|
||||
*
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Callback ref setter returned by {@link useElementOffset}.
|
||||
*
|
||||
* Pass this to a DOM element's `ref` prop to start observing its layout.
|
||||
*
|
||||
* @param node - the DOM element to observe, or `null` when the element unmounts
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks whether two ElementOffset values differ by more than `EPS` (1px) in any dimension.
|
||||
*
|
||||
* @param a - the first ElementOffset to compare
|
||||
* @param b - the second ElementOffset to compare
|
||||
* @returns true if any dimension differs by more than 1px
|
||||
*/
|
||||
function hasSignificantChange(a, b) {
|
||||
return Math.abs(a.height - b.height) > EPS || Math.abs(a.left - b.left) > EPS || Math.abs(a.top - b.top) > EPS || Math.abs(a.width - b.width) > EPS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the current bounding box of a DOM element using `getBoundingClientRect()`.
|
||||
*
|
||||
* @param node - the DOM element to measure
|
||||
* @returns an ElementOffset with the element's current dimensions and viewport-relative position
|
||||
*/
|
||||
function readElementOffset(node) {
|
||||
var rect = node.getBoundingClientRect();
|
||||
return {
|
||||
height: rect.height,
|
||||
left: rect.left,
|
||||
top: rect.top,
|
||||
width: rect.width
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this to listen to element layout changes.
|
||||
*
|
||||
* Very useful for reading actual sizes of DOM elements relative to the viewport.
|
||||
*
|
||||
* Uses ResizeObserver to automatically detect size changes of the observed element.
|
||||
*
|
||||
* @param extraDependencies use this to trigger new DOM dimensions read when any of these change. Good for things like payload and label, that will re-render something down in the children array, but you want to read the layout box of a parent.
|
||||
* @returns [lastElementOffset, updateElementOffset] most recent value, and setter. Pass the setter to a DOM element ref like this: `<div ref={updateElementOffset}>`
|
||||
*/
|
||||
export function useElementOffset() {
|
||||
var extraDependencies = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
var _useState = useState({
|
||||
height: 0,
|
||||
left: 0,
|
||||
top: 0,
|
||||
width: 0
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
lastBoundingBox = _useState2[0],
|
||||
setLastBoundingBox = _useState2[1];
|
||||
var observerRef = useRef(null);
|
||||
var lastBoundingBoxRef = useRef(lastBoundingBox);
|
||||
lastBoundingBoxRef.current = lastBoundingBox;
|
||||
var updateBoundingBox = useCallback(node => {
|
||||
// Disconnect any previously active ResizeObserver
|
||||
if (observerRef.current != null) {
|
||||
observerRef.current.disconnect();
|
||||
observerRef.current = null;
|
||||
}
|
||||
if (node != null) {
|
||||
// Measure immediately on ref attach
|
||||
var box = readElementOffset(node);
|
||||
if (hasSignificantChange(box, lastBoundingBoxRef.current)) {
|
||||
setLastBoundingBox(box);
|
||||
}
|
||||
|
||||
// Set up ResizeObserver for future size changes
|
||||
if (typeof ResizeObserver !== 'undefined') {
|
||||
var observer = new ResizeObserver(() => {
|
||||
var newBox = readElementOffset(node);
|
||||
if (hasSignificantChange(newBox, lastBoundingBoxRef.current)) {
|
||||
setLastBoundingBox(newBox);
|
||||
}
|
||||
});
|
||||
observer.observe(node);
|
||||
observerRef.current = observer;
|
||||
}
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[...extraDependencies]);
|
||||
|
||||
// Cleanup on unmount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
var _observerRef$current;
|
||||
(_observerRef$current = observerRef.current) === null || _observerRef$current === void 0 || _observerRef$current.disconnect();
|
||||
};
|
||||
}, []);
|
||||
return [lastBoundingBox, updateBoundingBox];
|
||||
}
|
||||
28
frontend/node_modules/recharts/es6/util/useId.js
generated
vendored
Normal file
28
frontend/node_modules/recharts/es6/util/useId.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
var _ref;
|
||||
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 { uniqueId } from './DataUtils';
|
||||
|
||||
/**
|
||||
* Fallback for React.useId() for versions prior to React 18.
|
||||
* Generates a unique ID using a simple counter and a prefix.
|
||||
*
|
||||
* @returns A unique ID that remains consistent across renders.
|
||||
*/
|
||||
export var useIdFallback = () => {
|
||||
var _React$useState = React.useState(() => uniqueId('uid-')),
|
||||
_React$useState2 = _slicedToArray(_React$useState, 1),
|
||||
id = _React$useState2[0];
|
||||
return id;
|
||||
};
|
||||
|
||||
/*
|
||||
* This weird syntax is used to avoid a build-time error in React 17 and earlier when building with Webpack.
|
||||
* See https://github.com/webpack/webpack/issues/14814
|
||||
*/
|
||||
export var useId = (_ref = React['useId'.toString()]) !== null && _ref !== void 0 ? _ref : useIdFallback;
|
||||
43
frontend/node_modules/recharts/es6/util/usePrefersReducedMotion.js
generated
vendored
Normal file
43
frontend/node_modules/recharts/es6/util/usePrefersReducedMotion.js
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
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 { useEffect, useState } from 'react';
|
||||
import { Global } from './Global';
|
||||
|
||||
/**
|
||||
* Detects and subscribes to the user's `prefers-reduced-motion` system preference.
|
||||
* Returns `true` when the user prefers reduced motion, `false` otherwise.
|
||||
* SSR-safe: always returns `false` during server-side rendering.
|
||||
*/
|
||||
export function usePrefersReducedMotion() {
|
||||
var _useState = useState(() => {
|
||||
if (Global.isSsr) {
|
||||
return false;
|
||||
}
|
||||
if (!window.matchMedia) {
|
||||
return false;
|
||||
}
|
||||
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
prefersReducedMotion = _useState2[0],
|
||||
setPrefersReducedMotion = _useState2[1];
|
||||
useEffect(() => {
|
||||
if (!window.matchMedia) {
|
||||
return;
|
||||
}
|
||||
var mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
var handleChange = () => {
|
||||
setPrefersReducedMotion(mediaQuery.matches);
|
||||
};
|
||||
mediaQuery.addEventListener('change', handleChange);
|
||||
// eslint-disable-next-line consistent-return
|
||||
return () => {
|
||||
mediaQuery.removeEventListener('change', handleChange);
|
||||
};
|
||||
}, []);
|
||||
return prefersReducedMotion;
|
||||
}
|
||||
30
frontend/node_modules/recharts/es6/util/useReportScale.js
generated
vendored
Normal file
30
frontend/node_modules/recharts/es6/util/useReportScale.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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 { useEffect, useState } from 'react';
|
||||
import { useAppDispatch, useAppSelector } from '../state/hooks';
|
||||
import { selectContainerScale } from '../state/selectors/containerSelectors';
|
||||
import { setScale } from '../state/layoutSlice';
|
||||
import { isWellBehavedNumber } from './isWellBehavedNumber';
|
||||
export function useReportScale() {
|
||||
var dispatch = useAppDispatch();
|
||||
var _useState = useState(null),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
ref = _useState2[0],
|
||||
setRef = _useState2[1];
|
||||
var scale = useAppSelector(selectContainerScale);
|
||||
useEffect(() => {
|
||||
if (ref == null) {
|
||||
return;
|
||||
}
|
||||
var rect = ref.getBoundingClientRect();
|
||||
var newScale = rect.width / ref.offsetWidth;
|
||||
if (isWellBehavedNumber(newScale) && newScale !== scale) {
|
||||
dispatch(setScale(newScale));
|
||||
}
|
||||
}, [ref, dispatch, scale]);
|
||||
return setRef;
|
||||
}
|
||||
32
frontend/node_modules/recharts/es6/util/useUniqueId.js
generated
vendored
Normal file
32
frontend/node_modules/recharts/es6/util/useUniqueId.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { useId } from './useId';
|
||||
|
||||
/**
|
||||
* A hook that generates a unique ID. It uses React.useId() in React 18+ for SSR safety
|
||||
* and falls back to a client-side-only unique ID generator for older versions.
|
||||
*
|
||||
* The ID will stay the same across renders, and you can optionally provide a prefix.
|
||||
*
|
||||
* @param [prefix] - An optional prefix for the generated ID.
|
||||
* @param [customId] - An optional custom ID to override the generated one.
|
||||
* @returns The unique ID.
|
||||
*/
|
||||
export function useUniqueId(prefix, customId) {
|
||||
/*
|
||||
* We have to call this hook here even if we don't use the result because
|
||||
* rules of hooks demand that hooks are never called conditionally.
|
||||
*/
|
||||
var generatedId = useId();
|
||||
|
||||
// If a custom ID is provided, it always takes precedence.
|
||||
if (customId) {
|
||||
return customId;
|
||||
}
|
||||
|
||||
// Apply the prefix if one was provided.
|
||||
return prefix ? "".concat(prefix, "-").concat(generatedId) : generatedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The useUniqueId hook returns a unique ID that is either reused from external props or generated internally.
|
||||
* Either way the ID is now guaranteed to be present so no more nulls or undefined.
|
||||
*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue