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