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
74
frontend/node_modules/recharts/lib/context/ErrorBarContext.js
generated
vendored
Normal file
74
frontend/node_modules/recharts/lib/context/ErrorBarContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ReportErrorBarSettings = ReportErrorBarSettings;
|
||||
exports.SetErrorBarContext = SetErrorBarContext;
|
||||
exports.useErrorBarContext = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var React = _react;
|
||||
var _errorBarSlice = require("../state/errorBarSlice");
|
||||
var _hooks = require("../state/hooks");
|
||||
var _RegisterGraphicalItemId = require("./RegisterGraphicalItemId");
|
||||
var _excluded = ["children"];
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
||||
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
||||
var initialContextState = {
|
||||
data: [],
|
||||
xAxisId: 'xAxis-0',
|
||||
yAxisId: 'yAxis-0',
|
||||
dataPointFormatter: () => ({
|
||||
x: 0,
|
||||
y: 0,
|
||||
value: 0
|
||||
}),
|
||||
errorBarOffset: 0
|
||||
};
|
||||
var ErrorBarContext = /*#__PURE__*/(0, _react.createContext)(initialContextState);
|
||||
function SetErrorBarContext(props) {
|
||||
var children = props.children,
|
||||
rest = _objectWithoutProperties(props, _excluded);
|
||||
return /*#__PURE__*/React.createElement(ErrorBarContext.Provider, {
|
||||
value: rest
|
||||
}, children);
|
||||
}
|
||||
var useErrorBarContext = () => (0, _react.useContext)(ErrorBarContext);
|
||||
exports.useErrorBarContext = useErrorBarContext;
|
||||
function ReportErrorBarSettings(props) {
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
var graphicalItemId = (0, _RegisterGraphicalItemId.useGraphicalItemId)();
|
||||
var prevPropsRef = (0, _react.useRef)(null);
|
||||
(0, _react.useEffect)(() => {
|
||||
if (graphicalItemId == null) {
|
||||
// ErrorBar outside a graphical item context does not do anything.
|
||||
return;
|
||||
}
|
||||
if (prevPropsRef.current === null) {
|
||||
dispatch((0, _errorBarSlice.addErrorBar)({
|
||||
itemId: graphicalItemId,
|
||||
errorBar: props
|
||||
}));
|
||||
} else if (prevPropsRef.current !== props) {
|
||||
dispatch((0, _errorBarSlice.replaceErrorBar)({
|
||||
itemId: graphicalItemId,
|
||||
prev: prevPropsRef.current,
|
||||
next: props
|
||||
}));
|
||||
}
|
||||
prevPropsRef.current = props;
|
||||
}, [dispatch, graphicalItemId, props]);
|
||||
(0, _react.useEffect)(() => {
|
||||
return () => {
|
||||
if (prevPropsRef.current != null && graphicalItemId != null) {
|
||||
dispatch((0, _errorBarSlice.removeErrorBar)({
|
||||
itemId: graphicalItemId,
|
||||
errorBar: prevPropsRef.current
|
||||
}));
|
||||
prevPropsRef.current = null;
|
||||
}
|
||||
};
|
||||
}, [dispatch, graphicalItemId]);
|
||||
return null;
|
||||
}
|
||||
19
frontend/node_modules/recharts/lib/context/PanoramaContext.js
generated
vendored
Normal file
19
frontend/node_modules/recharts/lib/context/PanoramaContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useIsPanorama = exports.PanoramaContextProvider = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var React = _react;
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
var PanoramaContext = /*#__PURE__*/(0, _react.createContext)(null);
|
||||
var useIsPanorama = () => (0, _react.useContext)(PanoramaContext) != null;
|
||||
exports.useIsPanorama = useIsPanorama;
|
||||
var PanoramaContextProvider = _ref => {
|
||||
var children = _ref.children;
|
||||
return /*#__PURE__*/React.createElement(PanoramaContext.Provider, {
|
||||
value: true
|
||||
}, children);
|
||||
};
|
||||
exports.PanoramaContextProvider = PanoramaContextProvider;
|
||||
25
frontend/node_modules/recharts/lib/context/RegisterGraphicalItemId.js
generated
vendored
Normal file
25
frontend/node_modules/recharts/lib/context/RegisterGraphicalItemId.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RegisterGraphicalItemId = void 0;
|
||||
exports.useGraphicalItemId = useGraphicalItemId;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var React = _react;
|
||||
var _useUniqueId = require("../util/useUniqueId");
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
var GraphicalItemIdContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
||||
var RegisterGraphicalItemId = _ref => {
|
||||
var id = _ref.id,
|
||||
type = _ref.type,
|
||||
children = _ref.children;
|
||||
var resolvedId = (0, _useUniqueId.useUniqueId)("recharts-".concat(type), id);
|
||||
return /*#__PURE__*/React.createElement(GraphicalItemIdContext.Provider, {
|
||||
value: resolvedId
|
||||
}, children(resolvedId));
|
||||
};
|
||||
exports.RegisterGraphicalItemId = RegisterGraphicalItemId;
|
||||
function useGraphicalItemId() {
|
||||
return (0, _react.useContext)(GraphicalItemIdContext);
|
||||
}
|
||||
12
frontend/node_modules/recharts/lib/context/accessibilityContext.js
generated
vendored
Normal file
12
frontend/node_modules/recharts/lib/context/accessibilityContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useAccessibilityLayer = void 0;
|
||||
var _hooks = require("../state/hooks");
|
||||
var useAccessibilityLayer = () => {
|
||||
var _useAppSelector;
|
||||
return (_useAppSelector = (0, _hooks.useAppSelector)(state => state.rootProps.accessibilityLayer)) !== null && _useAppSelector !== void 0 ? _useAppSelector : true;
|
||||
};
|
||||
exports.useAccessibilityLayer = useAccessibilityLayer;
|
||||
8
frontend/node_modules/recharts/lib/context/brushUpdateContext.js
generated
vendored
Normal file
8
frontend/node_modules/recharts/lib/context/brushUpdateContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BrushUpdateDispatchContext = void 0;
|
||||
var _react = require("react");
|
||||
var BrushUpdateDispatchContext = exports.BrushUpdateDispatchContext = /*#__PURE__*/(0, _react.createContext)(() => {});
|
||||
83
frontend/node_modules/recharts/lib/context/chartDataContext.js
generated
vendored
Normal file
83
frontend/node_modules/recharts/lib/context/chartDataContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useDataIndex = exports.useChartData = exports.SetComputedData = exports.ChartDataContextProvider = void 0;
|
||||
var _react = require("react");
|
||||
var _chartDataSlice = require("../state/chartDataSlice");
|
||||
var _hooks = require("../state/hooks");
|
||||
var _PanoramaContext = require("./PanoramaContext");
|
||||
var ChartDataContextProvider = props => {
|
||||
var chartData = props.chartData;
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
var isPanorama = (0, _PanoramaContext.useIsPanorama)();
|
||||
(0, _react.useEffect)(() => {
|
||||
if (isPanorama) {
|
||||
// Panorama mode reuses data from the main chart, so we must not overwrite it here.
|
||||
return () => {
|
||||
// there is nothing to clean up
|
||||
};
|
||||
}
|
||||
dispatch((0, _chartDataSlice.setChartData)(chartData));
|
||||
return () => {
|
||||
dispatch((0, _chartDataSlice.setChartData)(undefined));
|
||||
};
|
||||
}, [chartData, dispatch, isPanorama]);
|
||||
return null;
|
||||
};
|
||||
exports.ChartDataContextProvider = ChartDataContextProvider;
|
||||
var SetComputedData = props => {
|
||||
var computedData = props.computedData;
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
(0, _react.useEffect)(() => {
|
||||
dispatch((0, _chartDataSlice.setComputedData)(computedData));
|
||||
return () => {
|
||||
dispatch((0, _chartDataSlice.setChartData)(undefined));
|
||||
};
|
||||
}, [computedData, dispatch]);
|
||||
return null;
|
||||
};
|
||||
exports.SetComputedData = SetComputedData;
|
||||
var selectChartData = state => state.chartData.chartData;
|
||||
|
||||
/**
|
||||
* "data" is the data of the chart - it has no type because this part of recharts is very flexible.
|
||||
* Basically it's an array of "something" and then there's the dataKey property in various places
|
||||
* that's meant to pull other things away from the data.
|
||||
*
|
||||
* Some charts have `data` defined on the chart root, and they will return the array through this hook.
|
||||
* For example: <ComposedChart data={data} />.
|
||||
*
|
||||
* Other charts, such as Pie, have data defined on individual graphical elements.
|
||||
* These charts will return `undefined` through this hook, and you need to read the data from children.
|
||||
* For example: <PieChart><Pie data={data} />
|
||||
*
|
||||
* Some charts also allow setting both - data on the parent, and data on the children at the same time!
|
||||
* However, this particular selector will only return the ones defined on the parent.
|
||||
*
|
||||
* @deprecated use one of the other selectors instead - which one, depends on how do you identify the applicable graphical items.
|
||||
*
|
||||
* @return data array for some charts and undefined for other
|
||||
*/
|
||||
var useChartData = () => (0, _hooks.useAppSelector)(selectChartData);
|
||||
exports.useChartData = useChartData;
|
||||
var selectDataIndex = state => {
|
||||
var _state$chartData = state.chartData,
|
||||
dataStartIndex = _state$chartData.dataStartIndex,
|
||||
dataEndIndex = _state$chartData.dataEndIndex;
|
||||
return {
|
||||
startIndex: dataStartIndex,
|
||||
endIndex: dataEndIndex
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* startIndex and endIndex are data boundaries, set through Brush.
|
||||
*
|
||||
* @return object with startIndex and endIndex
|
||||
*/
|
||||
var useDataIndex = () => {
|
||||
return (0, _hooks.useAppSelector)(selectDataIndex);
|
||||
};
|
||||
exports.useDataIndex = useDataIndex;
|
||||
263
frontend/node_modules/recharts/lib/context/chartLayoutContext.js
generated
vendored
Normal file
263
frontend/node_modules/recharts/lib/context/chartLayoutContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ReportChartSize = exports.ReportChartMargin = void 0;
|
||||
exports.cartesianViewBoxToTrapezoid = cartesianViewBoxToTrapezoid;
|
||||
exports.useViewBox = exports.usePolarChartLayout = exports.useOffsetInternal = exports.useMargin = exports.useIsInChartContext = exports.useChartWidth = exports.useChartLayout = exports.useChartHeight = exports.useCartesianChartLayout = exports.selectPolarChartLayout = exports.selectChartLayout = void 0;
|
||||
var _react = require("react");
|
||||
var _hooks = require("../state/hooks");
|
||||
var _layoutSlice = require("../state/layoutSlice");
|
||||
var _selectChartOffsetInternal = require("../state/selectors/selectChartOffsetInternal");
|
||||
var _containerSelectors = require("../state/selectors/containerSelectors");
|
||||
var _PanoramaContext = require("./PanoramaContext");
|
||||
var _brushSelectors = require("../state/selectors/brushSelectors");
|
||||
var _ResponsiveContainer = require("../component/ResponsiveContainer");
|
||||
var _isWellBehavedNumber = require("../util/isWellBehavedNumber");
|
||||
function cartesianViewBoxToTrapezoid(box) {
|
||||
if (!box) {
|
||||
return undefined;
|
||||
}
|
||||
return {
|
||||
x: box.x,
|
||||
y: box.y,
|
||||
upperWidth: 'upperWidth' in box ? box.upperWidth : box.width,
|
||||
lowerWidth: 'lowerWidth' in box ? box.lowerWidth : box.width,
|
||||
width: box.width,
|
||||
height: box.height
|
||||
};
|
||||
}
|
||||
var useViewBox = () => {
|
||||
var _useAppSelector;
|
||||
var panorama = (0, _PanoramaContext.useIsPanorama)();
|
||||
var rootViewBox = (0, _hooks.useAppSelector)(_selectChartOffsetInternal.selectChartViewBox);
|
||||
var brushDimensions = (0, _hooks.useAppSelector)(_brushSelectors.selectBrushDimensions);
|
||||
var brushPadding = (_useAppSelector = (0, _hooks.useAppSelector)(_brushSelectors.selectBrushSettings)) === null || _useAppSelector === void 0 ? void 0 : _useAppSelector.padding;
|
||||
if (!panorama || !brushDimensions || !brushPadding) {
|
||||
return rootViewBox;
|
||||
}
|
||||
return {
|
||||
width: brushDimensions.width - brushPadding.left - brushPadding.right,
|
||||
height: brushDimensions.height - brushPadding.top - brushPadding.bottom,
|
||||
x: brushPadding.left,
|
||||
y: brushPadding.top
|
||||
};
|
||||
};
|
||||
exports.useViewBox = useViewBox;
|
||||
var manyComponentsThrowErrorsIfOffsetIsUndefined = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
brushBottom: 0
|
||||
};
|
||||
/**
|
||||
* For internal use only. If you want this information, `import { useOffset } from 'recharts'` instead.
|
||||
*
|
||||
* Returns the offset of the chart in pixels.
|
||||
*
|
||||
* @returns {ChartOffsetInternal} The offset of the chart in pixels, or a default value if not in a chart context.
|
||||
*/
|
||||
var useOffsetInternal = () => {
|
||||
var _useAppSelector2;
|
||||
return (_useAppSelector2 = (0, _hooks.useAppSelector)(_selectChartOffsetInternal.selectChartOffsetInternal)) !== null && _useAppSelector2 !== void 0 ? _useAppSelector2 : manyComponentsThrowErrorsIfOffsetIsUndefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the width of the chart in pixels.
|
||||
*
|
||||
* If you are using chart with hardcoded `width` prop, then the width returned will be the same
|
||||
* as the `width` prop on the main chart element.
|
||||
*
|
||||
* If you are using a chart with a `ResponsiveContainer`, the width will be the size of the chart
|
||||
* as the ResponsiveContainer has decided it would be.
|
||||
*
|
||||
* If the chart has any axes or legend, the `width` will be the size of the chart
|
||||
* including the axes and legend. Meaning: adding axes and legend will not change the width.
|
||||
*
|
||||
* The dimensions do not scale, meaning as user zoom in and out, the width number will not change
|
||||
* as the chart gets visually larger or smaller.
|
||||
*
|
||||
* Returns `undefined` if used outside a chart context.
|
||||
*
|
||||
* @returns {number | undefined} The width of the chart in pixels, or `undefined` if not in a chart context.
|
||||
*/
|
||||
exports.useOffsetInternal = useOffsetInternal;
|
||||
var useChartWidth = () => {
|
||||
return (0, _hooks.useAppSelector)(_containerSelectors.selectChartWidth);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the height of the chart in pixels.
|
||||
*
|
||||
* If you are using chart with hardcoded `height` props, then the height returned will be the same
|
||||
* as the `height` prop on the main chart element.
|
||||
*
|
||||
* If you are using a chart with a `ResponsiveContainer`, the height will be the size of the chart
|
||||
* as the ResponsiveContainer has decided it would be.
|
||||
*
|
||||
* If the chart has any axes or legend, the `height` will be the size of the chart
|
||||
* including the axes and legend. Meaning: adding axes and legend will not change the height.
|
||||
*
|
||||
* The dimensions do not scale, meaning as user zoom in and out, the height number will not change
|
||||
* as the chart gets visually larger or smaller.
|
||||
*
|
||||
* Returns `undefined` if used outside a chart context.
|
||||
*
|
||||
* @returns {number | undefined} The height of the chart in pixels, or `undefined` if not in a chart context.
|
||||
*/
|
||||
exports.useChartWidth = useChartWidth;
|
||||
var useChartHeight = () => {
|
||||
return (0, _hooks.useAppSelector)(_containerSelectors.selectChartHeight);
|
||||
};
|
||||
|
||||
/**
|
||||
* Margin is the empty space around the chart. Excludes axes and legend and brushes and the like.
|
||||
* This is declared by the user in the chart props.
|
||||
* If you are interested in the space occupied by axes, legend, or brushes,
|
||||
* use {@link useOffset} instead, which also includes calculated widths and heights of axes and legends.
|
||||
*
|
||||
* Returns `undefined` if used outside a chart context.
|
||||
*
|
||||
* @returns {Margin | undefined} The margin of the chart in pixels, or `undefined` if not in a chart context.
|
||||
*/
|
||||
exports.useChartHeight = useChartHeight;
|
||||
var useMargin = () => {
|
||||
return (0, _hooks.useAppSelector)(state => state.layout.margin);
|
||||
};
|
||||
exports.useMargin = useMargin;
|
||||
var selectChartLayout = state => state.layout.layoutType;
|
||||
|
||||
/**
|
||||
* Returns the chart layout as configured by the chart.
|
||||
*
|
||||
* Cartesian charts use `horizontal` or `vertical`.
|
||||
* Polar charts use `centric` or `radial`.
|
||||
*
|
||||
* Returns `undefined` if used outside a chart context.
|
||||
*
|
||||
* @deprecated this hook mixes cartesian and polar layouts together; prefer to use {@link useCartesianChartLayout} and {@link usePolarChartLayout} instead, which give you better type safety.
|
||||
*
|
||||
* @returns {LayoutType | undefined} The chart layout, or `undefined` if not in a chart context.
|
||||
*
|
||||
* @since 3.9
|
||||
*/
|
||||
exports.selectChartLayout = selectChartLayout;
|
||||
var useChartLayout = () => (0, _hooks.useAppSelector)(selectChartLayout);
|
||||
|
||||
/**
|
||||
* Returns the chart layout only for Cartesian charts.
|
||||
*
|
||||
* Returns `horizontal` or `vertical` for Cartesian charts.
|
||||
* Returns `undefined` for non-Cartesian charts or outside chart context.
|
||||
*
|
||||
* @since 3.9
|
||||
*
|
||||
* @returns {CartesianLayout | undefined} The Cartesian chart layout, or `undefined`.
|
||||
*/
|
||||
exports.useChartLayout = useChartLayout;
|
||||
var useCartesianChartLayout = () => {
|
||||
var layout = useChartLayout();
|
||||
if (layout === 'horizontal' || layout === 'vertical') {
|
||||
return layout;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
exports.useCartesianChartLayout = useCartesianChartLayout;
|
||||
var selectPolarChartLayout = state => {
|
||||
var layout = state.layout.layoutType;
|
||||
if (layout === 'centric' || layout === 'radial') {
|
||||
return layout;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the chart layout only for Polar charts.
|
||||
*
|
||||
* Returns `centric` or `radial` for Polar charts.
|
||||
* Returns `undefined` for non-Polar charts or outside chart context.
|
||||
*
|
||||
* @returns {PolarLayout | undefined} The Polar chart layout, or `undefined`.
|
||||
*
|
||||
* @since 3.9
|
||||
*/
|
||||
exports.selectPolarChartLayout = selectPolarChartLayout;
|
||||
var usePolarChartLayout = () => {
|
||||
return (0, _hooks.useAppSelector)(selectPolarChartLayout);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the component is rendered inside a chart context.
|
||||
* Some components may be used both inside and outside of charts,
|
||||
* and this hook allows them to determine if they are in a chart context or not.
|
||||
*
|
||||
* Other selectors may return undefined when used outside a chart context,
|
||||
* or undefined when inside a chart, but without relevant data.
|
||||
* This hook provides a more explicit way to check for chart context.
|
||||
*
|
||||
* @returns {boolean} True if in chart context, false otherwise.
|
||||
*/
|
||||
exports.usePolarChartLayout = usePolarChartLayout;
|
||||
var useIsInChartContext = () => {
|
||||
/*
|
||||
* All charts provide a layout type in the chart context.
|
||||
* If we have a layout type, we are in a chart context.
|
||||
*/
|
||||
var layout = useChartLayout();
|
||||
return layout !== undefined;
|
||||
};
|
||||
exports.useIsInChartContext = useIsInChartContext;
|
||||
var ReportChartSize = props => {
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
|
||||
/*
|
||||
* Skip dispatching properties in panorama chart for two reasons:
|
||||
* 1. The root chart should be deciding on these properties, and
|
||||
* 2. Brush reads these properties from redux store, and so they must remain stable
|
||||
* to avoid circular dependency and infinite re-rendering.
|
||||
*/
|
||||
var isPanorama = (0, _PanoramaContext.useIsPanorama)();
|
||||
var widthFromProps = props.width,
|
||||
heightFromProps = props.height;
|
||||
var responsiveContainerCalculations = (0, _ResponsiveContainer.useResponsiveContainerContext)();
|
||||
var width = widthFromProps;
|
||||
var height = heightFromProps;
|
||||
if (responsiveContainerCalculations) {
|
||||
/*
|
||||
* In case we receive width and height from ResponsiveContainer,
|
||||
* we will always prefer those.
|
||||
* Only in case ResponsiveContainer does not provide width or height,
|
||||
* we will fall back to the explicitly provided width and height.
|
||||
*
|
||||
* This to me feels backwards - we should allow override by the more specific props on individual charts, right?
|
||||
* But this is 3.x behaviour, so let's keep it for backwards compatibility.
|
||||
*
|
||||
* We can change this in 4.x if we want to.
|
||||
*/
|
||||
width = responsiveContainerCalculations.width > 0 ? responsiveContainerCalculations.width : widthFromProps;
|
||||
height = responsiveContainerCalculations.height > 0 ? responsiveContainerCalculations.height : heightFromProps;
|
||||
}
|
||||
(0, _react.useEffect)(() => {
|
||||
if (!isPanorama && (0, _isWellBehavedNumber.isPositiveNumber)(width) && (0, _isWellBehavedNumber.isPositiveNumber)(height)) {
|
||||
dispatch((0, _layoutSlice.setChartSize)({
|
||||
width,
|
||||
height
|
||||
}));
|
||||
}
|
||||
}, [dispatch, isPanorama, width, height]);
|
||||
return null;
|
||||
};
|
||||
exports.ReportChartSize = ReportChartSize;
|
||||
var ReportChartMargin = _ref => {
|
||||
var margin = _ref.margin;
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
(0, _react.useEffect)(() => {
|
||||
dispatch((0, _layoutSlice.setMargin)(margin));
|
||||
}, [dispatch, margin]);
|
||||
return null;
|
||||
};
|
||||
exports.ReportChartMargin = ReportChartMargin;
|
||||
15
frontend/node_modules/recharts/lib/context/legendPayloadContext.js
generated
vendored
Normal file
15
frontend/node_modules/recharts/lib/context/legendPayloadContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useLegendPayload = useLegendPayload;
|
||||
var _hooks = require("../state/hooks");
|
||||
var _legendSelectors = require("../state/selectors/legendSelectors");
|
||||
/**
|
||||
* Use this hook in Legend, or anywhere else where you want to read the current Legend items.
|
||||
* @return all Legend items ready to be rendered
|
||||
*/
|
||||
function useLegendPayload() {
|
||||
return (0, _hooks.useAppSelector)(_legendSelectors.selectLegendPayload);
|
||||
}
|
||||
10
frontend/node_modules/recharts/lib/context/legendPortalContext.js
generated
vendored
Normal file
10
frontend/node_modules/recharts/lib/context/legendPortalContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useLegendPortal = exports.LegendPortalContext = void 0;
|
||||
var _react = require("react");
|
||||
var LegendPortalContext = exports.LegendPortalContext = /*#__PURE__*/(0, _react.createContext)(null);
|
||||
var useLegendPortal = () => (0, _react.useContext)(LegendPortalContext);
|
||||
exports.useLegendPortal = useLegendPortal;
|
||||
47
frontend/node_modules/recharts/lib/context/tooltipContext.js
generated
vendored
Normal file
47
frontend/node_modules/recharts/lib/context/tooltipContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useMouseLeaveItemDispatch = exports.useMouseEnterItemDispatch = exports.useMouseClickItemDispatch = void 0;
|
||||
var _hooks = require("../state/hooks");
|
||||
var _tooltipSlice = require("../state/tooltipSlice");
|
||||
/**
|
||||
* Some graphical items choose to provide more information to the tooltip
|
||||
* and some do not.
|
||||
*/
|
||||
|
||||
var useMouseEnterItemDispatch = (onMouseEnterFromProps, dataKey, graphicalItemId) => {
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
return (data, index) => event => {
|
||||
onMouseEnterFromProps === null || onMouseEnterFromProps === void 0 || onMouseEnterFromProps(data, index, event);
|
||||
dispatch((0, _tooltipSlice.setActiveMouseOverItemIndex)({
|
||||
activeIndex: String(index),
|
||||
activeDataKey: dataKey,
|
||||
activeCoordinate: data.tooltipPosition,
|
||||
activeGraphicalItemId: graphicalItemId
|
||||
}));
|
||||
};
|
||||
};
|
||||
exports.useMouseEnterItemDispatch = useMouseEnterItemDispatch;
|
||||
var useMouseLeaveItemDispatch = onMouseLeaveFromProps => {
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
return (data, index) => event => {
|
||||
onMouseLeaveFromProps === null || onMouseLeaveFromProps === void 0 || onMouseLeaveFromProps(data, index, event);
|
||||
dispatch((0, _tooltipSlice.mouseLeaveItem)());
|
||||
};
|
||||
};
|
||||
exports.useMouseLeaveItemDispatch = useMouseLeaveItemDispatch;
|
||||
var useMouseClickItemDispatch = (onMouseClickFromProps, dataKey, graphicalItemId) => {
|
||||
var dispatch = (0, _hooks.useAppDispatch)();
|
||||
return (data, index) => event => {
|
||||
onMouseClickFromProps === null || onMouseClickFromProps === void 0 || onMouseClickFromProps(data, index, event);
|
||||
dispatch((0, _tooltipSlice.setActiveClickItemIndex)({
|
||||
activeIndex: String(index),
|
||||
activeDataKey: dataKey,
|
||||
activeCoordinate: data.tooltipPosition,
|
||||
activeGraphicalItemId: graphicalItemId
|
||||
}));
|
||||
};
|
||||
};
|
||||
exports.useMouseClickItemDispatch = useMouseClickItemDispatch;
|
||||
10
frontend/node_modules/recharts/lib/context/tooltipPortalContext.js
generated
vendored
Normal file
10
frontend/node_modules/recharts/lib/context/tooltipPortalContext.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useTooltipPortal = exports.TooltipPortalContext = void 0;
|
||||
var _react = require("react");
|
||||
var TooltipPortalContext = exports.TooltipPortalContext = /*#__PURE__*/(0, _react.createContext)(null);
|
||||
var useTooltipPortal = () => (0, _react.useContext)(TooltipPortalContext);
|
||||
exports.useTooltipPortal = useTooltipPortal;
|
||||
29
frontend/node_modules/recharts/lib/context/useTooltipAxis.js
generated
vendored
Normal file
29
frontend/node_modules/recharts/lib/context/useTooltipAxis.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useTooltipAxisBandSize = exports.useTooltipAxis = void 0;
|
||||
var _hooks = require("../state/hooks");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _axisSelectors = require("../state/selectors/axisSelectors");
|
||||
var _tooltipSelectors = require("../state/selectors/tooltipSelectors");
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var useTooltipAxis = () => (0, _hooks.useAppSelector)(_axisSelectors.selectTooltipAxis);
|
||||
exports.useTooltipAxis = useTooltipAxis;
|
||||
var useTooltipAxisBandSize = () => {
|
||||
var tooltipAxis = useTooltipAxis();
|
||||
var tooltipTicks = (0, _hooks.useAppSelector)(_tooltipSelectors.selectTooltipAxisTicks);
|
||||
var tooltipAxisScale = (0, _hooks.useAppSelector)(_tooltipSelectors.selectTooltipAxisScale);
|
||||
if (!tooltipAxis || !tooltipAxisScale) {
|
||||
return (0, _ChartUtils.getBandSizeOfAxis)(undefined, tooltipTicks);
|
||||
}
|
||||
return (0, _ChartUtils.getBandSizeOfAxis)(_objectSpread(_objectSpread({}, tooltipAxis), {}, {
|
||||
scale: tooltipAxisScale
|
||||
}), tooltipTicks);
|
||||
};
|
||||
exports.useTooltipAxisBandSize = useTooltipAxisBandSize;
|
||||
Loading…
Add table
Add a link
Reference in a new issue