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
21
frontend/node_modules/recharts/es6/chart/AreaChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/AreaChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['axis'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var AreaChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "AreaChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
21
frontend/node_modules/recharts/es6/chart/BarChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/BarChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['axis', 'item'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "BarChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
84
frontend/node_modules/recharts/es6/chart/CartesianChart.js
generated
vendored
Normal file
84
frontend/node_modules/recharts/es6/chart/CartesianChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { RechartsStoreProvider } from '../state/RechartsStoreProvider';
|
||||
import { ChartDataContextProvider } from '../context/chartDataContext';
|
||||
import { ReportMainChartProps } from '../state/ReportMainChartProps';
|
||||
import { ReportChartProps } from '../state/ReportChartProps';
|
||||
import { ReportEventSettings } from '../state/ReportEventSettings';
|
||||
import { CategoricalChart } from './CategoricalChart';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
||||
var defaultMargin = {
|
||||
top: 5,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
left: 5
|
||||
};
|
||||
export var defaultCartesianChartProps = _objectSpread({
|
||||
accessibilityLayer: true,
|
||||
barCategoryGap: '10%',
|
||||
barGap: 4,
|
||||
layout: 'horizontal',
|
||||
margin: defaultMargin,
|
||||
responsive: false,
|
||||
reverseStackOrder: false,
|
||||
stackOffset: 'none',
|
||||
syncMethod: 'index'
|
||||
}, initialEventSettingsState);
|
||||
|
||||
/**
|
||||
* These are one-time, immutable options that decide the chart's behavior.
|
||||
* Users who wish to call CartesianChart may decide to pass these options explicitly,
|
||||
* but usually we would expect that they use one of the convenience components like BarChart, LineChart, etc.
|
||||
*/
|
||||
|
||||
export var CartesianChart = /*#__PURE__*/forwardRef(function CartesianChart(props, ref) {
|
||||
var _categoricalChartProp;
|
||||
var rootChartProps = resolveDefaultProps(props.categoricalChartProps, defaultCartesianChartProps);
|
||||
var chartName = props.chartName,
|
||||
defaultTooltipEventType = props.defaultTooltipEventType,
|
||||
validateTooltipEventTypes = props.validateTooltipEventTypes,
|
||||
tooltipPayloadSearcher = props.tooltipPayloadSearcher,
|
||||
categoricalChartProps = props.categoricalChartProps;
|
||||
var options = {
|
||||
chartName,
|
||||
defaultTooltipEventType,
|
||||
validateTooltipEventTypes,
|
||||
tooltipPayloadSearcher,
|
||||
eventEmitter: undefined
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(RechartsStoreProvider, {
|
||||
preloadedState: {
|
||||
options
|
||||
},
|
||||
reduxStoreName: (_categoricalChartProp = categoricalChartProps.id) !== null && _categoricalChartProp !== void 0 ? _categoricalChartProp : chartName
|
||||
}, /*#__PURE__*/React.createElement(ChartDataContextProvider, {
|
||||
chartData: categoricalChartProps.data
|
||||
}), /*#__PURE__*/React.createElement(ReportMainChartProps, {
|
||||
layout: rootChartProps.layout,
|
||||
margin: rootChartProps.margin
|
||||
}), /*#__PURE__*/React.createElement(ReportEventSettings, {
|
||||
throttleDelay: rootChartProps.throttleDelay,
|
||||
throttledEvents: rootChartProps.throttledEvents
|
||||
}), /*#__PURE__*/React.createElement(ReportChartProps, {
|
||||
baseValue: rootChartProps.baseValue,
|
||||
accessibilityLayer: rootChartProps.accessibilityLayer,
|
||||
barCategoryGap: rootChartProps.barCategoryGap,
|
||||
maxBarSize: rootChartProps.maxBarSize,
|
||||
stackOffset: rootChartProps.stackOffset,
|
||||
barGap: rootChartProps.barGap,
|
||||
barSize: rootChartProps.barSize,
|
||||
syncId: rootChartProps.syncId,
|
||||
syncMethod: rootChartProps.syncMethod,
|
||||
className: rootChartProps.className,
|
||||
reverseStackOrder: rootChartProps.reverseStackOrder
|
||||
}), /*#__PURE__*/React.createElement(CategoricalChart, _extends({}, rootChartProps, {
|
||||
ref: ref
|
||||
})));
|
||||
});
|
||||
61
frontend/node_modules/recharts/es6/chart/CategoricalChart.js
generated
vendored
Normal file
61
frontend/node_modules/recharts/es6/chart/CategoricalChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
var _excluded = ["width", "height", "responsive", "children", "className", "style", "compact", "title", "desc"];
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { RootSurface } from '../container/RootSurface';
|
||||
import { RechartsWrapper } from './RechartsWrapper';
|
||||
import { ClipPathProvider } from '../container/ClipPathProvider';
|
||||
import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
|
||||
import { ReportChartSize } from '../context/chartLayoutContext';
|
||||
export var CategoricalChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var width = props.width,
|
||||
height = props.height,
|
||||
responsive = props.responsive,
|
||||
children = props.children,
|
||||
className = props.className,
|
||||
style = props.style,
|
||||
compact = props.compact,
|
||||
title = props.title,
|
||||
desc = props.desc,
|
||||
others = _objectWithoutProperties(props, _excluded);
|
||||
var attrs = svgPropertiesNoEvents(others);
|
||||
|
||||
/*
|
||||
* The "compact" mode is used as the panorama within Brush.
|
||||
* However because `compact` is a public prop, let's assume that it can render outside of Brush too.
|
||||
*/
|
||||
if (compact) {
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: width,
|
||||
height: height
|
||||
}), /*#__PURE__*/React.createElement(RootSurface, {
|
||||
otherAttributes: attrs,
|
||||
title: title,
|
||||
desc: desc
|
||||
}, children));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(RechartsWrapper, {
|
||||
className: className,
|
||||
style: style,
|
||||
width: width,
|
||||
height: height,
|
||||
responsive: responsive !== null && responsive !== void 0 ? responsive : false,
|
||||
onClick: props.onClick,
|
||||
onMouseLeave: props.onMouseLeave,
|
||||
onMouseEnter: props.onMouseEnter,
|
||||
onMouseMove: props.onMouseMove,
|
||||
onMouseDown: props.onMouseDown,
|
||||
onMouseUp: props.onMouseUp,
|
||||
onContextMenu: props.onContextMenu,
|
||||
onDoubleClick: props.onDoubleClick,
|
||||
onTouchStart: props.onTouchStart,
|
||||
onTouchMove: props.onTouchMove,
|
||||
onTouchEnd: props.onTouchEnd
|
||||
}, /*#__PURE__*/React.createElement(RootSurface, {
|
||||
otherAttributes: attrs,
|
||||
title: title,
|
||||
desc: desc,
|
||||
ref: ref
|
||||
}, /*#__PURE__*/React.createElement(ClipPathProvider, null, children)));
|
||||
});
|
||||
21
frontend/node_modules/recharts/es6/chart/ComposedChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/ComposedChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['axis'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var ComposedChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "ComposedChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
21
frontend/node_modules/recharts/es6/chart/FunnelChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/FunnelChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['item'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var FunnelChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "FunnelChart",
|
||||
defaultTooltipEventType: "item",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
21
frontend/node_modules/recharts/es6/chart/LineChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/LineChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['axis'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "LineChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
33
frontend/node_modules/recharts/es6/chart/PieChart.js
generated
vendored
Normal file
33
frontend/node_modules/recharts/es6/chart/PieChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { defaultPolarChartProps, PolarChart } from './PolarChart';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
var allowedTooltipTypes = ['item'];
|
||||
export var defaultPieChartProps = _objectSpread(_objectSpread({}, defaultPolarChartProps), {}, {
|
||||
layout: 'centric',
|
||||
startAngle: 0,
|
||||
endAngle: 360
|
||||
});
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides PolarViewBoxContext
|
||||
* @provides PolarChartContext
|
||||
*/
|
||||
export var PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var propsWithDefaults = resolveDefaultProps(props, defaultPieChartProps);
|
||||
return /*#__PURE__*/React.createElement(PolarChart, {
|
||||
chartName: "PieChart",
|
||||
defaultTooltipEventType: "item",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: propsWithDefaults,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
113
frontend/node_modules/recharts/es6/chart/PolarChart.js
generated
vendored
Normal file
113
frontend/node_modules/recharts/es6/chart/PolarChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
var _excluded = ["layout"];
|
||||
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import { forwardRef } from 'react';
|
||||
import * as React from 'react';
|
||||
import { RechartsStoreProvider } from '../state/RechartsStoreProvider';
|
||||
import { ChartDataContextProvider } from '../context/chartDataContext';
|
||||
import { ReportMainChartProps } from '../state/ReportMainChartProps';
|
||||
import { ReportChartProps } from '../state/ReportChartProps';
|
||||
import { ReportEventSettings } from '../state/ReportEventSettings';
|
||||
import { ReportPolarOptions } from '../state/ReportPolarOptions';
|
||||
import { CategoricalChart } from './CategoricalChart';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
||||
var defaultMargin = {
|
||||
top: 5,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
left: 5
|
||||
};
|
||||
|
||||
/**
|
||||
* These default props are the same for all PolarChart components.
|
||||
*/
|
||||
export var defaultPolarChartProps = _objectSpread({
|
||||
accessibilityLayer: true,
|
||||
stackOffset: 'none',
|
||||
barCategoryGap: '10%',
|
||||
barGap: 4,
|
||||
margin: defaultMargin,
|
||||
reverseStackOrder: false,
|
||||
syncMethod: 'index',
|
||||
layout: 'radial',
|
||||
responsive: false,
|
||||
cx: '50%',
|
||||
cy: '50%',
|
||||
innerRadius: 0,
|
||||
outerRadius: '80%'
|
||||
}, initialEventSettingsState);
|
||||
|
||||
/**
|
||||
* These props are required for the PolarChart to function correctly.
|
||||
* Users usually would not need to specify these explicitly,
|
||||
* because the convenience components like PieChart, RadarChart, etc.
|
||||
* will provide these defaults.
|
||||
* We can't have the defaults in this file because each of those convenience components
|
||||
* have their own opinions about what they should be.
|
||||
*/
|
||||
|
||||
/**
|
||||
* These are one-time, immutable options that decide the chart's behavior.
|
||||
* Users who wish to call CartesianChart may decide to pass these options explicitly,
|
||||
* but usually we would expect that they use one of the convenience components like PieChart, RadarChart, etc.
|
||||
*/
|
||||
|
||||
export var PolarChart = /*#__PURE__*/forwardRef(function PolarChart(props, ref) {
|
||||
var _polarChartProps$id;
|
||||
var polarChartProps = resolveDefaultProps(props.categoricalChartProps, defaultPolarChartProps);
|
||||
var layout = polarChartProps.layout,
|
||||
otherCategoricalProps = _objectWithoutProperties(polarChartProps, _excluded);
|
||||
var chartName = props.chartName,
|
||||
defaultTooltipEventType = props.defaultTooltipEventType,
|
||||
validateTooltipEventTypes = props.validateTooltipEventTypes,
|
||||
tooltipPayloadSearcher = props.tooltipPayloadSearcher;
|
||||
var options = {
|
||||
chartName,
|
||||
defaultTooltipEventType,
|
||||
validateTooltipEventTypes,
|
||||
tooltipPayloadSearcher,
|
||||
eventEmitter: undefined
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(RechartsStoreProvider, {
|
||||
preloadedState: {
|
||||
options
|
||||
},
|
||||
reduxStoreName: (_polarChartProps$id = polarChartProps.id) !== null && _polarChartProps$id !== void 0 ? _polarChartProps$id : chartName
|
||||
}, /*#__PURE__*/React.createElement(ChartDataContextProvider, {
|
||||
chartData: polarChartProps.data
|
||||
}), /*#__PURE__*/React.createElement(ReportMainChartProps, {
|
||||
layout: layout,
|
||||
margin: polarChartProps.margin
|
||||
}), /*#__PURE__*/React.createElement(ReportEventSettings, {
|
||||
throttleDelay: polarChartProps.throttleDelay,
|
||||
throttledEvents: polarChartProps.throttledEvents
|
||||
}), /*#__PURE__*/React.createElement(ReportChartProps, {
|
||||
baseValue: undefined,
|
||||
accessibilityLayer: polarChartProps.accessibilityLayer,
|
||||
barCategoryGap: polarChartProps.barCategoryGap,
|
||||
maxBarSize: polarChartProps.maxBarSize,
|
||||
stackOffset: polarChartProps.stackOffset,
|
||||
barGap: polarChartProps.barGap,
|
||||
barSize: polarChartProps.barSize,
|
||||
syncId: polarChartProps.syncId,
|
||||
syncMethod: polarChartProps.syncMethod,
|
||||
className: polarChartProps.className,
|
||||
reverseStackOrder: polarChartProps.reverseStackOrder
|
||||
}), /*#__PURE__*/React.createElement(ReportPolarOptions, {
|
||||
cx: polarChartProps.cx,
|
||||
cy: polarChartProps.cy,
|
||||
startAngle: polarChartProps.startAngle,
|
||||
endAngle: polarChartProps.endAngle,
|
||||
innerRadius: polarChartProps.innerRadius,
|
||||
outerRadius: polarChartProps.outerRadius
|
||||
}), /*#__PURE__*/React.createElement(CategoricalChart, _extends({}, otherCategoricalProps, {
|
||||
ref: ref
|
||||
})));
|
||||
});
|
||||
32
frontend/node_modules/recharts/es6/chart/RadarChart.js
generated
vendored
Normal file
32
frontend/node_modules/recharts/es6/chart/RadarChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { defaultPolarChartProps, PolarChart } from './PolarChart';
|
||||
var allowedTooltipTypes = ['axis'];
|
||||
export var defaultRadarChartProps = _objectSpread(_objectSpread({}, defaultPolarChartProps), {}, {
|
||||
layout: 'centric',
|
||||
startAngle: 90,
|
||||
endAngle: -270
|
||||
});
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides PolarViewBoxContext
|
||||
* @provides PolarChartContext
|
||||
*/
|
||||
export var RadarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var propsWithDefaults = resolveDefaultProps(props, defaultRadarChartProps);
|
||||
return /*#__PURE__*/React.createElement(PolarChart, {
|
||||
chartName: "RadarChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: propsWithDefaults,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
33
frontend/node_modules/recharts/es6/chart/RadialBarChart.js
generated
vendored
Normal file
33
frontend/node_modules/recharts/es6/chart/RadialBarChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { defaultPolarChartProps, PolarChart } from './PolarChart';
|
||||
var allowedTooltipTypes = ['axis', 'item'];
|
||||
export var defaultRadialBarChartProps = _objectSpread(_objectSpread({}, defaultPolarChartProps), {}, {
|
||||
layout: 'radial',
|
||||
startAngle: 0,
|
||||
endAngle: 360
|
||||
});
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides PolarViewBoxContext
|
||||
* @provides PolarChartContext
|
||||
*/
|
||||
export var RadialBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var propsWithDefaults = resolveDefaultProps(props, defaultRadialBarChartProps);
|
||||
return /*#__PURE__*/React.createElement(PolarChart, {
|
||||
chartName: "RadialBarChart",
|
||||
defaultTooltipEventType: "axis",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: propsWithDefaults,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
363
frontend/node_modules/recharts/es6/chart/RechartsWrapper.js
generated
vendored
Normal file
363
frontend/node_modules/recharts/es6/chart/RechartsWrapper.js
generated
vendored
Normal file
|
|
@ -0,0 +1,363 @@
|
|||
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
||||
import * as React from 'react';
|
||||
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { clsx } from 'clsx';
|
||||
import { mouseLeaveChart } from '../state/tooltipSlice';
|
||||
import { useAppDispatch } from '../state/hooks';
|
||||
import { mouseClickAction, mouseMoveAction } from '../state/mouseEventsMiddleware';
|
||||
import { useSynchronisedEventsFromOtherCharts } from '../synchronisation/useChartSynchronisation';
|
||||
import { focusAction, keyDownAction, blurAction } from '../state/keyboardEventsMiddleware';
|
||||
import { useReportScale } from '../util/useReportScale';
|
||||
import { externalEventAction } from '../state/externalEventsMiddleware';
|
||||
import { touchEventAction } from '../state/touchEventsMiddleware';
|
||||
import { TooltipPortalContext } from '../context/tooltipPortalContext';
|
||||
import { LegendPortalContext } from '../context/legendPortalContext';
|
||||
import { ReportChartSize } from '../context/chartLayoutContext';
|
||||
import { useResponsiveContainerContext } from '../component/ResponsiveContainer';
|
||||
var EventSynchronizer = () => {
|
||||
useSynchronisedEventsFromOtherCharts();
|
||||
return null;
|
||||
};
|
||||
function getNumberOrZero(value) {
|
||||
if (typeof value === 'number') {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
var parsed = parseFloat(value);
|
||||
if (!Number.isNaN(parsed)) {
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
var ResponsiveDiv = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var _props$style, _props$style2;
|
||||
var observerRef = useRef(null);
|
||||
var _useState = useState({
|
||||
containerWidth: getNumberOrZero((_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.width),
|
||||
containerHeight: getNumberOrZero((_props$style2 = props.style) === null || _props$style2 === void 0 ? void 0 : _props$style2.height)
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
sizes = _useState2[0],
|
||||
setSizes = _useState2[1];
|
||||
var setContainerSize = useCallback((newWidth, newHeight) => {
|
||||
setSizes(prevState => {
|
||||
var roundedWidth = Math.round(newWidth);
|
||||
var roundedHeight = Math.round(newHeight);
|
||||
if (prevState.containerWidth === roundedWidth && prevState.containerHeight === roundedHeight) {
|
||||
return prevState;
|
||||
}
|
||||
return {
|
||||
containerWidth: roundedWidth,
|
||||
containerHeight: roundedHeight
|
||||
};
|
||||
});
|
||||
}, []);
|
||||
var innerRef = useCallback(node => {
|
||||
// 1. First, call the external ref if it was provided
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
}
|
||||
|
||||
// 2. Disconnect any previously active ResizeObserver instance to prevent memory leaks
|
||||
if (observerRef.current != null) {
|
||||
observerRef.current.disconnect();
|
||||
observerRef.current = null;
|
||||
}
|
||||
|
||||
// 3. Initiate a new ResizeObserver on the valid DOM node
|
||||
if (node != null && typeof ResizeObserver !== 'undefined') {
|
||||
var _node$getBoundingClie = node.getBoundingClientRect(),
|
||||
containerWidth = _node$getBoundingClie.width,
|
||||
containerHeight = _node$getBoundingClie.height;
|
||||
setContainerSize(containerWidth, containerHeight);
|
||||
var callback = entries => {
|
||||
var entry = entries[0];
|
||||
if (entry == null) {
|
||||
return;
|
||||
}
|
||||
var _entry$contentRect = entry.contentRect,
|
||||
width = _entry$contentRect.width,
|
||||
height = _entry$contentRect.height;
|
||||
setContainerSize(width, height);
|
||||
};
|
||||
var observer = new ResizeObserver(callback);
|
||||
observer.observe(node);
|
||||
observerRef.current = observer;
|
||||
}
|
||||
}, [ref, setContainerSize]);
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
var observer = observerRef.current;
|
||||
if (observer != null) {
|
||||
observer.disconnect();
|
||||
}
|
||||
};
|
||||
}, [setContainerSize]);
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: sizes.containerWidth,
|
||||
height: sizes.containerHeight
|
||||
}), /*#__PURE__*/React.createElement("div", _extends({
|
||||
ref: innerRef
|
||||
}, props)));
|
||||
});
|
||||
var ReadSizeOnceDiv = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var width = props.width,
|
||||
height = props.height;
|
||||
var _useState3 = useState({
|
||||
containerWidth: getNumberOrZero(width),
|
||||
containerHeight: getNumberOrZero(height)
|
||||
}),
|
||||
_useState4 = _slicedToArray(_useState3, 2),
|
||||
sizes = _useState4[0],
|
||||
setSizes = _useState4[1];
|
||||
var setContainerSize = useCallback((newWidth, newHeight) => {
|
||||
setSizes(prevState => {
|
||||
var roundedWidth = Math.round(newWidth);
|
||||
var roundedHeight = Math.round(newHeight);
|
||||
if (prevState.containerWidth === roundedWidth && prevState.containerHeight === roundedHeight) {
|
||||
return prevState;
|
||||
}
|
||||
return {
|
||||
containerWidth: roundedWidth,
|
||||
containerHeight: roundedHeight
|
||||
};
|
||||
});
|
||||
}, []);
|
||||
var innerRef = useCallback(node => {
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
}
|
||||
if (node != null) {
|
||||
var _node$getBoundingClie2 = node.getBoundingClientRect(),
|
||||
containerWidth = _node$getBoundingClie2.width,
|
||||
containerHeight = _node$getBoundingClie2.height;
|
||||
setContainerSize(containerWidth, containerHeight);
|
||||
}
|
||||
}, [ref, setContainerSize]);
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: sizes.containerWidth,
|
||||
height: sizes.containerHeight
|
||||
}), /*#__PURE__*/React.createElement("div", _extends({
|
||||
ref: innerRef
|
||||
}, props)));
|
||||
});
|
||||
var StaticDiv = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var width = props.width,
|
||||
height = props.height;
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: width,
|
||||
height: height
|
||||
}), /*#__PURE__*/React.createElement("div", _extends({
|
||||
ref: ref
|
||||
}, props)));
|
||||
});
|
||||
var NonResponsiveDiv = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var width = props.width,
|
||||
height = props.height;
|
||||
// When width or height are percentages or CSS short names, read size from DOM once
|
||||
if (typeof width === 'string' || typeof height === 'string') {
|
||||
return /*#__PURE__*/React.createElement(ReadSizeOnceDiv, _extends({}, props, {
|
||||
ref: ref
|
||||
}));
|
||||
}
|
||||
// When both are numbers, use them directly
|
||||
if (typeof width === 'number' && typeof height === 'number') {
|
||||
return /*#__PURE__*/React.createElement(StaticDiv, _extends({}, props, {
|
||||
width: width,
|
||||
height: height,
|
||||
ref: ref
|
||||
}));
|
||||
}
|
||||
// When width/height are undefined, render wrapper div without reporting size
|
||||
// This results in no SVG being rendered (intentional for backwards compatibility)
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: width,
|
||||
height: height
|
||||
}), /*#__PURE__*/React.createElement("div", _extends({
|
||||
ref: ref
|
||||
}, props)));
|
||||
});
|
||||
function getWrapperDivComponent(responsive) {
|
||||
return responsive ? ResponsiveDiv : NonResponsiveDiv;
|
||||
}
|
||||
export var RechartsWrapper = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
var children = props.children,
|
||||
className = props.className,
|
||||
heightFromProps = props.height,
|
||||
onClick = props.onClick,
|
||||
onContextMenu = props.onContextMenu,
|
||||
onDoubleClick = props.onDoubleClick,
|
||||
onMouseDown = props.onMouseDown,
|
||||
onMouseEnter = props.onMouseEnter,
|
||||
onMouseLeave = props.onMouseLeave,
|
||||
onMouseMove = props.onMouseMove,
|
||||
onMouseUp = props.onMouseUp,
|
||||
onTouchEnd = props.onTouchEnd,
|
||||
onTouchMove = props.onTouchMove,
|
||||
onTouchStart = props.onTouchStart,
|
||||
style = props.style,
|
||||
widthFromProps = props.width,
|
||||
responsive = props.responsive,
|
||||
_props$dispatchTouchE = props.dispatchTouchEvents,
|
||||
dispatchTouchEvents = _props$dispatchTouchE === void 0 ? true : _props$dispatchTouchE;
|
||||
var containerRef = useRef(null);
|
||||
var dispatch = useAppDispatch();
|
||||
var _useState5 = useState(null),
|
||||
_useState6 = _slicedToArray(_useState5, 2),
|
||||
tooltipPortal = _useState6[0],
|
||||
setTooltipPortal = _useState6[1];
|
||||
var _useState7 = useState(null),
|
||||
_useState8 = _slicedToArray(_useState7, 2),
|
||||
legendPortal = _useState8[0],
|
||||
setLegendPortal = _useState8[1];
|
||||
var setScaleRef = useReportScale();
|
||||
var responsiveContainerCalculations = useResponsiveContainerContext();
|
||||
var width = (responsiveContainerCalculations === null || responsiveContainerCalculations === void 0 ? void 0 : responsiveContainerCalculations.width) > 0 ? responsiveContainerCalculations.width : widthFromProps;
|
||||
var height = (responsiveContainerCalculations === null || responsiveContainerCalculations === void 0 ? void 0 : responsiveContainerCalculations.height) > 0 ? responsiveContainerCalculations.height : heightFromProps;
|
||||
var innerRef = useCallback(node => {
|
||||
setScaleRef(node);
|
||||
if (typeof ref === 'function') {
|
||||
ref(node);
|
||||
}
|
||||
setTooltipPortal(node);
|
||||
setLegendPortal(node);
|
||||
if (node != null) {
|
||||
containerRef.current = node;
|
||||
}
|
||||
}, [setScaleRef, ref, setTooltipPortal, setLegendPortal]);
|
||||
var myOnClick = useCallback(e => {
|
||||
dispatch(mouseClickAction(e));
|
||||
dispatch(externalEventAction({
|
||||
handler: onClick,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onClick]);
|
||||
var myOnMouseEnter = useCallback(e => {
|
||||
dispatch(mouseMoveAction(e));
|
||||
dispatch(externalEventAction({
|
||||
handler: onMouseEnter,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onMouseEnter]);
|
||||
var myOnMouseLeave = useCallback(e => {
|
||||
dispatch(mouseLeaveChart());
|
||||
dispatch(externalEventAction({
|
||||
handler: onMouseLeave,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onMouseLeave]);
|
||||
var myOnMouseMove = useCallback(e => {
|
||||
dispatch(mouseMoveAction(e));
|
||||
dispatch(externalEventAction({
|
||||
handler: onMouseMove,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onMouseMove]);
|
||||
var onFocus = useCallback(() => {
|
||||
dispatch(focusAction());
|
||||
}, [dispatch]);
|
||||
var onBlur = useCallback(() => {
|
||||
dispatch(blurAction());
|
||||
}, [dispatch]);
|
||||
var onKeyDown = useCallback(e => {
|
||||
dispatch(keyDownAction(e.key));
|
||||
}, [dispatch]);
|
||||
var myOnContextMenu = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onContextMenu,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onContextMenu]);
|
||||
var myOnDoubleClick = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onDoubleClick,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onDoubleClick]);
|
||||
var myOnMouseDown = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onMouseDown,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onMouseDown]);
|
||||
var myOnMouseUp = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onMouseUp,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onMouseUp]);
|
||||
var myOnTouchStart = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onTouchStart,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onTouchStart]);
|
||||
|
||||
/*
|
||||
* onTouchMove is special because it behaves different from mouse events.
|
||||
* Mouse events have 'enter' + 'leave' combo that notify us when the mouse is over
|
||||
* a certain element. Touch events don't have that; touch only gives us
|
||||
* start (finger down), end (finger up) and move (finger moving).
|
||||
* So we need to figure out which element the user is touching
|
||||
* ourselves. Fortunately, there's a convenient method for that:
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/Document/elementFromPoint
|
||||
*/
|
||||
var myOnTouchMove = useCallback(e => {
|
||||
if (dispatchTouchEvents) {
|
||||
dispatch(touchEventAction(e));
|
||||
}
|
||||
dispatch(externalEventAction({
|
||||
handler: onTouchMove,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, dispatchTouchEvents, onTouchMove]);
|
||||
var myOnTouchEnd = useCallback(e => {
|
||||
dispatch(externalEventAction({
|
||||
handler: onTouchEnd,
|
||||
reactEvent: e
|
||||
}));
|
||||
}, [dispatch, onTouchEnd]);
|
||||
var WrapperDiv = getWrapperDivComponent(responsive);
|
||||
return /*#__PURE__*/React.createElement(TooltipPortalContext.Provider, {
|
||||
value: tooltipPortal
|
||||
}, /*#__PURE__*/React.createElement(LegendPortalContext.Provider, {
|
||||
value: legendPortal
|
||||
}, /*#__PURE__*/React.createElement(WrapperDiv, {
|
||||
width: width !== null && width !== void 0 ? width : style === null || style === void 0 ? void 0 : style.width,
|
||||
height: height !== null && height !== void 0 ? height : style === null || style === void 0 ? void 0 : style.height,
|
||||
className: clsx('recharts-wrapper', className),
|
||||
style: _objectSpread({
|
||||
position: 'relative',
|
||||
cursor: 'default',
|
||||
width,
|
||||
height
|
||||
}, style),
|
||||
onClick: myOnClick,
|
||||
onContextMenu: myOnContextMenu,
|
||||
onDoubleClick: myOnDoubleClick,
|
||||
onFocus: onFocus,
|
||||
onBlur: onBlur,
|
||||
onKeyDown: onKeyDown,
|
||||
onMouseDown: myOnMouseDown,
|
||||
onMouseEnter: myOnMouseEnter,
|
||||
onMouseLeave: myOnMouseLeave,
|
||||
onMouseMove: myOnMouseMove,
|
||||
onMouseUp: myOnMouseUp,
|
||||
onTouchEnd: myOnTouchEnd,
|
||||
onTouchMove: myOnTouchMove,
|
||||
onTouchStart: myOnTouchStart,
|
||||
ref: innerRef
|
||||
}, /*#__PURE__*/React.createElement(EventSynchronizer, null), children)));
|
||||
});
|
||||
1041
frontend/node_modules/recharts/es6/chart/Sankey.js
generated
vendored
Normal file
1041
frontend/node_modules/recharts/es6/chart/Sankey.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
21
frontend/node_modules/recharts/es6/chart/ScatterChart.js
generated
vendored
Normal file
21
frontend/node_modules/recharts/es6/chart/ScatterChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import * as React from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
import { arrayTooltipSearcher } from '../state/optionsSlice';
|
||||
import { CartesianChart } from './CartesianChart';
|
||||
var allowedTooltipTypes = ['item'];
|
||||
|
||||
/**
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides CartesianViewBoxContext
|
||||
* @provides CartesianChartContext
|
||||
*/
|
||||
export var ScatterChart = /*#__PURE__*/forwardRef((props, ref) => {
|
||||
return /*#__PURE__*/React.createElement(CartesianChart, {
|
||||
chartName: "ScatterChart",
|
||||
defaultTooltipEventType: "item",
|
||||
validateTooltipEventTypes: allowedTooltipTypes,
|
||||
tooltipPayloadSearcher: arrayTooltipSearcher,
|
||||
categoricalChartProps: props,
|
||||
ref: ref
|
||||
});
|
||||
});
|
||||
334
frontend/node_modules/recharts/es6/chart/SunburstChart.js
generated
vendored
Normal file
334
frontend/node_modules/recharts/es6/chart/SunburstChart.js
generated
vendored
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
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 _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
import * as React from 'react';
|
||||
import { useState } from 'react';
|
||||
import { scaleLinear } from 'victory-vendor/d3-scale';
|
||||
import { clsx } from 'clsx';
|
||||
import get from 'es-toolkit/compat/get';
|
||||
import { Surface } from '../container/Surface';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { Sector } from '../shape/Sector';
|
||||
import { Text } from '../component/Text';
|
||||
import { polarToCartesian } from '../util/PolarUtils';
|
||||
import { ReportChartMargin, ReportChartSize, useChartHeight, useChartWidth } from '../context/chartLayoutContext';
|
||||
import { TooltipPortalContext } from '../context/tooltipPortalContext';
|
||||
import { RechartsWrapper } from './RechartsWrapper';
|
||||
import { mouseLeaveItem, setActiveClickItemIndex, setActiveMouseOverItemIndex } from '../state/tooltipSlice';
|
||||
import { SetTooltipEntrySettings } from '../state/SetTooltipEntrySettings';
|
||||
import { RechartsStoreProvider } from '../state/RechartsStoreProvider';
|
||||
import { ReportEventSettings } from '../state/ReportEventSettings';
|
||||
import { useAppDispatch } from '../state/hooks';
|
||||
import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
||||
|
||||
/**
|
||||
* We require tooltipIndex on each node internally to track which node is active in the tooltip.
|
||||
* This is not required from the outside user - we can calculate it as we traverse the tree.
|
||||
*/
|
||||
|
||||
var defaultTextProps = {
|
||||
fontWeight: 'bold',
|
||||
paintOrder: 'stroke fill',
|
||||
fontSize: '.75rem',
|
||||
stroke: '#FFF',
|
||||
fill: 'black',
|
||||
pointerEvents: 'none'
|
||||
};
|
||||
function getMaxDepthOf(node) {
|
||||
if (!node.children || node.children.length === 0) return 1;
|
||||
|
||||
// Calculate depth for each child and find the maximum
|
||||
var childDepths = node.children.map(d => getMaxDepthOf(d));
|
||||
return 1 + Math.max(...childDepths);
|
||||
}
|
||||
var SetSunburstTooltipEntrySettings = /*#__PURE__*/React.memo(_ref => {
|
||||
var dataKey = _ref.dataKey,
|
||||
nameKey = _ref.nameKey,
|
||||
data = _ref.data,
|
||||
stroke = _ref.stroke,
|
||||
fill = _ref.fill,
|
||||
positions = _ref.positions,
|
||||
id = _ref.id;
|
||||
var tooltipEntrySettings = {
|
||||
dataDefinedOnItem: data.children,
|
||||
getPosition: index => positions.get(index),
|
||||
// Sunburst does not support many of the properties as other charts do so there's plenty of defaults here
|
||||
settings: {
|
||||
stroke,
|
||||
strokeWidth: undefined,
|
||||
fill,
|
||||
nameKey,
|
||||
dataKey,
|
||||
// if there is a nameKey use it, otherwise make the name of the tooltip the dataKey itself
|
||||
name: nameKey ? undefined : dataKey,
|
||||
hide: false,
|
||||
type: undefined,
|
||||
color: fill,
|
||||
unit: '',
|
||||
graphicalItemId: id
|
||||
}
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(SetTooltipEntrySettings, {
|
||||
tooltipEntrySettings: tooltipEntrySettings
|
||||
});
|
||||
});
|
||||
|
||||
// Why is margin not a sunburst prop? No clue. Probably it should be
|
||||
var defaultSunburstMargin = {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
};
|
||||
export var payloadSearcher = (data, activeIndex) => {
|
||||
if (activeIndex == null) {
|
||||
return undefined;
|
||||
}
|
||||
return get(data, activeIndex);
|
||||
};
|
||||
var addToSunburstNodeIndex = function addToSunburstNodeIndex(indexInChildrenArr) {
|
||||
var activeTooltipIndexSoFar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
return "".concat(activeTooltipIndexSoFar, "children[").concat(indexInChildrenArr, "]");
|
||||
};
|
||||
var preloadedState = {
|
||||
options: {
|
||||
validateTooltipEventTypes: ['item'],
|
||||
defaultTooltipEventType: 'item',
|
||||
chartName: 'Sunburst',
|
||||
tooltipPayloadSearcher: payloadSearcher,
|
||||
eventEmitter: undefined
|
||||
}
|
||||
};
|
||||
export var defaultSunburstChartProps = _objectSpread({
|
||||
padding: 2,
|
||||
dataKey: 'value',
|
||||
nameKey: 'name',
|
||||
ringPadding: 2,
|
||||
innerRadius: 50,
|
||||
fill: '#333',
|
||||
stroke: '#FFF',
|
||||
textOptions: defaultTextProps,
|
||||
startAngle: 0,
|
||||
endAngle: 360,
|
||||
responsive: false
|
||||
}, initialEventSettingsState);
|
||||
var SunburstChartImpl = _ref2 => {
|
||||
var className = _ref2.className,
|
||||
data = _ref2.data,
|
||||
children = _ref2.children,
|
||||
padding = _ref2.padding,
|
||||
dataKey = _ref2.dataKey,
|
||||
nameKey = _ref2.nameKey,
|
||||
ringPadding = _ref2.ringPadding,
|
||||
innerRadius = _ref2.innerRadius,
|
||||
fill = _ref2.fill,
|
||||
stroke = _ref2.stroke,
|
||||
textOptions = _ref2.textOptions,
|
||||
outerRadiusFromProps = _ref2.outerRadius,
|
||||
cxFromProps = _ref2.cx,
|
||||
cyFromProps = _ref2.cy,
|
||||
startAngle = _ref2.startAngle,
|
||||
endAngle = _ref2.endAngle,
|
||||
onClick = _ref2.onClick,
|
||||
onMouseEnter = _ref2.onMouseEnter,
|
||||
onMouseLeave = _ref2.onMouseLeave,
|
||||
id = _ref2.id;
|
||||
var dispatch = useAppDispatch();
|
||||
var width = useChartWidth();
|
||||
var height = useChartHeight();
|
||||
if (width == null || height == null) {
|
||||
return null;
|
||||
}
|
||||
var outerRadius = outerRadiusFromProps !== null && outerRadiusFromProps !== void 0 ? outerRadiusFromProps : Math.min(width, height) / 2;
|
||||
var cx = cxFromProps !== null && cxFromProps !== void 0 ? cxFromProps : width / 2;
|
||||
var cy = cyFromProps !== null && cyFromProps !== void 0 ? cyFromProps : height / 2;
|
||||
var rScale = scaleLinear([0, data[dataKey]], [0, endAngle]);
|
||||
var treeDepth = getMaxDepthOf(data);
|
||||
var thickness = (outerRadius - innerRadius) / treeDepth;
|
||||
var sectors = [];
|
||||
var positions = new Map([]);
|
||||
|
||||
// event handlers
|
||||
function handleMouseEnter(node, e) {
|
||||
if (onMouseEnter) onMouseEnter(node, e);
|
||||
dispatch(setActiveMouseOverItemIndex({
|
||||
activeIndex: node.tooltipIndex,
|
||||
activeDataKey: dataKey,
|
||||
activeCoordinate: positions.get(node.name),
|
||||
activeGraphicalItemId: id
|
||||
}));
|
||||
}
|
||||
function handleMouseLeave(node, e) {
|
||||
if (onMouseLeave) onMouseLeave(node, e);
|
||||
dispatch(mouseLeaveItem());
|
||||
}
|
||||
function handleClick(node) {
|
||||
if (onClick) onClick(node);
|
||||
dispatch(setActiveClickItemIndex({
|
||||
activeIndex: node.tooltipIndex,
|
||||
activeDataKey: dataKey,
|
||||
activeCoordinate: positions.get(node.name),
|
||||
activeGraphicalItemId: id
|
||||
}));
|
||||
}
|
||||
|
||||
// recursively add nodes for each data point and its children
|
||||
function drawArcs(childNodes, options) {
|
||||
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
||||
var radius = options.radius,
|
||||
innerR = options.innerR,
|
||||
initialAngle = options.initialAngle,
|
||||
childColor = options.childColor,
|
||||
nestedActiveTooltipIndex = options.nestedActiveTooltipIndex;
|
||||
var currentAngle = initialAngle;
|
||||
if (!childNodes) return; // base case: no children of this node
|
||||
|
||||
childNodes.forEach((d, i) => {
|
||||
var _ref3, _d$fill;
|
||||
var currentTooltipIndex = depth === 1 ? "[".concat(i, "]") : addToSunburstNodeIndex(i, nestedActiveTooltipIndex);
|
||||
var nodeWithIndex = _objectSpread(_objectSpread({}, d), {}, {
|
||||
tooltipIndex: currentTooltipIndex
|
||||
});
|
||||
var arcLength = rScale(d[dataKey]);
|
||||
var start = currentAngle;
|
||||
// color priority - if there's a color on the individual point use that, otherwise use parent color or default
|
||||
var fillColor = (_ref3 = (_d$fill = d === null || d === void 0 ? void 0 : d.fill) !== null && _d$fill !== void 0 ? _d$fill : childColor) !== null && _ref3 !== void 0 ? _ref3 : fill;
|
||||
var _polarToCartesian = polarToCartesian(0, 0, innerR + radius / 2, -(start + arcLength - arcLength / 2)),
|
||||
textX = _polarToCartesian.x,
|
||||
textY = _polarToCartesian.y;
|
||||
currentAngle += arcLength;
|
||||
sectors.push(/*#__PURE__*/React.createElement("g", {
|
||||
key: "sunburst-sector-".concat(d.name, "-").concat(i)
|
||||
}, /*#__PURE__*/React.createElement(Sector, {
|
||||
onClick: () => handleClick(nodeWithIndex),
|
||||
onMouseEnter: e => handleMouseEnter(nodeWithIndex, e),
|
||||
onMouseLeave: e => handleMouseLeave(nodeWithIndex, e),
|
||||
fill: fillColor,
|
||||
stroke: stroke,
|
||||
strokeWidth: padding,
|
||||
startAngle: start,
|
||||
endAngle: start + arcLength,
|
||||
innerRadius: innerR,
|
||||
outerRadius: innerR + radius,
|
||||
cx: cx,
|
||||
cy: cy
|
||||
}), /*#__PURE__*/React.createElement(Text, _extends({}, textOptions, {
|
||||
alignmentBaseline: "middle",
|
||||
textAnchor: "middle",
|
||||
x: textX + cx,
|
||||
y: cy - textY
|
||||
}), d[dataKey])));
|
||||
var _polarToCartesian2 = polarToCartesian(cx, cy, innerR + radius / 2, start),
|
||||
tooltipX = _polarToCartesian2.x,
|
||||
tooltipY = _polarToCartesian2.y;
|
||||
positions.set(d.name, {
|
||||
x: tooltipX,
|
||||
y: tooltipY
|
||||
});
|
||||
return drawArcs(d.children, {
|
||||
radius,
|
||||
innerR: innerR + radius + ringPadding,
|
||||
initialAngle: start,
|
||||
childColor: fillColor,
|
||||
nestedActiveTooltipIndex: currentTooltipIndex
|
||||
}, depth + 1);
|
||||
});
|
||||
}
|
||||
drawArcs(data.children, {
|
||||
radius: thickness,
|
||||
innerR: innerRadius,
|
||||
initialAngle: startAngle
|
||||
});
|
||||
var layerClass = clsx('recharts-sunburst', className);
|
||||
return /*#__PURE__*/React.createElement(Surface, {
|
||||
width: width,
|
||||
height: height
|
||||
}, /*#__PURE__*/React.createElement(Layer, {
|
||||
className: layerClass
|
||||
}, sectors), /*#__PURE__*/React.createElement(SetSunburstTooltipEntrySettings, {
|
||||
dataKey: dataKey,
|
||||
nameKey: nameKey,
|
||||
data: data,
|
||||
stroke: stroke,
|
||||
fill: fill,
|
||||
positions: positions,
|
||||
id: id
|
||||
}), children);
|
||||
};
|
||||
|
||||
/**
|
||||
* The sunburst is a hierarchical chart, similar to a {@link Treemap}, plotted in polar coordinates.
|
||||
* Sunburst charts effectively convey the hierarchical relationships and proportions within each level.
|
||||
* It is easy to see all the middle layers in the hierarchy, which might get lost in other visualizations.
|
||||
* For some datasets, the radial layout may be more visually appealing and intuitive than a traditional {@link Treemap}.
|
||||
*
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides TooltipEntrySettings
|
||||
*/
|
||||
export var SunburstChart = outsideProps => {
|
||||
var props = resolveDefaultProps(outsideProps, defaultSunburstChartProps);
|
||||
var className = props.className,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
responsive = props.responsive,
|
||||
style = props.style,
|
||||
externalId = props.id,
|
||||
throttleDelay = props.throttleDelay,
|
||||
throttledEvents = props.throttledEvents;
|
||||
var _useState = useState(null),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
tooltipPortal = _useState2[0],
|
||||
setTooltipPortal = _useState2[1];
|
||||
return /*#__PURE__*/React.createElement(RechartsStoreProvider, {
|
||||
preloadedState: preloadedState,
|
||||
reduxStoreName: className !== null && className !== void 0 ? className : 'SunburstChart'
|
||||
}, /*#__PURE__*/React.createElement(ReportChartSize, {
|
||||
width: width,
|
||||
height: height
|
||||
}), /*#__PURE__*/React.createElement(ReportChartMargin, {
|
||||
margin: defaultSunburstMargin
|
||||
}), /*#__PURE__*/React.createElement(ReportEventSettings, {
|
||||
throttleDelay: throttleDelay,
|
||||
throttledEvents: throttledEvents
|
||||
}), /*#__PURE__*/React.createElement(TooltipPortalContext.Provider, {
|
||||
value: tooltipPortal
|
||||
}, /*#__PURE__*/React.createElement(RechartsWrapper, {
|
||||
className: className,
|
||||
width: width,
|
||||
height: height,
|
||||
responsive: responsive,
|
||||
style: style,
|
||||
ref: node => {
|
||||
if (tooltipPortal == null && node != null) {
|
||||
setTooltipPortal(node);
|
||||
}
|
||||
},
|
||||
onMouseEnter: undefined,
|
||||
onMouseLeave: undefined,
|
||||
onClick: undefined,
|
||||
onMouseMove: undefined,
|
||||
onMouseDown: undefined,
|
||||
onMouseUp: undefined,
|
||||
onContextMenu: undefined,
|
||||
onDoubleClick: undefined,
|
||||
onTouchStart: undefined,
|
||||
onTouchMove: undefined,
|
||||
onTouchEnd: undefined
|
||||
}, /*#__PURE__*/React.createElement(RegisterGraphicalItemId, {
|
||||
id: externalId,
|
||||
type: "sunburst"
|
||||
}, id => /*#__PURE__*/React.createElement(SunburstChartImpl, _extends({}, props, {
|
||||
id: id
|
||||
}))))));
|
||||
};
|
||||
860
frontend/node_modules/recharts/es6/chart/Treemap.js
generated
vendored
Normal file
860
frontend/node_modules/recharts/es6/chart/Treemap.js
generated
vendored
Normal file
|
|
@ -0,0 +1,860 @@
|
|||
var _excluded = ["width", "height", "className", "style", "children", "type"];
|
||||
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 _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); }
|
||||
import * as React from 'react';
|
||||
import { PureComponent, useCallback, useState } from 'react';
|
||||
import omit from 'es-toolkit/compat/omit';
|
||||
import get from 'es-toolkit/compat/get';
|
||||
import { Layer } from '../container/Layer';
|
||||
import { Surface } from '../container/Surface';
|
||||
import { Polygon } from '../shape/Polygon';
|
||||
import { Rectangle } from '../shape/Rectangle';
|
||||
import { getValueByDataKey } from '../util/ChartUtils';
|
||||
import { COLOR_PANEL } from '../util/Constants';
|
||||
import { isNan, noop, uniqueId } from '../util/DataUtils';
|
||||
import { getStringSize } from '../util/DOMUtils';
|
||||
import { ReportChartMargin, useChartHeight, useChartWidth } from '../context/chartLayoutContext';
|
||||
import { TooltipPortalContext } from '../context/tooltipPortalContext';
|
||||
import { RechartsWrapper } from './RechartsWrapper';
|
||||
import { setActiveClickItemIndex, setActiveMouseOverItemIndex } from '../state/tooltipSlice';
|
||||
import { SetTooltipEntrySettings } from '../state/SetTooltipEntrySettings';
|
||||
import { RechartsStoreProvider } from '../state/RechartsStoreProvider';
|
||||
import { ReportEventSettings } from '../state/ReportEventSettings';
|
||||
import { useAppDispatch } from '../state/hooks';
|
||||
import { isPositiveNumber } from '../util/isWellBehavedNumber';
|
||||
import { svgPropertiesNoEvents } from '../util/svgPropertiesNoEvents';
|
||||
import { CSSTransitionAnimate, extractCssEasing } from '../animation/CSSTransitionAnimate';
|
||||
import { resolveDefaultProps } from '../util/resolveDefaultProps';
|
||||
import { RegisterGraphicalItemId } from '../context/RegisterGraphicalItemId';
|
||||
import { initialEventSettingsState } from '../state/eventSettingsSlice';
|
||||
var NODE_VALUE_KEY = 'value';
|
||||
|
||||
/**
|
||||
* This is what end users defines as `data` on Treemap.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is what is returned from `squarify`, the final treemap data structure
|
||||
* that gets rendered and is stored in
|
||||
*/
|
||||
|
||||
function isTreemapNode(value) {
|
||||
return value != null && typeof value === 'object' && 'x' in value && 'y' in value && 'width' in value && 'height' in value && typeof value.x === 'number' && typeof value.y === 'number' && typeof value.width === 'number' && typeof value.height === 'number';
|
||||
}
|
||||
export var treemapPayloadSearcher = (data, activeIndex) => {
|
||||
if (!data || !activeIndex) {
|
||||
return undefined;
|
||||
}
|
||||
return get(data, activeIndex);
|
||||
};
|
||||
export var addToTreemapNodeIndex = function addToTreemapNodeIndex(indexInChildrenArr) {
|
||||
var activeTooltipIndexSoFar = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
return "".concat(activeTooltipIndexSoFar, "children[").concat(indexInChildrenArr, "]");
|
||||
};
|
||||
var options = {
|
||||
chartName: 'Treemap',
|
||||
defaultTooltipEventType: 'item',
|
||||
validateTooltipEventTypes: ['item'],
|
||||
tooltipPayloadSearcher: treemapPayloadSearcher,
|
||||
eventEmitter: undefined
|
||||
};
|
||||
var NEST_INDEX_HEIGHT = 30;
|
||||
var getTreemapRenderHeight = (height, type) => {
|
||||
if (type === 'nest') {
|
||||
return height - NEST_INDEX_HEIGHT;
|
||||
}
|
||||
return height;
|
||||
};
|
||||
export var computeNode = _ref => {
|
||||
var depth = _ref.depth,
|
||||
node = _ref.node,
|
||||
index = _ref.index,
|
||||
dataKey = _ref.dataKey,
|
||||
nameKey = _ref.nameKey,
|
||||
nestedActiveTooltipIndex = _ref.nestedActiveTooltipIndex;
|
||||
var currentTooltipIndex = depth === 0 ? '' : addToTreemapNodeIndex(index, nestedActiveTooltipIndex);
|
||||
var children = node.children;
|
||||
var childDepth = depth + 1;
|
||||
var computedChildren = children && children.length ? children.map((child, i) => computeNode({
|
||||
depth: childDepth,
|
||||
node: child,
|
||||
index: i,
|
||||
dataKey,
|
||||
nameKey,
|
||||
nestedActiveTooltipIndex: currentTooltipIndex
|
||||
})) : null;
|
||||
var nodeValue;
|
||||
if (computedChildren && computedChildren.length) {
|
||||
nodeValue = computedChildren.reduce((result, child) => result + child.value, 0);
|
||||
} else {
|
||||
// TODO need to verify dataKey
|
||||
var rawNodeValue = node[dataKey];
|
||||
var numericValue = typeof rawNodeValue === 'number' ? rawNodeValue : 0;
|
||||
nodeValue = isNan(numericValue) || numericValue <= 0 ? 0 : numericValue;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, node), {}, {
|
||||
children: computedChildren,
|
||||
// @ts-expect-error getValueByDataKey does not validate the output type
|
||||
name: getValueByDataKey(node, nameKey, ''),
|
||||
[NODE_VALUE_KEY]: nodeValue,
|
||||
depth,
|
||||
index,
|
||||
tooltipIndex: currentTooltipIndex
|
||||
});
|
||||
};
|
||||
var filterRect = node => ({
|
||||
x: node.x,
|
||||
y: node.y,
|
||||
width: node.width,
|
||||
height: node.height
|
||||
});
|
||||
var insetRect = (rect, nodeInset) => {
|
||||
if (!Number.isFinite(nodeInset) || nodeInset <= 0) {
|
||||
return rect;
|
||||
}
|
||||
var clampedPadding = Math.min(nodeInset, rect.width / 2, rect.height / 2);
|
||||
return {
|
||||
x: rect.x + clampedPadding,
|
||||
y: rect.y + clampedPadding,
|
||||
width: Math.max(rect.width - clampedPadding * 2, 0),
|
||||
height: Math.max(rect.height - clampedPadding * 2, 0)
|
||||
};
|
||||
};
|
||||
var applyGapToChildren = (children, parentRect, nodeGap) => {
|
||||
if (!Number.isFinite(nodeGap) || nodeGap <= 0) {
|
||||
return children;
|
||||
}
|
||||
var halfGap = nodeGap / 2;
|
||||
var parentRight = parentRect.x + parentRect.width;
|
||||
var parentBottom = parentRect.y + parentRect.height;
|
||||
return children.map(child => {
|
||||
var childRight = child.x + child.width;
|
||||
var childBottom = child.y + child.height;
|
||||
var leftInset = child.x > parentRect.x ? halfGap : 0;
|
||||
var rightInset = childRight < parentRight ? halfGap : 0;
|
||||
var topInset = child.y > parentRect.y ? halfGap : 0;
|
||||
var bottomInset = childBottom < parentBottom ? halfGap : 0;
|
||||
return _objectSpread(_objectSpread({}, child), {}, {
|
||||
x: child.x + leftInset,
|
||||
y: child.y + topInset,
|
||||
width: Math.max(child.width - leftInset - rightInset, 0),
|
||||
height: Math.max(child.height - topInset - bottomInset, 0)
|
||||
});
|
||||
});
|
||||
};
|
||||
// Compute the area for each child based on value & scale.
|
||||
var getAreaOfChildren = (children, areaValueRatio) => {
|
||||
var ratio = areaValueRatio < 0 ? 0 : areaValueRatio;
|
||||
return children.map(child => {
|
||||
var area = child[NODE_VALUE_KEY] * ratio;
|
||||
return _objectSpread(_objectSpread({}, child), {}, {
|
||||
area: isNan(area) || area <= 0 ? 0 : area
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Computes the score for the specified row, as the worst aspect ratio.
|
||||
var getWorstScore = (row, parentSize, aspectRatio) => {
|
||||
var parentArea = parentSize * parentSize;
|
||||
var rowArea = row.area * row.area;
|
||||
var _row$reduce = row.reduce((result, child) => ({
|
||||
min: Math.min(result.min, child.area),
|
||||
max: Math.max(result.max, child.area)
|
||||
}), {
|
||||
min: Infinity,
|
||||
max: 0
|
||||
}),
|
||||
min = _row$reduce.min,
|
||||
max = _row$reduce.max;
|
||||
return rowArea ? Math.max(parentArea * max * aspectRatio / rowArea, rowArea / (parentArea * min * aspectRatio)) : Infinity;
|
||||
};
|
||||
var horizontalPosition = (row, parentSize, parentRect, isFlush) => {
|
||||
var rowHeight = parentSize ? Math.round(row.area / parentSize) : 0;
|
||||
if (isFlush || rowHeight > parentRect.height) {
|
||||
rowHeight = parentRect.height;
|
||||
}
|
||||
var curX = parentRect.x;
|
||||
var child;
|
||||
for (var i = 0, len = row.length; i < len; i++) {
|
||||
child = row[i];
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
child.x = curX;
|
||||
child.y = parentRect.y;
|
||||
child.height = rowHeight;
|
||||
child.width = Math.min(rowHeight ? Math.round(child.area / rowHeight) : 0, parentRect.x + parentRect.width - curX);
|
||||
curX += child.width;
|
||||
}
|
||||
// add the remain x to the last one of row
|
||||
if (child != null) {
|
||||
child.width += parentRect.x + parentRect.width - curX;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, parentRect), {}, {
|
||||
y: parentRect.y + rowHeight,
|
||||
height: parentRect.height - rowHeight
|
||||
});
|
||||
};
|
||||
var verticalPosition = (row, parentSize, parentRect, isFlush) => {
|
||||
var rowWidth = parentSize ? Math.round(row.area / parentSize) : 0;
|
||||
if (isFlush || rowWidth > parentRect.width) {
|
||||
rowWidth = parentRect.width;
|
||||
}
|
||||
var curY = parentRect.y;
|
||||
var child;
|
||||
for (var i = 0, len = row.length; i < len; i++) {
|
||||
child = row[i];
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
child.x = parentRect.x;
|
||||
child.y = curY;
|
||||
child.width = rowWidth;
|
||||
child.height = Math.min(rowWidth ? Math.round(child.area / rowWidth) : 0, parentRect.y + parentRect.height - curY);
|
||||
curY += child.height;
|
||||
}
|
||||
if (child) {
|
||||
child.height += parentRect.y + parentRect.height - curY;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, parentRect), {}, {
|
||||
x: parentRect.x + rowWidth,
|
||||
width: parentRect.width - rowWidth
|
||||
});
|
||||
};
|
||||
var position = (row, parentSize, parentRect, isFlush) => {
|
||||
if (parentSize === parentRect.width) {
|
||||
return horizontalPosition(row, parentSize, parentRect, isFlush);
|
||||
}
|
||||
return verticalPosition(row, parentSize, parentRect, isFlush);
|
||||
};
|
||||
// Recursively arranges the specified node's children into squarified rows.
|
||||
var squarify = (node, aspectRatio, nodeInset, nodeGap) => {
|
||||
var children = node.children;
|
||||
if (children && children.length) {
|
||||
var layoutRect = insetRect(filterRect(node), nodeInset);
|
||||
var rect = layoutRect;
|
||||
// @ts-expect-error we can't create an array with static property on a single line so typescript will complain.
|
||||
var row = [];
|
||||
var best = Infinity; // the best row score so far
|
||||
var child, score; // the current row score
|
||||
var size = Math.min(rect.width, rect.height); // initial orientation
|
||||
var scaleChildren = getAreaOfChildren(children, rect.width * rect.height / node[NODE_VALUE_KEY]);
|
||||
var tempChildren = scaleChildren.slice();
|
||||
|
||||
// why are we setting static properties on an array?
|
||||
row.area = 0;
|
||||
while (tempChildren.length > 0) {
|
||||
var _tempChildren = _slicedToArray(tempChildren, 1);
|
||||
child = _tempChildren[0];
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
// row first
|
||||
row.push(child);
|
||||
row.area += child.area;
|
||||
score = getWorstScore(row, size, aspectRatio);
|
||||
if (score <= best) {
|
||||
// continue with this orientation
|
||||
tempChildren.shift();
|
||||
best = score;
|
||||
} else {
|
||||
var _row$pop$area, _row$pop;
|
||||
// abort, and try a different orientation
|
||||
row.area -= (_row$pop$area = (_row$pop = row.pop()) === null || _row$pop === void 0 ? void 0 : _row$pop.area) !== null && _row$pop$area !== void 0 ? _row$pop$area : 0;
|
||||
rect = position(row, size, rect, false);
|
||||
size = Math.min(rect.width, rect.height);
|
||||
row.length = row.area = 0;
|
||||
best = Infinity;
|
||||
}
|
||||
}
|
||||
if (row.length) {
|
||||
rect = position(row, size, rect, true);
|
||||
row.length = row.area = 0;
|
||||
}
|
||||
var childrenWithGaps = applyGapToChildren(scaleChildren, layoutRect, nodeGap);
|
||||
return _objectSpread(_objectSpread({}, node), {}, {
|
||||
children: childrenWithGaps.map(c => squarify(c, aspectRatio, nodeInset, nodeGap))
|
||||
});
|
||||
}
|
||||
return node;
|
||||
};
|
||||
export var defaultTreeMapProps = _objectSpread({
|
||||
aspectRatio: 0.5 * (1 + Math.sqrt(5)),
|
||||
nodeInset: 0,
|
||||
nodeGap: 0,
|
||||
dataKey: 'value',
|
||||
nameKey: 'name',
|
||||
type: 'flat',
|
||||
isAnimationActive: 'auto',
|
||||
isUpdateAnimationActive: 'auto',
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'linear'
|
||||
}, initialEventSettingsState);
|
||||
var defaultState = {
|
||||
isAnimationFinished: false,
|
||||
formatRoot: null,
|
||||
currentRoot: undefined,
|
||||
nestIndex: [],
|
||||
prevAspectRatio: defaultTreeMapProps.aspectRatio,
|
||||
prevNodeInset: defaultTreeMapProps.nodeInset,
|
||||
prevNodeGap: defaultTreeMapProps.nodeGap,
|
||||
prevDataKey: defaultTreeMapProps.dataKey
|
||||
};
|
||||
function ContentItem(_ref2) {
|
||||
var content = _ref2.content,
|
||||
nodeProps = _ref2.nodeProps,
|
||||
type = _ref2.type,
|
||||
colorPanel = _ref2.colorPanel,
|
||||
onMouseEnter = _ref2.onMouseEnter,
|
||||
onMouseLeave = _ref2.onMouseLeave,
|
||||
onClick = _ref2.onClick;
|
||||
if (/*#__PURE__*/React.isValidElement(content)) {
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick
|
||||
}, /*#__PURE__*/React.cloneElement(content, nodeProps));
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick
|
||||
}, content(nodeProps));
|
||||
}
|
||||
// optimize default shape
|
||||
var x = nodeProps.x,
|
||||
y = nodeProps.y,
|
||||
width = nodeProps.width,
|
||||
height = nodeProps.height,
|
||||
index = nodeProps.index;
|
||||
var arrow = null;
|
||||
if (width > 10 && height > 10 && nodeProps.children && type === 'nest' && nodeProps.depth > 0) {
|
||||
arrow = /*#__PURE__*/React.createElement(Polygon, {
|
||||
points: [{
|
||||
x: x + 2,
|
||||
y: y + height / 2
|
||||
}, {
|
||||
x: x + 6,
|
||||
y: y + height / 2 + 3
|
||||
}, {
|
||||
x: x + 2,
|
||||
y: y + height / 2 + 6
|
||||
}]
|
||||
});
|
||||
}
|
||||
var text = null;
|
||||
var nameSize = getStringSize(nodeProps.name);
|
||||
if (width > 20 && height > 20 && nameSize.width < width && nameSize.height < height) {
|
||||
text = /*#__PURE__*/React.createElement("text", {
|
||||
x: x + 8,
|
||||
y: y + height / 2 + 7,
|
||||
fontSize: 14
|
||||
}, nodeProps.name);
|
||||
}
|
||||
var colors = colorPanel || COLOR_PANEL;
|
||||
return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement(Rectangle, _extends({
|
||||
fill: nodeProps.depth < 2 ? colors[index % colors.length] : 'rgba(255,255,255,0)',
|
||||
stroke: "#fff"
|
||||
}, omit(nodeProps, ['children']), {
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick,
|
||||
"data-recharts-item-index": nodeProps.tooltipIndex
|
||||
})), arrow, text);
|
||||
}
|
||||
function ContentItemWithEvents(props) {
|
||||
var dispatch = useAppDispatch();
|
||||
var activeCoordinate = {
|
||||
x: props.nodeProps.x + props.nodeProps.width / 2,
|
||||
y: props.nodeProps.y + props.nodeProps.height / 2
|
||||
};
|
||||
var onMouseEnter = () => {
|
||||
dispatch(setActiveMouseOverItemIndex({
|
||||
activeIndex: props.nodeProps.tooltipIndex,
|
||||
activeDataKey: props.dataKey,
|
||||
activeCoordinate,
|
||||
activeGraphicalItemId: props.id
|
||||
}));
|
||||
};
|
||||
var onMouseLeave = () => {
|
||||
// clearing state on mouseLeaveItem causes re-rendering issues
|
||||
// we don't actually want to do this for TreeMap - we clear state when we leave the entire chart instead
|
||||
};
|
||||
var onClick = () => {
|
||||
dispatch(setActiveClickItemIndex({
|
||||
activeIndex: props.nodeProps.tooltipIndex,
|
||||
activeDataKey: props.dataKey,
|
||||
activeCoordinate,
|
||||
activeGraphicalItemId: props.id
|
||||
}));
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(ContentItem, _extends({}, props, {
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick
|
||||
}));
|
||||
}
|
||||
var SetTreemapTooltipEntrySettings = /*#__PURE__*/React.memo(_ref3 => {
|
||||
var dataKey = _ref3.dataKey,
|
||||
nameKey = _ref3.nameKey,
|
||||
stroke = _ref3.stroke,
|
||||
fill = _ref3.fill,
|
||||
currentRoot = _ref3.currentRoot,
|
||||
id = _ref3.id;
|
||||
var tooltipEntrySettings = {
|
||||
dataDefinedOnItem: currentRoot,
|
||||
getPosition: noop,
|
||||
// TODO I think Treemap has the capability of computing positions and supporting defaultIndex? Except it doesn't yet
|
||||
settings: {
|
||||
stroke,
|
||||
strokeWidth: undefined,
|
||||
fill,
|
||||
dataKey,
|
||||
nameKey,
|
||||
name: undefined,
|
||||
// Each TreemapNode has its own name
|
||||
hide: false,
|
||||
type: undefined,
|
||||
color: fill,
|
||||
unit: '',
|
||||
graphicalItemId: id
|
||||
}
|
||||
};
|
||||
return /*#__PURE__*/React.createElement(SetTooltipEntrySettings, {
|
||||
tooltipEntrySettings: tooltipEntrySettings
|
||||
});
|
||||
});
|
||||
|
||||
// Why is margin not a treemap prop? No clue. Probably it should be
|
||||
var defaultTreemapMargin = {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
};
|
||||
function TreemapItem(_ref4) {
|
||||
var content = _ref4.content,
|
||||
nodeProps = _ref4.nodeProps,
|
||||
isLeaf = _ref4.isLeaf,
|
||||
treemapProps = _ref4.treemapProps,
|
||||
onNestClick = _ref4.onNestClick;
|
||||
var id = treemapProps.id,
|
||||
isAnimationActive = treemapProps.isAnimationActive,
|
||||
animationBegin = treemapProps.animationBegin,
|
||||
animationDuration = treemapProps.animationDuration,
|
||||
animationEasing = treemapProps.animationEasing,
|
||||
isUpdateAnimationActive = treemapProps.isUpdateAnimationActive,
|
||||
type = treemapProps.type,
|
||||
colorPanel = treemapProps.colorPanel,
|
||||
dataKey = treemapProps.dataKey,
|
||||
onAnimationStart = treemapProps.onAnimationStart,
|
||||
onAnimationEnd = treemapProps.onAnimationEnd,
|
||||
onMouseEnterFromProps = treemapProps.onMouseEnter,
|
||||
onItemClickFromProps = treemapProps.onClick,
|
||||
onMouseLeaveFromProps = treemapProps.onMouseLeave;
|
||||
var width = nodeProps.width,
|
||||
height = nodeProps.height,
|
||||
x = nodeProps.x,
|
||||
y = nodeProps.y;
|
||||
var translateX = -x - width;
|
||||
var translateY = 0;
|
||||
var onMouseEnter = e => {
|
||||
if ((isLeaf || type === 'nest') && typeof onMouseEnterFromProps === 'function') {
|
||||
onMouseEnterFromProps(nodeProps, e);
|
||||
}
|
||||
};
|
||||
var onMouseLeave = e => {
|
||||
if ((isLeaf || type === 'nest') && typeof onMouseLeaveFromProps === 'function') {
|
||||
onMouseLeaveFromProps(nodeProps, e);
|
||||
}
|
||||
};
|
||||
var onClick = () => {
|
||||
if (type === 'nest' && nodeProps.depth > 0) {
|
||||
onNestClick(nodeProps);
|
||||
}
|
||||
if ((isLeaf || type === 'nest') && typeof onItemClickFromProps === 'function') {
|
||||
onItemClickFromProps(nodeProps);
|
||||
}
|
||||
};
|
||||
var handleAnimationEnd = useCallback(() => {
|
||||
if (typeof onAnimationEnd === 'function') {
|
||||
onAnimationEnd();
|
||||
}
|
||||
}, [onAnimationEnd]);
|
||||
var handleAnimationStart = useCallback(() => {
|
||||
if (typeof onAnimationStart === 'function') {
|
||||
onAnimationStart();
|
||||
}
|
||||
}, [onAnimationStart]);
|
||||
return /*#__PURE__*/React.createElement(CSSTransitionAnimate, {
|
||||
animationId: "treemap-".concat(nodeProps.tooltipIndex),
|
||||
from: "translate(".concat(translateX, "px, ").concat(translateY, "px)"),
|
||||
to: "translate(0, 0)",
|
||||
attributeName: "transform",
|
||||
begin: animationBegin,
|
||||
easing: extractCssEasing(animationEasing),
|
||||
isActive: isAnimationActive,
|
||||
duration: animationDuration,
|
||||
onAnimationStart: handleAnimationStart,
|
||||
onAnimationEnd: handleAnimationEnd
|
||||
}, style => /*#__PURE__*/React.createElement(Layer, {
|
||||
onMouseEnter: onMouseEnter,
|
||||
onMouseLeave: onMouseLeave,
|
||||
onClick: onClick,
|
||||
style: _objectSpread(_objectSpread({}, style), {}, {
|
||||
transformOrigin: "".concat(x, " ").concat(y)
|
||||
})
|
||||
}, /*#__PURE__*/React.createElement(ContentItemWithEvents, {
|
||||
id: id,
|
||||
content: content,
|
||||
dataKey: dataKey,
|
||||
nodeProps: _objectSpread(_objectSpread({}, nodeProps), {}, {
|
||||
isAnimationActive,
|
||||
isUpdateAnimationActive: !isUpdateAnimationActive,
|
||||
width,
|
||||
height,
|
||||
x,
|
||||
y
|
||||
}),
|
||||
type: type,
|
||||
colorPanel: colorPanel
|
||||
})));
|
||||
}
|
||||
class TreemapWithState extends PureComponent {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
_defineProperty(this, "state", _objectSpread({}, defaultState));
|
||||
_defineProperty(this, "handleClick", node => {
|
||||
var _this$props = this.props,
|
||||
onClick = _this$props.onClick,
|
||||
type = _this$props.type;
|
||||
if (type === 'nest' && node.children) {
|
||||
var _this$props2 = this.props,
|
||||
width = _this$props2.width,
|
||||
height = _this$props2.height,
|
||||
dataKey = _this$props2.dataKey,
|
||||
nameKey = _this$props2.nameKey,
|
||||
aspectRatio = _this$props2.aspectRatio,
|
||||
nodeInset = _this$props2.nodeInset,
|
||||
nodeGap = _this$props2.nodeGap;
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: _objectSpread(_objectSpread({}, node), {}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width,
|
||||
height: getTreemapRenderHeight(height, type)
|
||||
}),
|
||||
index: 0,
|
||||
dataKey,
|
||||
nameKey,
|
||||
// with Treemap nesting, should this continue nesting the index or start from empty string?
|
||||
nestedActiveTooltipIndex: node.tooltipIndex
|
||||
});
|
||||
var formatRoot = squarify(root, aspectRatio, nodeInset, nodeGap);
|
||||
var nestIndex = this.state.nestIndex;
|
||||
nestIndex.push(node);
|
||||
this.setState({
|
||||
formatRoot,
|
||||
currentRoot: root,
|
||||
nestIndex
|
||||
});
|
||||
}
|
||||
if (onClick) {
|
||||
onClick(node);
|
||||
}
|
||||
});
|
||||
_defineProperty(this, "handleTouchMove", e => {
|
||||
var touchEvent = e.touches[0];
|
||||
if (touchEvent == null) {
|
||||
return;
|
||||
}
|
||||
var target = document.elementFromPoint(touchEvent.clientX, touchEvent.clientY);
|
||||
if (!target || !target.getAttribute || this.state.formatRoot == null) {
|
||||
return;
|
||||
}
|
||||
var itemIndex = target.getAttribute('data-recharts-item-index');
|
||||
var activeNode = treemapPayloadSearcher(this.state.formatRoot, itemIndex);
|
||||
if (!isTreemapNode(activeNode)) {
|
||||
return;
|
||||
}
|
||||
var _this$props3 = this.props,
|
||||
dataKey = _this$props3.dataKey,
|
||||
dispatch = _this$props3.dispatch;
|
||||
var activeCoordinate = {
|
||||
x: activeNode.x + activeNode.width / 2,
|
||||
y: activeNode.y + activeNode.height / 2
|
||||
};
|
||||
|
||||
// Treemap does not support onTouchMove prop, but it could
|
||||
// onTouchMove?.(activeNode, Number(itemIndex), e);
|
||||
dispatch(setActiveMouseOverItemIndex({
|
||||
activeIndex: itemIndex,
|
||||
activeDataKey: dataKey,
|
||||
activeCoordinate,
|
||||
activeGraphicalItemId: this.props.id
|
||||
}));
|
||||
});
|
||||
}
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.data !== prevState.prevData || nextProps.type !== prevState.prevType || nextProps.width !== prevState.prevWidth || nextProps.height !== prevState.prevHeight || nextProps.dataKey !== prevState.prevDataKey || nextProps.aspectRatio !== prevState.prevAspectRatio || nextProps.nodeInset !== prevState.prevNodeInset || nextProps.nodeGap !== prevState.prevNodeGap) {
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: {
|
||||
// @ts-expect-error missing properties
|
||||
children: nextProps.data,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: nextProps.width,
|
||||
height: getTreemapRenderHeight(nextProps.height, nextProps.type)
|
||||
},
|
||||
index: 0,
|
||||
dataKey: nextProps.dataKey,
|
||||
nameKey: nextProps.nameKey
|
||||
});
|
||||
var formatRoot = squarify(root, nextProps.aspectRatio, nextProps.nodeInset, nextProps.nodeGap);
|
||||
return _objectSpread(_objectSpread({}, prevState), {}, {
|
||||
formatRoot,
|
||||
currentRoot: root,
|
||||
nestIndex: [root],
|
||||
prevAspectRatio: nextProps.aspectRatio,
|
||||
prevData: nextProps.data,
|
||||
prevWidth: nextProps.width,
|
||||
prevHeight: nextProps.height,
|
||||
prevDataKey: nextProps.dataKey,
|
||||
prevType: nextProps.type,
|
||||
prevNodeInset: nextProps.nodeInset,
|
||||
prevNodeGap: nextProps.nodeGap
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
handleNestIndex(node, i) {
|
||||
var nestIndex = this.state.nestIndex;
|
||||
var _this$props4 = this.props,
|
||||
width = _this$props4.width,
|
||||
height = _this$props4.height,
|
||||
dataKey = _this$props4.dataKey,
|
||||
nameKey = _this$props4.nameKey,
|
||||
aspectRatio = _this$props4.aspectRatio,
|
||||
nodeInset = _this$props4.nodeInset,
|
||||
nodeGap = _this$props4.nodeGap,
|
||||
type = _this$props4.type;
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: _objectSpread(_objectSpread({}, node), {}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width,
|
||||
height: getTreemapRenderHeight(height, type)
|
||||
}),
|
||||
index: 0,
|
||||
dataKey,
|
||||
nameKey,
|
||||
// with Treemap nesting, should this continue nesting the index or start from empty string?
|
||||
nestedActiveTooltipIndex: node.tooltipIndex
|
||||
});
|
||||
var formatRoot = squarify(root, aspectRatio, nodeInset, nodeGap);
|
||||
nestIndex = nestIndex.slice(0, i + 1);
|
||||
this.setState({
|
||||
formatRoot,
|
||||
currentRoot: node,
|
||||
nestIndex
|
||||
});
|
||||
}
|
||||
renderNode(root, node) {
|
||||
var _this$props5 = this.props,
|
||||
content = _this$props5.content,
|
||||
type = _this$props5.type;
|
||||
var nodeProps = _objectSpread(_objectSpread(_objectSpread({}, svgPropertiesNoEvents(this.props)), node), {}, {
|
||||
root
|
||||
});
|
||||
var isLeaf = !node.children || !node.children.length;
|
||||
var currentRoot = this.state.currentRoot;
|
||||
var isCurrentRootChild = ((currentRoot === null || currentRoot === void 0 ? void 0 : currentRoot.children) || []).filter(item => item.depth === node.depth && item.name === node.name);
|
||||
if (!isCurrentRootChild.length && root.depth && type === 'nest') {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(Layer, {
|
||||
key: "recharts-treemap-node-".concat(nodeProps.x, "-").concat(nodeProps.y, "-").concat(nodeProps.name),
|
||||
className: "recharts-treemap-depth-".concat(node.depth)
|
||||
}, /*#__PURE__*/React.createElement(TreemapItem, {
|
||||
isLeaf: isLeaf,
|
||||
content: content,
|
||||
nodeProps: nodeProps,
|
||||
treemapProps: this.props,
|
||||
onNestClick: this.handleClick
|
||||
}), node.children && node.children.length ? node.children.map(child => this.renderNode(node, child)) : null);
|
||||
}
|
||||
renderAllNodes() {
|
||||
var formatRoot = this.state.formatRoot;
|
||||
if (!formatRoot) {
|
||||
return null;
|
||||
}
|
||||
return this.renderNode(formatRoot, formatRoot);
|
||||
}
|
||||
|
||||
// render nest treemap
|
||||
renderNestIndex() {
|
||||
var _this$props6 = this.props,
|
||||
nameKey = _this$props6.nameKey,
|
||||
nestIndexContent = _this$props6.nestIndexContent;
|
||||
var nestIndex = this.state.nestIndex;
|
||||
return /*#__PURE__*/React.createElement("div", {
|
||||
className: "recharts-treemap-nest-index-wrapper",
|
||||
style: {
|
||||
marginTop: '8px',
|
||||
textAlign: 'center'
|
||||
}
|
||||
}, nestIndex.map((item, i) => {
|
||||
// TODO need to verify nameKey type
|
||||
var rawName = get(item, nameKey, 'root');
|
||||
var name = typeof rawName === 'string' ? rawName : 'root';
|
||||
var content;
|
||||
if (/*#__PURE__*/React.isValidElement(nestIndexContent)) {
|
||||
// the cloned content is ignored at all times - let's remove it?
|
||||
content = /*#__PURE__*/React.cloneElement(nestIndexContent, item, i);
|
||||
}
|
||||
if (typeof nestIndexContent === 'function') {
|
||||
content = nestIndexContent(item, i);
|
||||
} else {
|
||||
content = name;
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
||||
React.createElement("div", {
|
||||
onClick: this.handleNestIndex.bind(this, item, i),
|
||||
key: "nest-index-".concat(uniqueId()),
|
||||
className: "recharts-treemap-nest-index-box",
|
||||
style: {
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
padding: '0 7px',
|
||||
background: '#000',
|
||||
color: '#fff',
|
||||
marginRight: '3px'
|
||||
}
|
||||
}, content)
|
||||
);
|
||||
}));
|
||||
}
|
||||
render() {
|
||||
var _this$props7 = this.props,
|
||||
width = _this$props7.width,
|
||||
height = _this$props7.height,
|
||||
className = _this$props7.className,
|
||||
style = _this$props7.style,
|
||||
children = _this$props7.children,
|
||||
type = _this$props7.type,
|
||||
others = _objectWithoutProperties(_this$props7, _excluded);
|
||||
var attrs = svgPropertiesNoEvents(others);
|
||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SetTreemapTooltipEntrySettings, {
|
||||
dataKey: this.props.dataKey,
|
||||
nameKey: this.props.nameKey,
|
||||
stroke: this.props.stroke,
|
||||
fill: this.props.fill,
|
||||
currentRoot: this.state.currentRoot,
|
||||
id: this.props.id
|
||||
}), /*#__PURE__*/React.createElement(Surface, _extends({}, attrs, {
|
||||
width: width,
|
||||
height: getTreemapRenderHeight(height, type),
|
||||
onTouchMove: this.handleTouchMove
|
||||
}), this.renderAllNodes(), children), type === 'nest' && this.renderNestIndex());
|
||||
}
|
||||
}
|
||||
_defineProperty(TreemapWithState, "displayName", 'Treemap');
|
||||
function TreemapDispatchInject(props) {
|
||||
var dispatch = useAppDispatch();
|
||||
var width = useChartWidth();
|
||||
var height = useChartHeight();
|
||||
if (!isPositiveNumber(width) || !isPositiveNumber(height)) {
|
||||
return null;
|
||||
}
|
||||
var externalId = props.id;
|
||||
return /*#__PURE__*/React.createElement(RegisterGraphicalItemId, {
|
||||
id: externalId,
|
||||
type: "treemap"
|
||||
}, id => /*#__PURE__*/React.createElement(TreemapWithState, _extends({}, props, {
|
||||
id: id,
|
||||
width: width,
|
||||
height: height,
|
||||
dispatch: dispatch
|
||||
})));
|
||||
}
|
||||
|
||||
/**
|
||||
* The Treemap chart is used to visualize hierarchical data using nested rectangles.
|
||||
*
|
||||
* @consumes ResponsiveContainerContext
|
||||
* @provides TooltipEntrySettings
|
||||
*/
|
||||
export function Treemap(outsideProps) {
|
||||
var _props$className;
|
||||
var props = resolveDefaultProps(outsideProps, defaultTreeMapProps);
|
||||
var className = props.className,
|
||||
style = props.style,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
throttleDelay = props.throttleDelay,
|
||||
throttledEvents = props.throttledEvents;
|
||||
var _useState = useState(null),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
tooltipPortal = _useState2[0],
|
||||
setTooltipPortal = _useState2[1];
|
||||
return /*#__PURE__*/React.createElement(RechartsStoreProvider, {
|
||||
preloadedState: {
|
||||
options
|
||||
},
|
||||
reduxStoreName: (_props$className = props.className) !== null && _props$className !== void 0 ? _props$className : 'Treemap'
|
||||
}, /*#__PURE__*/React.createElement(ReportChartMargin, {
|
||||
margin: defaultTreemapMargin
|
||||
}), /*#__PURE__*/React.createElement(ReportEventSettings, {
|
||||
throttleDelay: throttleDelay,
|
||||
throttledEvents: throttledEvents
|
||||
}), /*#__PURE__*/React.createElement(RechartsWrapper, {
|
||||
dispatchTouchEvents: false,
|
||||
className: className,
|
||||
style: style,
|
||||
width: width,
|
||||
height: height
|
||||
/*
|
||||
* Treemap has a bug where it doesn't include strokeWidth in its dimension calculation
|
||||
* which makes the actual chart exactly {strokeWidth} larger than asked for.
|
||||
* It's not a huge deal usually, but it makes the responsive option cycle infinitely.
|
||||
*/,
|
||||
responsive: false,
|
||||
ref: node => {
|
||||
if (tooltipPortal == null && node != null) {
|
||||
setTooltipPortal(node);
|
||||
}
|
||||
},
|
||||
onMouseEnter: undefined,
|
||||
onMouseLeave: undefined,
|
||||
onClick: undefined,
|
||||
onMouseMove: undefined,
|
||||
onMouseDown: undefined,
|
||||
onMouseUp: undefined,
|
||||
onContextMenu: undefined,
|
||||
onDoubleClick: undefined,
|
||||
onTouchStart: undefined,
|
||||
onTouchMove: undefined,
|
||||
onTouchEnd: undefined
|
||||
}, /*#__PURE__*/React.createElement(TooltipPortalContext.Provider, {
|
||||
value: tooltipPortal
|
||||
}, /*#__PURE__*/React.createElement(TreemapDispatchInject, props))));
|
||||
}
|
||||
1
frontend/node_modules/recharts/es6/chart/types.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/es6/chart/types.js
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue