| [a762898] | 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, "__esModule", {
|
|---|
| 4 | value: true
|
|---|
| 5 | });
|
|---|
| 6 | exports.selectRadiusAxisForBandSize = exports.selectRadarPoints = exports.selectAngleAxisWithScaleAndViewport = exports.selectAngleAxisForBandSize = void 0;
|
|---|
| 7 | var _reselect = require("reselect");
|
|---|
| 8 | var _Radar = require("../../polar/Radar");
|
|---|
| 9 | var _polarScaleSelectors = require("./polarScaleSelectors");
|
|---|
| 10 | var _polarAxisSelectors = require("./polarAxisSelectors");
|
|---|
| 11 | var _dataSelectors = require("./dataSelectors");
|
|---|
| 12 | var _chartLayoutContext = require("../../context/chartLayoutContext");
|
|---|
| 13 | var _ChartUtils = require("../../util/ChartUtils");
|
|---|
| 14 | var _polarSelectors = require("./polarSelectors");
|
|---|
| 15 | 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; }
|
|---|
| 16 | 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; }
|
|---|
| 17 | 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; }
|
|---|
| 18 | function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|---|
| 19 | 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); }
|
|---|
| 20 | var selectRadiusAxisScale = (state, radiusAxisId) => (0, _polarScaleSelectors.selectPolarAxisScale)(state, 'radiusAxis', radiusAxisId);
|
|---|
| 21 | var selectRadiusAxisForRadar = (0, _reselect.createSelector)([selectRadiusAxisScale], scale => {
|
|---|
| 22 | if (scale == null) {
|
|---|
| 23 | return undefined;
|
|---|
| 24 | }
|
|---|
| 25 | return {
|
|---|
| 26 | scale
|
|---|
| 27 | };
|
|---|
| 28 | });
|
|---|
| 29 | var selectRadiusAxisForBandSize = exports.selectRadiusAxisForBandSize = (0, _reselect.createSelector)([_polarAxisSelectors.selectRadiusAxis, selectRadiusAxisScale], (axisSettings, scale) => {
|
|---|
| 30 | if (axisSettings == null || scale == null) {
|
|---|
| 31 | return undefined;
|
|---|
| 32 | }
|
|---|
| 33 | return _objectSpread(_objectSpread({}, axisSettings), {}, {
|
|---|
| 34 | scale
|
|---|
| 35 | });
|
|---|
| 36 | });
|
|---|
| 37 | var selectRadiusAxisTicks = (state, radiusAxisId, _angleAxisId, isPanorama) => {
|
|---|
| 38 | return (0, _polarScaleSelectors.selectPolarAxisTicks)(state, 'radiusAxis', radiusAxisId, isPanorama);
|
|---|
| 39 | };
|
|---|
| 40 | var selectAngleAxisForRadar = (state, _radiusAxisId, angleAxisId) => (0, _polarAxisSelectors.selectAngleAxis)(state, angleAxisId);
|
|---|
| 41 | var selectPolarAxisScaleForRadar = (state, _radiusAxisId, angleAxisId) => (0, _polarScaleSelectors.selectPolarAxisScale)(state, 'angleAxis', angleAxisId);
|
|---|
| 42 | var selectAngleAxisForBandSize = exports.selectAngleAxisForBandSize = (0, _reselect.createSelector)([selectAngleAxisForRadar, selectPolarAxisScaleForRadar], (axisSettings, scale) => {
|
|---|
| 43 | if (axisSettings == null || scale == null) {
|
|---|
| 44 | return undefined;
|
|---|
| 45 | }
|
|---|
| 46 | return _objectSpread(_objectSpread({}, axisSettings), {}, {
|
|---|
| 47 | scale
|
|---|
| 48 | });
|
|---|
| 49 | });
|
|---|
| 50 | var selectAngleAxisTicks = (state, _radiusAxisId, angleAxisId, isPanorama) => {
|
|---|
| 51 | return (0, _polarScaleSelectors.selectPolarAxisTicks)(state, 'angleAxis', angleAxisId, isPanorama);
|
|---|
| 52 | };
|
|---|
| 53 | var selectAngleAxisWithScaleAndViewport = exports.selectAngleAxisWithScaleAndViewport = (0, _reselect.createSelector)([selectAngleAxisForRadar, selectPolarAxisScaleForRadar, _polarAxisSelectors.selectPolarViewBox], (axisOptions, scale, polarViewBox) => {
|
|---|
| 54 | if (polarViewBox == null || scale == null) {
|
|---|
| 55 | return undefined;
|
|---|
| 56 | }
|
|---|
| 57 | return {
|
|---|
| 58 | scale,
|
|---|
| 59 | type: axisOptions.type,
|
|---|
| 60 | dataKey: axisOptions.dataKey,
|
|---|
| 61 | cx: polarViewBox.cx,
|
|---|
| 62 | cy: polarViewBox.cy
|
|---|
| 63 | };
|
|---|
| 64 | });
|
|---|
| 65 | var pickId = (_state, _radiusAxisId, _angleAxisId, _isPanorama, radarId) => radarId;
|
|---|
| 66 | var selectBandSizeOfAxis = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectRadiusAxisForBandSize, selectRadiusAxisTicks, selectAngleAxisForBandSize, selectAngleAxisTicks], (layout, radiusAxis, radiusAxisTicks, angleAxis, angleAxisTicks) => {
|
|---|
| 67 | if ((0, _ChartUtils.isCategoricalAxis)(layout, 'radiusAxis')) {
|
|---|
| 68 | return (0, _ChartUtils.getBandSizeOfAxis)(radiusAxis, radiusAxisTicks, false);
|
|---|
| 69 | }
|
|---|
| 70 | return (0, _ChartUtils.getBandSizeOfAxis)(angleAxis, angleAxisTicks, false);
|
|---|
| 71 | });
|
|---|
| 72 | var selectSynchronisedRadarDataKey = (0, _reselect.createSelector)([_polarSelectors.selectUnfilteredPolarItems, pickId], (graphicalItems, radarId) => {
|
|---|
| 73 | if (graphicalItems == null) {
|
|---|
| 74 | return undefined;
|
|---|
| 75 | }
|
|---|
| 76 | // Find the radar item with the given radarId
|
|---|
| 77 | var pgis = graphicalItems.find(item => item.type === 'radar' && radarId === item.id);
|
|---|
| 78 | // If found, return its dataKey
|
|---|
| 79 | return pgis === null || pgis === void 0 ? void 0 : pgis.dataKey;
|
|---|
| 80 | });
|
|---|
| 81 | var selectRadarPoints = exports.selectRadarPoints = (0, _reselect.createSelector)([selectRadiusAxisForRadar, selectAngleAxisWithScaleAndViewport, _dataSelectors.selectChartDataAndAlwaysIgnoreIndexes, selectSynchronisedRadarDataKey, selectBandSizeOfAxis], (radiusAxis, angleAxis, _ref, dataKey, bandSize) => {
|
|---|
| 82 | var {
|
|---|
| 83 | chartData,
|
|---|
| 84 | dataStartIndex,
|
|---|
| 85 | dataEndIndex
|
|---|
| 86 | } = _ref;
|
|---|
| 87 | if (radiusAxis == null || angleAxis == null || chartData == null || bandSize == null || dataKey == null) {
|
|---|
| 88 | return undefined;
|
|---|
| 89 | }
|
|---|
| 90 | var displayedData = chartData.slice(dataStartIndex, dataEndIndex + 1);
|
|---|
| 91 | return (0, _Radar.computeRadarPoints)({
|
|---|
| 92 | radiusAxis,
|
|---|
| 93 | angleAxis,
|
|---|
| 94 | displayedData,
|
|---|
| 95 | dataKey,
|
|---|
| 96 | bandSize
|
|---|
| 97 | });
|
|---|
| 98 | }); |
|---|