Spaces:
Paused
Paused
Upload folder using huggingface_hub (part 25)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- node_modules/recharts/lib/state/selectors/selectAllAxes.js +13 -0
- node_modules/recharts/lib/state/selectors/selectChartOffset.js +16 -0
- node_modules/recharts/lib/state/selectors/selectChartOffsetInternal.js +99 -0
- node_modules/recharts/lib/state/selectors/selectPlotArea.js +20 -0
- node_modules/recharts/lib/state/selectors/selectTooltipAxisId.js +8 -0
- node_modules/recharts/lib/state/selectors/selectTooltipAxisType.js +29 -0
- node_modules/recharts/lib/state/selectors/selectTooltipEventType.js +33 -0
- node_modules/recharts/lib/state/selectors/selectTooltipPayloadSearcher.js +8 -0
- node_modules/recharts/lib/state/selectors/selectTooltipSettings.js +8 -0
- node_modules/recharts/lib/state/selectors/selectTooltipState.js +8 -0
- node_modules/recharts/lib/state/selectors/selectors.js +110 -0
- node_modules/recharts/lib/state/selectors/tooltipSelectors.js +185 -0
- node_modules/recharts/lib/state/selectors/touchSelectors.js +27 -0
- node_modules/recharts/lib/state/store.js +89 -0
- node_modules/recharts/lib/state/tooltipSlice.js +236 -0
- node_modules/recharts/lib/state/touchEventsMiddleware.js +71 -0
- node_modules/recharts/lib/state/types/AreaSettings.js +1 -0
- node_modules/recharts/lib/state/types/BarSettings.js +1 -0
- node_modules/recharts/lib/state/types/LineSettings.js +1 -0
- node_modules/recharts/lib/state/types/PieSettings.js +1 -0
- node_modules/recharts/lib/state/types/RadarSettings.js +1 -0
- node_modules/recharts/lib/state/types/RadialBarSettings.js +1 -0
- node_modules/recharts/lib/state/types/ScatterSettings.js +1 -0
- node_modules/recharts/lib/state/types/StackedGraphicalItem.js +20 -0
- node_modules/recharts/lib/state/zIndexSlice.js +124 -0
- node_modules/recharts/lib/synchronisation/syncSelectors.js +9 -0
- node_modules/recharts/lib/synchronisation/types.js +1 -0
- node_modules/recharts/lib/synchronisation/useChartSynchronisation.js +261 -0
- node_modules/recharts/lib/types.js +1 -0
- node_modules/recharts/lib/util/ActiveShapeUtils.js +108 -0
- node_modules/recharts/lib/util/BarUtils.js +38 -0
- node_modules/recharts/lib/util/CartesianUtils.js +76 -0
- node_modules/recharts/lib/util/ChartUtils.js +548 -0
- node_modules/recharts/lib/util/Constants.js +21 -0
- node_modules/recharts/lib/util/CssPrefixUtils.js +24 -0
- node_modules/recharts/lib/util/DOMUtils.js +137 -0
- node_modules/recharts/lib/util/DataUtils.js +183 -0
- node_modules/recharts/lib/util/Events.js +11 -0
- node_modules/recharts/lib/util/FunnelUtils.js +15 -0
- node_modules/recharts/lib/util/Global.js +11 -0
- node_modules/recharts/lib/util/IfOverflow.js +1 -0
- node_modules/recharts/lib/util/LRUCache.js +44 -0
- node_modules/recharts/lib/util/LogUtils.js +26 -0
- node_modules/recharts/lib/util/PolarUtils.js +154 -0
- node_modules/recharts/lib/util/RadialBarUtils.js +22 -0
- node_modules/recharts/lib/util/ReactUtils.js +97 -0
- node_modules/recharts/lib/util/ReduceCSSCalc.js +152 -0
- node_modules/recharts/lib/util/ScatterUtils.js +36 -0
- node_modules/recharts/lib/util/TickUtils.js +49 -0
- node_modules/recharts/lib/util/YAxisUtils.js +48 -0
node_modules/recharts/lib/state/selectors/selectAllAxes.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectAllYAxes = exports.selectAllXAxes = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var selectAllXAxes = exports.selectAllXAxes = (0, _reselect.createSelector)(state => state.cartesianAxis.xAxis, xAxisMap => {
|
| 9 |
+
return Object.values(xAxisMap);
|
| 10 |
+
});
|
| 11 |
+
var selectAllYAxes = exports.selectAllYAxes = (0, _reselect.createSelector)(state => state.cartesianAxis.yAxis, yAxisMap => {
|
| 12 |
+
return Object.values(yAxisMap);
|
| 13 |
+
});
|
node_modules/recharts/lib/state/selectors/selectChartOffset.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectChartOffset = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _selectChartOffsetInternal = require("./selectChartOffsetInternal");
|
| 9 |
+
var selectChartOffset = exports.selectChartOffset = (0, _reselect.createSelector)([_selectChartOffsetInternal.selectChartOffsetInternal], offsetInternal => {
|
| 10 |
+
return {
|
| 11 |
+
top: offsetInternal.top,
|
| 12 |
+
bottom: offsetInternal.bottom,
|
| 13 |
+
left: offsetInternal.left,
|
| 14 |
+
right: offsetInternal.right
|
| 15 |
+
};
|
| 16 |
+
});
|
node_modules/recharts/lib/state/selectors/selectChartOffsetInternal.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectChartViewBox = exports.selectChartOffsetInternal = exports.selectBrushHeight = exports.selectAxisViewBox = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _legendSelectors = require("./legendSelectors");
|
| 9 |
+
var _ChartUtils = require("../../util/ChartUtils");
|
| 10 |
+
var _containerSelectors = require("./containerSelectors");
|
| 11 |
+
var _selectAllAxes = require("./selectAllAxes");
|
| 12 |
+
var _Constants = require("../../util/Constants");
|
| 13 |
+
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; }
|
| 14 |
+
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; }
|
| 15 |
+
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; }
|
| 16 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 17 |
+
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); }
|
| 18 |
+
var selectBrushHeight = state => state.brush.height;
|
| 19 |
+
exports.selectBrushHeight = selectBrushHeight;
|
| 20 |
+
function selectLeftAxesOffset(state) {
|
| 21 |
+
var yAxes = (0, _selectAllAxes.selectAllYAxes)(state);
|
| 22 |
+
return yAxes.reduce((result, entry) => {
|
| 23 |
+
if (entry.orientation === 'left' && !entry.mirror && !entry.hide) {
|
| 24 |
+
var width = typeof entry.width === 'number' ? entry.width : _Constants.DEFAULT_Y_AXIS_WIDTH;
|
| 25 |
+
return result + width;
|
| 26 |
+
}
|
| 27 |
+
return result;
|
| 28 |
+
}, 0);
|
| 29 |
+
}
|
| 30 |
+
function selectRightAxesOffset(state) {
|
| 31 |
+
var yAxes = (0, _selectAllAxes.selectAllYAxes)(state);
|
| 32 |
+
return yAxes.reduce((result, entry) => {
|
| 33 |
+
if (entry.orientation === 'right' && !entry.mirror && !entry.hide) {
|
| 34 |
+
var width = typeof entry.width === 'number' ? entry.width : _Constants.DEFAULT_Y_AXIS_WIDTH;
|
| 35 |
+
return result + width;
|
| 36 |
+
}
|
| 37 |
+
return result;
|
| 38 |
+
}, 0);
|
| 39 |
+
}
|
| 40 |
+
function selectTopAxesOffset(state) {
|
| 41 |
+
var xAxes = (0, _selectAllAxes.selectAllXAxes)(state);
|
| 42 |
+
return xAxes.reduce((result, entry) => {
|
| 43 |
+
if (entry.orientation === 'top' && !entry.mirror && !entry.hide) {
|
| 44 |
+
return result + entry.height;
|
| 45 |
+
}
|
| 46 |
+
return result;
|
| 47 |
+
}, 0);
|
| 48 |
+
}
|
| 49 |
+
function selectBottomAxesOffset(state) {
|
| 50 |
+
var xAxes = (0, _selectAllAxes.selectAllXAxes)(state);
|
| 51 |
+
return xAxes.reduce((result, entry) => {
|
| 52 |
+
if (entry.orientation === 'bottom' && !entry.mirror && !entry.hide) {
|
| 53 |
+
return result + entry.height;
|
| 54 |
+
}
|
| 55 |
+
return result;
|
| 56 |
+
}, 0);
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* For internal use only.
|
| 61 |
+
*
|
| 62 |
+
* @param root state
|
| 63 |
+
* @return ChartOffsetInternal
|
| 64 |
+
*/
|
| 65 |
+
var selectChartOffsetInternal = exports.selectChartOffsetInternal = (0, _reselect.createSelector)([_containerSelectors.selectChartWidth, _containerSelectors.selectChartHeight, _containerSelectors.selectMargin, selectBrushHeight, selectLeftAxesOffset, selectRightAxesOffset, selectTopAxesOffset, selectBottomAxesOffset, _legendSelectors.selectLegendSettings, _legendSelectors.selectLegendSize], (chartWidth, chartHeight, margin, brushHeight, leftAxesOffset, rightAxesOffset, topAxesOffset, bottomAxesOffset, legendSettings, legendSize) => {
|
| 66 |
+
var offsetH = {
|
| 67 |
+
left: (margin.left || 0) + leftAxesOffset,
|
| 68 |
+
right: (margin.right || 0) + rightAxesOffset
|
| 69 |
+
};
|
| 70 |
+
var offsetV = {
|
| 71 |
+
top: (margin.top || 0) + topAxesOffset,
|
| 72 |
+
bottom: (margin.bottom || 0) + bottomAxesOffset
|
| 73 |
+
};
|
| 74 |
+
var offset = _objectSpread(_objectSpread({}, offsetV), offsetH);
|
| 75 |
+
var brushBottom = offset.bottom;
|
| 76 |
+
offset.bottom += brushHeight;
|
| 77 |
+
offset = (0, _ChartUtils.appendOffsetOfLegend)(offset, legendSettings, legendSize);
|
| 78 |
+
var offsetWidth = chartWidth - offset.left - offset.right;
|
| 79 |
+
var offsetHeight = chartHeight - offset.top - offset.bottom;
|
| 80 |
+
return _objectSpread(_objectSpread({
|
| 81 |
+
brushBottom
|
| 82 |
+
}, offset), {}, {
|
| 83 |
+
// never return negative values for height and width
|
| 84 |
+
width: Math.max(offsetWidth, 0),
|
| 85 |
+
height: Math.max(offsetHeight, 0)
|
| 86 |
+
});
|
| 87 |
+
});
|
| 88 |
+
var selectChartViewBox = exports.selectChartViewBox = (0, _reselect.createSelector)(selectChartOffsetInternal, offset => ({
|
| 89 |
+
x: offset.left,
|
| 90 |
+
y: offset.top,
|
| 91 |
+
width: offset.width,
|
| 92 |
+
height: offset.height
|
| 93 |
+
}));
|
| 94 |
+
var selectAxisViewBox = exports.selectAxisViewBox = (0, _reselect.createSelector)(_containerSelectors.selectChartWidth, _containerSelectors.selectChartHeight, (width, height) => ({
|
| 95 |
+
x: 0,
|
| 96 |
+
y: 0,
|
| 97 |
+
width,
|
| 98 |
+
height
|
| 99 |
+
}));
|
node_modules/recharts/lib/state/selectors/selectPlotArea.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectPlotArea = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _selectChartOffset = require("./selectChartOffset");
|
| 9 |
+
var _containerSelectors = require("./containerSelectors");
|
| 10 |
+
var selectPlotArea = exports.selectPlotArea = (0, _reselect.createSelector)([_selectChartOffset.selectChartOffset, _containerSelectors.selectChartWidth, _containerSelectors.selectChartHeight], (offset, chartWidth, chartHeight) => {
|
| 11 |
+
if (!offset || chartWidth == null || chartHeight == null) {
|
| 12 |
+
return undefined;
|
| 13 |
+
}
|
| 14 |
+
return {
|
| 15 |
+
x: offset.left,
|
| 16 |
+
y: offset.top,
|
| 17 |
+
width: Math.max(0, chartWidth - offset.left - offset.right),
|
| 18 |
+
height: Math.max(0, chartHeight - offset.top - offset.bottom)
|
| 19 |
+
};
|
| 20 |
+
});
|
node_modules/recharts/lib/state/selectors/selectTooltipAxisId.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipAxisId = void 0;
|
| 7 |
+
var selectTooltipAxisId = state => state.tooltip.settings.axisId;
|
| 8 |
+
exports.selectTooltipAxisId = selectTooltipAxisId;
|
node_modules/recharts/lib/state/selectors/selectTooltipAxisType.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipAxisType = void 0;
|
| 7 |
+
var _chartLayoutContext = require("../../context/chartLayoutContext");
|
| 8 |
+
/**
|
| 9 |
+
* angle, radius, X, Y, and Z axes all have domain and range and scale and associated settings
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Z axis is never displayed and so it lacks ticks and tick settings.
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
var selectTooltipAxisType = state => {
|
| 17 |
+
var layout = (0, _chartLayoutContext.selectChartLayout)(state);
|
| 18 |
+
if (layout === 'horizontal') {
|
| 19 |
+
return 'xAxis';
|
| 20 |
+
}
|
| 21 |
+
if (layout === 'vertical') {
|
| 22 |
+
return 'yAxis';
|
| 23 |
+
}
|
| 24 |
+
if (layout === 'centric') {
|
| 25 |
+
return 'angleAxis';
|
| 26 |
+
}
|
| 27 |
+
return 'radiusAxis';
|
| 28 |
+
};
|
| 29 |
+
exports.selectTooltipAxisType = selectTooltipAxisType;
|
node_modules/recharts/lib/state/selectors/selectTooltipEventType.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.combineTooltipEventType = combineTooltipEventType;
|
| 7 |
+
exports.selectDefaultTooltipEventType = void 0;
|
| 8 |
+
exports.selectTooltipEventType = selectTooltipEventType;
|
| 9 |
+
exports.selectValidateTooltipEventTypes = void 0;
|
| 10 |
+
exports.useTooltipEventType = useTooltipEventType;
|
| 11 |
+
var _hooks = require("../hooks");
|
| 12 |
+
var selectDefaultTooltipEventType = state => state.options.defaultTooltipEventType;
|
| 13 |
+
exports.selectDefaultTooltipEventType = selectDefaultTooltipEventType;
|
| 14 |
+
var selectValidateTooltipEventTypes = state => state.options.validateTooltipEventTypes;
|
| 15 |
+
exports.selectValidateTooltipEventTypes = selectValidateTooltipEventTypes;
|
| 16 |
+
function combineTooltipEventType(shared, defaultTooltipEventType, validateTooltipEventTypes) {
|
| 17 |
+
if (shared == null) {
|
| 18 |
+
return defaultTooltipEventType;
|
| 19 |
+
}
|
| 20 |
+
var eventType = shared ? 'axis' : 'item';
|
| 21 |
+
if (validateTooltipEventTypes == null) {
|
| 22 |
+
return defaultTooltipEventType;
|
| 23 |
+
}
|
| 24 |
+
return validateTooltipEventTypes.includes(eventType) ? eventType : defaultTooltipEventType;
|
| 25 |
+
}
|
| 26 |
+
function selectTooltipEventType(state, shared) {
|
| 27 |
+
var defaultTooltipEventType = selectDefaultTooltipEventType(state);
|
| 28 |
+
var validateTooltipEventTypes = selectValidateTooltipEventTypes(state);
|
| 29 |
+
return combineTooltipEventType(shared, defaultTooltipEventType, validateTooltipEventTypes);
|
| 30 |
+
}
|
| 31 |
+
function useTooltipEventType(shared) {
|
| 32 |
+
return (0, _hooks.useAppSelector)(state => selectTooltipEventType(state, shared));
|
| 33 |
+
}
|
node_modules/recharts/lib/state/selectors/selectTooltipPayloadSearcher.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipPayloadSearcher = void 0;
|
| 7 |
+
var selectTooltipPayloadSearcher = state => state.options.tooltipPayloadSearcher;
|
| 8 |
+
exports.selectTooltipPayloadSearcher = selectTooltipPayloadSearcher;
|
node_modules/recharts/lib/state/selectors/selectTooltipSettings.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipSettings = void 0;
|
| 7 |
+
var selectTooltipSettings = state => state.tooltip.settings;
|
| 8 |
+
exports.selectTooltipSettings = selectTooltipSettings;
|
node_modules/recharts/lib/state/selectors/selectTooltipState.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipState = void 0;
|
| 7 |
+
var selectTooltipState = state => state.tooltip;
|
| 8 |
+
exports.selectTooltipState = selectTooltipState;
|
node_modules/recharts/lib/state/selectors/selectors.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.useChartName = exports.selectTooltipPayloadConfigurations = exports.selectTooltipPayload = exports.selectTooltipInteractionState = exports.selectTooltipDataKey = exports.selectOrderedTooltipTicks = exports.selectIsTooltipActive = exports.selectCoordinateForDefaultIndex = exports.selectActiveLabel = exports.selectActiveIndex = exports.selectActiveCoordinate = exports.combineActiveProps = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _sortBy = _interopRequireDefault(require("es-toolkit/compat/sortBy"));
|
| 9 |
+
var _hooks = require("../hooks");
|
| 10 |
+
var _ChartUtils = require("../../util/ChartUtils");
|
| 11 |
+
var _dataSelectors = require("./dataSelectors");
|
| 12 |
+
var _tooltipSelectors = require("./tooltipSelectors");
|
| 13 |
+
var _axisSelectors = require("./axisSelectors");
|
| 14 |
+
var _rootPropsSelectors = require("./rootPropsSelectors");
|
| 15 |
+
var _chartLayoutContext = require("../../context/chartLayoutContext");
|
| 16 |
+
var _selectChartOffsetInternal = require("./selectChartOffsetInternal");
|
| 17 |
+
var _containerSelectors = require("./containerSelectors");
|
| 18 |
+
var _combineActiveLabel = require("./combiners/combineActiveLabel");
|
| 19 |
+
var _combineTooltipInteractionState = require("./combiners/combineTooltipInteractionState");
|
| 20 |
+
var _combineActiveTooltipIndex = require("./combiners/combineActiveTooltipIndex");
|
| 21 |
+
var _combineCoordinateForDefaultIndex = require("./combiners/combineCoordinateForDefaultIndex");
|
| 22 |
+
var _combineTooltipPayloadConfigurations = require("./combiners/combineTooltipPayloadConfigurations");
|
| 23 |
+
var _selectTooltipPayloadSearcher = require("./selectTooltipPayloadSearcher");
|
| 24 |
+
var _selectTooltipState = require("./selectTooltipState");
|
| 25 |
+
var _combineTooltipPayload = require("./combiners/combineTooltipPayload");
|
| 26 |
+
var _getActiveCoordinate = require("../../util/getActiveCoordinate");
|
| 27 |
+
var _PolarUtils = require("../../util/PolarUtils");
|
| 28 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 29 |
+
var useChartName = () => {
|
| 30 |
+
return (0, _hooks.useAppSelector)(_rootPropsSelectors.selectChartName);
|
| 31 |
+
};
|
| 32 |
+
exports.useChartName = useChartName;
|
| 33 |
+
var pickTooltipEventType = (_state, tooltipEventType) => tooltipEventType;
|
| 34 |
+
var pickTrigger = (_state, _tooltipEventType, trigger) => trigger;
|
| 35 |
+
var pickDefaultIndex = (_state, _tooltipEventType, _trigger, defaultIndex) => defaultIndex;
|
| 36 |
+
var selectOrderedTooltipTicks = exports.selectOrderedTooltipTicks = (0, _reselect.createSelector)(_tooltipSelectors.selectTooltipAxisTicks, ticks => (0, _sortBy.default)(ticks, o => o.coordinate));
|
| 37 |
+
var selectTooltipInteractionState = exports.selectTooltipInteractionState = (0, _reselect.createSelector)([_selectTooltipState.selectTooltipState, pickTooltipEventType, pickTrigger, pickDefaultIndex], _combineTooltipInteractionState.combineTooltipInteractionState);
|
| 38 |
+
var selectActiveIndex = exports.selectActiveIndex = (0, _reselect.createSelector)([selectTooltipInteractionState, _tooltipSelectors.selectTooltipDisplayedData, _axisSelectors.selectTooltipAxisDataKey, _tooltipSelectors.selectTooltipAxisDomain], _combineActiveTooltipIndex.combineActiveTooltipIndex);
|
| 39 |
+
var selectTooltipDataKey = (state, tooltipEventType, trigger) => {
|
| 40 |
+
if (tooltipEventType == null) {
|
| 41 |
+
return undefined;
|
| 42 |
+
}
|
| 43 |
+
var tooltipState = (0, _selectTooltipState.selectTooltipState)(state);
|
| 44 |
+
if (tooltipEventType === 'axis') {
|
| 45 |
+
if (trigger === 'hover') {
|
| 46 |
+
return tooltipState.axisInteraction.hover.dataKey;
|
| 47 |
+
}
|
| 48 |
+
return tooltipState.axisInteraction.click.dataKey;
|
| 49 |
+
}
|
| 50 |
+
if (trigger === 'hover') {
|
| 51 |
+
return tooltipState.itemInteraction.hover.dataKey;
|
| 52 |
+
}
|
| 53 |
+
return tooltipState.itemInteraction.click.dataKey;
|
| 54 |
+
};
|
| 55 |
+
exports.selectTooltipDataKey = selectTooltipDataKey;
|
| 56 |
+
var selectTooltipPayloadConfigurations = exports.selectTooltipPayloadConfigurations = (0, _reselect.createSelector)([_selectTooltipState.selectTooltipState, pickTooltipEventType, pickTrigger, pickDefaultIndex], _combineTooltipPayloadConfigurations.combineTooltipPayloadConfigurations);
|
| 57 |
+
var selectCoordinateForDefaultIndex = exports.selectCoordinateForDefaultIndex = (0, _reselect.createSelector)([_containerSelectors.selectChartWidth, _containerSelectors.selectChartHeight, _chartLayoutContext.selectChartLayout, _selectChartOffsetInternal.selectChartOffsetInternal, _tooltipSelectors.selectTooltipAxisTicks, pickDefaultIndex, selectTooltipPayloadConfigurations], _combineCoordinateForDefaultIndex.combineCoordinateForDefaultIndex);
|
| 58 |
+
var selectActiveCoordinate = exports.selectActiveCoordinate = (0, _reselect.createSelector)([selectTooltipInteractionState, selectCoordinateForDefaultIndex], (tooltipInteractionState, defaultIndexCoordinate) => {
|
| 59 |
+
var _tooltipInteractionSt;
|
| 60 |
+
return (_tooltipInteractionSt = tooltipInteractionState.coordinate) !== null && _tooltipInteractionSt !== void 0 ? _tooltipInteractionSt : defaultIndexCoordinate;
|
| 61 |
+
});
|
| 62 |
+
var selectActiveLabel = exports.selectActiveLabel = (0, _reselect.createSelector)([_tooltipSelectors.selectTooltipAxisTicks, selectActiveIndex], _combineActiveLabel.combineActiveLabel);
|
| 63 |
+
var selectTooltipPayload = exports.selectTooltipPayload = (0, _reselect.createSelector)([selectTooltipPayloadConfigurations, selectActiveIndex, _dataSelectors.selectChartDataWithIndexes, _axisSelectors.selectTooltipAxisDataKey, selectActiveLabel, _selectTooltipPayloadSearcher.selectTooltipPayloadSearcher, pickTooltipEventType], _combineTooltipPayload.combineTooltipPayload);
|
| 64 |
+
var selectIsTooltipActive = exports.selectIsTooltipActive = (0, _reselect.createSelector)([selectTooltipInteractionState, selectActiveIndex], (tooltipInteractionState, activeIndex) => {
|
| 65 |
+
return {
|
| 66 |
+
isActive: tooltipInteractionState.active && activeIndex != null,
|
| 67 |
+
activeIndex
|
| 68 |
+
};
|
| 69 |
+
});
|
| 70 |
+
var combineActiveCartesianProps = (chartEvent, layout, tooltipAxisType, tooltipAxisRange, tooltipTicks, orderedTooltipTicks, offset) => {
|
| 71 |
+
if (!chartEvent || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks) {
|
| 72 |
+
return undefined;
|
| 73 |
+
}
|
| 74 |
+
if (!(0, _getActiveCoordinate.isInCartesianRange)(chartEvent, offset)) {
|
| 75 |
+
return undefined;
|
| 76 |
+
}
|
| 77 |
+
var pos = (0, _ChartUtils.calculateCartesianTooltipPos)(chartEvent, layout);
|
| 78 |
+
var activeIndex = (0, _getActiveCoordinate.calculateActiveTickIndex)(pos, orderedTooltipTicks, tooltipTicks, tooltipAxisType, tooltipAxisRange);
|
| 79 |
+
var activeCoordinate = (0, _getActiveCoordinate.getActiveCartesianCoordinate)(layout, tooltipTicks, activeIndex, chartEvent);
|
| 80 |
+
return {
|
| 81 |
+
activeIndex: String(activeIndex),
|
| 82 |
+
activeCoordinate
|
| 83 |
+
};
|
| 84 |
+
};
|
| 85 |
+
var combineActivePolarProps = (chartEvent, layout, polarViewBox, tooltipAxisType, tooltipAxisRange, tooltipTicks, orderedTooltipTicks) => {
|
| 86 |
+
if (!chartEvent || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks || !polarViewBox) {
|
| 87 |
+
return undefined;
|
| 88 |
+
}
|
| 89 |
+
var rangeObj = (0, _PolarUtils.inRangeOfSector)(chartEvent, polarViewBox);
|
| 90 |
+
if (!rangeObj) {
|
| 91 |
+
return undefined;
|
| 92 |
+
}
|
| 93 |
+
var pos = (0, _ChartUtils.calculatePolarTooltipPos)(rangeObj, layout);
|
| 94 |
+
var activeIndex = (0, _getActiveCoordinate.calculateActiveTickIndex)(pos, orderedTooltipTicks, tooltipTicks, tooltipAxisType, tooltipAxisRange);
|
| 95 |
+
var activeCoordinate = (0, _getActiveCoordinate.getActivePolarCoordinate)(layout, tooltipTicks, activeIndex, rangeObj);
|
| 96 |
+
return {
|
| 97 |
+
activeIndex: String(activeIndex),
|
| 98 |
+
activeCoordinate
|
| 99 |
+
};
|
| 100 |
+
};
|
| 101 |
+
var combineActiveProps = (chartEvent, layout, polarViewBox, tooltipAxisType, tooltipAxisRange, tooltipTicks, orderedTooltipTicks, offset) => {
|
| 102 |
+
if (!chartEvent || !layout || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks) {
|
| 103 |
+
return undefined;
|
| 104 |
+
}
|
| 105 |
+
if (layout === 'horizontal' || layout === 'vertical') {
|
| 106 |
+
return combineActiveCartesianProps(chartEvent, layout, tooltipAxisType, tooltipAxisRange, tooltipTicks, orderedTooltipTicks, offset);
|
| 107 |
+
}
|
| 108 |
+
return combineActivePolarProps(chartEvent, layout, polarViewBox, tooltipAxisType, tooltipAxisRange, tooltipTicks, orderedTooltipTicks);
|
| 109 |
+
};
|
| 110 |
+
exports.combineActiveProps = combineActiveProps;
|
node_modules/recharts/lib/state/selectors/tooltipSelectors.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipGraphicalItemsData = exports.selectTooltipDisplayedData = exports.selectTooltipCategoricalDomain = exports.selectTooltipAxisTicks = exports.selectTooltipAxisScale = exports.selectTooltipAxisRealScaleType = exports.selectTooltipAxisRangeWithReverse = exports.selectTooltipAxisDomainIncludingNiceTicks = exports.selectTooltipAxisDomain = exports.selectIsTooltipActive = exports.selectAllUnfilteredGraphicalItems = exports.selectAllGraphicalItemsSettings = exports.selectActiveTooltipPayload = exports.selectActiveTooltipIndex = exports.selectActiveTooltipGraphicalItemId = exports.selectActiveTooltipDataPoints = exports.selectActiveTooltipDataKey = exports.selectActiveTooltipCoordinate = exports.selectActiveLabel = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _axisSelectors = require("./axisSelectors");
|
| 9 |
+
var _chartLayoutContext = require("../../context/chartLayoutContext");
|
| 10 |
+
var _ChartUtils = require("../../util/ChartUtils");
|
| 11 |
+
var _dataSelectors = require("./dataSelectors");
|
| 12 |
+
var _rootPropsSelectors = require("./rootPropsSelectors");
|
| 13 |
+
var _DataUtils = require("../../util/DataUtils");
|
| 14 |
+
var _combineAxisRangeWithReverse = require("./combiners/combineAxisRangeWithReverse");
|
| 15 |
+
var _selectTooltipEventType = require("./selectTooltipEventType");
|
| 16 |
+
var _combineActiveLabel = require("./combiners/combineActiveLabel");
|
| 17 |
+
var _selectTooltipSettings = require("./selectTooltipSettings");
|
| 18 |
+
var _combineTooltipInteractionState = require("./combiners/combineTooltipInteractionState");
|
| 19 |
+
var _combineActiveTooltipIndex = require("./combiners/combineActiveTooltipIndex");
|
| 20 |
+
var _combineCoordinateForDefaultIndex = require("./combiners/combineCoordinateForDefaultIndex");
|
| 21 |
+
var _containerSelectors = require("./containerSelectors");
|
| 22 |
+
var _selectChartOffsetInternal = require("./selectChartOffsetInternal");
|
| 23 |
+
var _combineTooltipPayloadConfigurations = require("./combiners/combineTooltipPayloadConfigurations");
|
| 24 |
+
var _selectTooltipPayloadSearcher = require("./selectTooltipPayloadSearcher");
|
| 25 |
+
var _selectTooltipState = require("./selectTooltipState");
|
| 26 |
+
var _combineTooltipPayload = require("./combiners/combineTooltipPayload");
|
| 27 |
+
var _selectTooltipAxisId = require("./selectTooltipAxisId");
|
| 28 |
+
var _selectTooltipAxisType = require("./selectTooltipAxisType");
|
| 29 |
+
var _combineDisplayedStackedData = require("./combiners/combineDisplayedStackedData");
|
| 30 |
+
var _StackedGraphicalItem = require("../types/StackedGraphicalItem");
|
| 31 |
+
var _isDomainSpecifiedByUser = require("../../util/isDomainSpecifiedByUser");
|
| 32 |
+
var _numberDomainEqualityCheck = require("./numberDomainEqualityCheck");
|
| 33 |
+
var _arrayEqualityCheck = require("./arrayEqualityCheck");
|
| 34 |
+
var _isWellBehavedNumber = require("../../util/isWellBehavedNumber");
|
| 35 |
+
var selectTooltipAxisRealScaleType = exports.selectTooltipAxisRealScaleType = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, _axisSelectors.selectHasBar, _rootPropsSelectors.selectChartName], _axisSelectors.combineRealScaleType);
|
| 36 |
+
var selectAllUnfilteredGraphicalItems = exports.selectAllUnfilteredGraphicalItems = (0, _reselect.createSelector)([state => state.graphicalItems.cartesianItems, state => state.graphicalItems.polarItems], (cartesianItems, polarItems) => [...cartesianItems, ...polarItems]);
|
| 37 |
+
var selectTooltipAxisPredicate = (0, _reselect.createSelector)([_selectTooltipAxisType.selectTooltipAxisType, _selectTooltipAxisId.selectTooltipAxisId], _axisSelectors.itemAxisPredicate);
|
| 38 |
+
var selectAllGraphicalItemsSettings = exports.selectAllGraphicalItemsSettings = (0, _reselect.createSelector)([selectAllUnfilteredGraphicalItems, _axisSelectors.selectTooltipAxis, selectTooltipAxisPredicate], _axisSelectors.combineGraphicalItemsSettings, {
|
| 39 |
+
memoizeOptions: {
|
| 40 |
+
resultEqualityCheck: _arrayEqualityCheck.emptyArraysAreEqualCheck
|
| 41 |
+
}
|
| 42 |
+
});
|
| 43 |
+
var selectAllStackedGraphicalItemsSettings = (0, _reselect.createSelector)([selectAllGraphicalItemsSettings], graphicalItems => graphicalItems.filter(_StackedGraphicalItem.isStacked));
|
| 44 |
+
var selectTooltipGraphicalItemsData = exports.selectTooltipGraphicalItemsData = (0, _reselect.createSelector)([selectAllGraphicalItemsSettings], _axisSelectors.combineGraphicalItemsData, {
|
| 45 |
+
memoizeOptions: {
|
| 46 |
+
resultEqualityCheck: _arrayEqualityCheck.emptyArraysAreEqualCheck
|
| 47 |
+
}
|
| 48 |
+
});
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Data for tooltip always use the data with indexes set by a Brush,
|
| 52 |
+
* and never accept the isPanorama flag:
|
| 53 |
+
* because Tooltip never displays inside the panorama anyway
|
| 54 |
+
* so we don't need to worry what would happen there.
|
| 55 |
+
*/
|
| 56 |
+
var selectTooltipDisplayedData = exports.selectTooltipDisplayedData = (0, _reselect.createSelector)([selectTooltipGraphicalItemsData, _dataSelectors.selectChartDataWithIndexes], _axisSelectors.combineDisplayedData);
|
| 57 |
+
var selectTooltipStackedData = (0, _reselect.createSelector)([selectAllStackedGraphicalItemsSettings, _dataSelectors.selectChartDataWithIndexes, _axisSelectors.selectTooltipAxis], _combineDisplayedStackedData.combineDisplayedStackedData);
|
| 58 |
+
var selectAllTooltipAppliedValues = (0, _reselect.createSelector)([selectTooltipDisplayedData, _axisSelectors.selectTooltipAxis, selectAllGraphicalItemsSettings], _axisSelectors.combineAppliedValues);
|
| 59 |
+
var selectTooltipAxisDomainDefinition = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis], _axisSelectors.getDomainDefinition);
|
| 60 |
+
var selectTooltipDataOverflow = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis], axisSettings => axisSettings.allowDataOverflow);
|
| 61 |
+
var selectTooltipDomainFromUserPreferences = (0, _reselect.createSelector)([selectTooltipAxisDomainDefinition, selectTooltipDataOverflow], _isDomainSpecifiedByUser.numericalDomainSpecifiedWithoutRequiringData);
|
| 62 |
+
var selectAllStackedGraphicalItems = (0, _reselect.createSelector)([selectAllGraphicalItemsSettings], graphicalItems => graphicalItems.filter(_StackedGraphicalItem.isStacked));
|
| 63 |
+
var selectTooltipStackGroups = (0, _reselect.createSelector)([selectTooltipStackedData, selectAllStackedGraphicalItems, _rootPropsSelectors.selectStackOffsetType, _rootPropsSelectors.selectReverseStackOrder], _axisSelectors.combineStackGroups);
|
| 64 |
+
var selectTooltipDomainOfStackGroups = (0, _reselect.createSelector)([selectTooltipStackGroups, _dataSelectors.selectChartDataWithIndexes, _selectTooltipAxisType.selectTooltipAxisType, selectTooltipDomainFromUserPreferences], _axisSelectors.combineDomainOfStackGroups);
|
| 65 |
+
var selectTooltipItemsSettingsExceptStacked = (0, _reselect.createSelector)([selectAllGraphicalItemsSettings], _axisSelectors.filterGraphicalNotStackedItems);
|
| 66 |
+
var selectDomainOfAllAppliedNumericalValuesIncludingErrorValues = (0, _reselect.createSelector)([selectTooltipDisplayedData, _axisSelectors.selectTooltipAxis, selectTooltipItemsSettingsExceptStacked, _axisSelectors.selectAllErrorBarSettings, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineDomainOfAllAppliedNumericalValuesIncludingErrorValues, {
|
| 67 |
+
memoizeOptions: {
|
| 68 |
+
resultEqualityCheck: _numberDomainEqualityCheck.numberDomainEqualityCheck
|
| 69 |
+
}
|
| 70 |
+
});
|
| 71 |
+
var selectReferenceDotsByTooltipAxis = (0, _reselect.createSelector)([_axisSelectors.selectReferenceDots, _selectTooltipAxisType.selectTooltipAxisType, _selectTooltipAxisId.selectTooltipAxisId], _axisSelectors.filterReferenceElements);
|
| 72 |
+
var selectTooltipReferenceDotsDomain = (0, _reselect.createSelector)([selectReferenceDotsByTooltipAxis, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineDotsDomain);
|
| 73 |
+
var selectReferenceAreasByTooltipAxis = (0, _reselect.createSelector)([_axisSelectors.selectReferenceAreas, _selectTooltipAxisType.selectTooltipAxisType, _selectTooltipAxisId.selectTooltipAxisId], _axisSelectors.filterReferenceElements);
|
| 74 |
+
var selectTooltipReferenceAreasDomain = (0, _reselect.createSelector)([selectReferenceAreasByTooltipAxis, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineAreasDomain);
|
| 75 |
+
var selectReferenceLinesByTooltipAxis = (0, _reselect.createSelector)([_axisSelectors.selectReferenceLines, _selectTooltipAxisType.selectTooltipAxisType, _selectTooltipAxisId.selectTooltipAxisId], _axisSelectors.filterReferenceElements);
|
| 76 |
+
var selectTooltipReferenceLinesDomain = (0, _reselect.createSelector)([selectReferenceLinesByTooltipAxis, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineLinesDomain);
|
| 77 |
+
var selectTooltipReferenceElementsDomain = (0, _reselect.createSelector)([selectTooltipReferenceDotsDomain, selectTooltipReferenceLinesDomain, selectTooltipReferenceAreasDomain], _axisSelectors.mergeDomains);
|
| 78 |
+
var selectTooltipNumericalDomain = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, selectTooltipAxisDomainDefinition, selectTooltipDomainFromUserPreferences, selectTooltipDomainOfStackGroups, selectDomainOfAllAppliedNumericalValuesIncludingErrorValues, selectTooltipReferenceElementsDomain, _chartLayoutContext.selectChartLayout, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineNumericalDomain);
|
| 79 |
+
var selectTooltipAxisDomain = exports.selectTooltipAxisDomain = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, _chartLayoutContext.selectChartLayout, selectTooltipDisplayedData, selectAllTooltipAppliedValues, _rootPropsSelectors.selectStackOffsetType, _selectTooltipAxisType.selectTooltipAxisType, selectTooltipNumericalDomain], _axisSelectors.combineAxisDomain);
|
| 80 |
+
var selectTooltipNiceTicks = (0, _reselect.createSelector)([selectTooltipAxisDomain, _axisSelectors.selectTooltipAxis, selectTooltipAxisRealScaleType], _axisSelectors.combineNiceTicks);
|
| 81 |
+
var selectTooltipAxisDomainIncludingNiceTicks = exports.selectTooltipAxisDomainIncludingNiceTicks = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, selectTooltipAxisDomain, selectTooltipNiceTicks, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineAxisDomainWithNiceTicks);
|
| 82 |
+
var selectTooltipAxisRange = state => {
|
| 83 |
+
var axisType = (0, _selectTooltipAxisType.selectTooltipAxisType)(state);
|
| 84 |
+
var axisId = (0, _selectTooltipAxisId.selectTooltipAxisId)(state);
|
| 85 |
+
var isPanorama = false; // Tooltip never displays in panorama so this is safe to assume
|
| 86 |
+
return (0, _axisSelectors.selectAxisRange)(state, axisType, axisId, isPanorama);
|
| 87 |
+
};
|
| 88 |
+
var selectTooltipAxisRangeWithReverse = exports.selectTooltipAxisRangeWithReverse = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, selectTooltipAxisRange], _combineAxisRangeWithReverse.combineAxisRangeWithReverse);
|
| 89 |
+
var selectTooltipAxisScale = exports.selectTooltipAxisScale = (0, _reselect.createSelector)([_axisSelectors.selectTooltipAxis, selectTooltipAxisRealScaleType, selectTooltipAxisDomainIncludingNiceTicks, selectTooltipAxisRangeWithReverse], _axisSelectors.combineScaleFunction);
|
| 90 |
+
var selectTooltipDuplicateDomain = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectAllTooltipAppliedValues, _axisSelectors.selectTooltipAxis, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineDuplicateDomain);
|
| 91 |
+
var selectTooltipCategoricalDomain = exports.selectTooltipCategoricalDomain = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, selectAllTooltipAppliedValues, _axisSelectors.selectTooltipAxis, _selectTooltipAxisType.selectTooltipAxisType], _axisSelectors.combineCategoricalDomain);
|
| 92 |
+
var combineTicksOfTooltipAxis = (layout, axis, realScaleType, scale, range, duplicateDomain, categoricalDomain, axisType) => {
|
| 93 |
+
if (!axis) {
|
| 94 |
+
return undefined;
|
| 95 |
+
}
|
| 96 |
+
var {
|
| 97 |
+
type
|
| 98 |
+
} = axis;
|
| 99 |
+
var isCategorical = (0, _ChartUtils.isCategoricalAxis)(layout, axisType);
|
| 100 |
+
if (!scale) {
|
| 101 |
+
return undefined;
|
| 102 |
+
}
|
| 103 |
+
var offsetForBand = realScaleType === 'scaleBand' && scale.bandwidth ? scale.bandwidth() / 2 : 2;
|
| 104 |
+
var offset = type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
| 105 |
+
offset = axisType === 'angleAxis' && range != null && (range === null || range === void 0 ? void 0 : range.length) >= 2 ? (0, _DataUtils.mathSign)(range[0] - range[1]) * 2 * offset : offset;
|
| 106 |
+
|
| 107 |
+
// When axis is a categorical axis, but the type of axis is number or the scale of axis is not "auto"
|
| 108 |
+
if (isCategorical && categoricalDomain) {
|
| 109 |
+
return categoricalDomain.map((entry, index) => {
|
| 110 |
+
var scaled = scale.map(entry);
|
| 111 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 112 |
+
return null;
|
| 113 |
+
}
|
| 114 |
+
return {
|
| 115 |
+
coordinate: scaled + offset,
|
| 116 |
+
value: entry,
|
| 117 |
+
index,
|
| 118 |
+
offset
|
| 119 |
+
};
|
| 120 |
+
}).filter(_DataUtils.isNotNil);
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
// When axis has duplicated text, serial numbers are used to generate scale
|
| 124 |
+
return scale.domain().map((entry, index) => {
|
| 125 |
+
var scaled = scale.map(entry);
|
| 126 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 127 |
+
return null;
|
| 128 |
+
}
|
| 129 |
+
return {
|
| 130 |
+
coordinate: scaled + offset,
|
| 131 |
+
// @ts-expect-error can't use Date as an index
|
| 132 |
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
| 133 |
+
index,
|
| 134 |
+
offset
|
| 135 |
+
};
|
| 136 |
+
}).filter(_DataUtils.isNotNil);
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Of on four almost identical implementations of tick generation.
|
| 141 |
+
* The four horsemen of tick generation are:
|
| 142 |
+
* - {@link selectTooltipAxisTicks}
|
| 143 |
+
* - {@link combineAxisTicks}
|
| 144 |
+
* - {@link getTicksOfAxis}.
|
| 145 |
+
* - {@link combineGraphicalItemTicks}
|
| 146 |
+
*/
|
| 147 |
+
var selectTooltipAxisTicks = exports.selectTooltipAxisTicks = (0, _reselect.createSelector)([_chartLayoutContext.selectChartLayout, _axisSelectors.selectTooltipAxis, selectTooltipAxisRealScaleType, selectTooltipAxisScale, selectTooltipAxisRange, selectTooltipDuplicateDomain, selectTooltipCategoricalDomain, _selectTooltipAxisType.selectTooltipAxisType], combineTicksOfTooltipAxis);
|
| 148 |
+
var selectTooltipEventType = (0, _reselect.createSelector)([_selectTooltipEventType.selectDefaultTooltipEventType, _selectTooltipEventType.selectValidateTooltipEventTypes, _selectTooltipSettings.selectTooltipSettings], (defaultTooltipEventType, validateTooltipEventType, settings) => (0, _selectTooltipEventType.combineTooltipEventType)(settings.shared, defaultTooltipEventType, validateTooltipEventType));
|
| 149 |
+
var selectTooltipTrigger = state => state.tooltip.settings.trigger;
|
| 150 |
+
var selectDefaultIndex = state => state.tooltip.settings.defaultIndex;
|
| 151 |
+
var selectTooltipInteractionState = (0, _reselect.createSelector)([_selectTooltipState.selectTooltipState, selectTooltipEventType, selectTooltipTrigger, selectDefaultIndex], _combineTooltipInteractionState.combineTooltipInteractionState);
|
| 152 |
+
var selectActiveTooltipIndex = exports.selectActiveTooltipIndex = (0, _reselect.createSelector)([selectTooltipInteractionState, selectTooltipDisplayedData, _axisSelectors.selectTooltipAxisDataKey, selectTooltipAxisDomain], _combineActiveTooltipIndex.combineActiveTooltipIndex);
|
| 153 |
+
var selectActiveLabel = exports.selectActiveLabel = (0, _reselect.createSelector)([selectTooltipAxisTicks, selectActiveTooltipIndex], _combineActiveLabel.combineActiveLabel);
|
| 154 |
+
var selectActiveTooltipDataKey = exports.selectActiveTooltipDataKey = (0, _reselect.createSelector)([selectTooltipInteractionState], tooltipInteraction => {
|
| 155 |
+
if (!tooltipInteraction) {
|
| 156 |
+
return undefined;
|
| 157 |
+
}
|
| 158 |
+
return tooltipInteraction.dataKey;
|
| 159 |
+
});
|
| 160 |
+
var selectActiveTooltipGraphicalItemId = exports.selectActiveTooltipGraphicalItemId = (0, _reselect.createSelector)([selectTooltipInteractionState], tooltipInteraction => {
|
| 161 |
+
if (!tooltipInteraction) {
|
| 162 |
+
return undefined;
|
| 163 |
+
}
|
| 164 |
+
return tooltipInteraction.graphicalItemId;
|
| 165 |
+
});
|
| 166 |
+
var selectTooltipPayloadConfigurations = (0, _reselect.createSelector)([_selectTooltipState.selectTooltipState, selectTooltipEventType, selectTooltipTrigger, selectDefaultIndex], _combineTooltipPayloadConfigurations.combineTooltipPayloadConfigurations);
|
| 167 |
+
var selectTooltipCoordinateForDefaultIndex = (0, _reselect.createSelector)([_containerSelectors.selectChartWidth, _containerSelectors.selectChartHeight, _chartLayoutContext.selectChartLayout, _selectChartOffsetInternal.selectChartOffsetInternal, selectTooltipAxisTicks, selectDefaultIndex, selectTooltipPayloadConfigurations], _combineCoordinateForDefaultIndex.combineCoordinateForDefaultIndex);
|
| 168 |
+
var selectActiveTooltipCoordinate = exports.selectActiveTooltipCoordinate = (0, _reselect.createSelector)([selectTooltipInteractionState, selectTooltipCoordinateForDefaultIndex], (tooltipInteractionState, defaultIndexCoordinate) => {
|
| 169 |
+
if (tooltipInteractionState !== null && tooltipInteractionState !== void 0 && tooltipInteractionState.coordinate) {
|
| 170 |
+
return tooltipInteractionState.coordinate;
|
| 171 |
+
}
|
| 172 |
+
return defaultIndexCoordinate;
|
| 173 |
+
});
|
| 174 |
+
var selectIsTooltipActive = exports.selectIsTooltipActive = (0, _reselect.createSelector)([selectTooltipInteractionState], tooltipInteractionState => {
|
| 175 |
+
var _tooltipInteractionSt;
|
| 176 |
+
return (_tooltipInteractionSt = tooltipInteractionState === null || tooltipInteractionState === void 0 ? void 0 : tooltipInteractionState.active) !== null && _tooltipInteractionSt !== void 0 ? _tooltipInteractionSt : false;
|
| 177 |
+
});
|
| 178 |
+
var selectActiveTooltipPayload = exports.selectActiveTooltipPayload = (0, _reselect.createSelector)([selectTooltipPayloadConfigurations, selectActiveTooltipIndex, _dataSelectors.selectChartDataWithIndexes, _axisSelectors.selectTooltipAxisDataKey, selectActiveLabel, _selectTooltipPayloadSearcher.selectTooltipPayloadSearcher, selectTooltipEventType], _combineTooltipPayload.combineTooltipPayload);
|
| 179 |
+
var selectActiveTooltipDataPoints = exports.selectActiveTooltipDataPoints = (0, _reselect.createSelector)([selectActiveTooltipPayload], payload => {
|
| 180 |
+
if (payload == null) {
|
| 181 |
+
return undefined;
|
| 182 |
+
}
|
| 183 |
+
var dataPoints = payload.map(p => p.payload).filter(p => p != null);
|
| 184 |
+
return Array.from(new Set(dataPoints));
|
| 185 |
+
});
|
node_modules/recharts/lib/state/selectors/touchSelectors.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectTooltipCoordinate = void 0;
|
| 7 |
+
var _reselect = require("reselect");
|
| 8 |
+
var _selectTooltipState = require("./selectTooltipState");
|
| 9 |
+
var selectAllTooltipPayloadConfiguration = (0, _reselect.createSelector)([_selectTooltipState.selectTooltipState], tooltipState => tooltipState.tooltipItemPayloads);
|
| 10 |
+
var selectTooltipCoordinate = exports.selectTooltipCoordinate = (0, _reselect.createSelector)([selectAllTooltipPayloadConfiguration, (_state, tooltipIndex) => tooltipIndex, (_state, _tooltipIndex, graphicalItemId) => graphicalItemId], (allTooltipConfigurations, tooltipIndex, graphicalItemId) => {
|
| 11 |
+
if (tooltipIndex == null) {
|
| 12 |
+
return undefined;
|
| 13 |
+
}
|
| 14 |
+
var mostRelevantTooltipConfiguration = allTooltipConfigurations.find(tooltipConfiguration => {
|
| 15 |
+
return tooltipConfiguration.settings.graphicalItemId === graphicalItemId;
|
| 16 |
+
});
|
| 17 |
+
if (mostRelevantTooltipConfiguration == null) {
|
| 18 |
+
return undefined;
|
| 19 |
+
}
|
| 20 |
+
var {
|
| 21 |
+
getPosition
|
| 22 |
+
} = mostRelevantTooltipConfiguration;
|
| 23 |
+
if (getPosition == null) {
|
| 24 |
+
return undefined;
|
| 25 |
+
}
|
| 26 |
+
return getPosition(tooltipIndex);
|
| 27 |
+
});
|
node_modules/recharts/lib/state/store.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.createRechartsStore = void 0;
|
| 7 |
+
var _toolkit = require("@reduxjs/toolkit");
|
| 8 |
+
var _optionsSlice = require("./optionsSlice");
|
| 9 |
+
var _tooltipSlice = require("./tooltipSlice");
|
| 10 |
+
var _chartDataSlice = require("./chartDataSlice");
|
| 11 |
+
var _layoutSlice = require("./layoutSlice");
|
| 12 |
+
var _mouseEventsMiddleware = require("./mouseEventsMiddleware");
|
| 13 |
+
var _reduxDevtoolsJsonStringifyReplacer = require("./reduxDevtoolsJsonStringifyReplacer");
|
| 14 |
+
var _cartesianAxisSlice = require("./cartesianAxisSlice");
|
| 15 |
+
var _graphicalItemsSlice = require("./graphicalItemsSlice");
|
| 16 |
+
var _referenceElementsSlice = require("./referenceElementsSlice");
|
| 17 |
+
var _brushSlice = require("./brushSlice");
|
| 18 |
+
var _legendSlice = require("./legendSlice");
|
| 19 |
+
var _rootPropsSlice = require("./rootPropsSlice");
|
| 20 |
+
var _polarAxisSlice = require("./polarAxisSlice");
|
| 21 |
+
var _polarOptionsSlice = require("./polarOptionsSlice");
|
| 22 |
+
var _keyboardEventsMiddleware = require("./keyboardEventsMiddleware");
|
| 23 |
+
var _externalEventsMiddleware = require("./externalEventsMiddleware");
|
| 24 |
+
var _touchEventsMiddleware = require("./touchEventsMiddleware");
|
| 25 |
+
var _errorBarSlice = require("./errorBarSlice");
|
| 26 |
+
var _Global = require("../util/Global");
|
| 27 |
+
var _zIndexSlice = require("./zIndexSlice");
|
| 28 |
+
var rootReducer = (0, _toolkit.combineReducers)({
|
| 29 |
+
brush: _brushSlice.brushReducer,
|
| 30 |
+
cartesianAxis: _cartesianAxisSlice.cartesianAxisReducer,
|
| 31 |
+
chartData: _chartDataSlice.chartDataReducer,
|
| 32 |
+
errorBars: _errorBarSlice.errorBarReducer,
|
| 33 |
+
graphicalItems: _graphicalItemsSlice.graphicalItemsReducer,
|
| 34 |
+
layout: _layoutSlice.chartLayoutReducer,
|
| 35 |
+
legend: _legendSlice.legendReducer,
|
| 36 |
+
options: _optionsSlice.optionsReducer,
|
| 37 |
+
polarAxis: _polarAxisSlice.polarAxisReducer,
|
| 38 |
+
polarOptions: _polarOptionsSlice.polarOptionsReducer,
|
| 39 |
+
referenceElements: _referenceElementsSlice.referenceElementsReducer,
|
| 40 |
+
rootProps: _rootPropsSlice.rootPropsReducer,
|
| 41 |
+
tooltip: _tooltipSlice.tooltipReducer,
|
| 42 |
+
zIndex: _zIndexSlice.zIndexReducer
|
| 43 |
+
});
|
| 44 |
+
var createRechartsStore = exports.createRechartsStore = function createRechartsStore(preloadedState) {
|
| 45 |
+
var chartName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Chart';
|
| 46 |
+
return (0, _toolkit.configureStore)({
|
| 47 |
+
reducer: rootReducer,
|
| 48 |
+
// redux-toolkit v1 types are unhappy with the preloadedState type. Remove the `as any` when bumping to v2
|
| 49 |
+
preloadedState: preloadedState,
|
| 50 |
+
// @ts-expect-error redux-toolkit v1 types are unhappy with the middleware array. Remove this comment when bumping to v2
|
| 51 |
+
middleware: getDefaultMiddleware => {
|
| 52 |
+
var _process$env$NODE_ENV;
|
| 53 |
+
return getDefaultMiddleware({
|
| 54 |
+
serializableCheck: false,
|
| 55 |
+
immutableCheck: !['commonjs', 'es6', 'production'].includes((_process$env$NODE_ENV = "commonjs") !== null && _process$env$NODE_ENV !== void 0 ? _process$env$NODE_ENV : '')
|
| 56 |
+
}).concat([_mouseEventsMiddleware.mouseClickMiddleware.middleware, _mouseEventsMiddleware.mouseMoveMiddleware.middleware, _keyboardEventsMiddleware.keyboardEventsMiddleware.middleware, _externalEventsMiddleware.externalEventsMiddleware.middleware, _touchEventsMiddleware.touchEventMiddleware.middleware]);
|
| 57 |
+
},
|
| 58 |
+
/*
|
| 59 |
+
* I can't find out how to satisfy typescript here.
|
| 60 |
+
* We return `EnhancerArray<[StoreEnhancer<{}, {}>, StoreEnhancer]>` from this function,
|
| 61 |
+
* but the types say we should return `EnhancerArray<StoreEnhancer<{}, {}>`.
|
| 62 |
+
* Looks like it's badly inferred generics, but it won't allow me to provide the correct type manually either.
|
| 63 |
+
* So let's just ignore the error for now.
|
| 64 |
+
*/
|
| 65 |
+
// @ts-expect-error mismatched generics
|
| 66 |
+
enhancers: getDefaultEnhancers => {
|
| 67 |
+
var enhancers = getDefaultEnhancers;
|
| 68 |
+
if (typeof getDefaultEnhancers === 'function') {
|
| 69 |
+
/*
|
| 70 |
+
* In RTK v2 this is always a function, but in v1 it is an array.
|
| 71 |
+
* Because we have @types/redux-toolkit v1 as a dependency, typescript is going to flag this as an error.
|
| 72 |
+
* We support both RTK v1 and v2, so we need to do this check.
|
| 73 |
+
* https://redux-toolkit.js.org/usage/migrating-rtk-2#configurestoreenhancers-must-be-a-callback
|
| 74 |
+
*/
|
| 75 |
+
// @ts-expect-error RTK v2 behaviour on RTK v1 types
|
| 76 |
+
enhancers = getDefaultEnhancers();
|
| 77 |
+
}
|
| 78 |
+
return enhancers.concat((0, _toolkit.autoBatchEnhancer)({
|
| 79 |
+
type: 'raf'
|
| 80 |
+
}));
|
| 81 |
+
},
|
| 82 |
+
devTools: _Global.Global.devToolsEnabled && {
|
| 83 |
+
serialize: {
|
| 84 |
+
replacer: _reduxDevtoolsJsonStringifyReplacer.reduxDevtoolsJsonStringifyReplacer
|
| 85 |
+
},
|
| 86 |
+
name: "recharts-".concat(chartName)
|
| 87 |
+
}
|
| 88 |
+
});
|
| 89 |
+
};
|
node_modules/recharts/lib/state/tooltipSlice.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.tooltipReducer = exports.setTooltipSettingsState = exports.setSyncInteraction = exports.setMouseOverAxisIndex = exports.setMouseClickAxisIndex = exports.setKeyboardInteraction = exports.setActiveMouseOverItemIndex = exports.setActiveClickItemIndex = exports.replaceTooltipEntrySettings = exports.removeTooltipEntrySettings = exports.noInteraction = exports.mouseLeaveItem = exports.mouseLeaveChart = exports.initialState = exports.addTooltipEntrySettings = void 0;
|
| 7 |
+
var _toolkit = require("@reduxjs/toolkit");
|
| 8 |
+
var _immer = require("immer");
|
| 9 |
+
/**
|
| 10 |
+
* One Tooltip can display multiple TooltipPayloadEntries at a time.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* So what happens is that the tooltip payload is decided based on the available data, and the dataKey.
|
| 15 |
+
* The dataKey can either be defined on the graphical element (like Line, or Bar)
|
| 16 |
+
* or on the tooltip itself.
|
| 17 |
+
*
|
| 18 |
+
* The data can be defined in the chart element, or in the graphical item.
|
| 19 |
+
*
|
| 20 |
+
* So this type is all the settings, other than the data + dataKey complications.
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* This is what Tooltip renders.
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* null means no active index
|
| 29 |
+
* string means: whichever index from the chart data it is.
|
| 30 |
+
* Different charts have different requirements on data shapes,
|
| 31 |
+
* and are also responsible for providing a function that will accept this index
|
| 32 |
+
* and return data.
|
| 33 |
+
*/
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Different items have different data shapes so the state has no opinion on what the data shape should be;
|
| 37 |
+
* the only requirement is that the chart also provides a searcher function
|
| 38 |
+
* that accepts the data, and a key, and returns whatever the payload in Tooltip should be.
|
| 39 |
+
*/
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* So this informs the "tooltip event type". Tooltip event type can be either "axis" or "item"
|
| 43 |
+
* and it is used for two things:
|
| 44 |
+
* 1. Sets the active area
|
| 45 |
+
* 2. Sets the background and cursor highlights
|
| 46 |
+
*
|
| 47 |
+
* Some charts only allow to have one type of tooltip event type, some allow both.
|
| 48 |
+
* Those charts that allow both will have one default, and the "shared" prop will be used to switch between them.
|
| 49 |
+
* Undefined means "use the chart default".
|
| 50 |
+
*
|
| 51 |
+
* Charts that only allow one tooltip event type, will ignore the shared prop.
|
| 52 |
+
*/
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* A generic state for user interaction with the chart.
|
| 56 |
+
* User interaction can come through multiple channels: mouse events, keyboard events, or hardcoded in props, or synchronised from other charts.
|
| 57 |
+
*
|
| 58 |
+
* Each of the interaction states is represented as TooltipInteractionState,
|
| 59 |
+
* and then the selectors and Tooltip will decide which of the interaction states to use.
|
| 60 |
+
*/
|
| 61 |
+
|
| 62 |
+
var noInteraction = exports.noInteraction = {
|
| 63 |
+
active: false,
|
| 64 |
+
index: null,
|
| 65 |
+
dataKey: undefined,
|
| 66 |
+
graphicalItemId: undefined,
|
| 67 |
+
coordinate: undefined
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* The tooltip interaction state stores:
|
| 72 |
+
*
|
| 73 |
+
* - Which graphical item is user interacting with at the moment,
|
| 74 |
+
* - which axis (or, which part of chart background) is user interacting with at the moment
|
| 75 |
+
* - The data that individual graphical items wish to be displayed in case the tooltip gets activated
|
| 76 |
+
*/
|
| 77 |
+
|
| 78 |
+
var initialState = exports.initialState = {
|
| 79 |
+
itemInteraction: {
|
| 80 |
+
click: noInteraction,
|
| 81 |
+
hover: noInteraction
|
| 82 |
+
},
|
| 83 |
+
axisInteraction: {
|
| 84 |
+
click: noInteraction,
|
| 85 |
+
hover: noInteraction
|
| 86 |
+
},
|
| 87 |
+
keyboardInteraction: noInteraction,
|
| 88 |
+
syncInteraction: {
|
| 89 |
+
active: false,
|
| 90 |
+
index: null,
|
| 91 |
+
dataKey: undefined,
|
| 92 |
+
label: undefined,
|
| 93 |
+
coordinate: undefined,
|
| 94 |
+
sourceViewBox: undefined,
|
| 95 |
+
graphicalItemId: undefined
|
| 96 |
+
},
|
| 97 |
+
tooltipItemPayloads: [],
|
| 98 |
+
settings: {
|
| 99 |
+
shared: undefined,
|
| 100 |
+
trigger: 'hover',
|
| 101 |
+
axisId: 0,
|
| 102 |
+
active: false,
|
| 103 |
+
defaultIndex: undefined
|
| 104 |
+
}
|
| 105 |
+
};
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* This is the event we get when user is interacting with a specific graphical item.
|
| 109 |
+
*/
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Keyboard interaction payload has no graphical item ID,
|
| 113 |
+
* and no dataKey, because keyboard interaction is always
|
| 114 |
+
* with the whole chart, not with a specific graphical item.
|
| 115 |
+
*/
|
| 116 |
+
|
| 117 |
+
var tooltipSlice = (0, _toolkit.createSlice)({
|
| 118 |
+
name: 'tooltip',
|
| 119 |
+
initialState,
|
| 120 |
+
reducers: {
|
| 121 |
+
addTooltipEntrySettings: {
|
| 122 |
+
reducer(state, action) {
|
| 123 |
+
state.tooltipItemPayloads.push((0, _immer.castDraft)(action.payload));
|
| 124 |
+
},
|
| 125 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 126 |
+
},
|
| 127 |
+
replaceTooltipEntrySettings: {
|
| 128 |
+
reducer(state, action) {
|
| 129 |
+
var {
|
| 130 |
+
prev,
|
| 131 |
+
next
|
| 132 |
+
} = action.payload;
|
| 133 |
+
var index = (0, _toolkit.current)(state).tooltipItemPayloads.indexOf((0, _immer.castDraft)(prev));
|
| 134 |
+
if (index > -1) {
|
| 135 |
+
state.tooltipItemPayloads[index] = (0, _immer.castDraft)(next);
|
| 136 |
+
}
|
| 137 |
+
},
|
| 138 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 139 |
+
},
|
| 140 |
+
removeTooltipEntrySettings: {
|
| 141 |
+
reducer(state, action) {
|
| 142 |
+
var index = (0, _toolkit.current)(state).tooltipItemPayloads.indexOf((0, _immer.castDraft)(action.payload));
|
| 143 |
+
if (index > -1) {
|
| 144 |
+
state.tooltipItemPayloads.splice(index, 1);
|
| 145 |
+
}
|
| 146 |
+
},
|
| 147 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 148 |
+
},
|
| 149 |
+
setTooltipSettingsState(state, action) {
|
| 150 |
+
state.settings = action.payload;
|
| 151 |
+
},
|
| 152 |
+
setActiveMouseOverItemIndex(state, action) {
|
| 153 |
+
state.syncInteraction.active = false;
|
| 154 |
+
state.keyboardInteraction.active = false;
|
| 155 |
+
state.itemInteraction.hover.active = true;
|
| 156 |
+
state.itemInteraction.hover.index = action.payload.activeIndex;
|
| 157 |
+
state.itemInteraction.hover.dataKey = action.payload.activeDataKey;
|
| 158 |
+
state.itemInteraction.hover.graphicalItemId = action.payload.activeGraphicalItemId;
|
| 159 |
+
state.itemInteraction.hover.coordinate = action.payload.activeCoordinate;
|
| 160 |
+
},
|
| 161 |
+
mouseLeaveChart(state) {
|
| 162 |
+
/*
|
| 163 |
+
* Clear only the active flags. Why?
|
| 164 |
+
* 1. Keep Coordinate to preserve animation - next time the Tooltip appears, we want to render it from
|
| 165 |
+
* the last place where it was when it disappeared.
|
| 166 |
+
* 2. We want to keep all the properties anyway just in case the tooltip has `active=true` prop
|
| 167 |
+
* and continues being visible even after the mouse has left the chart.
|
| 168 |
+
*/
|
| 169 |
+
state.itemInteraction.hover.active = false;
|
| 170 |
+
state.axisInteraction.hover.active = false;
|
| 171 |
+
},
|
| 172 |
+
mouseLeaveItem(state) {
|
| 173 |
+
state.itemInteraction.hover.active = false;
|
| 174 |
+
},
|
| 175 |
+
setActiveClickItemIndex(state, action) {
|
| 176 |
+
state.syncInteraction.active = false;
|
| 177 |
+
state.itemInteraction.click.active = true;
|
| 178 |
+
state.keyboardInteraction.active = false;
|
| 179 |
+
state.itemInteraction.click.index = action.payload.activeIndex;
|
| 180 |
+
state.itemInteraction.click.dataKey = action.payload.activeDataKey;
|
| 181 |
+
state.itemInteraction.click.graphicalItemId = action.payload.activeGraphicalItemId;
|
| 182 |
+
state.itemInteraction.click.coordinate = action.payload.activeCoordinate;
|
| 183 |
+
},
|
| 184 |
+
setMouseOverAxisIndex(state, action) {
|
| 185 |
+
state.syncInteraction.active = false;
|
| 186 |
+
state.axisInteraction.hover.active = true;
|
| 187 |
+
state.keyboardInteraction.active = false;
|
| 188 |
+
state.axisInteraction.hover.index = action.payload.activeIndex;
|
| 189 |
+
state.axisInteraction.hover.dataKey = action.payload.activeDataKey;
|
| 190 |
+
state.axisInteraction.hover.coordinate = action.payload.activeCoordinate;
|
| 191 |
+
},
|
| 192 |
+
setMouseClickAxisIndex(state, action) {
|
| 193 |
+
state.syncInteraction.active = false;
|
| 194 |
+
state.keyboardInteraction.active = false;
|
| 195 |
+
state.axisInteraction.click.active = true;
|
| 196 |
+
state.axisInteraction.click.index = action.payload.activeIndex;
|
| 197 |
+
state.axisInteraction.click.dataKey = action.payload.activeDataKey;
|
| 198 |
+
state.axisInteraction.click.coordinate = action.payload.activeCoordinate;
|
| 199 |
+
},
|
| 200 |
+
setSyncInteraction(state, action) {
|
| 201 |
+
state.syncInteraction = action.payload;
|
| 202 |
+
},
|
| 203 |
+
setKeyboardInteraction(state, action) {
|
| 204 |
+
state.keyboardInteraction.active = action.payload.active;
|
| 205 |
+
state.keyboardInteraction.index = action.payload.activeIndex;
|
| 206 |
+
state.keyboardInteraction.coordinate = action.payload.activeCoordinate;
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
});
|
| 210 |
+
var {
|
| 211 |
+
addTooltipEntrySettings,
|
| 212 |
+
replaceTooltipEntrySettings,
|
| 213 |
+
removeTooltipEntrySettings,
|
| 214 |
+
setTooltipSettingsState,
|
| 215 |
+
setActiveMouseOverItemIndex,
|
| 216 |
+
mouseLeaveItem,
|
| 217 |
+
mouseLeaveChart,
|
| 218 |
+
setActiveClickItemIndex,
|
| 219 |
+
setMouseOverAxisIndex,
|
| 220 |
+
setMouseClickAxisIndex,
|
| 221 |
+
setSyncInteraction,
|
| 222 |
+
setKeyboardInteraction
|
| 223 |
+
} = tooltipSlice.actions;
|
| 224 |
+
exports.setKeyboardInteraction = setKeyboardInteraction;
|
| 225 |
+
exports.setSyncInteraction = setSyncInteraction;
|
| 226 |
+
exports.setMouseClickAxisIndex = setMouseClickAxisIndex;
|
| 227 |
+
exports.setMouseOverAxisIndex = setMouseOverAxisIndex;
|
| 228 |
+
exports.setActiveClickItemIndex = setActiveClickItemIndex;
|
| 229 |
+
exports.mouseLeaveChart = mouseLeaveChart;
|
| 230 |
+
exports.mouseLeaveItem = mouseLeaveItem;
|
| 231 |
+
exports.setActiveMouseOverItemIndex = setActiveMouseOverItemIndex;
|
| 232 |
+
exports.setTooltipSettingsState = setTooltipSettingsState;
|
| 233 |
+
exports.removeTooltipEntrySettings = removeTooltipEntrySettings;
|
| 234 |
+
exports.replaceTooltipEntrySettings = replaceTooltipEntrySettings;
|
| 235 |
+
exports.addTooltipEntrySettings = addTooltipEntrySettings;
|
| 236 |
+
var tooltipReducer = exports.tooltipReducer = tooltipSlice.reducer;
|
node_modules/recharts/lib/state/touchEventsMiddleware.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.touchEventMiddleware = exports.touchEventAction = void 0;
|
| 7 |
+
var _toolkit = require("@reduxjs/toolkit");
|
| 8 |
+
var _tooltipSlice = require("./tooltipSlice");
|
| 9 |
+
var _selectActivePropsFromChartPointer = require("./selectors/selectActivePropsFromChartPointer");
|
| 10 |
+
var _getChartPointer = require("../util/getChartPointer");
|
| 11 |
+
var _selectTooltipEventType = require("./selectors/selectTooltipEventType");
|
| 12 |
+
var _Constants = require("../util/Constants");
|
| 13 |
+
var _touchSelectors = require("./selectors/touchSelectors");
|
| 14 |
+
var _tooltipSelectors = require("./selectors/tooltipSelectors");
|
| 15 |
+
var touchEventAction = exports.touchEventAction = (0, _toolkit.createAction)('touchMove');
|
| 16 |
+
var touchEventMiddleware = exports.touchEventMiddleware = (0, _toolkit.createListenerMiddleware)();
|
| 17 |
+
touchEventMiddleware.startListening({
|
| 18 |
+
actionCreator: touchEventAction,
|
| 19 |
+
effect: (action, listenerApi) => {
|
| 20 |
+
var touchEvent = action.payload;
|
| 21 |
+
if (touchEvent.touches == null || touchEvent.touches.length === 0) {
|
| 22 |
+
return;
|
| 23 |
+
}
|
| 24 |
+
var state = listenerApi.getState();
|
| 25 |
+
var tooltipEventType = (0, _selectTooltipEventType.selectTooltipEventType)(state, state.tooltip.settings.shared);
|
| 26 |
+
if (tooltipEventType === 'axis') {
|
| 27 |
+
var touch = touchEvent.touches[0];
|
| 28 |
+
if (touch == null) {
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
var activeProps = (0, _selectActivePropsFromChartPointer.selectActivePropsFromChartPointer)(state, (0, _getChartPointer.getChartPointer)({
|
| 32 |
+
clientX: touch.clientX,
|
| 33 |
+
clientY: touch.clientY,
|
| 34 |
+
currentTarget: touchEvent.currentTarget
|
| 35 |
+
}));
|
| 36 |
+
if ((activeProps === null || activeProps === void 0 ? void 0 : activeProps.activeIndex) != null) {
|
| 37 |
+
listenerApi.dispatch((0, _tooltipSlice.setMouseOverAxisIndex)({
|
| 38 |
+
activeIndex: activeProps.activeIndex,
|
| 39 |
+
activeDataKey: undefined,
|
| 40 |
+
activeCoordinate: activeProps.activeCoordinate
|
| 41 |
+
}));
|
| 42 |
+
}
|
| 43 |
+
} else if (tooltipEventType === 'item') {
|
| 44 |
+
var _target$getAttribute;
|
| 45 |
+
var _touch = touchEvent.touches[0];
|
| 46 |
+
if (document.elementFromPoint == null || _touch == null) {
|
| 47 |
+
return;
|
| 48 |
+
}
|
| 49 |
+
var target = document.elementFromPoint(_touch.clientX, _touch.clientY);
|
| 50 |
+
if (!target || !target.getAttribute) {
|
| 51 |
+
return;
|
| 52 |
+
}
|
| 53 |
+
var itemIndex = target.getAttribute(_Constants.DATA_ITEM_INDEX_ATTRIBUTE_NAME);
|
| 54 |
+
var graphicalItemId = (_target$getAttribute = target.getAttribute(_Constants.DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME)) !== null && _target$getAttribute !== void 0 ? _target$getAttribute : undefined;
|
| 55 |
+
var settings = (0, _tooltipSelectors.selectAllGraphicalItemsSettings)(state).find(item => item.id === graphicalItemId);
|
| 56 |
+
if (itemIndex == null || settings == null || graphicalItemId == null) {
|
| 57 |
+
return;
|
| 58 |
+
}
|
| 59 |
+
var {
|
| 60 |
+
dataKey
|
| 61 |
+
} = settings;
|
| 62 |
+
var coordinate = (0, _touchSelectors.selectTooltipCoordinate)(state, itemIndex, graphicalItemId);
|
| 63 |
+
listenerApi.dispatch((0, _tooltipSlice.setActiveMouseOverItemIndex)({
|
| 64 |
+
activeDataKey: dataKey,
|
| 65 |
+
activeIndex: itemIndex,
|
| 66 |
+
activeCoordinate: coordinate,
|
| 67 |
+
activeGraphicalItemId: graphicalItemId
|
| 68 |
+
}));
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
});
|
node_modules/recharts/lib/state/types/AreaSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/BarSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/LineSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/PieSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/RadarSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/RadialBarSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/ScatterSettings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/state/types/StackedGraphicalItem.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.isStacked = isStacked;
|
| 7 |
+
/**
|
| 8 |
+
* Some graphical items allow data stacking. The stacks are optional,
|
| 9 |
+
* so all props here are optional too.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* Some graphical items allow data stacking.
|
| 14 |
+
* This interface is used to represent the items that are stacked
|
| 15 |
+
* because the user has provided the stackId and dataKey properties.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
function isStacked(graphicalItem) {
|
| 19 |
+
return 'stackId' in graphicalItem && graphicalItem.stackId != null && graphicalItem.dataKey != null;
|
| 20 |
+
}
|
node_modules/recharts/lib/state/zIndexSlice.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.zIndexReducer = exports.unregisterZIndexPortalElement = exports.unregisterZIndexPortal = exports.registerZIndexPortalElement = exports.registerZIndexPortal = void 0;
|
| 7 |
+
var _toolkit = require("@reduxjs/toolkit");
|
| 8 |
+
var _immer = require("immer");
|
| 9 |
+
var _DefaultZIndexes = require("../zIndex/DefaultZIndexes");
|
| 10 |
+
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; }
|
| 11 |
+
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; }
|
| 12 |
+
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; }
|
| 13 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 14 |
+
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); } /**
|
| 15 |
+
* This slice contains a registry of z-index values for various components.
|
| 16 |
+
* The state is a map from z-index numbers to element references.
|
| 17 |
+
*/
|
| 18 |
+
var seed = {};
|
| 19 |
+
var initialState = {
|
| 20 |
+
zIndexMap: Object.values(_DefaultZIndexes.DefaultZIndexes).reduce((acc, current) => _objectSpread(_objectSpread({}, acc), {}, {
|
| 21 |
+
[current]: {
|
| 22 |
+
element: undefined,
|
| 23 |
+
panoramaElement: undefined,
|
| 24 |
+
consumers: 0
|
| 25 |
+
}
|
| 26 |
+
}), seed)
|
| 27 |
+
};
|
| 28 |
+
var defaultZIndexSet = new Set(Object.values(_DefaultZIndexes.DefaultZIndexes));
|
| 29 |
+
function isDefaultZIndex(zIndex) {
|
| 30 |
+
return defaultZIndexSet.has(zIndex);
|
| 31 |
+
}
|
| 32 |
+
var zIndexSlice = (0, _toolkit.createSlice)({
|
| 33 |
+
name: 'zIndex',
|
| 34 |
+
initialState,
|
| 35 |
+
reducers: {
|
| 36 |
+
registerZIndexPortal: {
|
| 37 |
+
reducer: (state, action) => {
|
| 38 |
+
var {
|
| 39 |
+
zIndex
|
| 40 |
+
} = action.payload;
|
| 41 |
+
if (state.zIndexMap[zIndex]) {
|
| 42 |
+
state.zIndexMap[zIndex].consumers += 1;
|
| 43 |
+
} else {
|
| 44 |
+
state.zIndexMap[zIndex] = {
|
| 45 |
+
consumers: 1,
|
| 46 |
+
element: undefined,
|
| 47 |
+
panoramaElement: undefined
|
| 48 |
+
};
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 52 |
+
},
|
| 53 |
+
unregisterZIndexPortal: {
|
| 54 |
+
reducer: (state, action) => {
|
| 55 |
+
var {
|
| 56 |
+
zIndex
|
| 57 |
+
} = action.payload;
|
| 58 |
+
if (state.zIndexMap[zIndex]) {
|
| 59 |
+
state.zIndexMap[zIndex].consumers -= 1;
|
| 60 |
+
/*
|
| 61 |
+
* Garbage collect unused z-index entries, except for default z-indexes.
|
| 62 |
+
* Default z-indexes are always rendered, regardless of whether there are consumers or not.
|
| 63 |
+
* And because of that, even if we delete this entry, the ZIndexPortal provider will still be rendered
|
| 64 |
+
* and React is not going to re-create it, and it won't re-register the element ID.
|
| 65 |
+
* So let's not delete default z-index entries.
|
| 66 |
+
*/
|
| 67 |
+
if (state.zIndexMap[zIndex].consumers <= 0 && !isDefaultZIndex(zIndex)) {
|
| 68 |
+
delete state.zIndexMap[zIndex];
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 73 |
+
},
|
| 74 |
+
registerZIndexPortalElement: {
|
| 75 |
+
reducer: (state, action) => {
|
| 76 |
+
var {
|
| 77 |
+
zIndex,
|
| 78 |
+
element,
|
| 79 |
+
isPanorama
|
| 80 |
+
} = action.payload;
|
| 81 |
+
if (state.zIndexMap[zIndex]) {
|
| 82 |
+
if (isPanorama) {
|
| 83 |
+
state.zIndexMap[zIndex].panoramaElement = (0, _immer.castDraft)(element);
|
| 84 |
+
} else {
|
| 85 |
+
state.zIndexMap[zIndex].element = (0, _immer.castDraft)(element);
|
| 86 |
+
}
|
| 87 |
+
} else {
|
| 88 |
+
state.zIndexMap[zIndex] = {
|
| 89 |
+
consumers: 0,
|
| 90 |
+
element: isPanorama ? undefined : (0, _immer.castDraft)(element),
|
| 91 |
+
panoramaElement: isPanorama ? (0, _immer.castDraft)(element) : undefined
|
| 92 |
+
};
|
| 93 |
+
}
|
| 94 |
+
},
|
| 95 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 96 |
+
},
|
| 97 |
+
unregisterZIndexPortalElement: {
|
| 98 |
+
reducer: (state, action) => {
|
| 99 |
+
var {
|
| 100 |
+
zIndex
|
| 101 |
+
} = action.payload;
|
| 102 |
+
if (state.zIndexMap[zIndex]) {
|
| 103 |
+
if (action.payload.isPanorama) {
|
| 104 |
+
state.zIndexMap[zIndex].panoramaElement = undefined;
|
| 105 |
+
} else {
|
| 106 |
+
state.zIndexMap[zIndex].element = undefined;
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
prepare: (0, _toolkit.prepareAutoBatched)()
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
});
|
| 114 |
+
var {
|
| 115 |
+
registerZIndexPortal,
|
| 116 |
+
unregisterZIndexPortal,
|
| 117 |
+
registerZIndexPortalElement,
|
| 118 |
+
unregisterZIndexPortalElement
|
| 119 |
+
} = zIndexSlice.actions;
|
| 120 |
+
exports.unregisterZIndexPortalElement = unregisterZIndexPortalElement;
|
| 121 |
+
exports.registerZIndexPortalElement = registerZIndexPortalElement;
|
| 122 |
+
exports.unregisterZIndexPortal = unregisterZIndexPortal;
|
| 123 |
+
exports.registerZIndexPortal = registerZIndexPortal;
|
| 124 |
+
var zIndexReducer = exports.zIndexReducer = zIndexSlice.reducer;
|
node_modules/recharts/lib/synchronisation/syncSelectors.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.selectSynchronisedTooltipState = selectSynchronisedTooltipState;
|
| 7 |
+
function selectSynchronisedTooltipState(state) {
|
| 8 |
+
return state.tooltip.syncInteraction;
|
| 9 |
+
}
|
node_modules/recharts/lib/synchronisation/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/synchronisation/useChartSynchronisation.js
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.useBrushChartSynchronisation = useBrushChartSynchronisation;
|
| 7 |
+
exports.useSynchronisedEventsFromOtherCharts = useSynchronisedEventsFromOtherCharts;
|
| 8 |
+
exports.useTooltipChartSynchronisation = useTooltipChartSynchronisation;
|
| 9 |
+
var _react = require("react");
|
| 10 |
+
var _hooks = require("../state/hooks");
|
| 11 |
+
var _rootPropsSelectors = require("../state/selectors/rootPropsSelectors");
|
| 12 |
+
var _Events = require("../util/Events");
|
| 13 |
+
var _optionsSlice = require("../state/optionsSlice");
|
| 14 |
+
var _tooltipSlice = require("../state/tooltipSlice");
|
| 15 |
+
var _selectors = require("../state/selectors/selectors");
|
| 16 |
+
var _tooltipSelectors = require("../state/selectors/tooltipSelectors");
|
| 17 |
+
var _syncSelectors = require("./syncSelectors");
|
| 18 |
+
var _chartLayoutContext = require("../context/chartLayoutContext");
|
| 19 |
+
var _chartDataSlice = require("../state/chartDataSlice");
|
| 20 |
+
var _DataUtils = require("../util/DataUtils");
|
| 21 |
+
var _excluded = ["x", "y"];
|
| 22 |
+
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; }
|
| 23 |
+
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; }
|
| 24 |
+
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; }
|
| 25 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 26 |
+
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); }
|
| 27 |
+
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; }
|
| 28 |
+
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; }
|
| 29 |
+
function useTooltipSyncEventsListener() {
|
| 30 |
+
var mySyncId = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncId);
|
| 31 |
+
var myEventEmitter = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectEventEmitter);
|
| 32 |
+
var dispatch = (0, _hooks.useAppDispatch)();
|
| 33 |
+
var syncMethod = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncMethod);
|
| 34 |
+
var tooltipTicks = (0, _hooks.useAppSelector)(_tooltipSelectors.selectTooltipAxisTicks);
|
| 35 |
+
var layout = (0, _chartLayoutContext.useChartLayout)();
|
| 36 |
+
var viewBox = (0, _chartLayoutContext.useViewBox)();
|
| 37 |
+
var className = (0, _hooks.useAppSelector)(state => state.rootProps.className);
|
| 38 |
+
(0, _react.useEffect)(() => {
|
| 39 |
+
if (mySyncId == null) {
|
| 40 |
+
// This chart is not synchronised with any other chart so we don't need to listen for any events.
|
| 41 |
+
return _DataUtils.noop;
|
| 42 |
+
}
|
| 43 |
+
var listener = (incomingSyncId, action, emitter) => {
|
| 44 |
+
if (myEventEmitter === emitter) {
|
| 45 |
+
// We don't want to dispatch actions that we sent ourselves.
|
| 46 |
+
return;
|
| 47 |
+
}
|
| 48 |
+
if (mySyncId !== incomingSyncId) {
|
| 49 |
+
// This event is not for this chart
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
if (syncMethod === 'index') {
|
| 53 |
+
var _action$payload;
|
| 54 |
+
if (viewBox && action !== null && action !== void 0 && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.coordinate && action.payload.sourceViewBox) {
|
| 55 |
+
var _action$payload$coord = action.payload.coordinate,
|
| 56 |
+
{
|
| 57 |
+
x: _x,
|
| 58 |
+
y: _y
|
| 59 |
+
} = _action$payload$coord,
|
| 60 |
+
otherCoordinateProps = _objectWithoutProperties(_action$payload$coord, _excluded);
|
| 61 |
+
var {
|
| 62 |
+
x: sourceX,
|
| 63 |
+
y: sourceY,
|
| 64 |
+
width: sourceWidth,
|
| 65 |
+
height: sourceHeight
|
| 66 |
+
} = action.payload.sourceViewBox;
|
| 67 |
+
var scaledCoordinate = _objectSpread(_objectSpread({}, otherCoordinateProps), {}, {
|
| 68 |
+
x: viewBox.x + (sourceWidth ? (_x - sourceX) / sourceWidth : 0) * viewBox.width,
|
| 69 |
+
y: viewBox.y + (sourceHeight ? (_y - sourceY) / sourceHeight : 0) * viewBox.height
|
| 70 |
+
});
|
| 71 |
+
dispatch(_objectSpread(_objectSpread({}, action), {}, {
|
| 72 |
+
payload: _objectSpread(_objectSpread({}, action.payload), {}, {
|
| 73 |
+
coordinate: scaledCoordinate
|
| 74 |
+
})
|
| 75 |
+
}));
|
| 76 |
+
} else {
|
| 77 |
+
dispatch(action);
|
| 78 |
+
}
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
if (tooltipTicks == null) {
|
| 82 |
+
// for the other two sync methods, we need the ticks to be available
|
| 83 |
+
return;
|
| 84 |
+
}
|
| 85 |
+
var activeTick;
|
| 86 |
+
if (typeof syncMethod === 'function') {
|
| 87 |
+
/*
|
| 88 |
+
* This is what the data shape in 2.x CategoricalChartState used to look like.
|
| 89 |
+
* In 3.x we store things differently but let's try to keep the old shape for compatibility.
|
| 90 |
+
*/
|
| 91 |
+
var syncMethodParam = {
|
| 92 |
+
activeTooltipIndex: action.payload.index == null ? undefined : Number(action.payload.index),
|
| 93 |
+
isTooltipActive: action.payload.active,
|
| 94 |
+
activeIndex: action.payload.index == null ? undefined : Number(action.payload.index),
|
| 95 |
+
activeLabel: action.payload.label,
|
| 96 |
+
activeDataKey: action.payload.dataKey,
|
| 97 |
+
activeCoordinate: action.payload.coordinate
|
| 98 |
+
};
|
| 99 |
+
// Call a callback function. If there is an application specific algorithm
|
| 100 |
+
var activeTooltipIndex = syncMethod(tooltipTicks, syncMethodParam);
|
| 101 |
+
activeTick = tooltipTicks[activeTooltipIndex];
|
| 102 |
+
} else if (syncMethod === 'value') {
|
| 103 |
+
// labels are always strings, tick.value might be a string or a number, depending on axis type
|
| 104 |
+
activeTick = tooltipTicks.find(tick => String(tick.value) === action.payload.label);
|
| 105 |
+
}
|
| 106 |
+
var {
|
| 107 |
+
coordinate
|
| 108 |
+
} = action.payload;
|
| 109 |
+
if (activeTick == null || action.payload.active === false || coordinate == null || viewBox == null) {
|
| 110 |
+
dispatch((0, _tooltipSlice.setSyncInteraction)({
|
| 111 |
+
active: false,
|
| 112 |
+
coordinate: undefined,
|
| 113 |
+
dataKey: undefined,
|
| 114 |
+
index: null,
|
| 115 |
+
label: undefined,
|
| 116 |
+
sourceViewBox: undefined,
|
| 117 |
+
graphicalItemId: undefined
|
| 118 |
+
}));
|
| 119 |
+
return;
|
| 120 |
+
}
|
| 121 |
+
var {
|
| 122 |
+
x,
|
| 123 |
+
y
|
| 124 |
+
} = coordinate;
|
| 125 |
+
var validateChartX = Math.min(x, viewBox.x + viewBox.width);
|
| 126 |
+
var validateChartY = Math.min(y, viewBox.y + viewBox.height);
|
| 127 |
+
var activeCoordinate = {
|
| 128 |
+
x: layout === 'horizontal' ? activeTick.coordinate : validateChartX,
|
| 129 |
+
y: layout === 'horizontal' ? validateChartY : activeTick.coordinate
|
| 130 |
+
};
|
| 131 |
+
var syncAction = (0, _tooltipSlice.setSyncInteraction)({
|
| 132 |
+
active: action.payload.active,
|
| 133 |
+
coordinate: activeCoordinate,
|
| 134 |
+
dataKey: action.payload.dataKey,
|
| 135 |
+
index: String(activeTick.index),
|
| 136 |
+
label: action.payload.label,
|
| 137 |
+
sourceViewBox: action.payload.sourceViewBox,
|
| 138 |
+
graphicalItemId: action.payload.graphicalItemId
|
| 139 |
+
});
|
| 140 |
+
dispatch(syncAction);
|
| 141 |
+
};
|
| 142 |
+
_Events.eventCenter.on(_Events.TOOLTIP_SYNC_EVENT, listener);
|
| 143 |
+
return () => {
|
| 144 |
+
_Events.eventCenter.off(_Events.TOOLTIP_SYNC_EVENT, listener);
|
| 145 |
+
};
|
| 146 |
+
}, [className, dispatch, myEventEmitter, mySyncId, syncMethod, tooltipTicks, layout, viewBox]);
|
| 147 |
+
}
|
| 148 |
+
function useBrushSyncEventsListener() {
|
| 149 |
+
var mySyncId = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncId);
|
| 150 |
+
var myEventEmitter = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectEventEmitter);
|
| 151 |
+
var dispatch = (0, _hooks.useAppDispatch)();
|
| 152 |
+
(0, _react.useEffect)(() => {
|
| 153 |
+
if (mySyncId == null) {
|
| 154 |
+
// This chart is not synchronised with any other chart so we don't need to listen for any events.
|
| 155 |
+
return _DataUtils.noop;
|
| 156 |
+
}
|
| 157 |
+
var listener = (incomingSyncId, action, emitter) => {
|
| 158 |
+
if (myEventEmitter === emitter) {
|
| 159 |
+
// We don't want to dispatch actions that we sent ourselves.
|
| 160 |
+
return;
|
| 161 |
+
}
|
| 162 |
+
if (mySyncId === incomingSyncId) {
|
| 163 |
+
dispatch((0, _chartDataSlice.setDataStartEndIndexes)(action));
|
| 164 |
+
}
|
| 165 |
+
};
|
| 166 |
+
_Events.eventCenter.on(_Events.BRUSH_SYNC_EVENT, listener);
|
| 167 |
+
return () => {
|
| 168 |
+
_Events.eventCenter.off(_Events.BRUSH_SYNC_EVENT, listener);
|
| 169 |
+
};
|
| 170 |
+
}, [dispatch, myEventEmitter, mySyncId]);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
* Will receive synchronisation events from other charts.
|
| 175 |
+
*
|
| 176 |
+
* Reads syncMethod from state and decides how to synchronise the tooltip based on that.
|
| 177 |
+
*
|
| 178 |
+
* @returns void
|
| 179 |
+
*/
|
| 180 |
+
function useSynchronisedEventsFromOtherCharts() {
|
| 181 |
+
var dispatch = (0, _hooks.useAppDispatch)();
|
| 182 |
+
(0, _react.useEffect)(() => {
|
| 183 |
+
dispatch((0, _optionsSlice.createEventEmitter)());
|
| 184 |
+
}, [dispatch]);
|
| 185 |
+
useTooltipSyncEventsListener();
|
| 186 |
+
useBrushSyncEventsListener();
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Will send events to other charts.
|
| 191 |
+
* If syncId is undefined, no events will be sent.
|
| 192 |
+
*
|
| 193 |
+
* This ignores the syncMethod, because that is set and computed on the receiving end.
|
| 194 |
+
*
|
| 195 |
+
* @param tooltipEventType from Tooltip
|
| 196 |
+
* @param trigger from Tooltip
|
| 197 |
+
* @param activeCoordinate from state
|
| 198 |
+
* @param activeLabel from state
|
| 199 |
+
* @param activeIndex from state
|
| 200 |
+
* @param isTooltipActive from state
|
| 201 |
+
* @returns void
|
| 202 |
+
*/
|
| 203 |
+
function useTooltipChartSynchronisation(tooltipEventType, trigger, activeCoordinate, activeLabel, activeIndex, isTooltipActive) {
|
| 204 |
+
var activeDataKey = (0, _hooks.useAppSelector)(state => (0, _selectors.selectTooltipDataKey)(state, tooltipEventType, trigger));
|
| 205 |
+
var eventEmitterSymbol = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectEventEmitter);
|
| 206 |
+
var syncId = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncId);
|
| 207 |
+
var syncMethod = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncMethod);
|
| 208 |
+
var tooltipState = (0, _hooks.useAppSelector)(_syncSelectors.selectSynchronisedTooltipState);
|
| 209 |
+
var isReceivingSynchronisation = tooltipState === null || tooltipState === void 0 ? void 0 : tooltipState.active;
|
| 210 |
+
var viewBox = (0, _chartLayoutContext.useViewBox)();
|
| 211 |
+
(0, _react.useEffect)(() => {
|
| 212 |
+
if (isReceivingSynchronisation) {
|
| 213 |
+
/*
|
| 214 |
+
* This chart currently has active tooltip, synchronised from another chart.
|
| 215 |
+
* Let's not send any outgoing synchronisation events while that's happening
|
| 216 |
+
* to avoid infinite loops.
|
| 217 |
+
*/
|
| 218 |
+
return;
|
| 219 |
+
}
|
| 220 |
+
if (syncId == null) {
|
| 221 |
+
/*
|
| 222 |
+
* syncId is not set, means that this chart is not synchronised with any other chart,
|
| 223 |
+
* means we don't need to send synchronisation events
|
| 224 |
+
*/
|
| 225 |
+
return;
|
| 226 |
+
}
|
| 227 |
+
if (eventEmitterSymbol == null) {
|
| 228 |
+
/*
|
| 229 |
+
* When using Recharts internal hooks and selectors outside charts context,
|
| 230 |
+
* these properties will be undefined. Let's return silently instead of throwing an error.
|
| 231 |
+
*/
|
| 232 |
+
return;
|
| 233 |
+
}
|
| 234 |
+
var syncAction = (0, _tooltipSlice.setSyncInteraction)({
|
| 235 |
+
active: isTooltipActive,
|
| 236 |
+
coordinate: activeCoordinate,
|
| 237 |
+
dataKey: activeDataKey,
|
| 238 |
+
index: activeIndex,
|
| 239 |
+
label: typeof activeLabel === 'number' ? String(activeLabel) : activeLabel,
|
| 240 |
+
sourceViewBox: viewBox,
|
| 241 |
+
graphicalItemId: undefined
|
| 242 |
+
});
|
| 243 |
+
_Events.eventCenter.emit(_Events.TOOLTIP_SYNC_EVENT, syncId, syncAction, eventEmitterSymbol);
|
| 244 |
+
}, [isReceivingSynchronisation, activeCoordinate, activeDataKey, activeIndex, activeLabel, eventEmitterSymbol, syncId, syncMethod, isTooltipActive, viewBox]);
|
| 245 |
+
}
|
| 246 |
+
function useBrushChartSynchronisation() {
|
| 247 |
+
var syncId = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectSyncId);
|
| 248 |
+
var eventEmitterSymbol = (0, _hooks.useAppSelector)(_rootPropsSelectors.selectEventEmitter);
|
| 249 |
+
var brushStartIndex = (0, _hooks.useAppSelector)(state => state.chartData.dataStartIndex);
|
| 250 |
+
var brushEndIndex = (0, _hooks.useAppSelector)(state => state.chartData.dataEndIndex);
|
| 251 |
+
(0, _react.useEffect)(() => {
|
| 252 |
+
if (syncId == null || brushStartIndex == null || brushEndIndex == null || eventEmitterSymbol == null) {
|
| 253 |
+
return;
|
| 254 |
+
}
|
| 255 |
+
var syncAction = {
|
| 256 |
+
startIndex: brushStartIndex,
|
| 257 |
+
endIndex: brushEndIndex
|
| 258 |
+
};
|
| 259 |
+
_Events.eventCenter.emit(_Events.BRUSH_SYNC_EVENT, syncId, syncAction, eventEmitterSymbol);
|
| 260 |
+
}, [brushEndIndex, brushStartIndex, eventEmitterSymbol, syncId]);
|
| 261 |
+
}
|
node_modules/recharts/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/util/ActiveShapeUtils.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.Shape = Shape;
|
| 7 |
+
exports.getPropsFromShapeOption = getPropsFromShapeOption;
|
| 8 |
+
var _react = _interopRequireWildcard(require("react"));
|
| 9 |
+
var React = _react;
|
| 10 |
+
var _isPlainObject = _interopRequireDefault(require("es-toolkit/compat/isPlainObject"));
|
| 11 |
+
var _Rectangle = require("../shape/Rectangle");
|
| 12 |
+
var _Trapezoid = require("../shape/Trapezoid");
|
| 13 |
+
var _Sector = require("../shape/Sector");
|
| 14 |
+
var _Layer = require("../container/Layer");
|
| 15 |
+
var _Symbols = require("../shape/Symbols");
|
| 16 |
+
var _Curve = require("../shape/Curve");
|
| 17 |
+
var _excluded = ["option", "shapeType", "activeClassName"];
|
| 18 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 19 |
+
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); }
|
| 20 |
+
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; }
|
| 21 |
+
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; }
|
| 22 |
+
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; }
|
| 23 |
+
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; }
|
| 24 |
+
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; }
|
| 25 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 26 |
+
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); }
|
| 27 |
+
/**
|
| 28 |
+
* This is an abstraction for rendering a user defined prop for a customized shape in several forms.
|
| 29 |
+
*
|
| 30 |
+
* <Shape /> is the root and will handle taking in:
|
| 31 |
+
* - an object of svg properties
|
| 32 |
+
* - a boolean
|
| 33 |
+
* - a render prop(inline function that returns jsx)
|
| 34 |
+
* - a React element
|
| 35 |
+
*
|
| 36 |
+
* <ShapeSelector /> is a subcomponent of <Shape /> and used to match a component
|
| 37 |
+
* to the value of props.shapeType that is passed to the root.
|
| 38 |
+
*
|
| 39 |
+
*/
|
| 40 |
+
|
| 41 |
+
function defaultPropTransformer(option, props) {
|
| 42 |
+
return _objectSpread(_objectSpread({}, props), option);
|
| 43 |
+
}
|
| 44 |
+
function isSymbolsProps(shapeType, _elementProps) {
|
| 45 |
+
return shapeType === 'symbols';
|
| 46 |
+
}
|
| 47 |
+
function ShapeSelector(_ref) {
|
| 48 |
+
var {
|
| 49 |
+
shapeType,
|
| 50 |
+
elementProps
|
| 51 |
+
} = _ref;
|
| 52 |
+
switch (shapeType) {
|
| 53 |
+
case 'rectangle':
|
| 54 |
+
return /*#__PURE__*/React.createElement(_Rectangle.Rectangle, elementProps);
|
| 55 |
+
case 'trapezoid':
|
| 56 |
+
return /*#__PURE__*/React.createElement(_Trapezoid.Trapezoid, elementProps);
|
| 57 |
+
case 'sector':
|
| 58 |
+
return /*#__PURE__*/React.createElement(_Sector.Sector, elementProps);
|
| 59 |
+
case 'symbols':
|
| 60 |
+
if (isSymbolsProps(shapeType, elementProps)) {
|
| 61 |
+
return /*#__PURE__*/React.createElement(_Symbols.Symbols, elementProps);
|
| 62 |
+
}
|
| 63 |
+
break;
|
| 64 |
+
case 'curve':
|
| 65 |
+
return /*#__PURE__*/React.createElement(_Curve.Curve, elementProps);
|
| 66 |
+
default:
|
| 67 |
+
return null;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
function getPropsFromShapeOption(option) {
|
| 71 |
+
if (/*#__PURE__*/(0, _react.isValidElement)(option)) {
|
| 72 |
+
return option.props;
|
| 73 |
+
}
|
| 74 |
+
return option;
|
| 75 |
+
}
|
| 76 |
+
function Shape(_ref2) {
|
| 77 |
+
var {
|
| 78 |
+
option,
|
| 79 |
+
shapeType,
|
| 80 |
+
activeClassName = 'recharts-active-shape'
|
| 81 |
+
} = _ref2,
|
| 82 |
+
props = _objectWithoutProperties(_ref2, _excluded);
|
| 83 |
+
var shape;
|
| 84 |
+
if (/*#__PURE__*/(0, _react.isValidElement)(option)) {
|
| 85 |
+
// @ts-expect-error we can't know the type of cloned element props
|
| 86 |
+
shape = /*#__PURE__*/(0, _react.cloneElement)(option, _objectSpread(_objectSpread({}, props), getPropsFromShapeOption(option)));
|
| 87 |
+
} else if (typeof option === 'function') {
|
| 88 |
+
shape = option(props, props.index);
|
| 89 |
+
} else if ((0, _isPlainObject.default)(option) && typeof option !== 'boolean') {
|
| 90 |
+
var nextProps = defaultPropTransformer(option, props);
|
| 91 |
+
shape = /*#__PURE__*/React.createElement(ShapeSelector, {
|
| 92 |
+
shapeType: shapeType,
|
| 93 |
+
elementProps: nextProps
|
| 94 |
+
});
|
| 95 |
+
} else {
|
| 96 |
+
var elementProps = props;
|
| 97 |
+
shape = /*#__PURE__*/React.createElement(ShapeSelector, {
|
| 98 |
+
shapeType: shapeType,
|
| 99 |
+
elementProps: elementProps
|
| 100 |
+
});
|
| 101 |
+
}
|
| 102 |
+
if (props.isActive) {
|
| 103 |
+
return /*#__PURE__*/React.createElement(_Layer.Layer, {
|
| 104 |
+
className: activeClassName
|
| 105 |
+
}, shape);
|
| 106 |
+
}
|
| 107 |
+
return shape;
|
| 108 |
+
}
|
node_modules/recharts/lib/util/BarUtils.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.BarRectangle = BarRectangle;
|
| 7 |
+
exports.minPointSizeCallback = void 0;
|
| 8 |
+
var React = _interopRequireWildcard(require("react"));
|
| 9 |
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
| 10 |
+
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
| 11 |
+
var _DataUtils = require("./DataUtils");
|
| 12 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 13 |
+
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); }
|
| 14 |
+
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); }
|
| 15 |
+
function BarRectangle(props) {
|
| 16 |
+
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
| 17 |
+
shapeType: "rectangle",
|
| 18 |
+
activeClassName: "recharts-active-bar"
|
| 19 |
+
}, props));
|
| 20 |
+
}
|
| 21 |
+
/**
|
| 22 |
+
* Safely gets minPointSize from the minPointSize prop if it is a function
|
| 23 |
+
* @param minPointSize minPointSize as passed to the Bar component
|
| 24 |
+
* @param defaultValue default minPointSize
|
| 25 |
+
* @returns minPointSize
|
| 26 |
+
*/
|
| 27 |
+
var minPointSizeCallback = exports.minPointSizeCallback = function minPointSizeCallback(minPointSize) {
|
| 28 |
+
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
| 29 |
+
return (value, index) => {
|
| 30 |
+
if ((0, _DataUtils.isNumber)(minPointSize)) return minPointSize;
|
| 31 |
+
var isValueNumberOrNil = (0, _DataUtils.isNumber)(value) || (0, _DataUtils.isNullish)(value);
|
| 32 |
+
if (isValueNumberOrNil) {
|
| 33 |
+
return minPointSize(value, index);
|
| 34 |
+
}
|
| 35 |
+
!isValueNumberOrNil ? true ? (0, _tinyInvariant.default)(false, "minPointSize callback function received a value with type of ".concat(typeof value, ". Currently only numbers or null/undefined are supported.")) : (0, _tinyInvariant.default)(false) : void 0;
|
| 36 |
+
return defaultValue;
|
| 37 |
+
};
|
| 38 |
+
};
|
node_modules/recharts/lib/util/CartesianUtils.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.getAngledRectangleWidth = void 0;
|
| 7 |
+
exports.normalizeAngle = normalizeAngle;
|
| 8 |
+
exports.rectWithPoints = exports.rectWithCoords = void 0;
|
| 9 |
+
var rectWithPoints = (_ref, _ref2) => {
|
| 10 |
+
var {
|
| 11 |
+
x: x1,
|
| 12 |
+
y: y1
|
| 13 |
+
} = _ref;
|
| 14 |
+
var {
|
| 15 |
+
x: x2,
|
| 16 |
+
y: y2
|
| 17 |
+
} = _ref2;
|
| 18 |
+
return {
|
| 19 |
+
x: Math.min(x1, x2),
|
| 20 |
+
y: Math.min(y1, y2),
|
| 21 |
+
width: Math.abs(x2 - x1),
|
| 22 |
+
height: Math.abs(y2 - y1)
|
| 23 |
+
};
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Compute the x, y, width, and height of a box from two reference points.
|
| 28 |
+
* @param {Object} coords x1, x2, y1, and y2
|
| 29 |
+
* @return {Object} object
|
| 30 |
+
*/
|
| 31 |
+
exports.rectWithPoints = rectWithPoints;
|
| 32 |
+
var rectWithCoords = _ref3 => {
|
| 33 |
+
var {
|
| 34 |
+
x1,
|
| 35 |
+
y1,
|
| 36 |
+
x2,
|
| 37 |
+
y2
|
| 38 |
+
} = _ref3;
|
| 39 |
+
return rectWithPoints({
|
| 40 |
+
x: x1,
|
| 41 |
+
y: y1
|
| 42 |
+
}, {
|
| 43 |
+
x: x2,
|
| 44 |
+
y: y2
|
| 45 |
+
});
|
| 46 |
+
};
|
| 47 |
+
|
| 48 |
+
/** Normalizes the angle so that 0 <= angle < 180.
|
| 49 |
+
* @param {number} angle Angle in degrees.
|
| 50 |
+
* @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */
|
| 51 |
+
exports.rectWithCoords = rectWithCoords;
|
| 52 |
+
function normalizeAngle(angle) {
|
| 53 |
+
return (angle % 180 + 180) % 180;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
| 57 |
+
* @param {Object} size Width and height of the text in a horizontal position.
|
| 58 |
+
* @param {number} angle Angle in degrees in which the text is displayed.
|
| 59 |
+
* @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
| 60 |
+
*/
|
| 61 |
+
var getAngledRectangleWidth = exports.getAngledRectangleWidth = function getAngledRectangleWidth(_ref4) {
|
| 62 |
+
var {
|
| 63 |
+
width,
|
| 64 |
+
height
|
| 65 |
+
} = _ref4;
|
| 66 |
+
var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
| 67 |
+
// Ensure angle is >= 0 && < 180
|
| 68 |
+
var normalizedAngle = normalizeAngle(angle);
|
| 69 |
+
var angleRadians = normalizedAngle * Math.PI / 180;
|
| 70 |
+
|
| 71 |
+
/* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled
|
| 72 |
+
* width. This threshold defines when each formula should kick in. */
|
| 73 |
+
var angleThreshold = Math.atan(height / width);
|
| 74 |
+
var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);
|
| 75 |
+
return Math.abs(angledWidth);
|
| 76 |
+
};
|
node_modules/recharts/lib/util/ChartUtils.js
ADDED
|
@@ -0,0 +1,548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.getCateCoordinateOfBar = exports.getBaseValueOfBar = exports.getBandSizeOfAxis = exports.calculatePolarTooltipPos = exports.calculateCartesianTooltipPos = exports.appendOffsetOfLegend = exports.MIN_VALUE_REG = exports.MAX_VALUE_REG = void 0;
|
| 7 |
+
exports.getCateCoordinateOfLine = getCateCoordinateOfLine;
|
| 8 |
+
exports.getDomainOfStackGroups = exports.getCoordinatesOfGrid = void 0;
|
| 9 |
+
exports.getNormalizedStackId = getNormalizedStackId;
|
| 10 |
+
exports.getTicksOfAxis = exports.getStackedData = void 0;
|
| 11 |
+
exports.getTooltipEntry = getTooltipEntry;
|
| 12 |
+
exports.getTooltipNameProp = getTooltipNameProp;
|
| 13 |
+
exports.getValueByDataKey = getValueByDataKey;
|
| 14 |
+
exports.truncateByDomain = exports.offsetSign = exports.offsetPositive = exports.isCategoricalAxis = void 0;
|
| 15 |
+
var _sortBy = _interopRequireDefault(require("es-toolkit/compat/sortBy"));
|
| 16 |
+
var _get = _interopRequireDefault(require("es-toolkit/compat/get"));
|
| 17 |
+
var _d3Shape = require("victory-vendor/d3-shape");
|
| 18 |
+
var _DataUtils = require("./DataUtils");
|
| 19 |
+
var _getSliced = require("./getSliced");
|
| 20 |
+
var _isWellBehavedNumber = require("./isWellBehavedNumber");
|
| 21 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 22 |
+
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; }
|
| 23 |
+
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; }
|
| 24 |
+
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; }
|
| 25 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 26 |
+
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); }
|
| 27 |
+
function getValueByDataKey(obj, dataKey, defaultValue) {
|
| 28 |
+
if ((0, _DataUtils.isNullish)(obj) || (0, _DataUtils.isNullish)(dataKey)) {
|
| 29 |
+
return defaultValue;
|
| 30 |
+
}
|
| 31 |
+
if ((0, _DataUtils.isNumOrStr)(dataKey)) {
|
| 32 |
+
return (0, _get.default)(obj, dataKey, defaultValue);
|
| 33 |
+
}
|
| 34 |
+
if (typeof dataKey === 'function') {
|
| 35 |
+
return dataKey(obj);
|
| 36 |
+
}
|
| 37 |
+
return defaultValue;
|
| 38 |
+
}
|
| 39 |
+
var appendOffsetOfLegend = (offset, legendSettings, legendSize) => {
|
| 40 |
+
if (legendSettings && legendSize) {
|
| 41 |
+
var {
|
| 42 |
+
width: boxWidth,
|
| 43 |
+
height: boxHeight
|
| 44 |
+
} = legendSize;
|
| 45 |
+
var {
|
| 46 |
+
align,
|
| 47 |
+
verticalAlign,
|
| 48 |
+
layout
|
| 49 |
+
} = legendSettings;
|
| 50 |
+
if ((layout === 'vertical' || layout === 'horizontal' && verticalAlign === 'middle') && align !== 'center' && (0, _DataUtils.isNumber)(offset[align])) {
|
| 51 |
+
return _objectSpread(_objectSpread({}, offset), {}, {
|
| 52 |
+
[align]: offset[align] + (boxWidth || 0)
|
| 53 |
+
});
|
| 54 |
+
}
|
| 55 |
+
if ((layout === 'horizontal' || layout === 'vertical' && align === 'center') && verticalAlign !== 'middle' && (0, _DataUtils.isNumber)(offset[verticalAlign])) {
|
| 56 |
+
return _objectSpread(_objectSpread({}, offset), {}, {
|
| 57 |
+
[verticalAlign]: offset[verticalAlign] + (boxHeight || 0)
|
| 58 |
+
});
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
return offset;
|
| 62 |
+
};
|
| 63 |
+
exports.appendOffsetOfLegend = appendOffsetOfLegend;
|
| 64 |
+
var isCategoricalAxis = (layout, axisType) => layout === 'horizontal' && axisType === 'xAxis' || layout === 'vertical' && axisType === 'yAxis' || layout === 'centric' && axisType === 'angleAxis' || layout === 'radial' && axisType === 'radiusAxis';
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* Calculate the Coordinates of grid
|
| 68 |
+
* @param {Array} ticks The ticks in axis
|
| 69 |
+
* @param {Number} minValue The minimum value of axis
|
| 70 |
+
* @param {Number} maxValue The maximum value of axis
|
| 71 |
+
* @param {boolean} syncWithTicks Synchronize grid lines with ticks or not
|
| 72 |
+
* @return {Array} Coordinates
|
| 73 |
+
*/
|
| 74 |
+
exports.isCategoricalAxis = isCategoricalAxis;
|
| 75 |
+
var getCoordinatesOfGrid = (ticks, minValue, maxValue, syncWithTicks) => {
|
| 76 |
+
if (syncWithTicks) {
|
| 77 |
+
return ticks.map(entry => entry.coordinate);
|
| 78 |
+
}
|
| 79 |
+
var hasMin, hasMax;
|
| 80 |
+
var values = ticks.map(entry => {
|
| 81 |
+
if (entry.coordinate === minValue) {
|
| 82 |
+
hasMin = true;
|
| 83 |
+
}
|
| 84 |
+
if (entry.coordinate === maxValue) {
|
| 85 |
+
hasMax = true;
|
| 86 |
+
}
|
| 87 |
+
return entry.coordinate;
|
| 88 |
+
});
|
| 89 |
+
if (!hasMin) {
|
| 90 |
+
values.push(minValue);
|
| 91 |
+
}
|
| 92 |
+
if (!hasMax) {
|
| 93 |
+
values.push(maxValue);
|
| 94 |
+
}
|
| 95 |
+
return values;
|
| 96 |
+
};
|
| 97 |
+
exports.getCoordinatesOfGrid = getCoordinatesOfGrid;
|
| 98 |
+
/**
|
| 99 |
+
* Of on four almost identical implementations of tick generation.
|
| 100 |
+
* The four horsemen of tick generation are:
|
| 101 |
+
* - {@link selectTooltipAxisTicks}
|
| 102 |
+
* - {@link combineAxisTicks}
|
| 103 |
+
* - {@link getTicksOfAxis}.
|
| 104 |
+
* - {@link combineGraphicalItemTicks}
|
| 105 |
+
*/
|
| 106 |
+
var getTicksOfAxis = (axis, isGrid, isAll) => {
|
| 107 |
+
if (!axis) {
|
| 108 |
+
return null;
|
| 109 |
+
}
|
| 110 |
+
var {
|
| 111 |
+
duplicateDomain,
|
| 112 |
+
type,
|
| 113 |
+
range,
|
| 114 |
+
scale,
|
| 115 |
+
realScaleType,
|
| 116 |
+
isCategorical,
|
| 117 |
+
categoricalDomain,
|
| 118 |
+
tickCount,
|
| 119 |
+
ticks,
|
| 120 |
+
niceTicks,
|
| 121 |
+
axisType
|
| 122 |
+
} = axis;
|
| 123 |
+
if (!scale) {
|
| 124 |
+
return null;
|
| 125 |
+
}
|
| 126 |
+
var offsetForBand = realScaleType === 'scaleBand' && scale.bandwidth ? scale.bandwidth() / 2 : 2;
|
| 127 |
+
var offset = (isGrid || isAll) && type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
| 128 |
+
offset = axisType === 'angleAxis' && range && range.length >= 2 ? (0, _DataUtils.mathSign)(range[0] - range[1]) * 2 * offset : offset;
|
| 129 |
+
|
| 130 |
+
// The ticks set by user should only affect the ticks adjacent to axis line
|
| 131 |
+
if (isGrid && (ticks || niceTicks)) {
|
| 132 |
+
var result = (ticks || niceTicks || []).map((entry, index) => {
|
| 133 |
+
var scaleContent = duplicateDomain ? duplicateDomain.indexOf(entry) : entry;
|
| 134 |
+
var scaled = scale.map(scaleContent);
|
| 135 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 136 |
+
return null;
|
| 137 |
+
}
|
| 138 |
+
return {
|
| 139 |
+
// If the scaleContent is not a number, the coordinate will be NaN.
|
| 140 |
+
// That could be the case for example with a PointScale and a string as domain.
|
| 141 |
+
coordinate: scaled + offset,
|
| 142 |
+
value: entry,
|
| 143 |
+
offset,
|
| 144 |
+
index
|
| 145 |
+
};
|
| 146 |
+
}).filter(_DataUtils.isNotNil);
|
| 147 |
+
return result;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
// When axis is a categorical axis, but the type of axis is number or the scale of axis is not "auto"
|
| 151 |
+
if (isCategorical && categoricalDomain) {
|
| 152 |
+
return categoricalDomain.map((entry, index) => {
|
| 153 |
+
var scaled = scale.map(entry);
|
| 154 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 155 |
+
return null;
|
| 156 |
+
}
|
| 157 |
+
return {
|
| 158 |
+
coordinate: scaled + offset,
|
| 159 |
+
value: entry,
|
| 160 |
+
index,
|
| 161 |
+
offset
|
| 162 |
+
};
|
| 163 |
+
}).filter(_DataUtils.isNotNil);
|
| 164 |
+
}
|
| 165 |
+
if (scale.ticks && !isAll && tickCount != null) {
|
| 166 |
+
return scale.ticks(tickCount).map((entry, index) => {
|
| 167 |
+
var scaled = scale.map(entry);
|
| 168 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 169 |
+
return null;
|
| 170 |
+
}
|
| 171 |
+
return {
|
| 172 |
+
coordinate: scaled + offset,
|
| 173 |
+
value: entry,
|
| 174 |
+
index,
|
| 175 |
+
offset
|
| 176 |
+
};
|
| 177 |
+
}).filter(_DataUtils.isNotNil);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// When axis has duplicated text, serial numbers are used to generate scale
|
| 181 |
+
return scale.domain().map((entry, index) => {
|
| 182 |
+
var scaled = scale.map(entry);
|
| 183 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(scaled)) {
|
| 184 |
+
return null;
|
| 185 |
+
}
|
| 186 |
+
return {
|
| 187 |
+
coordinate: scaled + offset,
|
| 188 |
+
// @ts-expect-error can't use Date as an index
|
| 189 |
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
| 190 |
+
index,
|
| 191 |
+
offset
|
| 192 |
+
};
|
| 193 |
+
}).filter(_DataUtils.isNotNil);
|
| 194 |
+
};
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Both value and domain are tuples of two numbers
|
| 198 |
+
* - but the type stays as array of numbers until we have better support in rest of the app
|
| 199 |
+
* @param value input that will be truncated
|
| 200 |
+
* @param domain boundaries
|
| 201 |
+
* @returns tuple of two numbers
|
| 202 |
+
*/
|
| 203 |
+
exports.getTicksOfAxis = getTicksOfAxis;
|
| 204 |
+
var truncateByDomain = (value, domain) => {
|
| 205 |
+
if (!domain || domain.length !== 2 || !(0, _DataUtils.isNumber)(domain[0]) || !(0, _DataUtils.isNumber)(domain[1])) {
|
| 206 |
+
return value;
|
| 207 |
+
}
|
| 208 |
+
var minValue = Math.min(domain[0], domain[1]);
|
| 209 |
+
var maxValue = Math.max(domain[0], domain[1]);
|
| 210 |
+
var result = [value[0], value[1]];
|
| 211 |
+
if (!(0, _DataUtils.isNumber)(value[0]) || value[0] < minValue) {
|
| 212 |
+
result[0] = minValue;
|
| 213 |
+
}
|
| 214 |
+
if (!(0, _DataUtils.isNumber)(value[1]) || value[1] > maxValue) {
|
| 215 |
+
result[1] = maxValue;
|
| 216 |
+
}
|
| 217 |
+
if (result[0] > maxValue) {
|
| 218 |
+
result[0] = maxValue;
|
| 219 |
+
}
|
| 220 |
+
if (result[1] < minValue) {
|
| 221 |
+
result[1] = minValue;
|
| 222 |
+
}
|
| 223 |
+
return result;
|
| 224 |
+
};
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* Stacks all positive numbers above zero and all negative numbers below zero.
|
| 228 |
+
*
|
| 229 |
+
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
| 230 |
+
*
|
| 231 |
+
* @param {Array} series from d3-shape Stack
|
| 232 |
+
* @return {Array} series with applied offset
|
| 233 |
+
*/
|
| 234 |
+
exports.truncateByDomain = truncateByDomain;
|
| 235 |
+
var offsetSign = series => {
|
| 236 |
+
var _series$;
|
| 237 |
+
var n = series.length;
|
| 238 |
+
if (n <= 0) {
|
| 239 |
+
return;
|
| 240 |
+
}
|
| 241 |
+
var m = (_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.length;
|
| 242 |
+
if (m == null || m <= 0) {
|
| 243 |
+
return;
|
| 244 |
+
}
|
| 245 |
+
for (var j = 0; j < m; ++j) {
|
| 246 |
+
var positive = 0;
|
| 247 |
+
var negative = 0;
|
| 248 |
+
for (var i = 0; i < n; ++i) {
|
| 249 |
+
var row = series[i];
|
| 250 |
+
var col = row === null || row === void 0 ? void 0 : row[j];
|
| 251 |
+
if (col == null) {
|
| 252 |
+
continue;
|
| 253 |
+
}
|
| 254 |
+
var series1 = col[1];
|
| 255 |
+
var series0 = col[0];
|
| 256 |
+
var value = (0, _DataUtils.isNan)(series1) ? series0 : series1;
|
| 257 |
+
if (value >= 0) {
|
| 258 |
+
col[0] = positive;
|
| 259 |
+
positive += value;
|
| 260 |
+
col[1] = positive;
|
| 261 |
+
} else {
|
| 262 |
+
col[0] = negative;
|
| 263 |
+
negative += value;
|
| 264 |
+
col[1] = negative;
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
};
|
| 269 |
+
|
| 270 |
+
/**
|
| 271 |
+
* Replaces all negative values with zero when stacking data.
|
| 272 |
+
*
|
| 273 |
+
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
| 274 |
+
*
|
| 275 |
+
* @param {Array} series from d3-shape Stack
|
| 276 |
+
* @return {Array} series with applied offset
|
| 277 |
+
*/
|
| 278 |
+
exports.offsetSign = offsetSign;
|
| 279 |
+
var offsetPositive = series => {
|
| 280 |
+
var _series$2;
|
| 281 |
+
var n = series.length;
|
| 282 |
+
if (n <= 0) {
|
| 283 |
+
return;
|
| 284 |
+
}
|
| 285 |
+
var m = (_series$2 = series[0]) === null || _series$2 === void 0 ? void 0 : _series$2.length;
|
| 286 |
+
if (m == null || m <= 0) {
|
| 287 |
+
return;
|
| 288 |
+
}
|
| 289 |
+
for (var j = 0; j < m; ++j) {
|
| 290 |
+
var positive = 0;
|
| 291 |
+
for (var i = 0; i < n; ++i) {
|
| 292 |
+
var row = series[i];
|
| 293 |
+
var col = row === null || row === void 0 ? void 0 : row[j];
|
| 294 |
+
if (col == null) {
|
| 295 |
+
continue;
|
| 296 |
+
}
|
| 297 |
+
var value = (0, _DataUtils.isNan)(col[1]) ? col[0] : col[1];
|
| 298 |
+
if (value >= 0) {
|
| 299 |
+
col[0] = positive;
|
| 300 |
+
positive += value;
|
| 301 |
+
col[1] = positive;
|
| 302 |
+
} else {
|
| 303 |
+
col[0] = 0;
|
| 304 |
+
col[1] = 0;
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
};
|
| 309 |
+
|
| 310 |
+
/**
|
| 311 |
+
* Function type to compute offset for stacked data.
|
| 312 |
+
*
|
| 313 |
+
* d3-shape has something fishy going on with its types.
|
| 314 |
+
* In @definitelytyped/d3-shape, this function (the offset accessor) is typed as Series<> => void.
|
| 315 |
+
* However! When I actually open the storybook I can see that the offset accessor actually receives Array<Series<>>.
|
| 316 |
+
* The same I can see in the source code itself:
|
| 317 |
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
| 318 |
+
* That one unfortunately has no types but we can tell it passes three-dimensional array.
|
| 319 |
+
*
|
| 320 |
+
* Which leads me to believe that definitelytyped is wrong on this one.
|
| 321 |
+
* There's open discussion on this topic without much attention:
|
| 322 |
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/66042
|
| 323 |
+
*/
|
| 324 |
+
exports.offsetPositive = offsetPositive;
|
| 325 |
+
var STACK_OFFSET_MAP = {
|
| 326 |
+
sign: offsetSign,
|
| 327 |
+
// @ts-expect-error definitelytyped types are incorrect
|
| 328 |
+
expand: _d3Shape.stackOffsetExpand,
|
| 329 |
+
// @ts-expect-error definitelytyped types are incorrect
|
| 330 |
+
none: _d3Shape.stackOffsetNone,
|
| 331 |
+
// @ts-expect-error definitelytyped types are incorrect
|
| 332 |
+
silhouette: _d3Shape.stackOffsetSilhouette,
|
| 333 |
+
// @ts-expect-error definitelytyped types are incorrect
|
| 334 |
+
wiggle: _d3Shape.stackOffsetWiggle,
|
| 335 |
+
positive: offsetPositive
|
| 336 |
+
};
|
| 337 |
+
var getStackedData = (data, dataKeys, offsetType) => {
|
| 338 |
+
var _STACK_OFFSET_MAP$off;
|
| 339 |
+
var offsetAccessor = (_STACK_OFFSET_MAP$off = STACK_OFFSET_MAP[offsetType]) !== null && _STACK_OFFSET_MAP$off !== void 0 ? _STACK_OFFSET_MAP$off : _d3Shape.stackOffsetNone;
|
| 340 |
+
var stack = (0, _d3Shape.stack)().keys(dataKeys).value((d, key) => Number(getValueByDataKey(d, key, 0))).order(_d3Shape.stackOrderNone)
|
| 341 |
+
// @ts-expect-error definitelytyped types are incorrect
|
| 342 |
+
.offset(offsetAccessor);
|
| 343 |
+
var result = stack(data);
|
| 344 |
+
|
| 345 |
+
// Post-process ranged data: if value is an array of two numbers, use them directly without stacking
|
| 346 |
+
result.forEach((series, seriesIndex) => {
|
| 347 |
+
series.forEach((point, pointIndex) => {
|
| 348 |
+
var value = getValueByDataKey(data[pointIndex], dataKeys[seriesIndex], 0);
|
| 349 |
+
if (Array.isArray(value) && value.length === 2 && (0, _DataUtils.isNumber)(value[0]) && (0, _DataUtils.isNumber)(value[1])) {
|
| 350 |
+
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
| 351 |
+
point[0] = value[0];
|
| 352 |
+
// eslint-disable-next-line prefer-destructuring,no-param-reassign
|
| 353 |
+
point[1] = value[1];
|
| 354 |
+
}
|
| 355 |
+
});
|
| 356 |
+
});
|
| 357 |
+
return result;
|
| 358 |
+
};
|
| 359 |
+
|
| 360 |
+
/**
|
| 361 |
+
* Externally, we accept both strings and numbers as stack IDs
|
| 362 |
+
* @inline
|
| 363 |
+
*/
|
| 364 |
+
|
| 365 |
+
/**
|
| 366 |
+
* Stack IDs in the external props allow numbers; but internally we use it as an object key
|
| 367 |
+
* and object keys are always strings. Also, it would be kinda confusing if stackId=8 and stackId='8' were different stacks
|
| 368 |
+
* so let's just force a string.
|
| 369 |
+
*/
|
| 370 |
+
exports.getStackedData = getStackedData;
|
| 371 |
+
function getNormalizedStackId(publicStackId) {
|
| 372 |
+
return publicStackId == null ? undefined : String(publicStackId);
|
| 373 |
+
}
|
| 374 |
+
function getCateCoordinateOfLine(_ref) {
|
| 375 |
+
var {
|
| 376 |
+
axis,
|
| 377 |
+
ticks,
|
| 378 |
+
bandSize,
|
| 379 |
+
entry,
|
| 380 |
+
index,
|
| 381 |
+
dataKey
|
| 382 |
+
} = _ref;
|
| 383 |
+
if (axis.type === 'category') {
|
| 384 |
+
// find coordinate of category axis by the value of category
|
| 385 |
+
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
| 386 |
+
if (!axis.allowDuplicatedCategory && axis.dataKey && !(0, _DataUtils.isNullish)(entry[axis.dataKey])) {
|
| 387 |
+
// @ts-expect-error why does this use direct object access instead of getValueByDataKey?
|
| 388 |
+
var matchedTick = (0, _DataUtils.findEntryInArray)(ticks, 'value', entry[axis.dataKey]);
|
| 389 |
+
if (matchedTick) {
|
| 390 |
+
return matchedTick.coordinate + bandSize / 2;
|
| 391 |
+
}
|
| 392 |
+
}
|
| 393 |
+
return ticks !== null && ticks !== void 0 && ticks[index] ? ticks[index].coordinate + bandSize / 2 : null;
|
| 394 |
+
}
|
| 395 |
+
var value = getValueByDataKey(entry, !(0, _DataUtils.isNullish)(dataKey) ? dataKey : axis.dataKey);
|
| 396 |
+
var scaled = axis.scale.map(value);
|
| 397 |
+
if (!(0, _DataUtils.isNumber)(scaled)) {
|
| 398 |
+
return null;
|
| 399 |
+
}
|
| 400 |
+
return scaled;
|
| 401 |
+
}
|
| 402 |
+
var getCateCoordinateOfBar = _ref2 => {
|
| 403 |
+
var {
|
| 404 |
+
axis,
|
| 405 |
+
ticks,
|
| 406 |
+
offset,
|
| 407 |
+
bandSize,
|
| 408 |
+
entry,
|
| 409 |
+
index
|
| 410 |
+
} = _ref2;
|
| 411 |
+
if (axis.type === 'category') {
|
| 412 |
+
return ticks[index] ? ticks[index].coordinate + offset : null;
|
| 413 |
+
}
|
| 414 |
+
// @ts-expect-error getValueByDataKey does not validate the output type
|
| 415 |
+
var value = getValueByDataKey(entry, axis.dataKey, axis.scale.domain()[index]);
|
| 416 |
+
if ((0, _DataUtils.isNullish)(value)) {
|
| 417 |
+
return null;
|
| 418 |
+
}
|
| 419 |
+
var scaled = axis.scale.map(value);
|
| 420 |
+
if (!(0, _DataUtils.isNumber)(scaled)) {
|
| 421 |
+
return null;
|
| 422 |
+
}
|
| 423 |
+
return scaled - bandSize / 2 + offset;
|
| 424 |
+
};
|
| 425 |
+
exports.getCateCoordinateOfBar = getCateCoordinateOfBar;
|
| 426 |
+
var getBaseValueOfBar = _ref3 => {
|
| 427 |
+
var {
|
| 428 |
+
numericAxis
|
| 429 |
+
} = _ref3;
|
| 430 |
+
var domain = numericAxis.scale.domain();
|
| 431 |
+
if (numericAxis.type === 'number') {
|
| 432 |
+
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
| 433 |
+
var minValue = Math.min(domain[0], domain[1]);
|
| 434 |
+
// @ts-expect-error type number means the domain has numbers in it but this relationship is not known to typescript
|
| 435 |
+
var maxValue = Math.max(domain[0], domain[1]);
|
| 436 |
+
if (minValue <= 0 && maxValue >= 0) {
|
| 437 |
+
return 0;
|
| 438 |
+
}
|
| 439 |
+
if (maxValue < 0) {
|
| 440 |
+
return maxValue;
|
| 441 |
+
}
|
| 442 |
+
return minValue;
|
| 443 |
+
}
|
| 444 |
+
return domain[0];
|
| 445 |
+
};
|
| 446 |
+
exports.getBaseValueOfBar = getBaseValueOfBar;
|
| 447 |
+
var getDomainOfSingle = data => {
|
| 448 |
+
var flat = data.flat(2).filter(_DataUtils.isNumber);
|
| 449 |
+
return [Math.min(...flat), Math.max(...flat)];
|
| 450 |
+
};
|
| 451 |
+
var makeDomainFinite = domain => {
|
| 452 |
+
return [domain[0] === Infinity ? 0 : domain[0], domain[1] === -Infinity ? 0 : domain[1]];
|
| 453 |
+
};
|
| 454 |
+
var getDomainOfStackGroups = (stackGroups, startIndex, endIndex) => {
|
| 455 |
+
if (stackGroups == null) {
|
| 456 |
+
return undefined;
|
| 457 |
+
}
|
| 458 |
+
return makeDomainFinite(Object.keys(stackGroups).reduce((result, stackId) => {
|
| 459 |
+
var group = stackGroups[stackId];
|
| 460 |
+
if (!group) {
|
| 461 |
+
return result;
|
| 462 |
+
}
|
| 463 |
+
var {
|
| 464 |
+
stackedData
|
| 465 |
+
} = group;
|
| 466 |
+
var domain = stackedData.reduce((res, entry) => {
|
| 467 |
+
var sliced = (0, _getSliced.getSliced)(entry, startIndex, endIndex);
|
| 468 |
+
var s = getDomainOfSingle(sliced);
|
| 469 |
+
if (!(0, _isWellBehavedNumber.isWellBehavedNumber)(s[0]) || !(0, _isWellBehavedNumber.isWellBehavedNumber)(s[1])) {
|
| 470 |
+
return res;
|
| 471 |
+
}
|
| 472 |
+
return [Math.min(res[0], s[0]), Math.max(res[1], s[1])];
|
| 473 |
+
}, [Infinity, -Infinity]);
|
| 474 |
+
return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])];
|
| 475 |
+
}, [Infinity, -Infinity]));
|
| 476 |
+
};
|
| 477 |
+
exports.getDomainOfStackGroups = getDomainOfStackGroups;
|
| 478 |
+
var MIN_VALUE_REG = exports.MIN_VALUE_REG = /^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
| 479 |
+
var MAX_VALUE_REG = exports.MAX_VALUE_REG = /^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/;
|
| 480 |
+
|
| 481 |
+
/**
|
| 482 |
+
* Calculate the size between two category
|
| 483 |
+
* @param {Object} axis The options of axis
|
| 484 |
+
* @param {Array} ticks The ticks of axis
|
| 485 |
+
* @param {Boolean} isBar if items in axis are bars
|
| 486 |
+
* @return {Number} Size
|
| 487 |
+
*/
|
| 488 |
+
var getBandSizeOfAxis = (axis, ticks, isBar) => {
|
| 489 |
+
if (axis && axis.scale && axis.scale.bandwidth) {
|
| 490 |
+
var bandWidth = axis.scale.bandwidth();
|
| 491 |
+
if (!isBar || bandWidth > 0) {
|
| 492 |
+
return bandWidth;
|
| 493 |
+
}
|
| 494 |
+
}
|
| 495 |
+
if (axis && ticks && ticks.length >= 2) {
|
| 496 |
+
var orderedTicks = (0, _sortBy.default)(ticks, o => o.coordinate);
|
| 497 |
+
var bandSize = Infinity;
|
| 498 |
+
for (var i = 1, len = orderedTicks.length; i < len; i++) {
|
| 499 |
+
var cur = orderedTicks[i];
|
| 500 |
+
var prev = orderedTicks[i - 1];
|
| 501 |
+
bandSize = Math.min(((cur === null || cur === void 0 ? void 0 : cur.coordinate) || 0) - ((prev === null || prev === void 0 ? void 0 : prev.coordinate) || 0), bandSize);
|
| 502 |
+
}
|
| 503 |
+
return bandSize === Infinity ? 0 : bandSize;
|
| 504 |
+
}
|
| 505 |
+
return isBar ? undefined : 0;
|
| 506 |
+
};
|
| 507 |
+
exports.getBandSizeOfAxis = getBandSizeOfAxis;
|
| 508 |
+
function getTooltipEntry(_ref4) {
|
| 509 |
+
var {
|
| 510 |
+
tooltipEntrySettings,
|
| 511 |
+
dataKey,
|
| 512 |
+
payload,
|
| 513 |
+
value,
|
| 514 |
+
name
|
| 515 |
+
} = _ref4;
|
| 516 |
+
return _objectSpread(_objectSpread({}, tooltipEntrySettings), {}, {
|
| 517 |
+
dataKey,
|
| 518 |
+
payload,
|
| 519 |
+
value,
|
| 520 |
+
name
|
| 521 |
+
});
|
| 522 |
+
}
|
| 523 |
+
function getTooltipNameProp(nameFromItem, dataKey) {
|
| 524 |
+
if (nameFromItem) {
|
| 525 |
+
return String(nameFromItem);
|
| 526 |
+
}
|
| 527 |
+
if (typeof dataKey === 'string') {
|
| 528 |
+
return dataKey;
|
| 529 |
+
}
|
| 530 |
+
return undefined;
|
| 531 |
+
}
|
| 532 |
+
var calculateCartesianTooltipPos = (coordinate, layout) => {
|
| 533 |
+
if (layout === 'horizontal') {
|
| 534 |
+
return coordinate.chartX;
|
| 535 |
+
}
|
| 536 |
+
if (layout === 'vertical') {
|
| 537 |
+
return coordinate.chartY;
|
| 538 |
+
}
|
| 539 |
+
return undefined;
|
| 540 |
+
};
|
| 541 |
+
exports.calculateCartesianTooltipPos = calculateCartesianTooltipPos;
|
| 542 |
+
var calculatePolarTooltipPos = (rangeObj, layout) => {
|
| 543 |
+
if (layout === 'centric') {
|
| 544 |
+
return rangeObj.angle;
|
| 545 |
+
}
|
| 546 |
+
return rangeObj.radius;
|
| 547 |
+
};
|
| 548 |
+
exports.calculatePolarTooltipPos = calculatePolarTooltipPos;
|
node_modules/recharts/lib/util/Constants.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.DEFAULT_Y_AXIS_WIDTH = exports.DATA_ITEM_INDEX_ATTRIBUTE_NAME = exports.DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME = exports.COLOR_PANEL = void 0;
|
| 7 |
+
var COLOR_PANEL = exports.COLOR_PANEL = ['#1890FF', '#66B5FF', '#41D9C7', '#2FC25B', '#6EDB8F', '#9AE65C', '#FACC14', '#E6965C', '#57AD71', '#223273', '#738AE6', '#7564CC', '#8543E0', '#A877ED', '#5C8EE6', '#13C2C2', '#70E0E0', '#5CA3E6', '#3436C7', '#8082FF', '#DD81E6', '#F04864', '#FA7D92', '#D598D9'];
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* We use this attribute to identify which element is the one that the user is touching.
|
| 11 |
+
* The index is the position of the element in the data array.
|
| 12 |
+
* This can be either a number (for array-based charts) or a string (for the charts that have a matrix-shaped data).
|
| 13 |
+
*/
|
| 14 |
+
var DATA_ITEM_INDEX_ATTRIBUTE_NAME = exports.DATA_ITEM_INDEX_ATTRIBUTE_NAME = 'data-recharts-item-index';
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* We use this attribute to identify which element is the one that the user is touching.
|
| 18 |
+
* Unlike dataKey, or name, it is always unique.
|
| 19 |
+
*/
|
| 20 |
+
var DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME = exports.DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME = 'data-recharts-item-id';
|
| 21 |
+
var DEFAULT_Y_AXIS_WIDTH = exports.DEFAULT_Y_AXIS_WIDTH = 60;
|
node_modules/recharts/lib/util/CssPrefixUtils.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.generatePrefixStyle = void 0;
|
| 7 |
+
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; }
|
| 8 |
+
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; }
|
| 9 |
+
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; }
|
| 10 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 11 |
+
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); }
|
| 12 |
+
var PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms'];
|
| 13 |
+
var generatePrefixStyle = (name, value) => {
|
| 14 |
+
if (!name) {
|
| 15 |
+
return undefined;
|
| 16 |
+
}
|
| 17 |
+
var camelName = name.replace(/(\w)/, v => v.toUpperCase());
|
| 18 |
+
var result = PREFIX_LIST.reduce((res, entry) => _objectSpread(_objectSpread({}, res), {}, {
|
| 19 |
+
[entry + camelName]: value
|
| 20 |
+
}), {});
|
| 21 |
+
result[name] = value;
|
| 22 |
+
return result;
|
| 23 |
+
};
|
| 24 |
+
exports.generatePrefixStyle = generatePrefixStyle;
|
node_modules/recharts/lib/util/DOMUtils.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.getTextMeasurementConfig = exports.getStringSize = exports.getStringCacheStats = exports.configureTextMeasurement = exports.clearStringCache = void 0;
|
| 7 |
+
var _Global = require("./Global");
|
| 8 |
+
var _LRUCache = require("./LRUCache");
|
| 9 |
+
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; }
|
| 10 |
+
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; }
|
| 11 |
+
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; }
|
| 12 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 13 |
+
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); }
|
| 14 |
+
var defaultConfig = {
|
| 15 |
+
cacheSize: 2000,
|
| 16 |
+
enableCache: true
|
| 17 |
+
};
|
| 18 |
+
var currentConfig = _objectSpread({}, defaultConfig);
|
| 19 |
+
var stringCache = new _LRUCache.LRUCache(currentConfig.cacheSize);
|
| 20 |
+
var SPAN_STYLE = {
|
| 21 |
+
position: 'absolute',
|
| 22 |
+
top: '-20000px',
|
| 23 |
+
left: 0,
|
| 24 |
+
padding: 0,
|
| 25 |
+
margin: 0,
|
| 26 |
+
border: 'none',
|
| 27 |
+
whiteSpace: 'pre'
|
| 28 |
+
};
|
| 29 |
+
var MEASUREMENT_SPAN_ID = 'recharts_measurement_span';
|
| 30 |
+
function createCacheKey(text, style) {
|
| 31 |
+
// Simple string concatenation for better performance than JSON.stringify
|
| 32 |
+
var fontSize = style.fontSize || '';
|
| 33 |
+
var fontFamily = style.fontFamily || '';
|
| 34 |
+
var fontWeight = style.fontWeight || '';
|
| 35 |
+
var fontStyle = style.fontStyle || '';
|
| 36 |
+
var letterSpacing = style.letterSpacing || '';
|
| 37 |
+
var textTransform = style.textTransform || '';
|
| 38 |
+
return "".concat(text, "|").concat(fontSize, "|").concat(fontFamily, "|").concat(fontWeight, "|").concat(fontStyle, "|").concat(letterSpacing, "|").concat(textTransform);
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Measure text using DOM (accurate but slower)
|
| 43 |
+
* @param text - The text to measure
|
| 44 |
+
* @param style - CSS style properties to apply
|
| 45 |
+
* @returns The size of the text
|
| 46 |
+
*/
|
| 47 |
+
var measureTextWithDOM = (text, style) => {
|
| 48 |
+
try {
|
| 49 |
+
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
| 50 |
+
if (!measurementSpan) {
|
| 51 |
+
measurementSpan = document.createElement('span');
|
| 52 |
+
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
| 53 |
+
measurementSpan.setAttribute('aria-hidden', 'true');
|
| 54 |
+
document.body.appendChild(measurementSpan);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// Apply styles directly without unnecessary object creation
|
| 58 |
+
Object.assign(measurementSpan.style, SPAN_STYLE, style);
|
| 59 |
+
measurementSpan.textContent = "".concat(text);
|
| 60 |
+
var rect = measurementSpan.getBoundingClientRect();
|
| 61 |
+
return {
|
| 62 |
+
width: rect.width,
|
| 63 |
+
height: rect.height
|
| 64 |
+
};
|
| 65 |
+
} catch (_unused) {
|
| 66 |
+
return {
|
| 67 |
+
width: 0,
|
| 68 |
+
height: 0
|
| 69 |
+
};
|
| 70 |
+
}
|
| 71 |
+
};
|
| 72 |
+
var getStringSize = exports.getStringSize = function getStringSize(text) {
|
| 73 |
+
var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
| 74 |
+
if (text === undefined || text === null || _Global.Global.isSsr) {
|
| 75 |
+
return {
|
| 76 |
+
width: 0,
|
| 77 |
+
height: 0
|
| 78 |
+
};
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// If caching is disabled, measure directly
|
| 82 |
+
if (!currentConfig.enableCache) {
|
| 83 |
+
return measureTextWithDOM(text, style);
|
| 84 |
+
}
|
| 85 |
+
var cacheKey = createCacheKey(text, style);
|
| 86 |
+
var cachedResult = stringCache.get(cacheKey);
|
| 87 |
+
if (cachedResult) {
|
| 88 |
+
return cachedResult;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
// Measure using DOM
|
| 92 |
+
var result = measureTextWithDOM(text, style);
|
| 93 |
+
|
| 94 |
+
// Store in LRU cache
|
| 95 |
+
stringCache.set(cacheKey, result);
|
| 96 |
+
return result;
|
| 97 |
+
};
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* Configure text measurement behavior
|
| 101 |
+
* @param config - Partial configuration to apply
|
| 102 |
+
* @returns void
|
| 103 |
+
*/
|
| 104 |
+
var configureTextMeasurement = config => {
|
| 105 |
+
var newConfig = _objectSpread(_objectSpread({}, currentConfig), config);
|
| 106 |
+
if (newConfig.cacheSize !== currentConfig.cacheSize) {
|
| 107 |
+
stringCache = new _LRUCache.LRUCache(newConfig.cacheSize);
|
| 108 |
+
}
|
| 109 |
+
currentConfig = newConfig;
|
| 110 |
+
};
|
| 111 |
+
|
| 112 |
+
/**
|
| 113 |
+
* Get current text measurement configuration
|
| 114 |
+
* @returns Current configuration
|
| 115 |
+
*/
|
| 116 |
+
exports.configureTextMeasurement = configureTextMeasurement;
|
| 117 |
+
var getTextMeasurementConfig = () => _objectSpread({}, currentConfig);
|
| 118 |
+
|
| 119 |
+
/**
|
| 120 |
+
* Clear the string size cache. Useful for testing or memory management.
|
| 121 |
+
* @returns void
|
| 122 |
+
*/
|
| 123 |
+
exports.getTextMeasurementConfig = getTextMeasurementConfig;
|
| 124 |
+
var clearStringCache = () => {
|
| 125 |
+
stringCache.clear();
|
| 126 |
+
};
|
| 127 |
+
|
| 128 |
+
/**
|
| 129 |
+
* Get cache statistics for debugging purposes.
|
| 130 |
+
* @returns Cache statistics including size and max size
|
| 131 |
+
*/
|
| 132 |
+
exports.clearStringCache = clearStringCache;
|
| 133 |
+
var getStringCacheStats = () => ({
|
| 134 |
+
size: stringCache.size(),
|
| 135 |
+
maxSize: currentConfig.cacheSize
|
| 136 |
+
});
|
| 137 |
+
exports.getStringCacheStats = getStringCacheStats;
|
node_modules/recharts/lib/util/DataUtils.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.findEntryInArray = findEntryInArray;
|
| 7 |
+
exports.hasDuplicate = exports.getPercentValue = exports.getLinearRegression = void 0;
|
| 8 |
+
exports.interpolate = interpolate;
|
| 9 |
+
exports.isNan = void 0;
|
| 10 |
+
exports.isNotNil = isNotNil;
|
| 11 |
+
exports.mathSign = exports.isPercent = exports.isNumber = exports.isNumOrStr = exports.isNullish = void 0;
|
| 12 |
+
exports.noop = noop;
|
| 13 |
+
exports.upperFirst = exports.uniqueId = void 0;
|
| 14 |
+
var _get = _interopRequireDefault(require("es-toolkit/compat/get"));
|
| 15 |
+
var _round = require("./round");
|
| 16 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 17 |
+
var mathSign = value => {
|
| 18 |
+
if (value === 0) {
|
| 19 |
+
return 0;
|
| 20 |
+
}
|
| 21 |
+
if (value > 0) {
|
| 22 |
+
return 1;
|
| 23 |
+
}
|
| 24 |
+
return -1;
|
| 25 |
+
};
|
| 26 |
+
exports.mathSign = mathSign;
|
| 27 |
+
var isNan = value => {
|
| 28 |
+
// eslint-disable-next-line eqeqeq
|
| 29 |
+
return typeof value == 'number' && value != +value;
|
| 30 |
+
};
|
| 31 |
+
exports.isNan = isNan;
|
| 32 |
+
var isPercent = value => typeof value === 'string' && value.indexOf('%') === value.length - 1;
|
| 33 |
+
exports.isPercent = isPercent;
|
| 34 |
+
var isNumber = value => (typeof value === 'number' || value instanceof Number) && !isNan(value);
|
| 35 |
+
exports.isNumber = isNumber;
|
| 36 |
+
var isNumOrStr = value => isNumber(value) || typeof value === 'string';
|
| 37 |
+
exports.isNumOrStr = isNumOrStr;
|
| 38 |
+
var idCounter = 0;
|
| 39 |
+
var uniqueId = prefix => {
|
| 40 |
+
var id = ++idCounter;
|
| 41 |
+
return "".concat(prefix || '').concat(id);
|
| 42 |
+
};
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Calculates the numeric value represented by a percent string or number, based on a total value.
|
| 46 |
+
*
|
| 47 |
+
* - If `percent` is not a number or string, returns `defaultValue`.
|
| 48 |
+
* - If `percent` is a percent string but `totalValue` is null/undefined, returns `defaultValue`.
|
| 49 |
+
* - If the result is NaN, returns `defaultValue`.
|
| 50 |
+
* - If `validate` is true and the result exceeds `totalValue`, returns `totalValue`.
|
| 51 |
+
*
|
| 52 |
+
* @param percent - The percent value to convert. Can be a number (e.g. 25) or a string ending with '%' (e.g. '25%').
|
| 53 |
+
* If a string, it must end with '%' to be treated as a percent; otherwise, it is parsed as a number.
|
| 54 |
+
* @param totalValue - The total value to calculate the percent of. Required if `percent` is a percent string.
|
| 55 |
+
* @param defaultValue - The value returned if `percent` is undefined, invalid, or cannot be converted to a number.
|
| 56 |
+
* @param validate - If true, ensures the result does not exceed `totalValue` (when provided).
|
| 57 |
+
* @returns The calculated value, or `defaultValue` for invalid input.
|
| 58 |
+
*/
|
| 59 |
+
exports.uniqueId = uniqueId;
|
| 60 |
+
var getPercentValue = exports.getPercentValue = function getPercentValue(percent, totalValue) {
|
| 61 |
+
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
| 62 |
+
var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
| 63 |
+
if (!isNumber(percent) && typeof percent !== 'string') {
|
| 64 |
+
return defaultValue;
|
| 65 |
+
}
|
| 66 |
+
var value;
|
| 67 |
+
if (isPercent(percent)) {
|
| 68 |
+
if (totalValue == null) {
|
| 69 |
+
return defaultValue;
|
| 70 |
+
}
|
| 71 |
+
var index = percent.indexOf('%');
|
| 72 |
+
value = totalValue * parseFloat(percent.slice(0, index)) / 100;
|
| 73 |
+
} else {
|
| 74 |
+
value = +percent;
|
| 75 |
+
}
|
| 76 |
+
if (isNan(value)) {
|
| 77 |
+
value = defaultValue;
|
| 78 |
+
}
|
| 79 |
+
if (validate && totalValue != null && value > totalValue) {
|
| 80 |
+
value = totalValue;
|
| 81 |
+
}
|
| 82 |
+
return value;
|
| 83 |
+
};
|
| 84 |
+
var hasDuplicate = ary => {
|
| 85 |
+
if (!Array.isArray(ary)) {
|
| 86 |
+
return false;
|
| 87 |
+
}
|
| 88 |
+
var len = ary.length;
|
| 89 |
+
var cache = {};
|
| 90 |
+
for (var i = 0; i < len; i++) {
|
| 91 |
+
if (!cache[String(ary[i])]) {
|
| 92 |
+
cache[String(ary[i])] = true;
|
| 93 |
+
} else {
|
| 94 |
+
return true;
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
return false;
|
| 98 |
+
};
|
| 99 |
+
exports.hasDuplicate = hasDuplicate;
|
| 100 |
+
function interpolate(start, end, t) {
|
| 101 |
+
if (isNumber(start) && isNumber(end)) {
|
| 102 |
+
return (0, _round.round)(start + t * (end - start));
|
| 103 |
+
}
|
| 104 |
+
return end;
|
| 105 |
+
}
|
| 106 |
+
function findEntryInArray(ary, specifiedKey, specifiedValue) {
|
| 107 |
+
if (!ary || !ary.length) {
|
| 108 |
+
return undefined;
|
| 109 |
+
}
|
| 110 |
+
return ary.find(entry => entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : (0, _get.default)(entry, specifiedKey)) === specifiedValue);
|
| 111 |
+
}
|
| 112 |
+
/**
|
| 113 |
+
* The least square linear regression
|
| 114 |
+
* @param {Array} data The array of points
|
| 115 |
+
* @returns {Object} The domain of x, and the parameter of linear function
|
| 116 |
+
*/
|
| 117 |
+
var getLinearRegression = data => {
|
| 118 |
+
var len = data.length;
|
| 119 |
+
var xsum = 0;
|
| 120 |
+
var ysum = 0;
|
| 121 |
+
var xysum = 0;
|
| 122 |
+
var xxsum = 0;
|
| 123 |
+
var xmin = Infinity;
|
| 124 |
+
var xmax = -Infinity;
|
| 125 |
+
var xcurrent = 0;
|
| 126 |
+
var ycurrent = 0;
|
| 127 |
+
for (var i = 0; i < len; i++) {
|
| 128 |
+
var _data$i, _data$i2;
|
| 129 |
+
xcurrent = ((_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i.cx) || 0;
|
| 130 |
+
ycurrent = ((_data$i2 = data[i]) === null || _data$i2 === void 0 ? void 0 : _data$i2.cy) || 0;
|
| 131 |
+
xsum += xcurrent;
|
| 132 |
+
ysum += ycurrent;
|
| 133 |
+
xysum += xcurrent * ycurrent;
|
| 134 |
+
xxsum += xcurrent * xcurrent;
|
| 135 |
+
xmin = Math.min(xmin, xcurrent);
|
| 136 |
+
xmax = Math.max(xmax, xcurrent);
|
| 137 |
+
}
|
| 138 |
+
var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
|
| 139 |
+
return {
|
| 140 |
+
xmin,
|
| 141 |
+
xmax,
|
| 142 |
+
a,
|
| 143 |
+
b: (ysum - a * xsum) / len
|
| 144 |
+
};
|
| 145 |
+
};
|
| 146 |
+
exports.getLinearRegression = getLinearRegression;
|
| 147 |
+
/**
|
| 148 |
+
* Checks if the value is null or undefined
|
| 149 |
+
* @param value The value to check
|
| 150 |
+
* @returns true if the value is null or undefined
|
| 151 |
+
*/
|
| 152 |
+
var isNullish = value => {
|
| 153 |
+
return value === null || typeof value === 'undefined';
|
| 154 |
+
};
|
| 155 |
+
|
| 156 |
+
/**
|
| 157 |
+
* Uppercase the first letter of a string
|
| 158 |
+
* @param {string} value The string to uppercase
|
| 159 |
+
* @returns {string} The uppercased string
|
| 160 |
+
*/
|
| 161 |
+
exports.isNullish = isNullish;
|
| 162 |
+
var upperFirst = value => {
|
| 163 |
+
if (isNullish(value)) {
|
| 164 |
+
return value;
|
| 165 |
+
}
|
| 166 |
+
return "".concat(value.charAt(0).toUpperCase()).concat(value.slice(1));
|
| 167 |
+
};
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* Checks if the value is not null nor undefined.
|
| 171 |
+
* @param value The value to check
|
| 172 |
+
* @returns true if the value is not null nor undefined
|
| 173 |
+
*/
|
| 174 |
+
exports.upperFirst = upperFirst;
|
| 175 |
+
function isNotNil(value) {
|
| 176 |
+
return value != null;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
/**
|
| 180 |
+
* No-operation function that does nothing.
|
| 181 |
+
* Useful as a placeholder or default callback function.
|
| 182 |
+
*/
|
| 183 |
+
function noop() {}
|
node_modules/recharts/lib/util/Events.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.eventCenter = exports.TOOLTIP_SYNC_EVENT = exports.BRUSH_SYNC_EVENT = void 0;
|
| 7 |
+
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
| 8 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 9 |
+
var eventCenter = exports.eventCenter = new _eventemitter.default();
|
| 10 |
+
var TOOLTIP_SYNC_EVENT = exports.TOOLTIP_SYNC_EVENT = 'recharts.syncEvent.tooltip';
|
| 11 |
+
var BRUSH_SYNC_EVENT = exports.BRUSH_SYNC_EVENT = 'recharts.syncEvent.brush';
|
node_modules/recharts/lib/util/FunnelUtils.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.FunnelTrapezoid = FunnelTrapezoid;
|
| 7 |
+
var React = _interopRequireWildcard(require("react"));
|
| 8 |
+
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
| 9 |
+
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); }
|
| 10 |
+
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); }
|
| 11 |
+
function FunnelTrapezoid(props) {
|
| 12 |
+
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
| 13 |
+
shapeType: "trapezoid"
|
| 14 |
+
}, props));
|
| 15 |
+
}
|
node_modules/recharts/lib/util/Global.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.Global = void 0;
|
| 7 |
+
var parseIsSsrByDefault = () => !(typeof window !== 'undefined' && window.document && Boolean(window.document.createElement) && window.setTimeout);
|
| 8 |
+
var Global = exports.Global = {
|
| 9 |
+
devToolsEnabled: true,
|
| 10 |
+
isSsr: parseIsSsrByDefault()
|
| 11 |
+
};
|
node_modules/recharts/lib/util/IfOverflow.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
node_modules/recharts/lib/util/LRUCache.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.LRUCache = void 0;
|
| 7 |
+
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; }
|
| 8 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 9 |
+
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); }
|
| 10 |
+
/**
|
| 11 |
+
* Simple LRU (Least Recently Used) cache implementation
|
| 12 |
+
*/
|
| 13 |
+
class LRUCache {
|
| 14 |
+
constructor(maxSize) {
|
| 15 |
+
_defineProperty(this, "cache", new Map());
|
| 16 |
+
this.maxSize = maxSize;
|
| 17 |
+
}
|
| 18 |
+
get(key) {
|
| 19 |
+
var value = this.cache.get(key);
|
| 20 |
+
if (value !== undefined) {
|
| 21 |
+
this.cache.delete(key);
|
| 22 |
+
this.cache.set(key, value);
|
| 23 |
+
}
|
| 24 |
+
return value;
|
| 25 |
+
}
|
| 26 |
+
set(key, value) {
|
| 27 |
+
if (this.cache.has(key)) {
|
| 28 |
+
this.cache.delete(key);
|
| 29 |
+
} else if (this.cache.size >= this.maxSize) {
|
| 30 |
+
var firstKey = this.cache.keys().next().value;
|
| 31 |
+
if (firstKey != null) {
|
| 32 |
+
this.cache.delete(firstKey);
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
this.cache.set(key, value);
|
| 36 |
+
}
|
| 37 |
+
clear() {
|
| 38 |
+
this.cache.clear();
|
| 39 |
+
}
|
| 40 |
+
size() {
|
| 41 |
+
return this.cache.size;
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
exports.LRUCache = LRUCache;
|
node_modules/recharts/lib/util/LogUtils.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.warn = void 0;
|
| 7 |
+
/* eslint no-console: 0 */
|
| 8 |
+
var isDev = true;
|
| 9 |
+
var warn = exports.warn = function warn(condition, format) {
|
| 10 |
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
| 11 |
+
args[_key - 2] = arguments[_key];
|
| 12 |
+
}
|
| 13 |
+
if (isDev && typeof console !== 'undefined' && console.warn) {
|
| 14 |
+
if (format === undefined) {
|
| 15 |
+
console.warn('LogUtils requires an error message argument');
|
| 16 |
+
}
|
| 17 |
+
if (!condition) {
|
| 18 |
+
if (format === undefined) {
|
| 19 |
+
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
| 20 |
+
} else {
|
| 21 |
+
var argIndex = 0;
|
| 22 |
+
console.warn(format.replace(/%s/g, () => args[argIndex++]));
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
};
|
node_modules/recharts/lib/util/PolarUtils.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.radianToDegree = exports.polarToCartesian = exports.inRangeOfSector = exports.getMaxRadius = exports.degreeToRadian = exports.RADIAN = void 0;
|
| 7 |
+
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; }
|
| 8 |
+
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; }
|
| 9 |
+
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; }
|
| 10 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 11 |
+
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); }
|
| 12 |
+
var RADIAN = exports.RADIAN = Math.PI / 180;
|
| 13 |
+
var degreeToRadian = angle => angle * Math.PI / 180;
|
| 14 |
+
exports.degreeToRadian = degreeToRadian;
|
| 15 |
+
var radianToDegree = angleInRadian => angleInRadian * 180 / Math.PI;
|
| 16 |
+
exports.radianToDegree = radianToDegree;
|
| 17 |
+
var polarToCartesian = (cx, cy, radius, angle) => ({
|
| 18 |
+
x: cx + Math.cos(-RADIAN * angle) * radius,
|
| 19 |
+
y: cy + Math.sin(-RADIAN * angle) * radius
|
| 20 |
+
});
|
| 21 |
+
exports.polarToCartesian = polarToCartesian;
|
| 22 |
+
var getMaxRadius = exports.getMaxRadius = function getMaxRadius(width, height) {
|
| 23 |
+
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
| 24 |
+
top: 0,
|
| 25 |
+
right: 0,
|
| 26 |
+
bottom: 0,
|
| 27 |
+
left: 0,
|
| 28 |
+
width: 0,
|
| 29 |
+
height: 0,
|
| 30 |
+
brushBottom: 0
|
| 31 |
+
};
|
| 32 |
+
return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;
|
| 33 |
+
};
|
| 34 |
+
var distanceBetweenPoints = (point, anotherPoint) => {
|
| 35 |
+
var {
|
| 36 |
+
x: x1,
|
| 37 |
+
y: y1
|
| 38 |
+
} = point;
|
| 39 |
+
var {
|
| 40 |
+
x: x2,
|
| 41 |
+
y: y2
|
| 42 |
+
} = anotherPoint;
|
| 43 |
+
return Math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2);
|
| 44 |
+
};
|
| 45 |
+
var getAngleOfPoint = (_ref, _ref2) => {
|
| 46 |
+
var {
|
| 47 |
+
x,
|
| 48 |
+
y
|
| 49 |
+
} = _ref;
|
| 50 |
+
var {
|
| 51 |
+
cx,
|
| 52 |
+
cy
|
| 53 |
+
} = _ref2;
|
| 54 |
+
var radius = distanceBetweenPoints({
|
| 55 |
+
x,
|
| 56 |
+
y
|
| 57 |
+
}, {
|
| 58 |
+
x: cx,
|
| 59 |
+
y: cy
|
| 60 |
+
});
|
| 61 |
+
if (radius <= 0) {
|
| 62 |
+
return {
|
| 63 |
+
radius,
|
| 64 |
+
angle: 0
|
| 65 |
+
};
|
| 66 |
+
}
|
| 67 |
+
var cos = (x - cx) / radius;
|
| 68 |
+
var angleInRadian = Math.acos(cos);
|
| 69 |
+
if (y > cy) {
|
| 70 |
+
angleInRadian = 2 * Math.PI - angleInRadian;
|
| 71 |
+
}
|
| 72 |
+
return {
|
| 73 |
+
radius,
|
| 74 |
+
angle: radianToDegree(angleInRadian),
|
| 75 |
+
angleInRadian
|
| 76 |
+
};
|
| 77 |
+
};
|
| 78 |
+
var formatAngleOfSector = _ref3 => {
|
| 79 |
+
var {
|
| 80 |
+
startAngle,
|
| 81 |
+
endAngle
|
| 82 |
+
} = _ref3;
|
| 83 |
+
var startCnt = Math.floor(startAngle / 360);
|
| 84 |
+
var endCnt = Math.floor(endAngle / 360);
|
| 85 |
+
var min = Math.min(startCnt, endCnt);
|
| 86 |
+
return {
|
| 87 |
+
startAngle: startAngle - min * 360,
|
| 88 |
+
endAngle: endAngle - min * 360
|
| 89 |
+
};
|
| 90 |
+
};
|
| 91 |
+
var reverseFormatAngleOfSector = (angle, _ref4) => {
|
| 92 |
+
var {
|
| 93 |
+
startAngle,
|
| 94 |
+
endAngle
|
| 95 |
+
} = _ref4;
|
| 96 |
+
var startCnt = Math.floor(startAngle / 360);
|
| 97 |
+
var endCnt = Math.floor(endAngle / 360);
|
| 98 |
+
var min = Math.min(startCnt, endCnt);
|
| 99 |
+
return angle + min * 360;
|
| 100 |
+
};
|
| 101 |
+
var inRangeOfSector = (_ref5, viewBox) => {
|
| 102 |
+
var {
|
| 103 |
+
chartX: x,
|
| 104 |
+
chartY: y
|
| 105 |
+
} = _ref5;
|
| 106 |
+
var {
|
| 107 |
+
radius,
|
| 108 |
+
angle
|
| 109 |
+
} = getAngleOfPoint({
|
| 110 |
+
x,
|
| 111 |
+
y
|
| 112 |
+
}, viewBox);
|
| 113 |
+
var {
|
| 114 |
+
innerRadius,
|
| 115 |
+
outerRadius
|
| 116 |
+
} = viewBox;
|
| 117 |
+
if (radius < innerRadius || radius > outerRadius) {
|
| 118 |
+
return null;
|
| 119 |
+
}
|
| 120 |
+
if (radius === 0) {
|
| 121 |
+
return null;
|
| 122 |
+
}
|
| 123 |
+
var {
|
| 124 |
+
startAngle,
|
| 125 |
+
endAngle
|
| 126 |
+
} = formatAngleOfSector(viewBox);
|
| 127 |
+
var formatAngle = angle;
|
| 128 |
+
var inRange;
|
| 129 |
+
if (startAngle <= endAngle) {
|
| 130 |
+
while (formatAngle > endAngle) {
|
| 131 |
+
formatAngle -= 360;
|
| 132 |
+
}
|
| 133 |
+
while (formatAngle < startAngle) {
|
| 134 |
+
formatAngle += 360;
|
| 135 |
+
}
|
| 136 |
+
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
|
| 137 |
+
} else {
|
| 138 |
+
while (formatAngle > startAngle) {
|
| 139 |
+
formatAngle -= 360;
|
| 140 |
+
}
|
| 141 |
+
while (formatAngle < endAngle) {
|
| 142 |
+
formatAngle += 360;
|
| 143 |
+
}
|
| 144 |
+
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
|
| 145 |
+
}
|
| 146 |
+
if (inRange) {
|
| 147 |
+
return _objectSpread(_objectSpread({}, viewBox), {}, {
|
| 148 |
+
radius,
|
| 149 |
+
angle: reverseFormatAngleOfSector(formatAngle, viewBox)
|
| 150 |
+
});
|
| 151 |
+
}
|
| 152 |
+
return null;
|
| 153 |
+
};
|
| 154 |
+
exports.inRangeOfSector = inRangeOfSector;
|
node_modules/recharts/lib/util/RadialBarUtils.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.RadialBarSector = RadialBarSector;
|
| 7 |
+
exports.parseCornerRadius = parseCornerRadius;
|
| 8 |
+
var React = _interopRequireWildcard(require("react"));
|
| 9 |
+
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
| 10 |
+
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); }
|
| 11 |
+
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); }
|
| 12 |
+
function parseCornerRadius(cornerRadius) {
|
| 13 |
+
if (typeof cornerRadius === 'string') {
|
| 14 |
+
return parseInt(cornerRadius, 10);
|
| 15 |
+
}
|
| 16 |
+
return cornerRadius;
|
| 17 |
+
}
|
| 18 |
+
function RadialBarSector(props) {
|
| 19 |
+
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
| 20 |
+
shapeType: "sector"
|
| 21 |
+
}, props));
|
| 22 |
+
}
|
node_modules/recharts/lib/util/ReactUtils.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.SCALE_TYPES = void 0;
|
| 7 |
+
exports.findAllByType = findAllByType;
|
| 8 |
+
exports.toArray = exports.isClipDot = exports.getDisplayName = void 0;
|
| 9 |
+
var _get = _interopRequireDefault(require("es-toolkit/compat/get"));
|
| 10 |
+
var _react = require("react");
|
| 11 |
+
var _reactIs = require("react-is");
|
| 12 |
+
var _DataUtils = require("./DataUtils");
|
| 13 |
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
| 14 |
+
var SCALE_TYPES = exports.SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @deprecated instead find another approach that does not depend on displayName.
|
| 18 |
+
* Get the display name of a component
|
| 19 |
+
* @param {Object} Comp Specified Component
|
| 20 |
+
* @return {String} Display name of Component
|
| 21 |
+
*/
|
| 22 |
+
var getDisplayName = Comp => {
|
| 23 |
+
if (typeof Comp === 'string') {
|
| 24 |
+
return Comp;
|
| 25 |
+
}
|
| 26 |
+
if (!Comp) {
|
| 27 |
+
return '';
|
| 28 |
+
}
|
| 29 |
+
return Comp.displayName || Comp.name || 'Component';
|
| 30 |
+
};
|
| 31 |
+
|
| 32 |
+
// `toArray` gets called multiple times during the render
|
| 33 |
+
// so we can memoize last invocation (since reference to `children` is the same)
|
| 34 |
+
exports.getDisplayName = getDisplayName;
|
| 35 |
+
var lastChildren = null;
|
| 36 |
+
var lastResult = null;
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* @deprecated instead find another approach that does not require reading React Elements from DOM.
|
| 40 |
+
*
|
| 41 |
+
* @param children do not use
|
| 42 |
+
* @return deprecated do not use
|
| 43 |
+
*/
|
| 44 |
+
var toArray = children => {
|
| 45 |
+
if (children === lastChildren && Array.isArray(lastResult)) {
|
| 46 |
+
return lastResult;
|
| 47 |
+
}
|
| 48 |
+
var result = [];
|
| 49 |
+
_react.Children.forEach(children, child => {
|
| 50 |
+
if ((0, _DataUtils.isNullish)(child)) return;
|
| 51 |
+
if ((0, _reactIs.isFragment)(child)) {
|
| 52 |
+
result = result.concat(toArray(child.props.children));
|
| 53 |
+
} else {
|
| 54 |
+
// @ts-expect-error this could still be Iterable<ReactNode> and TS does not like that
|
| 55 |
+
result.push(child);
|
| 56 |
+
}
|
| 57 |
+
});
|
| 58 |
+
lastResult = result;
|
| 59 |
+
lastChildren = children;
|
| 60 |
+
return result;
|
| 61 |
+
};
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* @deprecated instead find another approach that does not require reading React Elements from DOM.
|
| 65 |
+
*
|
| 66 |
+
* Find and return all matched children by type.
|
| 67 |
+
* `type` must be a React.ComponentType
|
| 68 |
+
*
|
| 69 |
+
* @param children do not use
|
| 70 |
+
* @param type do not use
|
| 71 |
+
* @return deprecated do not use
|
| 72 |
+
*/
|
| 73 |
+
exports.toArray = toArray;
|
| 74 |
+
function findAllByType(children, type) {
|
| 75 |
+
var result = [];
|
| 76 |
+
var types = [];
|
| 77 |
+
if (Array.isArray(type)) {
|
| 78 |
+
types = type.map(t => getDisplayName(t));
|
| 79 |
+
} else {
|
| 80 |
+
types = [getDisplayName(type)];
|
| 81 |
+
}
|
| 82 |
+
toArray(children).forEach(child => {
|
| 83 |
+
// @ts-expect-error toArray and lodash.get are not compatible. Let's get rid of the whole findAllByType function
|
| 84 |
+
var childType = (0, _get.default)(child, 'type.displayName') || (0, _get.default)(child, 'type.name');
|
| 85 |
+
if (childType && types.indexOf(childType) !== -1) {
|
| 86 |
+
result.push(child);
|
| 87 |
+
}
|
| 88 |
+
});
|
| 89 |
+
return result;
|
| 90 |
+
}
|
| 91 |
+
var isClipDot = dot => {
|
| 92 |
+
if (dot && typeof dot === 'object' && 'clipDot' in dot) {
|
| 93 |
+
return Boolean(dot.clipDot);
|
| 94 |
+
}
|
| 95 |
+
return true;
|
| 96 |
+
};
|
| 97 |
+
exports.isClipDot = isClipDot;
|
node_modules/recharts/lib/util/ReduceCSSCalc.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.reduceCSSCalc = reduceCSSCalc;
|
| 7 |
+
exports.safeEvaluateExpression = safeEvaluateExpression;
|
| 8 |
+
var _DataUtils = require("./DataUtils");
|
| 9 |
+
var _DecimalCSS;
|
| 10 |
+
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; }
|
| 11 |
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
| 12 |
+
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); }
|
| 13 |
+
var MULTIPLY_OR_DIVIDE_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
| 14 |
+
var ADD_OR_SUBTRACT_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
| 15 |
+
var CSS_LENGTH_UNIT_REGEX = /^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/;
|
| 16 |
+
var NUM_SPLIT_REGEX = /(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/;
|
| 17 |
+
var CONVERSION_RATES = {
|
| 18 |
+
cm: 96 / 2.54,
|
| 19 |
+
mm: 96 / 25.4,
|
| 20 |
+
pt: 96 / 72,
|
| 21 |
+
pc: 96 / 6,
|
| 22 |
+
in: 96,
|
| 23 |
+
Q: 96 / (2.54 * 40),
|
| 24 |
+
px: 1
|
| 25 |
+
};
|
| 26 |
+
var FIXED_CSS_LENGTH_UNITS = ['cm', 'mm', 'pt', 'pc', 'in', 'Q', 'px'];
|
| 27 |
+
function isSupportedUnit(unit) {
|
| 28 |
+
return FIXED_CSS_LENGTH_UNITS.includes(unit);
|
| 29 |
+
}
|
| 30 |
+
var STR_NAN = 'NaN';
|
| 31 |
+
function convertToPx(value, unit) {
|
| 32 |
+
return value * CONVERSION_RATES[unit];
|
| 33 |
+
}
|
| 34 |
+
class DecimalCSS {
|
| 35 |
+
static parse(str) {
|
| 36 |
+
var _NUM_SPLIT_REGEX$exec;
|
| 37 |
+
var [, numStr, unit] = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [];
|
| 38 |
+
if (numStr == null) {
|
| 39 |
+
return DecimalCSS.NaN;
|
| 40 |
+
}
|
| 41 |
+
return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : '');
|
| 42 |
+
}
|
| 43 |
+
constructor(num, unit) {
|
| 44 |
+
this.num = num;
|
| 45 |
+
this.unit = unit;
|
| 46 |
+
this.num = num;
|
| 47 |
+
this.unit = unit;
|
| 48 |
+
if ((0, _DataUtils.isNan)(num)) {
|
| 49 |
+
this.unit = '';
|
| 50 |
+
}
|
| 51 |
+
if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) {
|
| 52 |
+
this.num = NaN;
|
| 53 |
+
this.unit = '';
|
| 54 |
+
}
|
| 55 |
+
if (isSupportedUnit(unit)) {
|
| 56 |
+
this.num = convertToPx(num, unit);
|
| 57 |
+
this.unit = 'px';
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
add(other) {
|
| 61 |
+
if (this.unit !== other.unit) {
|
| 62 |
+
return new DecimalCSS(NaN, '');
|
| 63 |
+
}
|
| 64 |
+
return new DecimalCSS(this.num + other.num, this.unit);
|
| 65 |
+
}
|
| 66 |
+
subtract(other) {
|
| 67 |
+
if (this.unit !== other.unit) {
|
| 68 |
+
return new DecimalCSS(NaN, '');
|
| 69 |
+
}
|
| 70 |
+
return new DecimalCSS(this.num - other.num, this.unit);
|
| 71 |
+
}
|
| 72 |
+
multiply(other) {
|
| 73 |
+
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
| 74 |
+
return new DecimalCSS(NaN, '');
|
| 75 |
+
}
|
| 76 |
+
return new DecimalCSS(this.num * other.num, this.unit || other.unit);
|
| 77 |
+
}
|
| 78 |
+
divide(other) {
|
| 79 |
+
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
| 80 |
+
return new DecimalCSS(NaN, '');
|
| 81 |
+
}
|
| 82 |
+
return new DecimalCSS(this.num / other.num, this.unit || other.unit);
|
| 83 |
+
}
|
| 84 |
+
toString() {
|
| 85 |
+
return "".concat(this.num).concat(this.unit);
|
| 86 |
+
}
|
| 87 |
+
isNaN() {
|
| 88 |
+
return (0, _DataUtils.isNan)(this.num);
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
_DecimalCSS = DecimalCSS;
|
| 92 |
+
_defineProperty(DecimalCSS, "NaN", new _DecimalCSS(NaN, ''));
|
| 93 |
+
function calculateArithmetic(expr) {
|
| 94 |
+
if (expr == null || expr.includes(STR_NAN)) {
|
| 95 |
+
return STR_NAN;
|
| 96 |
+
}
|
| 97 |
+
var newExpr = expr;
|
| 98 |
+
while (newExpr.includes('*') || newExpr.includes('/')) {
|
| 99 |
+
var _MULTIPLY_OR_DIVIDE_R;
|
| 100 |
+
var [, leftOperand, operator, rightOperand] = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [];
|
| 101 |
+
var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : '');
|
| 102 |
+
var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : '');
|
| 103 |
+
var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs);
|
| 104 |
+
if (result.isNaN()) {
|
| 105 |
+
return STR_NAN;
|
| 106 |
+
}
|
| 107 |
+
newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString());
|
| 108 |
+
}
|
| 109 |
+
while (newExpr.includes('+') || /.-\d+(?:\.\d+)?/.test(newExpr)) {
|
| 110 |
+
var _ADD_OR_SUBTRACT_REGE;
|
| 111 |
+
var [, _leftOperand, _operator, _rightOperand] = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [];
|
| 112 |
+
var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : '');
|
| 113 |
+
var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : '');
|
| 114 |
+
var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs);
|
| 115 |
+
if (_result.isNaN()) {
|
| 116 |
+
return STR_NAN;
|
| 117 |
+
}
|
| 118 |
+
newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString());
|
| 119 |
+
}
|
| 120 |
+
return newExpr;
|
| 121 |
+
}
|
| 122 |
+
var PARENTHESES_REGEX = /\(([^()]*)\)/;
|
| 123 |
+
function calculateParentheses(expr) {
|
| 124 |
+
var newExpr = expr;
|
| 125 |
+
var match;
|
| 126 |
+
// eslint-disable-next-line no-cond-assign
|
| 127 |
+
while ((match = PARENTHESES_REGEX.exec(newExpr)) != null) {
|
| 128 |
+
var [, parentheticalExpression] = match;
|
| 129 |
+
newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression));
|
| 130 |
+
}
|
| 131 |
+
return newExpr;
|
| 132 |
+
}
|
| 133 |
+
function evaluateExpression(expression) {
|
| 134 |
+
var newExpr = expression.replace(/\s+/g, '');
|
| 135 |
+
newExpr = calculateParentheses(newExpr);
|
| 136 |
+
newExpr = calculateArithmetic(newExpr);
|
| 137 |
+
return newExpr;
|
| 138 |
+
}
|
| 139 |
+
function safeEvaluateExpression(expression) {
|
| 140 |
+
try {
|
| 141 |
+
return evaluateExpression(expression);
|
| 142 |
+
} catch (_unused) {
|
| 143 |
+
return STR_NAN;
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
function reduceCSSCalc(expression) {
|
| 147 |
+
var result = safeEvaluateExpression(expression.slice(5, -1));
|
| 148 |
+
if (result === STR_NAN) {
|
| 149 |
+
return '';
|
| 150 |
+
}
|
| 151 |
+
return result;
|
| 152 |
+
}
|
node_modules/recharts/lib/util/ScatterUtils.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.ScatterSymbol = ScatterSymbol;
|
| 7 |
+
var React = _interopRequireWildcard(require("react"));
|
| 8 |
+
var _Symbols = require("../shape/Symbols");
|
| 9 |
+
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
| 10 |
+
var _Constants = require("./Constants");
|
| 11 |
+
var _excluded = ["option", "isActive"];
|
| 12 |
+
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); }
|
| 13 |
+
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); }
|
| 14 |
+
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; }
|
| 15 |
+
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; }
|
| 16 |
+
function ScatterSymbol(_ref) {
|
| 17 |
+
var {
|
| 18 |
+
option,
|
| 19 |
+
isActive
|
| 20 |
+
} = _ref,
|
| 21 |
+
props = _objectWithoutProperties(_ref, _excluded);
|
| 22 |
+
if (typeof option === 'string') {
|
| 23 |
+
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
| 24 |
+
option: /*#__PURE__*/React.createElement(_Symbols.Symbols, _extends({
|
| 25 |
+
type: option
|
| 26 |
+
}, props)),
|
| 27 |
+
isActive: isActive,
|
| 28 |
+
shapeType: "symbols"
|
| 29 |
+
}, props));
|
| 30 |
+
}
|
| 31 |
+
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
| 32 |
+
option: option,
|
| 33 |
+
isActive: isActive,
|
| 34 |
+
shapeType: "symbols"
|
| 35 |
+
}, props));
|
| 36 |
+
}
|
node_modules/recharts/lib/util/TickUtils.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.getAngledTickWidth = getAngledTickWidth;
|
| 7 |
+
exports.getNumberIntervalTicks = getNumberIntervalTicks;
|
| 8 |
+
exports.getTickBoundaries = getTickBoundaries;
|
| 9 |
+
exports.isVisible = isVisible;
|
| 10 |
+
var _CartesianUtils = require("./CartesianUtils");
|
| 11 |
+
var _getEveryNth = require("./getEveryNth");
|
| 12 |
+
function getAngledTickWidth(contentSize, unitSize, angle) {
|
| 13 |
+
var size = {
|
| 14 |
+
width: contentSize.width + unitSize.width,
|
| 15 |
+
height: contentSize.height + unitSize.height
|
| 16 |
+
};
|
| 17 |
+
return (0, _CartesianUtils.getAngledRectangleWidth)(size, angle);
|
| 18 |
+
}
|
| 19 |
+
function getTickBoundaries(viewBox, sign, sizeKey) {
|
| 20 |
+
var isWidth = sizeKey === 'width';
|
| 21 |
+
var {
|
| 22 |
+
x,
|
| 23 |
+
y,
|
| 24 |
+
width,
|
| 25 |
+
height
|
| 26 |
+
} = viewBox;
|
| 27 |
+
if (sign === 1) {
|
| 28 |
+
return {
|
| 29 |
+
start: isWidth ? x : y,
|
| 30 |
+
end: isWidth ? x + width : y + height
|
| 31 |
+
};
|
| 32 |
+
}
|
| 33 |
+
return {
|
| 34 |
+
start: isWidth ? x + width : y + height,
|
| 35 |
+
end: isWidth ? x : y
|
| 36 |
+
};
|
| 37 |
+
}
|
| 38 |
+
function isVisible(sign, tickPosition, getSize, start, end) {
|
| 39 |
+
/* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating
|
| 40 |
+
* the tick's size. */
|
| 41 |
+
if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {
|
| 42 |
+
return false;
|
| 43 |
+
}
|
| 44 |
+
var size = getSize();
|
| 45 |
+
return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
|
| 46 |
+
}
|
| 47 |
+
function getNumberIntervalTicks(ticks, interval) {
|
| 48 |
+
return (0, _getEveryNth.getEveryNth)(ticks, interval + 1);
|
| 49 |
+
}
|
node_modules/recharts/lib/util/YAxisUtils.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
|
| 3 |
+
Object.defineProperty(exports, "__esModule", {
|
| 4 |
+
value: true
|
| 5 |
+
});
|
| 6 |
+
exports.getCalculatedYAxisWidth = void 0;
|
| 7 |
+
/**
|
| 8 |
+
* Calculates the width of the Y-axis based on the tick labels and the axis label.
|
| 9 |
+
* @param params - The parameters object.
|
| 10 |
+
* @param [params.ticks] - An array-like object of tick elements, each with a `getBoundingClientRect` method.
|
| 11 |
+
* @param [params.label] - The axis label element, with a `getBoundingClientRect` method.
|
| 12 |
+
* @param [params.labelGapWithTick=5] - The gap between the label and the tick.
|
| 13 |
+
* @param [params.tickSize=0] - The length of the tick line.
|
| 14 |
+
* @param [params.tickMargin=0] - The margin between the tick line and the tick text.
|
| 15 |
+
* @returns The calculated width of the Y-axis.
|
| 16 |
+
*/
|
| 17 |
+
var getCalculatedYAxisWidth = _ref => {
|
| 18 |
+
var {
|
| 19 |
+
ticks,
|
| 20 |
+
label,
|
| 21 |
+
labelGapWithTick = 5,
|
| 22 |
+
// Default gap between label and tick
|
| 23 |
+
tickSize = 0,
|
| 24 |
+
tickMargin = 0
|
| 25 |
+
} = _ref;
|
| 26 |
+
// find the max width of the tick labels
|
| 27 |
+
var maxTickWidth = 0;
|
| 28 |
+
if (ticks) {
|
| 29 |
+
Array.from(ticks).forEach(tickNode => {
|
| 30 |
+
if (tickNode) {
|
| 31 |
+
var bbox = tickNode.getBoundingClientRect();
|
| 32 |
+
if (bbox.width > maxTickWidth) {
|
| 33 |
+
maxTickWidth = bbox.width;
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
});
|
| 37 |
+
|
| 38 |
+
// calculate width of the axis label
|
| 39 |
+
var labelWidth = label ? label.getBoundingClientRect().width : 0;
|
| 40 |
+
var tickWidth = tickSize + tickMargin;
|
| 41 |
+
|
| 42 |
+
// calculate the updated width of the y-axis
|
| 43 |
+
var updatedYAxisWidth = maxTickWidth + tickWidth + labelWidth + (label ? labelGapWithTick : 0);
|
| 44 |
+
return Math.round(updatedYAxisWidth);
|
| 45 |
+
}
|
| 46 |
+
return 0;
|
| 47 |
+
};
|
| 48 |
+
exports.getCalculatedYAxisWidth = getCalculatedYAxisWidth;
|