| [a762898] | 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.defaultPolarChartProps = exports.PolarChart = void 0;
|
|---|
| 7 | var _react = _interopRequireWildcard(require("react"));
|
|---|
| 8 | var React = _react;
|
|---|
| 9 | var _RechartsStoreProvider = require("../state/RechartsStoreProvider");
|
|---|
| 10 | var _chartDataContext = require("../context/chartDataContext");
|
|---|
| 11 | var _ReportMainChartProps = require("../state/ReportMainChartProps");
|
|---|
| 12 | var _ReportChartProps = require("../state/ReportChartProps");
|
|---|
| 13 | var _ReportPolarOptions = require("../state/ReportPolarOptions");
|
|---|
| 14 | var _CategoricalChart = require("./CategoricalChart");
|
|---|
| 15 | var _resolveDefaultProps = require("../util/resolveDefaultProps");
|
|---|
| 16 | var _excluded = ["layout"];
|
|---|
| 17 | 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); }
|
|---|
| 18 | 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); }
|
|---|
| 19 | 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; }
|
|---|
| 20 | 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; }
|
|---|
| 21 | var defaultMargin = {
|
|---|
| 22 | top: 5,
|
|---|
| 23 | right: 5,
|
|---|
| 24 | bottom: 5,
|
|---|
| 25 | left: 5
|
|---|
| 26 | };
|
|---|
| 27 |
|
|---|
| 28 | /**
|
|---|
| 29 | * These default props are the same for all PolarChart components.
|
|---|
| 30 | */
|
|---|
| 31 | var defaultPolarChartProps = exports.defaultPolarChartProps = {
|
|---|
| 32 | accessibilityLayer: true,
|
|---|
| 33 | stackOffset: 'none',
|
|---|
| 34 | barCategoryGap: '10%',
|
|---|
| 35 | barGap: 4,
|
|---|
| 36 | margin: defaultMargin,
|
|---|
| 37 | reverseStackOrder: false,
|
|---|
| 38 | syncMethod: 'index',
|
|---|
| 39 | layout: 'radial',
|
|---|
| 40 | responsive: false,
|
|---|
| 41 | cx: '50%',
|
|---|
| 42 | cy: '50%',
|
|---|
| 43 | innerRadius: 0,
|
|---|
| 44 | outerRadius: '80%'
|
|---|
| 45 | };
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| 48 | * These props are required for the PolarChart to function correctly.
|
|---|
| 49 | * Users usually would not need to specify these explicitly,
|
|---|
| 50 | * because the convenience components like PieChart, RadarChart, etc.
|
|---|
| 51 | * will provide these defaults.
|
|---|
| 52 | * We can't have the defaults in this file because each of those convenience components
|
|---|
| 53 | * have their own opinions about what they should be.
|
|---|
| 54 | */
|
|---|
| 55 |
|
|---|
| 56 | /**
|
|---|
| 57 | * These are one-time, immutable options that decide the chart's behavior.
|
|---|
| 58 | * Users who wish to call CartesianChart may decide to pass these options explicitly,
|
|---|
| 59 | * but usually we would expect that they use one of the convenience components like PieChart, RadarChart, etc.
|
|---|
| 60 | */
|
|---|
| 61 |
|
|---|
| 62 | var PolarChart = exports.PolarChart = /*#__PURE__*/(0, _react.forwardRef)(function PolarChart(props, ref) {
|
|---|
| 63 | var _polarChartProps$id;
|
|---|
| 64 | var polarChartProps = (0, _resolveDefaultProps.resolveDefaultProps)(props.categoricalChartProps, defaultPolarChartProps);
|
|---|
| 65 | var {
|
|---|
| 66 | layout
|
|---|
| 67 | } = polarChartProps,
|
|---|
| 68 | otherCategoricalProps = _objectWithoutProperties(polarChartProps, _excluded);
|
|---|
| 69 | var {
|
|---|
| 70 | chartName,
|
|---|
| 71 | defaultTooltipEventType,
|
|---|
| 72 | validateTooltipEventTypes,
|
|---|
| 73 | tooltipPayloadSearcher
|
|---|
| 74 | } = props;
|
|---|
| 75 | var options = {
|
|---|
| 76 | chartName,
|
|---|
| 77 | defaultTooltipEventType,
|
|---|
| 78 | validateTooltipEventTypes,
|
|---|
| 79 | tooltipPayloadSearcher,
|
|---|
| 80 | eventEmitter: undefined
|
|---|
| 81 | };
|
|---|
| 82 | return /*#__PURE__*/React.createElement(_RechartsStoreProvider.RechartsStoreProvider, {
|
|---|
| 83 | preloadedState: {
|
|---|
| 84 | options
|
|---|
| 85 | },
|
|---|
| 86 | reduxStoreName: (_polarChartProps$id = polarChartProps.id) !== null && _polarChartProps$id !== void 0 ? _polarChartProps$id : chartName
|
|---|
| 87 | }, /*#__PURE__*/React.createElement(_chartDataContext.ChartDataContextProvider, {
|
|---|
| 88 | chartData: polarChartProps.data
|
|---|
| 89 | }), /*#__PURE__*/React.createElement(_ReportMainChartProps.ReportMainChartProps, {
|
|---|
| 90 | layout: layout,
|
|---|
| 91 | margin: polarChartProps.margin
|
|---|
| 92 | }), /*#__PURE__*/React.createElement(_ReportChartProps.ReportChartProps, {
|
|---|
| 93 | baseValue: undefined,
|
|---|
| 94 | accessibilityLayer: polarChartProps.accessibilityLayer,
|
|---|
| 95 | barCategoryGap: polarChartProps.barCategoryGap,
|
|---|
| 96 | maxBarSize: polarChartProps.maxBarSize,
|
|---|
| 97 | stackOffset: polarChartProps.stackOffset,
|
|---|
| 98 | barGap: polarChartProps.barGap,
|
|---|
| 99 | barSize: polarChartProps.barSize,
|
|---|
| 100 | syncId: polarChartProps.syncId,
|
|---|
| 101 | syncMethod: polarChartProps.syncMethod,
|
|---|
| 102 | className: polarChartProps.className,
|
|---|
| 103 | reverseStackOrder: polarChartProps.reverseStackOrder
|
|---|
| 104 | }), /*#__PURE__*/React.createElement(_ReportPolarOptions.ReportPolarOptions, {
|
|---|
| 105 | cx: polarChartProps.cx,
|
|---|
| 106 | cy: polarChartProps.cy,
|
|---|
| 107 | startAngle: polarChartProps.startAngle,
|
|---|
| 108 | endAngle: polarChartProps.endAngle,
|
|---|
| 109 | innerRadius: polarChartProps.innerRadius,
|
|---|
| 110 | outerRadius: polarChartProps.outerRadius
|
|---|
| 111 | }), /*#__PURE__*/React.createElement(_CategoricalChart.CategoricalChart, _extends({}, otherCategoricalProps, {
|
|---|
| 112 | ref: ref
|
|---|
| 113 | })));
|
|---|
| 114 | }); |
|---|