v1.0 with SW PWA enabled
This commit is contained in:
551
frontend/node_modules/recharts/lib/cartesian/Area.js
generated
vendored
Normal file
551
frontend/node_modules/recharts/lib/cartesian/Area.js
generated
vendored
Normal file
@ -0,0 +1,551 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Area = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _max = _interopRequireDefault(require("lodash/max"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isNaN = _interopRequireDefault(require("lodash/isNaN"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _Curve = require("../shape/Curve");
|
||||
var _Dot = require("../shape/Dot");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _Global = require("../util/Global");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["layout", "type", "stroke", "connectNulls", "isRange", "ref"],
|
||||
_excluded2 = ["key"];
|
||||
var _Area;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Area
|
||||
*/
|
||||
var Area = exports.Area = /*#__PURE__*/function (_PureComponent) {
|
||||
function Area() {
|
||||
var _this;
|
||||
_classCallCheck(this, Area);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Area, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: true
|
||||
});
|
||||
_defineProperty(_this, "id", (0, _DataUtils.uniqueId)('recharts-area-'));
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Area, _PureComponent);
|
||||
return _createClass(Area, [{
|
||||
key: "renderDots",
|
||||
value: function renderDots(needClip, clipDot, clipPathId) {
|
||||
var isAnimationActive = this.props.isAnimationActive;
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
if (isAnimationActive && !isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props = this.props,
|
||||
dot = _this$props.dot,
|
||||
points = _this$props.points,
|
||||
dataKey = _this$props.dataKey;
|
||||
var areaProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customDotProps = (0, _ReactUtils.filterProps)(dot, true);
|
||||
var dots = points.map(function (entry, i) {
|
||||
var dotProps = _objectSpread(_objectSpread(_objectSpread({
|
||||
key: "dot-".concat(i),
|
||||
r: 3
|
||||
}, areaProps), customDotProps), {}, {
|
||||
index: i,
|
||||
cx: entry.x,
|
||||
cy: entry.y,
|
||||
dataKey: dataKey,
|
||||
value: entry.value,
|
||||
payload: entry.payload,
|
||||
points: points
|
||||
});
|
||||
return Area.renderDotItem(dot, dotProps);
|
||||
});
|
||||
var dotsProps = {
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipDot ? '' : 'dots-').concat(clipPathId, ")") : null
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-area-dots"
|
||||
}, dotsProps), dots);
|
||||
}
|
||||
}, {
|
||||
key: "renderHorizontalRect",
|
||||
value: function renderHorizontalRect(alpha) {
|
||||
var _this$props2 = this.props,
|
||||
baseLine = _this$props2.baseLine,
|
||||
points = _this$props2.points,
|
||||
strokeWidth = _this$props2.strokeWidth;
|
||||
var startX = points[0].x;
|
||||
var endX = points[points.length - 1].x;
|
||||
var width = alpha * Math.abs(startX - endX);
|
||||
var maxY = (0, _max["default"])(points.map(function (entry) {
|
||||
return entry.y || 0;
|
||||
}));
|
||||
if ((0, _DataUtils.isNumber)(baseLine) && typeof baseLine === 'number') {
|
||||
maxY = Math.max(baseLine, maxY);
|
||||
} else if (baseLine && Array.isArray(baseLine) && baseLine.length) {
|
||||
maxY = Math.max((0, _max["default"])(baseLine.map(function (entry) {
|
||||
return entry.y || 0;
|
||||
})), maxY);
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(maxY)) {
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: startX < endX ? startX : startX - width,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: Math.floor(maxY + (strokeWidth ? parseInt("".concat(strokeWidth), 10) : 1))
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "renderVerticalRect",
|
||||
value: function renderVerticalRect(alpha) {
|
||||
var _this$props3 = this.props,
|
||||
baseLine = _this$props3.baseLine,
|
||||
points = _this$props3.points,
|
||||
strokeWidth = _this$props3.strokeWidth;
|
||||
var startY = points[0].y;
|
||||
var endY = points[points.length - 1].y;
|
||||
var height = alpha * Math.abs(startY - endY);
|
||||
var maxX = (0, _max["default"])(points.map(function (entry) {
|
||||
return entry.x || 0;
|
||||
}));
|
||||
if ((0, _DataUtils.isNumber)(baseLine) && typeof baseLine === 'number') {
|
||||
maxX = Math.max(baseLine, maxX);
|
||||
} else if (baseLine && Array.isArray(baseLine) && baseLine.length) {
|
||||
maxX = Math.max((0, _max["default"])(baseLine.map(function (entry) {
|
||||
return entry.x || 0;
|
||||
})), maxX);
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(maxX)) {
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: 0,
|
||||
y: startY < endY ? startY : startY - height,
|
||||
width: maxX + (strokeWidth ? parseInt("".concat(strokeWidth), 10) : 1),
|
||||
height: Math.floor(height)
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "renderClipRect",
|
||||
value: function renderClipRect(alpha) {
|
||||
var layout = this.props.layout;
|
||||
if (layout === 'vertical') {
|
||||
return this.renderVerticalRect(alpha);
|
||||
}
|
||||
return this.renderHorizontalRect(alpha);
|
||||
}
|
||||
}, {
|
||||
key: "renderAreaStatically",
|
||||
value: function renderAreaStatically(points, baseLine, needClip, clipPathId) {
|
||||
var _this$props4 = this.props,
|
||||
layout = _this$props4.layout,
|
||||
type = _this$props4.type,
|
||||
stroke = _this$props4.stroke,
|
||||
connectNulls = _this$props4.connectNulls,
|
||||
isRange = _this$props4.isRange,
|
||||
ref = _this$props4.ref,
|
||||
others = _objectWithoutProperties(_this$props4, _excluded);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
points: points,
|
||||
connectNulls: connectNulls,
|
||||
type: type,
|
||||
baseLine: baseLine,
|
||||
layout: layout,
|
||||
stroke: "none",
|
||||
className: "recharts-area-area"
|
||||
})), stroke !== 'none' && /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, (0, _ReactUtils.filterProps)(this.props, false), {
|
||||
className: "recharts-area-curve",
|
||||
layout: layout,
|
||||
type: type,
|
||||
connectNulls: connectNulls,
|
||||
fill: "none",
|
||||
points: points
|
||||
})), stroke !== 'none' && isRange && /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, (0, _ReactUtils.filterProps)(this.props, false), {
|
||||
className: "recharts-area-curve",
|
||||
layout: layout,
|
||||
type: type,
|
||||
connectNulls: connectNulls,
|
||||
fill: "none",
|
||||
points: baseLine
|
||||
})));
|
||||
}
|
||||
}, {
|
||||
key: "renderAreaWithAnimation",
|
||||
value: function renderAreaWithAnimation(needClip, clipPathId) {
|
||||
var _this2 = this;
|
||||
var _this$props5 = this.props,
|
||||
points = _this$props5.points,
|
||||
baseLine = _this$props5.baseLine,
|
||||
isAnimationActive = _this$props5.isAnimationActive,
|
||||
animationBegin = _this$props5.animationBegin,
|
||||
animationDuration = _this$props5.animationDuration,
|
||||
animationEasing = _this$props5.animationEasing,
|
||||
animationId = _this$props5.animationId;
|
||||
var _this$state = this.state,
|
||||
prevPoints = _this$state.prevPoints,
|
||||
prevBaseLine = _this$state.prevBaseLine;
|
||||
// const clipPathId = isNil(id) ? this.id : id;
|
||||
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "area-".concat(animationId),
|
||||
onAnimationEnd: this.handleAnimationEnd,
|
||||
onAnimationStart: this.handleAnimationStart
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
if (prevPoints) {
|
||||
var prevPointsDiffFactor = prevPoints.length / points.length;
|
||||
// update animtaion
|
||||
var stepPoints = points.map(function (entry, index) {
|
||||
var prevPointIndex = Math.floor(index * prevPointsDiffFactor);
|
||||
if (prevPoints[prevPointIndex]) {
|
||||
var prev = prevPoints[prevPointIndex];
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t)
|
||||
});
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
var stepBaseLine;
|
||||
if ((0, _DataUtils.isNumber)(baseLine) && typeof baseLine === 'number') {
|
||||
var interpolator = (0, _DataUtils.interpolateNumber)(prevBaseLine, baseLine);
|
||||
stepBaseLine = interpolator(t);
|
||||
} else if ((0, _isNil["default"])(baseLine) || (0, _isNaN["default"])(baseLine)) {
|
||||
var _interpolator = (0, _DataUtils.interpolateNumber)(prevBaseLine, 0);
|
||||
stepBaseLine = _interpolator(t);
|
||||
} else {
|
||||
stepBaseLine = baseLine.map(function (entry, index) {
|
||||
var prevPointIndex = Math.floor(index * prevPointsDiffFactor);
|
||||
if (prevBaseLine[prevPointIndex]) {
|
||||
var prev = prevBaseLine[prevPointIndex];
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t)
|
||||
});
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
return _this2.renderAreaStatically(stepPoints, stepBaseLine, needClip, clipPathId);
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "animationClipPath-".concat(clipPathId)
|
||||
}, _this2.renderClipRect(t))), /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
clipPath: "url(#animationClipPath-".concat(clipPathId, ")")
|
||||
}, _this2.renderAreaStatically(points, baseLine, needClip, clipPathId)));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderArea",
|
||||
value: function renderArea(needClip, clipPathId) {
|
||||
var _this$props6 = this.props,
|
||||
points = _this$props6.points,
|
||||
baseLine = _this$props6.baseLine,
|
||||
isAnimationActive = _this$props6.isAnimationActive;
|
||||
var _this$state2 = this.state,
|
||||
prevPoints = _this$state2.prevPoints,
|
||||
prevBaseLine = _this$state2.prevBaseLine,
|
||||
totalLength = _this$state2.totalLength;
|
||||
if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !(0, _isEqual["default"])(prevPoints, points) || !(0, _isEqual["default"])(prevBaseLine, baseLine))) {
|
||||
return this.renderAreaWithAnimation(needClip, clipPathId);
|
||||
}
|
||||
return this.renderAreaStatically(points, baseLine, needClip, clipPathId);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _filterProps;
|
||||
var _this$props7 = this.props,
|
||||
hide = _this$props7.hide,
|
||||
dot = _this$props7.dot,
|
||||
points = _this$props7.points,
|
||||
className = _this$props7.className,
|
||||
top = _this$props7.top,
|
||||
left = _this$props7.left,
|
||||
xAxis = _this$props7.xAxis,
|
||||
yAxis = _this$props7.yAxis,
|
||||
width = _this$props7.width,
|
||||
height = _this$props7.height,
|
||||
isAnimationActive = _this$props7.isAnimationActive,
|
||||
id = _this$props7.id;
|
||||
if (hide || !points || !points.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var hasSinglePoint = points.length === 1;
|
||||
var layerClass = (0, _clsx["default"])('recharts-area', className);
|
||||
var needClipX = xAxis && xAxis.allowDataOverflow;
|
||||
var needClipY = yAxis && yAxis.allowDataOverflow;
|
||||
var needClip = needClipX || needClipY;
|
||||
var clipPathId = (0, _isNil["default"])(id) ? this.id : id;
|
||||
var _ref2 = (_filterProps = (0, _ReactUtils.filterProps)(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {
|
||||
r: 3,
|
||||
strokeWidth: 2
|
||||
},
|
||||
_ref2$r = _ref2.r,
|
||||
r = _ref2$r === void 0 ? 3 : _ref2$r,
|
||||
_ref2$strokeWidth = _ref2.strokeWidth,
|
||||
strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
|
||||
var _ref3 = (0, _ReactUtils.hasClipDot)(dot) ? dot : {},
|
||||
_ref3$clipDot = _ref3.clipDot,
|
||||
clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;
|
||||
var dotSize = r * 2 + strokeWidth;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, needClipX || needClipY ? /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: needClipX ? left : left - width / 2,
|
||||
y: needClipY ? top : top - height / 2,
|
||||
width: needClipX ? width : width * 2,
|
||||
height: needClipY ? height : height * 2
|
||||
})), !clipDot && /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-dots-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: left - dotSize / 2,
|
||||
y: top - dotSize / 2,
|
||||
width: width + dotSize,
|
||||
height: height + dotSize
|
||||
}))) : null, !hasSinglePoint ? this.renderArea(needClip, clipPathId) : null, (dot || hasSinglePoint) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, points));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curPoints: nextProps.points,
|
||||
curBaseLine: nextProps.baseLine,
|
||||
prevPoints: prevState.curPoints,
|
||||
prevBaseLine: prevState.curBaseLine
|
||||
};
|
||||
}
|
||||
if (nextProps.points !== prevState.curPoints || nextProps.baseLine !== prevState.curBaseLine) {
|
||||
return {
|
||||
curPoints: nextProps.points,
|
||||
curBaseLine: nextProps.baseLine
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_Area = Area;
|
||||
_defineProperty(Area, "displayName", 'Area');
|
||||
_defineProperty(Area, "defaultProps", {
|
||||
stroke: '#3182bd',
|
||||
fill: '#3182bd',
|
||||
fillOpacity: 0.6,
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
legendType: 'line',
|
||||
connectNulls: false,
|
||||
// points of area
|
||||
points: [],
|
||||
dot: false,
|
||||
activeDot: true,
|
||||
hide: false,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease'
|
||||
});
|
||||
_defineProperty(Area, "getBaseValue", function (props, item, xAxis, yAxis) {
|
||||
var layout = props.layout,
|
||||
chartBaseValue = props.baseValue;
|
||||
var itemBaseValue = item.props.baseValue;
|
||||
|
||||
// The baseValue can be defined both on the AreaChart as well as on the Area.
|
||||
// The value for the item takes precedence.
|
||||
var baseValue = itemBaseValue !== null && itemBaseValue !== void 0 ? itemBaseValue : chartBaseValue;
|
||||
if ((0, _DataUtils.isNumber)(baseValue) && typeof baseValue === 'number') {
|
||||
return baseValue;
|
||||
}
|
||||
var numericAxis = layout === 'horizontal' ? yAxis : xAxis;
|
||||
var domain = numericAxis.scale.domain();
|
||||
if (numericAxis.type === 'number') {
|
||||
var domainMax = Math.max(domain[0], domain[1]);
|
||||
var domainMin = Math.min(domain[0], domain[1]);
|
||||
if (baseValue === 'dataMin') {
|
||||
return domainMin;
|
||||
}
|
||||
if (baseValue === 'dataMax') {
|
||||
return domainMax;
|
||||
}
|
||||
return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);
|
||||
}
|
||||
if (baseValue === 'dataMin') {
|
||||
return domain[0];
|
||||
}
|
||||
if (baseValue === 'dataMax') {
|
||||
return domain[1];
|
||||
}
|
||||
return domain[0];
|
||||
});
|
||||
_defineProperty(Area, "getComposedData", function (_ref4) {
|
||||
var props = _ref4.props,
|
||||
item = _ref4.item,
|
||||
xAxis = _ref4.xAxis,
|
||||
yAxis = _ref4.yAxis,
|
||||
xAxisTicks = _ref4.xAxisTicks,
|
||||
yAxisTicks = _ref4.yAxisTicks,
|
||||
bandSize = _ref4.bandSize,
|
||||
dataKey = _ref4.dataKey,
|
||||
stackedData = _ref4.stackedData,
|
||||
dataStartIndex = _ref4.dataStartIndex,
|
||||
displayedData = _ref4.displayedData,
|
||||
offset = _ref4.offset;
|
||||
var layout = props.layout;
|
||||
var hasStack = stackedData && stackedData.length;
|
||||
var baseValue = _Area.getBaseValue(props, item, xAxis, yAxis);
|
||||
var isHorizontalLayout = layout === 'horizontal';
|
||||
var isRange = false;
|
||||
var points = displayedData.map(function (entry, index) {
|
||||
var value;
|
||||
if (hasStack) {
|
||||
value = stackedData[dataStartIndex + index];
|
||||
} else {
|
||||
value = (0, _ChartUtils.getValueByDataKey)(entry, dataKey);
|
||||
if (!Array.isArray(value)) {
|
||||
value = [baseValue, value];
|
||||
} else {
|
||||
isRange = true;
|
||||
}
|
||||
}
|
||||
var isBreakPoint = value[1] == null || hasStack && (0, _ChartUtils.getValueByDataKey)(entry, dataKey) == null;
|
||||
if (isHorizontalLayout) {
|
||||
return {
|
||||
x: (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: xAxis,
|
||||
ticks: xAxisTicks,
|
||||
bandSize: bandSize,
|
||||
entry: entry,
|
||||
index: index
|
||||
}),
|
||||
y: isBreakPoint ? null : yAxis.scale(value[1]),
|
||||
value: value,
|
||||
payload: entry
|
||||
};
|
||||
}
|
||||
return {
|
||||
x: isBreakPoint ? null : xAxis.scale(value[1]),
|
||||
y: (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: yAxis,
|
||||
ticks: yAxisTicks,
|
||||
bandSize: bandSize,
|
||||
entry: entry,
|
||||
index: index
|
||||
}),
|
||||
value: value,
|
||||
payload: entry
|
||||
};
|
||||
});
|
||||
var baseLine;
|
||||
if (hasStack || isRange) {
|
||||
baseLine = points.map(function (entry) {
|
||||
var x = Array.isArray(entry.value) ? entry.value[0] : null;
|
||||
if (isHorizontalLayout) {
|
||||
return {
|
||||
x: entry.x,
|
||||
y: x != null && entry.y != null ? yAxis.scale(x) : null
|
||||
};
|
||||
}
|
||||
return {
|
||||
x: x != null ? xAxis.scale(x) : null,
|
||||
y: entry.y
|
||||
};
|
||||
});
|
||||
} else {
|
||||
baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);
|
||||
}
|
||||
return _objectSpread({
|
||||
points: points,
|
||||
baseLine: baseLine,
|
||||
layout: layout,
|
||||
isRange: isRange
|
||||
}, offset);
|
||||
});
|
||||
_defineProperty(Area, "renderDotItem", function (option, props) {
|
||||
var dotItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
dotItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
dotItem = option(props);
|
||||
} else {
|
||||
var className = (0, _clsx["default"])('recharts-area-dot', typeof option !== 'boolean' ? option.className : '');
|
||||
var key = props.key,
|
||||
rest = _objectWithoutProperties(props, _excluded2);
|
||||
dotItem = /*#__PURE__*/_react["default"].createElement(_Dot.Dot, _extends({}, rest, {
|
||||
key: key,
|
||||
className: className
|
||||
}));
|
||||
}
|
||||
return dotItem;
|
||||
});
|
||||
458
frontend/node_modules/recharts/lib/cartesian/Bar.js
generated
vendored
Normal file
458
frontend/node_modules/recharts/lib/cartesian/Bar.js
generated
vendored
Normal file
@ -0,0 +1,458 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Bar = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _ErrorBar = require("./ErrorBar");
|
||||
var _Cell = require("../component/Cell");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _types = require("../util/types");
|
||||
var _BarUtils = require("../util/BarUtils");
|
||||
var _excluded = ["value", "background"];
|
||||
var _Bar;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render a group of bar
|
||||
*/
|
||||
var Bar = exports.Bar = /*#__PURE__*/function (_PureComponent) {
|
||||
function Bar() {
|
||||
var _this;
|
||||
_classCallCheck(this, Bar);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Bar, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: false
|
||||
});
|
||||
_defineProperty(_this, "id", (0, _DataUtils.uniqueId)('recharts-bar-'));
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if (onAnimationEnd) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if (onAnimationStart) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Bar, _PureComponent);
|
||||
return _createClass(Bar, [{
|
||||
key: "renderRectanglesStatically",
|
||||
value: function renderRectanglesStatically(data) {
|
||||
var _this2 = this;
|
||||
var _this$props = this.props,
|
||||
shape = _this$props.shape,
|
||||
dataKey = _this$props.dataKey,
|
||||
activeIndex = _this$props.activeIndex,
|
||||
activeBar = _this$props.activeBar;
|
||||
var baseProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
return data && data.map(function (entry, i) {
|
||||
var isActive = i === activeIndex;
|
||||
var option = isActive ? activeBar : shape;
|
||||
var props = _objectSpread(_objectSpread(_objectSpread({}, baseProps), entry), {}, {
|
||||
isActive: isActive,
|
||||
option: option,
|
||||
index: i,
|
||||
dataKey: dataKey,
|
||||
onAnimationStart: _this2.handleAnimationStart,
|
||||
onAnimationEnd: _this2.handleAnimationEnd
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-bar-rectangle"
|
||||
}, (0, _types.adaptEventsOfChild)(_this2.props, entry, i), {
|
||||
// https://github.com/recharts/recharts/issues/5415
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key: "rectangle-".concat(entry === null || entry === void 0 ? void 0 : entry.x, "-").concat(entry === null || entry === void 0 ? void 0 : entry.y, "-").concat(entry === null || entry === void 0 ? void 0 : entry.value, "-").concat(i)
|
||||
}), /*#__PURE__*/_react["default"].createElement(_BarUtils.BarRectangle, props));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderRectanglesWithAnimation",
|
||||
value: function renderRectanglesWithAnimation() {
|
||||
var _this3 = this;
|
||||
var _this$props2 = this.props,
|
||||
data = _this$props2.data,
|
||||
layout = _this$props2.layout,
|
||||
isAnimationActive = _this$props2.isAnimationActive,
|
||||
animationBegin = _this$props2.animationBegin,
|
||||
animationDuration = _this$props2.animationDuration,
|
||||
animationEasing = _this$props2.animationEasing,
|
||||
animationId = _this$props2.animationId;
|
||||
var prevData = this.state.prevData;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "bar-".concat(animationId),
|
||||
onAnimationEnd: this.handleAnimationEnd,
|
||||
onAnimationStart: this.handleAnimationStart
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
var stepData = data.map(function (entry, index) {
|
||||
var prev = prevData && prevData[index];
|
||||
if (prev) {
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
var interpolatorWidth = (0, _DataUtils.interpolateNumber)(prev.width, entry.width);
|
||||
var interpolatorHeight = (0, _DataUtils.interpolateNumber)(prev.height, entry.height);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t),
|
||||
width: interpolatorWidth(t),
|
||||
height: interpolatorHeight(t)
|
||||
});
|
||||
}
|
||||
if (layout === 'horizontal') {
|
||||
var _interpolatorHeight = (0, _DataUtils.interpolateNumber)(0, entry.height);
|
||||
var h = _interpolatorHeight(t);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
y: entry.y + entry.height - h,
|
||||
height: h
|
||||
});
|
||||
}
|
||||
var interpolator = (0, _DataUtils.interpolateNumber)(0, entry.width);
|
||||
var w = interpolator(t);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
width: w
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, _this3.renderRectanglesStatically(stepData));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderRectangles",
|
||||
value: function renderRectangles() {
|
||||
var _this$props3 = this.props,
|
||||
data = _this$props3.data,
|
||||
isAnimationActive = _this$props3.isAnimationActive;
|
||||
var prevData = this.state.prevData;
|
||||
if (isAnimationActive && data && data.length && (!prevData || !(0, _isEqual["default"])(prevData, data))) {
|
||||
return this.renderRectanglesWithAnimation();
|
||||
}
|
||||
return this.renderRectanglesStatically(data);
|
||||
}
|
||||
}, {
|
||||
key: "renderBackground",
|
||||
value: function renderBackground() {
|
||||
var _this4 = this;
|
||||
var _this$props4 = this.props,
|
||||
data = _this$props4.data,
|
||||
dataKey = _this$props4.dataKey,
|
||||
activeIndex = _this$props4.activeIndex;
|
||||
var backgroundProps = (0, _ReactUtils.filterProps)(this.props.background, false);
|
||||
return data.map(function (entry, i) {
|
||||
var value = entry.value,
|
||||
background = entry.background,
|
||||
rest = _objectWithoutProperties(entry, _excluded);
|
||||
if (!background) {
|
||||
return null;
|
||||
}
|
||||
var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, rest), {}, {
|
||||
fill: '#eee'
|
||||
}, background), backgroundProps), (0, _types.adaptEventsOfChild)(_this4.props, entry, i)), {}, {
|
||||
onAnimationStart: _this4.handleAnimationStart,
|
||||
onAnimationEnd: _this4.handleAnimationEnd,
|
||||
dataKey: dataKey,
|
||||
index: i,
|
||||
className: 'recharts-bar-background-rectangle'
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_BarUtils.BarRectangle, _extends({
|
||||
key: "background-bar-".concat(i),
|
||||
option: _this4.props.background,
|
||||
isActive: i === activeIndex
|
||||
}, props));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderErrorBar",
|
||||
value: function renderErrorBar(needClip, clipPathId) {
|
||||
if (this.props.isAnimationActive && !this.state.isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props5 = this.props,
|
||||
data = _this$props5.data,
|
||||
xAxis = _this$props5.xAxis,
|
||||
yAxis = _this$props5.yAxis,
|
||||
layout = _this$props5.layout,
|
||||
children = _this$props5.children;
|
||||
var errorBarItems = (0, _ReactUtils.findAllByType)(children, _ErrorBar.ErrorBar);
|
||||
if (!errorBarItems) {
|
||||
return null;
|
||||
}
|
||||
var offset = layout === 'vertical' ? data[0].height / 2 : data[0].width / 2;
|
||||
var dataPointFormatter = function dataPointFormatter(dataPoint, dataKey) {
|
||||
/**
|
||||
* if the value coming from `getComposedData` is an array then this is a stacked bar chart.
|
||||
* arr[1] represents end value of the bar since the data is in the form of [startValue, endValue].
|
||||
* */
|
||||
var value = Array.isArray(dataPoint.value) ? dataPoint.value[1] : dataPoint.value;
|
||||
return {
|
||||
x: dataPoint.x,
|
||||
y: dataPoint.y,
|
||||
value: value,
|
||||
errorVal: (0, _ChartUtils.getValueByDataKey)(dataPoint, dataKey)
|
||||
};
|
||||
};
|
||||
var errorBarProps = {
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, errorBarProps, errorBarItems.map(function (item) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(item, {
|
||||
key: "error-bar-".concat(clipPathId, "-").concat(item.props.dataKey),
|
||||
data: data,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
layout: layout,
|
||||
offset: offset,
|
||||
dataPointFormatter: dataPointFormatter
|
||||
});
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props6 = this.props,
|
||||
hide = _this$props6.hide,
|
||||
data = _this$props6.data,
|
||||
className = _this$props6.className,
|
||||
xAxis = _this$props6.xAxis,
|
||||
yAxis = _this$props6.yAxis,
|
||||
left = _this$props6.left,
|
||||
top = _this$props6.top,
|
||||
width = _this$props6.width,
|
||||
height = _this$props6.height,
|
||||
isAnimationActive = _this$props6.isAnimationActive,
|
||||
background = _this$props6.background,
|
||||
id = _this$props6.id;
|
||||
if (hide || !data || !data.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var layerClass = (0, _clsx["default"])('recharts-bar', className);
|
||||
var needClipX = xAxis && xAxis.allowDataOverflow;
|
||||
var needClipY = yAxis && yAxis.allowDataOverflow;
|
||||
var needClip = needClipX || needClipY;
|
||||
var clipPathId = (0, _isNil["default"])(id) ? this.id : id;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, needClipX || needClipY ? /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: needClipX ? left : left - width / 2,
|
||||
y: needClipY ? top : top - height / 2,
|
||||
width: needClipX ? width : width * 2,
|
||||
height: needClipY ? height : height * 2
|
||||
}))) : null, /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-bar-rectangles",
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
|
||||
}, background ? this.renderBackground() : null, this.renderRectangles()), this.renderErrorBar(needClip, clipPathId), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, data));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curData: nextProps.data,
|
||||
prevData: prevState.curData
|
||||
};
|
||||
}
|
||||
if (nextProps.data !== prevState.curData) {
|
||||
return {
|
||||
curData: nextProps.data
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_Bar = Bar;
|
||||
_defineProperty(Bar, "displayName", 'Bar');
|
||||
_defineProperty(Bar, "defaultProps", {
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
legendType: 'rect',
|
||||
minPointSize: 0,
|
||||
hide: false,
|
||||
data: [],
|
||||
layout: 'vertical',
|
||||
activeBar: false,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 400,
|
||||
animationEasing: 'ease'
|
||||
});
|
||||
/**
|
||||
* Compose the data of each group
|
||||
* @param {Object} props Props for the component
|
||||
* @param {Object} item An instance of Bar
|
||||
* @param {Array} barPosition The offset and size of each bar
|
||||
* @param {Object} xAxis The configuration of x-axis
|
||||
* @param {Object} yAxis The configuration of y-axis
|
||||
* @param {Array} stackedData The stacked data of a bar item
|
||||
* @return{Array} Composed data
|
||||
*/
|
||||
_defineProperty(Bar, "getComposedData", function (_ref2) {
|
||||
var props = _ref2.props,
|
||||
item = _ref2.item,
|
||||
barPosition = _ref2.barPosition,
|
||||
bandSize = _ref2.bandSize,
|
||||
xAxis = _ref2.xAxis,
|
||||
yAxis = _ref2.yAxis,
|
||||
xAxisTicks = _ref2.xAxisTicks,
|
||||
yAxisTicks = _ref2.yAxisTicks,
|
||||
stackedData = _ref2.stackedData,
|
||||
dataStartIndex = _ref2.dataStartIndex,
|
||||
displayedData = _ref2.displayedData,
|
||||
offset = _ref2.offset;
|
||||
var pos = (0, _ChartUtils.findPositionOfBar)(barPosition, item);
|
||||
if (!pos) {
|
||||
return null;
|
||||
}
|
||||
var layout = props.layout;
|
||||
var itemDefaultProps = item.type.defaultProps;
|
||||
var itemProps = itemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, itemDefaultProps), item.props) : item.props;
|
||||
var dataKey = itemProps.dataKey,
|
||||
children = itemProps.children,
|
||||
minPointSizeProp = itemProps.minPointSize;
|
||||
var numericAxis = layout === 'horizontal' ? yAxis : xAxis;
|
||||
var stackedDomain = stackedData ? numericAxis.scale.domain() : null;
|
||||
var baseValue = (0, _ChartUtils.getBaseValueOfBar)({
|
||||
numericAxis: numericAxis
|
||||
});
|
||||
var cells = (0, _ReactUtils.findAllByType)(children, _Cell.Cell);
|
||||
var rects = displayedData.map(function (entry, index) {
|
||||
var value, x, y, width, height, background;
|
||||
if (stackedData) {
|
||||
value = (0, _ChartUtils.truncateByDomain)(stackedData[dataStartIndex + index], stackedDomain);
|
||||
} else {
|
||||
value = (0, _ChartUtils.getValueByDataKey)(entry, dataKey);
|
||||
if (!Array.isArray(value)) {
|
||||
value = [baseValue, value];
|
||||
}
|
||||
}
|
||||
var minPointSize = (0, _BarUtils.minPointSizeCallback)(minPointSizeProp, _Bar.defaultProps.minPointSize)(value[1], index);
|
||||
if (layout === 'horizontal') {
|
||||
var _ref4;
|
||||
var _ref3 = [yAxis.scale(value[0]), yAxis.scale(value[1])],
|
||||
baseValueScale = _ref3[0],
|
||||
currentValueScale = _ref3[1];
|
||||
x = (0, _ChartUtils.getCateCoordinateOfBar)({
|
||||
axis: xAxis,
|
||||
ticks: xAxisTicks,
|
||||
bandSize: bandSize,
|
||||
offset: pos.offset,
|
||||
entry: entry,
|
||||
index: index
|
||||
});
|
||||
y = (_ref4 = currentValueScale !== null && currentValueScale !== void 0 ? currentValueScale : baseValueScale) !== null && _ref4 !== void 0 ? _ref4 : undefined;
|
||||
width = pos.size;
|
||||
var computedHeight = baseValueScale - currentValueScale;
|
||||
height = Number.isNaN(computedHeight) ? 0 : computedHeight;
|
||||
background = {
|
||||
x: x,
|
||||
y: yAxis.y,
|
||||
width: width,
|
||||
height: yAxis.height
|
||||
};
|
||||
if (Math.abs(minPointSize) > 0 && Math.abs(height) < Math.abs(minPointSize)) {
|
||||
var delta = (0, _DataUtils.mathSign)(height || minPointSize) * (Math.abs(minPointSize) - Math.abs(height));
|
||||
y -= delta;
|
||||
height += delta;
|
||||
}
|
||||
} else {
|
||||
var _ref5 = [xAxis.scale(value[0]), xAxis.scale(value[1])],
|
||||
_baseValueScale = _ref5[0],
|
||||
_currentValueScale = _ref5[1];
|
||||
x = _baseValueScale;
|
||||
y = (0, _ChartUtils.getCateCoordinateOfBar)({
|
||||
axis: yAxis,
|
||||
ticks: yAxisTicks,
|
||||
bandSize: bandSize,
|
||||
offset: pos.offset,
|
||||
entry: entry,
|
||||
index: index
|
||||
});
|
||||
width = _currentValueScale - _baseValueScale;
|
||||
height = pos.size;
|
||||
background = {
|
||||
x: xAxis.x,
|
||||
y: y,
|
||||
width: xAxis.width,
|
||||
height: height
|
||||
};
|
||||
if (Math.abs(minPointSize) > 0 && Math.abs(width) < Math.abs(minPointSize)) {
|
||||
var _delta = (0, _DataUtils.mathSign)(width || minPointSize) * (Math.abs(minPointSize) - Math.abs(width));
|
||||
width += _delta;
|
||||
}
|
||||
}
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height,
|
||||
value: stackedData ? value : value[1],
|
||||
payload: entry,
|
||||
background: background
|
||||
}, cells && cells[index] && cells[index].props), {}, {
|
||||
tooltipPayload: [(0, _ChartUtils.getTooltipItem)(item, entry)],
|
||||
tooltipPosition: {
|
||||
x: x + width / 2,
|
||||
y: y + height / 2
|
||||
}
|
||||
});
|
||||
});
|
||||
return _objectSpread({
|
||||
data: rects,
|
||||
layout: layout
|
||||
}, offset);
|
||||
});
|
||||
629
frontend/node_modules/recharts/lib/cartesian/Brush.js
generated
vendored
Normal file
629
frontend/node_modules/recharts/lib/cartesian/Brush.js
generated
vendored
Normal file
@ -0,0 +1,629 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Brush = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _d3Scale = require("victory-vendor/d3-scale");
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _range = _interopRequireDefault(require("lodash/range"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Text = require("../component/Text");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _CssPrefixUtils = require("../util/CssPrefixUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Brush
|
||||
*/
|
||||
var createScale = function createScale(_ref) {
|
||||
var data = _ref.data,
|
||||
startIndex = _ref.startIndex,
|
||||
endIndex = _ref.endIndex,
|
||||
x = _ref.x,
|
||||
width = _ref.width,
|
||||
travellerWidth = _ref.travellerWidth;
|
||||
if (!data || !data.length) {
|
||||
return {};
|
||||
}
|
||||
var len = data.length;
|
||||
var scale = (0, _d3Scale.scalePoint)().domain((0, _range["default"])(0, len)).range([x, x + width - travellerWidth]);
|
||||
var scaleValues = scale.domain().map(function (entry) {
|
||||
return scale(entry);
|
||||
});
|
||||
return {
|
||||
isTextActive: false,
|
||||
isSlideMoving: false,
|
||||
isTravellerMoving: false,
|
||||
isTravellerFocused: false,
|
||||
startX: scale(startIndex),
|
||||
endX: scale(endIndex),
|
||||
scale: scale,
|
||||
scaleValues: scaleValues
|
||||
};
|
||||
};
|
||||
var isTouch = function isTouch(e) {
|
||||
return e.changedTouches && !!e.changedTouches.length;
|
||||
};
|
||||
var Brush = exports.Brush = /*#__PURE__*/function (_PureComponent) {
|
||||
function Brush(props) {
|
||||
var _this;
|
||||
_classCallCheck(this, Brush);
|
||||
_this = _callSuper(this, Brush, [props]);
|
||||
_defineProperty(_this, "handleDrag", function (e) {
|
||||
if (_this.leaveTimer) {
|
||||
clearTimeout(_this.leaveTimer);
|
||||
_this.leaveTimer = null;
|
||||
}
|
||||
if (_this.state.isTravellerMoving) {
|
||||
_this.handleTravellerMove(e);
|
||||
} else if (_this.state.isSlideMoving) {
|
||||
_this.handleSlideDrag(e);
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleTouchMove", function (e) {
|
||||
if (e.changedTouches != null && e.changedTouches.length > 0) {
|
||||
_this.handleDrag(e.changedTouches[0]);
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleDragEnd", function () {
|
||||
_this.setState({
|
||||
isTravellerMoving: false,
|
||||
isSlideMoving: false
|
||||
}, function () {
|
||||
var _this$props = _this.props,
|
||||
endIndex = _this$props.endIndex,
|
||||
onDragEnd = _this$props.onDragEnd,
|
||||
startIndex = _this$props.startIndex;
|
||||
onDragEnd === null || onDragEnd === void 0 || onDragEnd({
|
||||
endIndex: endIndex,
|
||||
startIndex: startIndex
|
||||
});
|
||||
});
|
||||
_this.detachDragEndListener();
|
||||
});
|
||||
_defineProperty(_this, "handleLeaveWrapper", function () {
|
||||
if (_this.state.isTravellerMoving || _this.state.isSlideMoving) {
|
||||
_this.leaveTimer = window.setTimeout(_this.handleDragEnd, _this.props.leaveTimeOut);
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleEnterSlideOrTraveller", function () {
|
||||
_this.setState({
|
||||
isTextActive: true
|
||||
});
|
||||
});
|
||||
_defineProperty(_this, "handleLeaveSlideOrTraveller", function () {
|
||||
_this.setState({
|
||||
isTextActive: false
|
||||
});
|
||||
});
|
||||
_defineProperty(_this, "handleSlideDragStart", function (e) {
|
||||
var event = isTouch(e) ? e.changedTouches[0] : e;
|
||||
_this.setState({
|
||||
isTravellerMoving: false,
|
||||
isSlideMoving: true,
|
||||
slideMoveStartX: event.pageX
|
||||
});
|
||||
_this.attachDragEndListener();
|
||||
});
|
||||
_this.travellerDragStartHandlers = {
|
||||
startX: _this.handleTravellerDragStart.bind(_this, 'startX'),
|
||||
endX: _this.handleTravellerDragStart.bind(_this, 'endX')
|
||||
};
|
||||
_this.state = {};
|
||||
return _this;
|
||||
}
|
||||
_inherits(Brush, _PureComponent);
|
||||
return _createClass(Brush, [{
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
if (this.leaveTimer) {
|
||||
clearTimeout(this.leaveTimer);
|
||||
this.leaveTimer = null;
|
||||
}
|
||||
this.detachDragEndListener();
|
||||
}
|
||||
}, {
|
||||
key: "getIndex",
|
||||
value: function getIndex(_ref2) {
|
||||
var startX = _ref2.startX,
|
||||
endX = _ref2.endX;
|
||||
var scaleValues = this.state.scaleValues;
|
||||
var _this$props2 = this.props,
|
||||
gap = _this$props2.gap,
|
||||
data = _this$props2.data;
|
||||
var lastIndex = data.length - 1;
|
||||
var min = Math.min(startX, endX);
|
||||
var max = Math.max(startX, endX);
|
||||
var minIndex = Brush.getIndexInRange(scaleValues, min);
|
||||
var maxIndex = Brush.getIndexInRange(scaleValues, max);
|
||||
return {
|
||||
startIndex: minIndex - minIndex % gap,
|
||||
endIndex: maxIndex === lastIndex ? lastIndex : maxIndex - maxIndex % gap
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "getTextOfTick",
|
||||
value: function getTextOfTick(index) {
|
||||
var _this$props3 = this.props,
|
||||
data = _this$props3.data,
|
||||
tickFormatter = _this$props3.tickFormatter,
|
||||
dataKey = _this$props3.dataKey;
|
||||
var text = (0, _ChartUtils.getValueByDataKey)(data[index], dataKey, index);
|
||||
return (0, _isFunction["default"])(tickFormatter) ? tickFormatter(text, index) : text;
|
||||
}
|
||||
}, {
|
||||
key: "attachDragEndListener",
|
||||
value: function attachDragEndListener() {
|
||||
window.addEventListener('mouseup', this.handleDragEnd, true);
|
||||
window.addEventListener('touchend', this.handleDragEnd, true);
|
||||
window.addEventListener('mousemove', this.handleDrag, true);
|
||||
}
|
||||
}, {
|
||||
key: "detachDragEndListener",
|
||||
value: function detachDragEndListener() {
|
||||
window.removeEventListener('mouseup', this.handleDragEnd, true);
|
||||
window.removeEventListener('touchend', this.handleDragEnd, true);
|
||||
window.removeEventListener('mousemove', this.handleDrag, true);
|
||||
}
|
||||
}, {
|
||||
key: "handleSlideDrag",
|
||||
value: function handleSlideDrag(e) {
|
||||
var _this$state = this.state,
|
||||
slideMoveStartX = _this$state.slideMoveStartX,
|
||||
startX = _this$state.startX,
|
||||
endX = _this$state.endX;
|
||||
var _this$props4 = this.props,
|
||||
x = _this$props4.x,
|
||||
width = _this$props4.width,
|
||||
travellerWidth = _this$props4.travellerWidth,
|
||||
startIndex = _this$props4.startIndex,
|
||||
endIndex = _this$props4.endIndex,
|
||||
onChange = _this$props4.onChange;
|
||||
var delta = e.pageX - slideMoveStartX;
|
||||
if (delta > 0) {
|
||||
delta = Math.min(delta, x + width - travellerWidth - endX, x + width - travellerWidth - startX);
|
||||
} else if (delta < 0) {
|
||||
delta = Math.max(delta, x - startX, x - endX);
|
||||
}
|
||||
var newIndex = this.getIndex({
|
||||
startX: startX + delta,
|
||||
endX: endX + delta
|
||||
});
|
||||
if ((newIndex.startIndex !== startIndex || newIndex.endIndex !== endIndex) && onChange) {
|
||||
onChange(newIndex);
|
||||
}
|
||||
this.setState({
|
||||
startX: startX + delta,
|
||||
endX: endX + delta,
|
||||
slideMoveStartX: e.pageX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "handleTravellerDragStart",
|
||||
value: function handleTravellerDragStart(id, e) {
|
||||
var event = isTouch(e) ? e.changedTouches[0] : e;
|
||||
this.setState({
|
||||
isSlideMoving: false,
|
||||
isTravellerMoving: true,
|
||||
movingTravellerId: id,
|
||||
brushMoveStartX: event.pageX
|
||||
});
|
||||
this.attachDragEndListener();
|
||||
}
|
||||
}, {
|
||||
key: "handleTravellerMove",
|
||||
value: function handleTravellerMove(e) {
|
||||
var _this$state2 = this.state,
|
||||
brushMoveStartX = _this$state2.brushMoveStartX,
|
||||
movingTravellerId = _this$state2.movingTravellerId,
|
||||
endX = _this$state2.endX,
|
||||
startX = _this$state2.startX;
|
||||
var prevValue = this.state[movingTravellerId];
|
||||
var _this$props5 = this.props,
|
||||
x = _this$props5.x,
|
||||
width = _this$props5.width,
|
||||
travellerWidth = _this$props5.travellerWidth,
|
||||
onChange = _this$props5.onChange,
|
||||
gap = _this$props5.gap,
|
||||
data = _this$props5.data;
|
||||
var params = {
|
||||
startX: this.state.startX,
|
||||
endX: this.state.endX
|
||||
};
|
||||
var delta = e.pageX - brushMoveStartX;
|
||||
if (delta > 0) {
|
||||
delta = Math.min(delta, x + width - travellerWidth - prevValue);
|
||||
} else if (delta < 0) {
|
||||
delta = Math.max(delta, x - prevValue);
|
||||
}
|
||||
params[movingTravellerId] = prevValue + delta;
|
||||
var newIndex = this.getIndex(params);
|
||||
var startIndex = newIndex.startIndex,
|
||||
endIndex = newIndex.endIndex;
|
||||
var isFullGap = function isFullGap() {
|
||||
var lastIndex = data.length - 1;
|
||||
if (movingTravellerId === 'startX' && (endX > startX ? startIndex % gap === 0 : endIndex % gap === 0) || endX < startX && endIndex === lastIndex || movingTravellerId === 'endX' && (endX > startX ? endIndex % gap === 0 : startIndex % gap === 0) || endX > startX && endIndex === lastIndex) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
this.setState(_defineProperty(_defineProperty({}, movingTravellerId, prevValue + delta), "brushMoveStartX", e.pageX), function () {
|
||||
if (onChange) {
|
||||
if (isFullGap()) {
|
||||
onChange(newIndex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "handleTravellerMoveKeyboard",
|
||||
value: function handleTravellerMoveKeyboard(direction, id) {
|
||||
var _this2 = this;
|
||||
// scaleValues are a list of coordinates. For example: [65, 250, 435, 620, 805, 990].
|
||||
var _this$state3 = this.state,
|
||||
scaleValues = _this$state3.scaleValues,
|
||||
startX = _this$state3.startX,
|
||||
endX = _this$state3.endX;
|
||||
// currentScaleValue refers to which coordinate the current traveller should be placed at.
|
||||
var currentScaleValue = this.state[id];
|
||||
var currentIndex = scaleValues.indexOf(currentScaleValue);
|
||||
if (currentIndex === -1) {
|
||||
return;
|
||||
}
|
||||
var newIndex = currentIndex + direction;
|
||||
if (newIndex === -1 || newIndex >= scaleValues.length) {
|
||||
return;
|
||||
}
|
||||
var newScaleValue = scaleValues[newIndex];
|
||||
|
||||
// Prevent travellers from being on top of each other or overlapping
|
||||
if (id === 'startX' && newScaleValue >= endX || id === 'endX' && newScaleValue <= startX) {
|
||||
return;
|
||||
}
|
||||
this.setState(_defineProperty({}, id, newScaleValue), function () {
|
||||
_this2.props.onChange(_this2.getIndex({
|
||||
startX: _this2.state.startX,
|
||||
endX: _this2.state.endX
|
||||
}));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderBackground",
|
||||
value: function renderBackground() {
|
||||
var _this$props6 = this.props,
|
||||
x = _this$props6.x,
|
||||
y = _this$props6.y,
|
||||
width = _this$props6.width,
|
||||
height = _this$props6.height,
|
||||
fill = _this$props6.fill,
|
||||
stroke = _this$props6.stroke;
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
stroke: stroke,
|
||||
fill: fill,
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderPanorama",
|
||||
value: function renderPanorama() {
|
||||
var _this$props7 = this.props,
|
||||
x = _this$props7.x,
|
||||
y = _this$props7.y,
|
||||
width = _this$props7.width,
|
||||
height = _this$props7.height,
|
||||
data = _this$props7.data,
|
||||
children = _this$props7.children,
|
||||
padding = _this$props7.padding;
|
||||
var chartElement = _react.Children.only(children);
|
||||
if (!chartElement) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].cloneElement(chartElement, {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height,
|
||||
margin: padding,
|
||||
compact: true,
|
||||
data: data
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderTravellerLayer",
|
||||
value: function renderTravellerLayer(travellerX, id) {
|
||||
var _data$startIndex,
|
||||
_data$endIndex,
|
||||
_this3 = this;
|
||||
var _this$props8 = this.props,
|
||||
y = _this$props8.y,
|
||||
travellerWidth = _this$props8.travellerWidth,
|
||||
height = _this$props8.height,
|
||||
traveller = _this$props8.traveller,
|
||||
ariaLabel = _this$props8.ariaLabel,
|
||||
data = _this$props8.data,
|
||||
startIndex = _this$props8.startIndex,
|
||||
endIndex = _this$props8.endIndex;
|
||||
var x = Math.max(travellerX, this.props.x);
|
||||
var travellerProps = _objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(this.props, false)), {}, {
|
||||
x: x,
|
||||
y: y,
|
||||
width: travellerWidth,
|
||||
height: height
|
||||
});
|
||||
var ariaLabelBrush = ariaLabel || "Min value: ".concat((_data$startIndex = data[startIndex]) === null || _data$startIndex === void 0 ? void 0 : _data$startIndex.name, ", Max value: ").concat((_data$endIndex = data[endIndex]) === null || _data$endIndex === void 0 ? void 0 : _data$endIndex.name);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
tabIndex: 0,
|
||||
role: "slider",
|
||||
"aria-label": ariaLabelBrush,
|
||||
"aria-valuenow": travellerX,
|
||||
className: "recharts-brush-traveller",
|
||||
onMouseEnter: this.handleEnterSlideOrTraveller,
|
||||
onMouseLeave: this.handleLeaveSlideOrTraveller,
|
||||
onMouseDown: this.travellerDragStartHandlers[id],
|
||||
onTouchStart: this.travellerDragStartHandlers[id],
|
||||
onKeyDown: function onKeyDown(e) {
|
||||
if (!['ArrowLeft', 'ArrowRight'].includes(e.key)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
_this3.handleTravellerMoveKeyboard(e.key === 'ArrowRight' ? 1 : -1, id);
|
||||
},
|
||||
onFocus: function onFocus() {
|
||||
_this3.setState({
|
||||
isTravellerFocused: true
|
||||
});
|
||||
},
|
||||
onBlur: function onBlur() {
|
||||
_this3.setState({
|
||||
isTravellerFocused: false
|
||||
});
|
||||
},
|
||||
style: {
|
||||
cursor: 'col-resize'
|
||||
}
|
||||
}, Brush.renderTraveller(traveller, travellerProps));
|
||||
}
|
||||
}, {
|
||||
key: "renderSlide",
|
||||
value: function renderSlide(startX, endX) {
|
||||
var _this$props9 = this.props,
|
||||
y = _this$props9.y,
|
||||
height = _this$props9.height,
|
||||
stroke = _this$props9.stroke,
|
||||
travellerWidth = _this$props9.travellerWidth;
|
||||
var x = Math.min(startX, endX) + travellerWidth;
|
||||
var width = Math.max(Math.abs(endX - startX) - travellerWidth, 0);
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
className: "recharts-brush-slide",
|
||||
onMouseEnter: this.handleEnterSlideOrTraveller,
|
||||
onMouseLeave: this.handleLeaveSlideOrTraveller,
|
||||
onMouseDown: this.handleSlideDragStart,
|
||||
onTouchStart: this.handleSlideDragStart,
|
||||
style: {
|
||||
cursor: 'move'
|
||||
},
|
||||
stroke: "none",
|
||||
fill: stroke,
|
||||
fillOpacity: 0.2,
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderText",
|
||||
value: function renderText() {
|
||||
var _this$props10 = this.props,
|
||||
startIndex = _this$props10.startIndex,
|
||||
endIndex = _this$props10.endIndex,
|
||||
y = _this$props10.y,
|
||||
height = _this$props10.height,
|
||||
travellerWidth = _this$props10.travellerWidth,
|
||||
stroke = _this$props10.stroke;
|
||||
var _this$state4 = this.state,
|
||||
startX = _this$state4.startX,
|
||||
endX = _this$state4.endX;
|
||||
var offset = 5;
|
||||
var attrs = {
|
||||
pointerEvents: 'none',
|
||||
fill: stroke
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-brush-texts"
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
||||
textAnchor: "end",
|
||||
verticalAnchor: "middle",
|
||||
x: Math.min(startX, endX) - offset,
|
||||
y: y + height / 2
|
||||
}, attrs), this.getTextOfTick(startIndex)), /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
||||
textAnchor: "start",
|
||||
verticalAnchor: "middle",
|
||||
x: Math.max(startX, endX) + travellerWidth + offset,
|
||||
y: y + height / 2
|
||||
}, attrs), this.getTextOfTick(endIndex)));
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props11 = this.props,
|
||||
data = _this$props11.data,
|
||||
className = _this$props11.className,
|
||||
children = _this$props11.children,
|
||||
x = _this$props11.x,
|
||||
y = _this$props11.y,
|
||||
width = _this$props11.width,
|
||||
height = _this$props11.height,
|
||||
alwaysShowText = _this$props11.alwaysShowText;
|
||||
var _this$state5 = this.state,
|
||||
startX = _this$state5.startX,
|
||||
endX = _this$state5.endX,
|
||||
isTextActive = _this$state5.isTextActive,
|
||||
isSlideMoving = _this$state5.isSlideMoving,
|
||||
isTravellerMoving = _this$state5.isTravellerMoving,
|
||||
isTravellerFocused = _this$state5.isTravellerFocused;
|
||||
if (!data || !data.length || !(0, _DataUtils.isNumber)(x) || !(0, _DataUtils.isNumber)(y) || !(0, _DataUtils.isNumber)(width) || !(0, _DataUtils.isNumber)(height) || width <= 0 || height <= 0) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-brush', className);
|
||||
var isPanoramic = _react["default"].Children.count(children) === 1;
|
||||
var style = (0, _CssPrefixUtils.generatePrefixStyle)('userSelect', 'none');
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass,
|
||||
onMouseLeave: this.handleLeaveWrapper,
|
||||
onTouchMove: this.handleTouchMove,
|
||||
style: style
|
||||
}, this.renderBackground(), isPanoramic && this.renderPanorama(), this.renderSlide(startX, endX), this.renderTravellerLayer(startX, 'startX'), this.renderTravellerLayer(endX, 'endX'), (isTextActive || isSlideMoving || isTravellerMoving || isTravellerFocused || alwaysShowText) && this.renderText());
|
||||
}
|
||||
}], [{
|
||||
key: "renderDefaultTraveller",
|
||||
value: function renderDefaultTraveller(props) {
|
||||
var x = props.x,
|
||||
y = props.y,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
stroke = props.stroke;
|
||||
var lineY = Math.floor(y + height / 2) - 1;
|
||||
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height,
|
||||
fill: stroke,
|
||||
stroke: "none"
|
||||
}), /*#__PURE__*/_react["default"].createElement("line", {
|
||||
x1: x + 1,
|
||||
y1: lineY,
|
||||
x2: x + width - 1,
|
||||
y2: lineY,
|
||||
fill: "none",
|
||||
stroke: "#fff"
|
||||
}), /*#__PURE__*/_react["default"].createElement("line", {
|
||||
x1: x + 1,
|
||||
y1: lineY + 2,
|
||||
x2: x + width - 1,
|
||||
y2: lineY + 2,
|
||||
fill: "none",
|
||||
stroke: "#fff"
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderTraveller",
|
||||
value: function renderTraveller(option, props) {
|
||||
var rectangle;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
rectangle = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
rectangle = option(props);
|
||||
} else {
|
||||
rectangle = Brush.renderDefaultTraveller(props);
|
||||
}
|
||||
return rectangle;
|
||||
}
|
||||
}, {
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
var data = nextProps.data,
|
||||
width = nextProps.width,
|
||||
x = nextProps.x,
|
||||
travellerWidth = nextProps.travellerWidth,
|
||||
updateId = nextProps.updateId,
|
||||
startIndex = nextProps.startIndex,
|
||||
endIndex = nextProps.endIndex;
|
||||
if (data !== prevState.prevData || updateId !== prevState.prevUpdateId) {
|
||||
return _objectSpread({
|
||||
prevData: data,
|
||||
prevTravellerWidth: travellerWidth,
|
||||
prevUpdateId: updateId,
|
||||
prevX: x,
|
||||
prevWidth: width
|
||||
}, data && data.length ? createScale({
|
||||
data: data,
|
||||
width: width,
|
||||
x: x,
|
||||
travellerWidth: travellerWidth,
|
||||
startIndex: startIndex,
|
||||
endIndex: endIndex
|
||||
}) : {
|
||||
scale: null,
|
||||
scaleValues: null
|
||||
});
|
||||
}
|
||||
if (prevState.scale && (width !== prevState.prevWidth || x !== prevState.prevX || travellerWidth !== prevState.prevTravellerWidth)) {
|
||||
prevState.scale.range([x, x + width - travellerWidth]);
|
||||
var scaleValues = prevState.scale.domain().map(function (entry) {
|
||||
return prevState.scale(entry);
|
||||
});
|
||||
return {
|
||||
prevData: data,
|
||||
prevTravellerWidth: travellerWidth,
|
||||
prevUpdateId: updateId,
|
||||
prevX: x,
|
||||
prevWidth: width,
|
||||
startX: prevState.scale(nextProps.startIndex),
|
||||
endX: prevState.scale(nextProps.endIndex),
|
||||
scaleValues: scaleValues
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "getIndexInRange",
|
||||
value: function getIndexInRange(valueRange, x) {
|
||||
var len = valueRange.length;
|
||||
var start = 0;
|
||||
var end = len - 1;
|
||||
while (end - start > 1) {
|
||||
var middle = Math.floor((start + end) / 2);
|
||||
if (valueRange[middle] > x) {
|
||||
end = middle;
|
||||
} else {
|
||||
start = middle;
|
||||
}
|
||||
}
|
||||
return x >= valueRange[end] ? end : start;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Brush, "displayName", 'Brush');
|
||||
_defineProperty(Brush, "defaultProps", {
|
||||
height: 40,
|
||||
travellerWidth: 5,
|
||||
gap: 1,
|
||||
fill: '#fff',
|
||||
stroke: '#666',
|
||||
padding: {
|
||||
top: 1,
|
||||
right: 1,
|
||||
bottom: 1,
|
||||
left: 1
|
||||
},
|
||||
leaveTimeOut: 1000,
|
||||
alwaysShowText: false
|
||||
});
|
||||
362
frontend/node_modules/recharts/lib/cartesian/CartesianAxis.js
generated
vendored
Normal file
362
frontend/node_modules/recharts/lib/cartesian/CartesianAxis.js
generated
vendored
Normal file
@ -0,0 +1,362 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CartesianAxis = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ShallowEqual = require("../util/ShallowEqual");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Text = require("../component/Text");
|
||||
var _Label = require("../component/Label");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _types = require("../util/types");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _getTicks = require("./getTicks");
|
||||
var _excluded = ["viewBox"],
|
||||
_excluded2 = ["viewBox"],
|
||||
_excluded3 = ["ticks"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Cartesian Axis
|
||||
*/
|
||||
/** The orientation of the axis in correspondence to the chart */
|
||||
/** A unit to be appended to a value */
|
||||
/** The formatter function of tick */
|
||||
var CartesianAxis = exports.CartesianAxis = /*#__PURE__*/function (_Component) {
|
||||
function CartesianAxis(props) {
|
||||
var _this;
|
||||
_classCallCheck(this, CartesianAxis);
|
||||
_this = _callSuper(this, CartesianAxis, [props]);
|
||||
_this.state = {
|
||||
fontSize: '',
|
||||
letterSpacing: ''
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_inherits(CartesianAxis, _Component);
|
||||
return _createClass(CartesianAxis, [{
|
||||
key: "shouldComponentUpdate",
|
||||
value: function shouldComponentUpdate(_ref, nextState) {
|
||||
var viewBox = _ref.viewBox,
|
||||
restProps = _objectWithoutProperties(_ref, _excluded);
|
||||
// props.viewBox is sometimes generated every time -
|
||||
// check that specially as object equality is likely to fail
|
||||
var _this$props = this.props,
|
||||
viewBoxOld = _this$props.viewBox,
|
||||
restPropsOld = _objectWithoutProperties(_this$props, _excluded2);
|
||||
return !(0, _ShallowEqual.shallowEqual)(viewBox, viewBoxOld) || !(0, _ShallowEqual.shallowEqual)(restProps, restPropsOld) || !(0, _ShallowEqual.shallowEqual)(nextState, this.state);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var htmlLayer = this.layerReference;
|
||||
if (!htmlLayer) return;
|
||||
var tick = htmlLayer.getElementsByClassName('recharts-cartesian-axis-tick-value')[0];
|
||||
if (tick) {
|
||||
this.setState({
|
||||
fontSize: window.getComputedStyle(tick).fontSize,
|
||||
letterSpacing: window.getComputedStyle(tick).letterSpacing
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the coordinates of endpoints in ticks
|
||||
* @param {Object} data The data of a simple tick
|
||||
* @return {Object} (x1, y1): The coordinate of endpoint close to tick text
|
||||
* (x2, y2): The coordinate of endpoint close to axis
|
||||
*/
|
||||
}, {
|
||||
key: "getTickLineCoord",
|
||||
value: function getTickLineCoord(data) {
|
||||
var _this$props2 = this.props,
|
||||
x = _this$props2.x,
|
||||
y = _this$props2.y,
|
||||
width = _this$props2.width,
|
||||
height = _this$props2.height,
|
||||
orientation = _this$props2.orientation,
|
||||
tickSize = _this$props2.tickSize,
|
||||
mirror = _this$props2.mirror,
|
||||
tickMargin = _this$props2.tickMargin;
|
||||
var x1, x2, y1, y2, tx, ty;
|
||||
var sign = mirror ? -1 : 1;
|
||||
var finalTickSize = data.tickSize || tickSize;
|
||||
var tickCoord = (0, _DataUtils.isNumber)(data.tickCoord) ? data.tickCoord : data.coordinate;
|
||||
switch (orientation) {
|
||||
case 'top':
|
||||
x1 = x2 = data.coordinate;
|
||||
y2 = y + +!mirror * height;
|
||||
y1 = y2 - sign * finalTickSize;
|
||||
ty = y1 - sign * tickMargin;
|
||||
tx = tickCoord;
|
||||
break;
|
||||
case 'left':
|
||||
y1 = y2 = data.coordinate;
|
||||
x2 = x + +!mirror * width;
|
||||
x1 = x2 - sign * finalTickSize;
|
||||
tx = x1 - sign * tickMargin;
|
||||
ty = tickCoord;
|
||||
break;
|
||||
case 'right':
|
||||
y1 = y2 = data.coordinate;
|
||||
x2 = x + +mirror * width;
|
||||
x1 = x2 + sign * finalTickSize;
|
||||
tx = x1 + sign * tickMargin;
|
||||
ty = tickCoord;
|
||||
break;
|
||||
default:
|
||||
x1 = x2 = data.coordinate;
|
||||
y2 = y + +mirror * height;
|
||||
y1 = y2 + sign * finalTickSize;
|
||||
ty = y1 + sign * tickMargin;
|
||||
tx = tickCoord;
|
||||
break;
|
||||
}
|
||||
return {
|
||||
line: {
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2
|
||||
},
|
||||
tick: {
|
||||
x: tx,
|
||||
y: ty
|
||||
}
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "getTickTextAnchor",
|
||||
value: function getTickTextAnchor() {
|
||||
var _this$props3 = this.props,
|
||||
orientation = _this$props3.orientation,
|
||||
mirror = _this$props3.mirror;
|
||||
var textAnchor;
|
||||
switch (orientation) {
|
||||
case 'left':
|
||||
textAnchor = mirror ? 'start' : 'end';
|
||||
break;
|
||||
case 'right':
|
||||
textAnchor = mirror ? 'end' : 'start';
|
||||
break;
|
||||
default:
|
||||
textAnchor = 'middle';
|
||||
break;
|
||||
}
|
||||
return textAnchor;
|
||||
}
|
||||
}, {
|
||||
key: "getTickVerticalAnchor",
|
||||
value: function getTickVerticalAnchor() {
|
||||
var _this$props4 = this.props,
|
||||
orientation = _this$props4.orientation,
|
||||
mirror = _this$props4.mirror;
|
||||
var verticalAnchor = 'end';
|
||||
switch (orientation) {
|
||||
case 'left':
|
||||
case 'right':
|
||||
verticalAnchor = 'middle';
|
||||
break;
|
||||
case 'top':
|
||||
verticalAnchor = mirror ? 'start' : 'end';
|
||||
break;
|
||||
default:
|
||||
verticalAnchor = mirror ? 'end' : 'start';
|
||||
break;
|
||||
}
|
||||
return verticalAnchor;
|
||||
}
|
||||
}, {
|
||||
key: "renderAxisLine",
|
||||
value: function renderAxisLine() {
|
||||
var _this$props5 = this.props,
|
||||
x = _this$props5.x,
|
||||
y = _this$props5.y,
|
||||
width = _this$props5.width,
|
||||
height = _this$props5.height,
|
||||
orientation = _this$props5.orientation,
|
||||
mirror = _this$props5.mirror,
|
||||
axisLine = _this$props5.axisLine;
|
||||
var props = _objectSpread(_objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(this.props, false)), (0, _ReactUtils.filterProps)(axisLine, false)), {}, {
|
||||
fill: 'none'
|
||||
});
|
||||
if (orientation === 'top' || orientation === 'bottom') {
|
||||
var needHeight = +(orientation === 'top' && !mirror || orientation === 'bottom' && mirror);
|
||||
props = _objectSpread(_objectSpread({}, props), {}, {
|
||||
x1: x,
|
||||
y1: y + needHeight * height,
|
||||
x2: x + width,
|
||||
y2: y + needHeight * height
|
||||
});
|
||||
} else {
|
||||
var needWidth = +(orientation === 'left' && !mirror || orientation === 'right' && mirror);
|
||||
props = _objectSpread(_objectSpread({}, props), {}, {
|
||||
x1: x + needWidth * width,
|
||||
y1: y,
|
||||
x2: x + needWidth * width,
|
||||
y2: y + height
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("line", _extends({}, props, {
|
||||
className: (0, _clsx["default"])('recharts-cartesian-axis-line', (0, _get["default"])(axisLine, 'className'))
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderTicks",
|
||||
value:
|
||||
/**
|
||||
* render the ticks
|
||||
* @param {Array} ticks The ticks to actually render (overrides what was passed in props)
|
||||
* @param {string} fontSize Fontsize to consider for tick spacing
|
||||
* @param {string} letterSpacing Letterspacing to consider for tick spacing
|
||||
* @return {ReactComponent} renderedTicks
|
||||
*/
|
||||
function renderTicks(ticks, fontSize, letterSpacing) {
|
||||
var _this2 = this;
|
||||
var _this$props6 = this.props,
|
||||
tickLine = _this$props6.tickLine,
|
||||
stroke = _this$props6.stroke,
|
||||
tick = _this$props6.tick,
|
||||
tickFormatter = _this$props6.tickFormatter,
|
||||
unit = _this$props6.unit;
|
||||
var finalTicks = (0, _getTicks.getTicks)(_objectSpread(_objectSpread({}, this.props), {}, {
|
||||
ticks: ticks
|
||||
}), fontSize, letterSpacing);
|
||||
var textAnchor = this.getTickTextAnchor();
|
||||
var verticalAnchor = this.getTickVerticalAnchor();
|
||||
var axisProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customTickProps = (0, _ReactUtils.filterProps)(tick, false);
|
||||
var tickLineProps = _objectSpread(_objectSpread({}, axisProps), {}, {
|
||||
fill: 'none'
|
||||
}, (0, _ReactUtils.filterProps)(tickLine, false));
|
||||
var items = finalTicks.map(function (entry, i) {
|
||||
var _this2$getTickLineCoo = _this2.getTickLineCoord(entry),
|
||||
lineCoord = _this2$getTickLineCoo.line,
|
||||
tickCoord = _this2$getTickLineCoo.tick;
|
||||
var tickProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
||||
textAnchor: textAnchor,
|
||||
verticalAnchor: verticalAnchor
|
||||
}, axisProps), {}, {
|
||||
stroke: 'none',
|
||||
fill: stroke
|
||||
}, customTickProps), tickCoord), {}, {
|
||||
index: i,
|
||||
payload: entry,
|
||||
visibleTicksCount: finalTicks.length,
|
||||
tickFormatter: tickFormatter
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-cartesian-axis-tick",
|
||||
key: "tick-".concat(entry.value, "-").concat(entry.coordinate, "-").concat(entry.tickCoord)
|
||||
}, (0, _types.adaptEventsOfChild)(_this2.props, entry, i)), tickLine && /*#__PURE__*/_react["default"].createElement("line", _extends({}, tickLineProps, lineCoord, {
|
||||
className: (0, _clsx["default"])('recharts-cartesian-axis-tick-line', (0, _get["default"])(tickLine, 'className'))
|
||||
})), tick && CartesianAxis.renderTickItem(tick, tickProps, "".concat((0, _isFunction["default"])(tickFormatter) ? tickFormatter(entry.value, i) : entry.value).concat(unit || '')));
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-axis-ticks"
|
||||
}, items);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this3 = this;
|
||||
var _this$props7 = this.props,
|
||||
axisLine = _this$props7.axisLine,
|
||||
width = _this$props7.width,
|
||||
height = _this$props7.height,
|
||||
ticksGenerator = _this$props7.ticksGenerator,
|
||||
className = _this$props7.className,
|
||||
hide = _this$props7.hide;
|
||||
if (hide) {
|
||||
return null;
|
||||
}
|
||||
var _this$props8 = this.props,
|
||||
ticks = _this$props8.ticks,
|
||||
noTicksProps = _objectWithoutProperties(_this$props8, _excluded3);
|
||||
var finalTicks = ticks;
|
||||
if ((0, _isFunction["default"])(ticksGenerator)) {
|
||||
finalTicks = ticks && ticks.length > 0 ? ticksGenerator(this.props) : ticksGenerator(noTicksProps);
|
||||
}
|
||||
if (width <= 0 || height <= 0 || !finalTicks || !finalTicks.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-cartesian-axis', className),
|
||||
ref: function ref(_ref2) {
|
||||
_this3.layerReference = _ref2;
|
||||
}
|
||||
}, axisLine && this.renderAxisLine(), this.renderTicks(finalTicks, this.state.fontSize, this.state.letterSpacing), _Label.Label.renderCallByParent(this.props));
|
||||
}
|
||||
}], [{
|
||||
key: "renderTickItem",
|
||||
value: function renderTickItem(option, props, value) {
|
||||
var tickItem;
|
||||
var combinedClassName = (0, _clsx["default"])(props.className, 'recharts-cartesian-axis-tick-value');
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
tickItem = /*#__PURE__*/_react["default"].cloneElement(option, _objectSpread(_objectSpread({}, props), {}, {
|
||||
className: combinedClassName
|
||||
}));
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
tickItem = option(_objectSpread(_objectSpread({}, props), {}, {
|
||||
className: combinedClassName
|
||||
}));
|
||||
} else {
|
||||
tickItem = /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({}, props, {
|
||||
className: "recharts-cartesian-axis-tick-value"
|
||||
}), value);
|
||||
}
|
||||
return tickItem;
|
||||
}
|
||||
}]);
|
||||
}(_react.Component);
|
||||
_defineProperty(CartesianAxis, "displayName", 'CartesianAxis');
|
||||
_defineProperty(CartesianAxis, "defaultProps", {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
},
|
||||
// The orientation of axis
|
||||
orientation: 'bottom',
|
||||
// The ticks
|
||||
ticks: [],
|
||||
stroke: '#666',
|
||||
tickLine: true,
|
||||
axisLine: true,
|
||||
tick: true,
|
||||
mirror: false,
|
||||
minTickGap: 5,
|
||||
// The width or height of tick
|
||||
tickSize: 6,
|
||||
tickMargin: 2,
|
||||
interval: 'preserveEnd'
|
||||
});
|
||||
375
frontend/node_modules/recharts/lib/cartesian/CartesianGrid.js
generated
vendored
Normal file
375
frontend/node_modules/recharts/lib/cartesian/CartesianGrid.js
generated
vendored
Normal file
@ -0,0 +1,375 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CartesianGrid = CartesianGrid;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _getTicks = require("./getTicks");
|
||||
var _CartesianAxis = require("./CartesianAxis");
|
||||
var _chartLayoutContext = require("../context/chartLayoutContext");
|
||||
var _excluded = ["x1", "y1", "x2", "y2", "key"],
|
||||
_excluded2 = ["offset"];
|
||||
/**
|
||||
* @fileOverview Cartesian Grid
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
/**
|
||||
* The <CartesianGrid horizontal
|
||||
*/
|
||||
|
||||
var Background = function Background(props) {
|
||||
var fill = props.fill;
|
||||
if (!fill || fill === 'none') {
|
||||
return null;
|
||||
}
|
||||
var fillOpacity = props.fillOpacity,
|
||||
x = props.x,
|
||||
y = props.y,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
ry = props.ry;
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: x,
|
||||
y: y,
|
||||
ry: ry,
|
||||
width: width,
|
||||
height: height,
|
||||
stroke: "none",
|
||||
fill: fill,
|
||||
fillOpacity: fillOpacity,
|
||||
className: "recharts-cartesian-grid-bg"
|
||||
});
|
||||
};
|
||||
function renderLineItem(option, props) {
|
||||
var lineItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
// @ts-expect-error typescript does not see the props type when cloning an element
|
||||
lineItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
lineItem = option(props);
|
||||
} else {
|
||||
var x1 = props.x1,
|
||||
y1 = props.y1,
|
||||
x2 = props.x2,
|
||||
y2 = props.y2,
|
||||
key = props.key,
|
||||
others = _objectWithoutProperties(props, _excluded);
|
||||
var _filterProps = (0, _ReactUtils.filterProps)(others, false),
|
||||
__ = _filterProps.offset,
|
||||
restOfFilteredProps = _objectWithoutProperties(_filterProps, _excluded2);
|
||||
lineItem = /*#__PURE__*/_react["default"].createElement("line", _extends({}, restOfFilteredProps, {
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2,
|
||||
fill: "none",
|
||||
key: key
|
||||
}));
|
||||
}
|
||||
return lineItem;
|
||||
}
|
||||
function HorizontalGridLines(props) {
|
||||
var x = props.x,
|
||||
width = props.width,
|
||||
_props$horizontal = props.horizontal,
|
||||
horizontal = _props$horizontal === void 0 ? true : _props$horizontal,
|
||||
horizontalPoints = props.horizontalPoints;
|
||||
if (!horizontal || !horizontalPoints || !horizontalPoints.length) {
|
||||
return null;
|
||||
}
|
||||
var items = horizontalPoints.map(function (entry, i) {
|
||||
var lineItemProps = _objectSpread(_objectSpread({}, props), {}, {
|
||||
x1: x,
|
||||
y1: entry,
|
||||
x2: x + width,
|
||||
y2: entry,
|
||||
key: "line-".concat(i),
|
||||
index: i
|
||||
});
|
||||
return renderLineItem(horizontal, lineItemProps);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-grid-horizontal"
|
||||
}, items);
|
||||
}
|
||||
function VerticalGridLines(props) {
|
||||
var y = props.y,
|
||||
height = props.height,
|
||||
_props$vertical = props.vertical,
|
||||
vertical = _props$vertical === void 0 ? true : _props$vertical,
|
||||
verticalPoints = props.verticalPoints;
|
||||
if (!vertical || !verticalPoints || !verticalPoints.length) {
|
||||
return null;
|
||||
}
|
||||
var items = verticalPoints.map(function (entry, i) {
|
||||
var lineItemProps = _objectSpread(_objectSpread({}, props), {}, {
|
||||
x1: entry,
|
||||
y1: y,
|
||||
x2: entry,
|
||||
y2: y + height,
|
||||
key: "line-".concat(i),
|
||||
index: i
|
||||
});
|
||||
return renderLineItem(vertical, lineItemProps);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-grid-vertical"
|
||||
}, items);
|
||||
}
|
||||
function HorizontalStripes(props) {
|
||||
var horizontalFill = props.horizontalFill,
|
||||
fillOpacity = props.fillOpacity,
|
||||
x = props.x,
|
||||
y = props.y,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
horizontalPoints = props.horizontalPoints,
|
||||
_props$horizontal2 = props.horizontal,
|
||||
horizontal = _props$horizontal2 === void 0 ? true : _props$horizontal2;
|
||||
if (!horizontal || !horizontalFill || !horizontalFill.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Why =y -y? I was trying to find any difference that this makes, with floating point numbers and edge cases but ... nothing.
|
||||
var roundedSortedHorizontalPoints = horizontalPoints.map(function (e) {
|
||||
return Math.round(e + y - y);
|
||||
}).sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
// Why is this condition `!==` instead of `<=` ?
|
||||
if (y !== roundedSortedHorizontalPoints[0]) {
|
||||
roundedSortedHorizontalPoints.unshift(0);
|
||||
}
|
||||
var items = roundedSortedHorizontalPoints.map(function (entry, i) {
|
||||
// Why do we strip only the last stripe if it is invisible, and not all invisible stripes?
|
||||
var lastStripe = !roundedSortedHorizontalPoints[i + 1];
|
||||
var lineHeight = lastStripe ? y + height - entry : roundedSortedHorizontalPoints[i + 1] - entry;
|
||||
if (lineHeight <= 0) {
|
||||
return null;
|
||||
}
|
||||
var colorIndex = i % horizontalFill.length;
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
key: "react-".concat(i) // eslint-disable-line react/no-array-index-key
|
||||
,
|
||||
y: entry,
|
||||
x: x,
|
||||
height: lineHeight,
|
||||
width: width,
|
||||
stroke: "none",
|
||||
fill: horizontalFill[colorIndex],
|
||||
fillOpacity: fillOpacity,
|
||||
className: "recharts-cartesian-grid-bg"
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-gridstripes-horizontal"
|
||||
}, items);
|
||||
}
|
||||
function VerticalStripes(props) {
|
||||
var _props$vertical2 = props.vertical,
|
||||
vertical = _props$vertical2 === void 0 ? true : _props$vertical2,
|
||||
verticalFill = props.verticalFill,
|
||||
fillOpacity = props.fillOpacity,
|
||||
x = props.x,
|
||||
y = props.y,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
verticalPoints = props.verticalPoints;
|
||||
if (!vertical || !verticalFill || !verticalFill.length) {
|
||||
return null;
|
||||
}
|
||||
var roundedSortedVerticalPoints = verticalPoints.map(function (e) {
|
||||
return Math.round(e + x - x);
|
||||
}).sort(function (a, b) {
|
||||
return a - b;
|
||||
});
|
||||
if (x !== roundedSortedVerticalPoints[0]) {
|
||||
roundedSortedVerticalPoints.unshift(0);
|
||||
}
|
||||
var items = roundedSortedVerticalPoints.map(function (entry, i) {
|
||||
var lastStripe = !roundedSortedVerticalPoints[i + 1];
|
||||
var lineWidth = lastStripe ? x + width - entry : roundedSortedVerticalPoints[i + 1] - entry;
|
||||
if (lineWidth <= 0) {
|
||||
return null;
|
||||
}
|
||||
var colorIndex = i % verticalFill.length;
|
||||
return /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
key: "react-".concat(i) // eslint-disable-line react/no-array-index-key
|
||||
,
|
||||
x: entry,
|
||||
y: y,
|
||||
width: lineWidth,
|
||||
height: height,
|
||||
stroke: "none",
|
||||
fill: verticalFill[colorIndex],
|
||||
fillOpacity: fillOpacity,
|
||||
className: "recharts-cartesian-grid-bg"
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-gridstripes-vertical"
|
||||
}, items);
|
||||
}
|
||||
var defaultVerticalCoordinatesGenerator = function defaultVerticalCoordinatesGenerator(_ref, syncWithTicks) {
|
||||
var xAxis = _ref.xAxis,
|
||||
width = _ref.width,
|
||||
height = _ref.height,
|
||||
offset = _ref.offset;
|
||||
return (0, _ChartUtils.getCoordinatesOfGrid)((0, _getTicks.getTicks)(_objectSpread(_objectSpread(_objectSpread({}, _CartesianAxis.CartesianAxis.defaultProps), xAxis), {}, {
|
||||
ticks: (0, _ChartUtils.getTicksOfAxis)(xAxis, true),
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
}
|
||||
})), offset.left, offset.left + offset.width, syncWithTicks);
|
||||
};
|
||||
var defaultHorizontalCoordinatesGenerator = function defaultHorizontalCoordinatesGenerator(_ref2, syncWithTicks) {
|
||||
var yAxis = _ref2.yAxis,
|
||||
width = _ref2.width,
|
||||
height = _ref2.height,
|
||||
offset = _ref2.offset;
|
||||
return (0, _ChartUtils.getCoordinatesOfGrid)((0, _getTicks.getTicks)(_objectSpread(_objectSpread(_objectSpread({}, _CartesianAxis.CartesianAxis.defaultProps), yAxis), {}, {
|
||||
ticks: (0, _ChartUtils.getTicksOfAxis)(yAxis, true),
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
}
|
||||
})), offset.top, offset.top + offset.height, syncWithTicks);
|
||||
};
|
||||
var defaultProps = {
|
||||
horizontal: true,
|
||||
vertical: true,
|
||||
// The ordinates of horizontal grid lines
|
||||
horizontalPoints: [],
|
||||
// The abscissas of vertical grid lines
|
||||
verticalPoints: [],
|
||||
stroke: '#ccc',
|
||||
fill: 'none',
|
||||
// The fill of colors of grid lines
|
||||
verticalFill: [],
|
||||
horizontalFill: []
|
||||
};
|
||||
function CartesianGrid(props) {
|
||||
var _props$stroke, _props$fill, _props$horizontal3, _props$horizontalFill, _props$vertical3, _props$verticalFill;
|
||||
var chartWidth = (0, _chartLayoutContext.useChartWidth)();
|
||||
var chartHeight = (0, _chartLayoutContext.useChartHeight)();
|
||||
var offset = (0, _chartLayoutContext.useOffset)();
|
||||
var propsIncludingDefaults = _objectSpread(_objectSpread({}, props), {}, {
|
||||
stroke: (_props$stroke = props.stroke) !== null && _props$stroke !== void 0 ? _props$stroke : defaultProps.stroke,
|
||||
fill: (_props$fill = props.fill) !== null && _props$fill !== void 0 ? _props$fill : defaultProps.fill,
|
||||
horizontal: (_props$horizontal3 = props.horizontal) !== null && _props$horizontal3 !== void 0 ? _props$horizontal3 : defaultProps.horizontal,
|
||||
horizontalFill: (_props$horizontalFill = props.horizontalFill) !== null && _props$horizontalFill !== void 0 ? _props$horizontalFill : defaultProps.horizontalFill,
|
||||
vertical: (_props$vertical3 = props.vertical) !== null && _props$vertical3 !== void 0 ? _props$vertical3 : defaultProps.vertical,
|
||||
verticalFill: (_props$verticalFill = props.verticalFill) !== null && _props$verticalFill !== void 0 ? _props$verticalFill : defaultProps.verticalFill,
|
||||
x: (0, _DataUtils.isNumber)(props.x) ? props.x : offset.left,
|
||||
y: (0, _DataUtils.isNumber)(props.y) ? props.y : offset.top,
|
||||
width: (0, _DataUtils.isNumber)(props.width) ? props.width : offset.width,
|
||||
height: (0, _DataUtils.isNumber)(props.height) ? props.height : offset.height
|
||||
});
|
||||
var x = propsIncludingDefaults.x,
|
||||
y = propsIncludingDefaults.y,
|
||||
width = propsIncludingDefaults.width,
|
||||
height = propsIncludingDefaults.height,
|
||||
syncWithTicks = propsIncludingDefaults.syncWithTicks,
|
||||
horizontalValues = propsIncludingDefaults.horizontalValues,
|
||||
verticalValues = propsIncludingDefaults.verticalValues;
|
||||
|
||||
// @ts-expect-error the scale prop is mixed up - we need to untagle this at some point
|
||||
var xAxis = (0, _chartLayoutContext.useArbitraryXAxis)();
|
||||
// @ts-expect-error the scale prop is mixed up - we need to untagle this at some point
|
||||
var yAxis = (0, _chartLayoutContext.useYAxisWithFiniteDomainOrRandom)();
|
||||
if (!(0, _DataUtils.isNumber)(width) || width <= 0 || !(0, _DataUtils.isNumber)(height) || height <= 0 || !(0, _DataUtils.isNumber)(x) || x !== +x || !(0, _DataUtils.isNumber)(y) || y !== +y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* verticalCoordinatesGenerator and horizontalCoordinatesGenerator are defined
|
||||
* outside of the propsIncludingDefaults because they were never part of the original props
|
||||
* and they were never passed as a prop down to horizontal/vertical custom elements.
|
||||
* If we add these two to propsIncludingDefaults then we are changing public API.
|
||||
* Not a bad thing per se but also not necessary.
|
||||
*/
|
||||
var verticalCoordinatesGenerator = propsIncludingDefaults.verticalCoordinatesGenerator || defaultVerticalCoordinatesGenerator;
|
||||
var horizontalCoordinatesGenerator = propsIncludingDefaults.horizontalCoordinatesGenerator || defaultHorizontalCoordinatesGenerator;
|
||||
var horizontalPoints = propsIncludingDefaults.horizontalPoints,
|
||||
verticalPoints = propsIncludingDefaults.verticalPoints;
|
||||
|
||||
// No horizontal points are specified
|
||||
if ((!horizontalPoints || !horizontalPoints.length) && (0, _isFunction["default"])(horizontalCoordinatesGenerator)) {
|
||||
var isHorizontalValues = horizontalValues && horizontalValues.length;
|
||||
var generatorResult = horizontalCoordinatesGenerator({
|
||||
yAxis: yAxis ? _objectSpread(_objectSpread({}, yAxis), {}, {
|
||||
ticks: isHorizontalValues ? horizontalValues : yAxis.ticks
|
||||
}) : undefined,
|
||||
width: chartWidth,
|
||||
height: chartHeight,
|
||||
offset: offset
|
||||
}, isHorizontalValues ? true : syncWithTicks);
|
||||
(0, _LogUtils.warn)(Array.isArray(generatorResult), "horizontalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof(generatorResult), "]"));
|
||||
if (Array.isArray(generatorResult)) {
|
||||
horizontalPoints = generatorResult;
|
||||
}
|
||||
}
|
||||
|
||||
// No vertical points are specified
|
||||
if ((!verticalPoints || !verticalPoints.length) && (0, _isFunction["default"])(verticalCoordinatesGenerator)) {
|
||||
var isVerticalValues = verticalValues && verticalValues.length;
|
||||
var _generatorResult = verticalCoordinatesGenerator({
|
||||
xAxis: xAxis ? _objectSpread(_objectSpread({}, xAxis), {}, {
|
||||
ticks: isVerticalValues ? verticalValues : xAxis.ticks
|
||||
}) : undefined,
|
||||
width: chartWidth,
|
||||
height: chartHeight,
|
||||
offset: offset
|
||||
}, isVerticalValues ? true : syncWithTicks);
|
||||
(0, _LogUtils.warn)(Array.isArray(_generatorResult), "verticalCoordinatesGenerator should return Array but instead it returned [".concat(_typeof(_generatorResult), "]"));
|
||||
if (Array.isArray(_generatorResult)) {
|
||||
verticalPoints = _generatorResult;
|
||||
}
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-cartesian-grid"
|
||||
}, /*#__PURE__*/_react["default"].createElement(Background, {
|
||||
fill: propsIncludingDefaults.fill,
|
||||
fillOpacity: propsIncludingDefaults.fillOpacity,
|
||||
x: propsIncludingDefaults.x,
|
||||
y: propsIncludingDefaults.y,
|
||||
width: propsIncludingDefaults.width,
|
||||
height: propsIncludingDefaults.height,
|
||||
ry: propsIncludingDefaults.ry
|
||||
}), /*#__PURE__*/_react["default"].createElement(HorizontalGridLines, _extends({}, propsIncludingDefaults, {
|
||||
offset: offset,
|
||||
horizontalPoints: horizontalPoints,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis
|
||||
})), /*#__PURE__*/_react["default"].createElement(VerticalGridLines, _extends({}, propsIncludingDefaults, {
|
||||
offset: offset,
|
||||
verticalPoints: verticalPoints,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis
|
||||
})), /*#__PURE__*/_react["default"].createElement(HorizontalStripes, _extends({}, propsIncludingDefaults, {
|
||||
horizontalPoints: horizontalPoints
|
||||
})), /*#__PURE__*/_react["default"].createElement(VerticalStripes, _extends({}, propsIncludingDefaults, {
|
||||
verticalPoints: verticalPoints
|
||||
})));
|
||||
}
|
||||
CartesianGrid.displayName = 'CartesianGrid';
|
||||
163
frontend/node_modules/recharts/lib/cartesian/ErrorBar.js
generated
vendored
Normal file
163
frontend/node_modules/recharts/lib/cartesian/ErrorBar.js
generated
vendored
Normal file
@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ErrorBar = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["offset", "layout", "width", "dataKey", "data", "dataPointFormatter", "xAxis", "yAxis"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render a group of error bar
|
||||
*/
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var ErrorBar = exports.ErrorBar = /*#__PURE__*/function (_React$Component) {
|
||||
function ErrorBar() {
|
||||
_classCallCheck(this, ErrorBar);
|
||||
return _callSuper(this, ErrorBar, arguments);
|
||||
}
|
||||
_inherits(ErrorBar, _React$Component);
|
||||
return _createClass(ErrorBar, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props = this.props,
|
||||
offset = _this$props.offset,
|
||||
layout = _this$props.layout,
|
||||
width = _this$props.width,
|
||||
dataKey = _this$props.dataKey,
|
||||
data = _this$props.data,
|
||||
dataPointFormatter = _this$props.dataPointFormatter,
|
||||
xAxis = _this$props.xAxis,
|
||||
yAxis = _this$props.yAxis,
|
||||
others = _objectWithoutProperties(_this$props, _excluded);
|
||||
var svgProps = (0, _ReactUtils.filterProps)(others, false);
|
||||
!!(this.props.direction === 'x' && xAxis.type !== 'number') ? process.env.NODE_ENV !== "production" ? (0, _tinyInvariant["default"])(false, 'ErrorBar requires Axis type property to be "number".') : (0, _tinyInvariant["default"])(false) : void 0;
|
||||
var errorBars = data.map(function (entry) {
|
||||
var _dataPointFormatter = dataPointFormatter(entry, dataKey),
|
||||
x = _dataPointFormatter.x,
|
||||
y = _dataPointFormatter.y,
|
||||
value = _dataPointFormatter.value,
|
||||
errorVal = _dataPointFormatter.errorVal;
|
||||
if (!errorVal) {
|
||||
return null;
|
||||
}
|
||||
var lineCoordinates = [];
|
||||
var lowBound, highBound;
|
||||
if (Array.isArray(errorVal)) {
|
||||
var _errorVal = _slicedToArray(errorVal, 2);
|
||||
lowBound = _errorVal[0];
|
||||
highBound = _errorVal[1];
|
||||
} else {
|
||||
lowBound = highBound = errorVal;
|
||||
}
|
||||
if (layout === 'vertical') {
|
||||
// error bar for horizontal charts, the y is fixed, x is a range value
|
||||
var scale = xAxis.scale;
|
||||
var yMid = y + offset;
|
||||
var yMin = yMid + width;
|
||||
var yMax = yMid - width;
|
||||
var xMin = scale(value - lowBound);
|
||||
var xMax = scale(value + highBound);
|
||||
|
||||
// the right line of |--|
|
||||
lineCoordinates.push({
|
||||
x1: xMax,
|
||||
y1: yMin,
|
||||
x2: xMax,
|
||||
y2: yMax
|
||||
});
|
||||
// the middle line of |--|
|
||||
lineCoordinates.push({
|
||||
x1: xMin,
|
||||
y1: yMid,
|
||||
x2: xMax,
|
||||
y2: yMid
|
||||
});
|
||||
// the left line of |--|
|
||||
lineCoordinates.push({
|
||||
x1: xMin,
|
||||
y1: yMin,
|
||||
x2: xMin,
|
||||
y2: yMax
|
||||
});
|
||||
} else if (layout === 'horizontal') {
|
||||
// error bar for horizontal charts, the x is fixed, y is a range value
|
||||
var _scale = yAxis.scale;
|
||||
var xMid = x + offset;
|
||||
var _xMin = xMid - width;
|
||||
var _xMax = xMid + width;
|
||||
var _yMin = _scale(value - lowBound);
|
||||
var _yMax = _scale(value + highBound);
|
||||
|
||||
// the top line
|
||||
lineCoordinates.push({
|
||||
x1: _xMin,
|
||||
y1: _yMax,
|
||||
x2: _xMax,
|
||||
y2: _yMax
|
||||
});
|
||||
// the middle line
|
||||
lineCoordinates.push({
|
||||
x1: xMid,
|
||||
y1: _yMin,
|
||||
x2: xMid,
|
||||
y2: _yMax
|
||||
});
|
||||
// the bottom line
|
||||
lineCoordinates.push({
|
||||
x1: _xMin,
|
||||
y1: _yMin,
|
||||
x2: _xMax,
|
||||
y2: _yMin
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-errorBar",
|
||||
key: "bar-".concat(lineCoordinates.map(function (c) {
|
||||
return "".concat(c.x1, "-").concat(c.x2, "-").concat(c.y1, "-").concat(c.y2);
|
||||
}))
|
||||
}, svgProps), lineCoordinates.map(function (coordinates) {
|
||||
return /*#__PURE__*/_react["default"].createElement("line", _extends({}, coordinates, {
|
||||
key: "line-".concat(coordinates.x1, "-").concat(coordinates.x2, "-").concat(coordinates.y1, "-").concat(coordinates.y2)
|
||||
}));
|
||||
}));
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-errorBars"
|
||||
}, errorBars);
|
||||
}
|
||||
}]);
|
||||
}(_react["default"].Component);
|
||||
_defineProperty(ErrorBar, "defaultProps", {
|
||||
stroke: 'black',
|
||||
strokeWidth: 1.5,
|
||||
width: 5,
|
||||
offset: 0,
|
||||
layout: 'horizontal'
|
||||
});
|
||||
_defineProperty(ErrorBar, "displayName", 'ErrorBar');
|
||||
519
frontend/node_modules/recharts/lib/cartesian/Line.js
generated
vendored
Executable file
519
frontend/node_modules/recharts/lib/cartesian/Line.js
generated
vendored
Executable file
@ -0,0 +1,519 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Line = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Curve = require("../shape/Curve");
|
||||
var _Dot = require("../shape/Dot");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _ErrorBar = require("./ErrorBar");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _excluded = ["type", "layout", "connectNulls", "ref"],
|
||||
_excluded2 = ["key"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Line
|
||||
*/
|
||||
var Line = exports.Line = /*#__PURE__*/function (_PureComponent) {
|
||||
function Line() {
|
||||
var _this;
|
||||
_classCallCheck(this, Line);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Line, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: true,
|
||||
totalLength: 0
|
||||
});
|
||||
_defineProperty(_this, "generateSimpleStrokeDasharray", function (totalLength, length) {
|
||||
return "".concat(length, "px ").concat(totalLength - length, "px");
|
||||
});
|
||||
_defineProperty(_this, "getStrokeDasharray", function (length, totalLength, lines) {
|
||||
var lineLength = lines.reduce(function (pre, next) {
|
||||
return pre + next;
|
||||
});
|
||||
|
||||
// if lineLength is 0 return the default when no strokeDasharray is provided
|
||||
if (!lineLength) {
|
||||
return _this.generateSimpleStrokeDasharray(totalLength, length);
|
||||
}
|
||||
var count = Math.floor(length / lineLength);
|
||||
var remainLength = length % lineLength;
|
||||
var restLength = totalLength - length;
|
||||
var remainLines = [];
|
||||
for (var i = 0, sum = 0; i < lines.length; sum += lines[i], ++i) {
|
||||
if (sum + lines[i] > remainLength) {
|
||||
remainLines = [].concat(_toConsumableArray(lines.slice(0, i)), [remainLength - sum]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var emptyLines = remainLines.length % 2 === 0 ? [0, restLength] : [restLength];
|
||||
return [].concat(_toConsumableArray(Line.repeat(lines, count)), _toConsumableArray(remainLines), emptyLines).map(function (line) {
|
||||
return "".concat(line, "px");
|
||||
}).join(', ');
|
||||
});
|
||||
_defineProperty(_this, "id", (0, _DataUtils.uniqueId)('recharts-line-'));
|
||||
_defineProperty(_this, "pathRef", function (node) {
|
||||
_this.mainCurve = node;
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if (_this.props.onAnimationEnd) {
|
||||
_this.props.onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if (_this.props.onAnimationStart) {
|
||||
_this.props.onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Line, _PureComponent);
|
||||
return _createClass(Line, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
if (!this.props.isAnimationActive) {
|
||||
return;
|
||||
}
|
||||
var totalLength = this.getTotalLength();
|
||||
this.setState({
|
||||
totalLength: totalLength
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
if (!this.props.isAnimationActive) {
|
||||
return;
|
||||
}
|
||||
var totalLength = this.getTotalLength();
|
||||
if (totalLength !== this.state.totalLength) {
|
||||
this.setState({
|
||||
totalLength: totalLength
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getTotalLength",
|
||||
value: function getTotalLength() {
|
||||
var curveDom = this.mainCurve;
|
||||
try {
|
||||
return curveDom && curveDom.getTotalLength && curveDom.getTotalLength() || 0;
|
||||
} catch (err) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "renderErrorBar",
|
||||
value: function renderErrorBar(needClip, clipPathId) {
|
||||
if (this.props.isAnimationActive && !this.state.isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props = this.props,
|
||||
points = _this$props.points,
|
||||
xAxis = _this$props.xAxis,
|
||||
yAxis = _this$props.yAxis,
|
||||
layout = _this$props.layout,
|
||||
children = _this$props.children;
|
||||
var errorBarItems = (0, _ReactUtils.findAllByType)(children, _ErrorBar.ErrorBar);
|
||||
if (!errorBarItems) {
|
||||
return null;
|
||||
}
|
||||
var dataPointFormatter = function dataPointFormatter(dataPoint, dataKey) {
|
||||
return {
|
||||
x: dataPoint.x,
|
||||
y: dataPoint.y,
|
||||
value: dataPoint.value,
|
||||
errorVal: (0, _ChartUtils.getValueByDataKey)(dataPoint.payload, dataKey)
|
||||
};
|
||||
};
|
||||
var errorBarProps = {
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, errorBarProps, errorBarItems.map(function (item) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(item, {
|
||||
key: "bar-".concat(item.props.dataKey),
|
||||
data: points,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
layout: layout,
|
||||
dataPointFormatter: dataPointFormatter
|
||||
});
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderDots",
|
||||
value: function renderDots(needClip, clipDot, clipPathId) {
|
||||
var isAnimationActive = this.props.isAnimationActive;
|
||||
if (isAnimationActive && !this.state.isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props2 = this.props,
|
||||
dot = _this$props2.dot,
|
||||
points = _this$props2.points,
|
||||
dataKey = _this$props2.dataKey;
|
||||
var lineProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customDotProps = (0, _ReactUtils.filterProps)(dot, true);
|
||||
var dots = points.map(function (entry, i) {
|
||||
var dotProps = _objectSpread(_objectSpread(_objectSpread({
|
||||
key: "dot-".concat(i),
|
||||
r: 3
|
||||
}, lineProps), customDotProps), {}, {
|
||||
index: i,
|
||||
cx: entry.x,
|
||||
cy: entry.y,
|
||||
value: entry.value,
|
||||
dataKey: dataKey,
|
||||
payload: entry.payload,
|
||||
points: points
|
||||
});
|
||||
return Line.renderDotItem(dot, dotProps);
|
||||
});
|
||||
var dotsProps = {
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipDot ? '' : 'dots-').concat(clipPathId, ")") : null
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-line-dots",
|
||||
key: "dots"
|
||||
}, dotsProps), dots);
|
||||
}
|
||||
}, {
|
||||
key: "renderCurveStatically",
|
||||
value: function renderCurveStatically(points, needClip, clipPathId, props) {
|
||||
var _this$props3 = this.props,
|
||||
type = _this$props3.type,
|
||||
layout = _this$props3.layout,
|
||||
connectNulls = _this$props3.connectNulls,
|
||||
ref = _this$props3.ref,
|
||||
others = _objectWithoutProperties(_this$props3, _excluded);
|
||||
var curveProps = _objectSpread(_objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(others, true)), {}, {
|
||||
fill: 'none',
|
||||
className: 'recharts-line-curve',
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null,
|
||||
points: points
|
||||
}, props), {}, {
|
||||
type: type,
|
||||
layout: layout,
|
||||
connectNulls: connectNulls
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, curveProps, {
|
||||
pathRef: this.pathRef
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderCurveWithAnimation",
|
||||
value: function renderCurveWithAnimation(needClip, clipPathId) {
|
||||
var _this2 = this;
|
||||
var _this$props4 = this.props,
|
||||
points = _this$props4.points,
|
||||
strokeDasharray = _this$props4.strokeDasharray,
|
||||
isAnimationActive = _this$props4.isAnimationActive,
|
||||
animationBegin = _this$props4.animationBegin,
|
||||
animationDuration = _this$props4.animationDuration,
|
||||
animationEasing = _this$props4.animationEasing,
|
||||
animationId = _this$props4.animationId,
|
||||
animateNewValues = _this$props4.animateNewValues,
|
||||
width = _this$props4.width,
|
||||
height = _this$props4.height;
|
||||
var _this$state = this.state,
|
||||
prevPoints = _this$state.prevPoints,
|
||||
totalLength = _this$state.totalLength;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "line-".concat(animationId),
|
||||
onAnimationEnd: this.handleAnimationEnd,
|
||||
onAnimationStart: this.handleAnimationStart
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
if (prevPoints) {
|
||||
var prevPointsDiffFactor = prevPoints.length / points.length;
|
||||
var stepData = points.map(function (entry, index) {
|
||||
var prevPointIndex = Math.floor(index * prevPointsDiffFactor);
|
||||
if (prevPoints[prevPointIndex]) {
|
||||
var prev = prevPoints[prevPointIndex];
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t)
|
||||
});
|
||||
}
|
||||
|
||||
// magic number of faking previous x and y location
|
||||
if (animateNewValues) {
|
||||
var _interpolatorX = (0, _DataUtils.interpolateNumber)(width * 2, entry.x);
|
||||
var _interpolatorY = (0, _DataUtils.interpolateNumber)(height / 2, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: _interpolatorX(t),
|
||||
y: _interpolatorY(t)
|
||||
});
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: entry.x,
|
||||
y: entry.y
|
||||
});
|
||||
});
|
||||
return _this2.renderCurveStatically(stepData, needClip, clipPathId);
|
||||
}
|
||||
var interpolator = (0, _DataUtils.interpolateNumber)(0, totalLength);
|
||||
var curLength = interpolator(t);
|
||||
var currentStrokeDasharray;
|
||||
if (strokeDasharray) {
|
||||
var lines = "".concat(strokeDasharray).split(/[,\s]+/gim).map(function (num) {
|
||||
return parseFloat(num);
|
||||
});
|
||||
currentStrokeDasharray = _this2.getStrokeDasharray(curLength, totalLength, lines);
|
||||
} else {
|
||||
currentStrokeDasharray = _this2.generateSimpleStrokeDasharray(totalLength, curLength);
|
||||
}
|
||||
return _this2.renderCurveStatically(points, needClip, clipPathId, {
|
||||
strokeDasharray: currentStrokeDasharray
|
||||
});
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderCurve",
|
||||
value: function renderCurve(needClip, clipPathId) {
|
||||
var _this$props5 = this.props,
|
||||
points = _this$props5.points,
|
||||
isAnimationActive = _this$props5.isAnimationActive;
|
||||
var _this$state2 = this.state,
|
||||
prevPoints = _this$state2.prevPoints,
|
||||
totalLength = _this$state2.totalLength;
|
||||
if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !(0, _isEqual["default"])(prevPoints, points))) {
|
||||
return this.renderCurveWithAnimation(needClip, clipPathId);
|
||||
}
|
||||
return this.renderCurveStatically(points, needClip, clipPathId);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _filterProps;
|
||||
var _this$props6 = this.props,
|
||||
hide = _this$props6.hide,
|
||||
dot = _this$props6.dot,
|
||||
points = _this$props6.points,
|
||||
className = _this$props6.className,
|
||||
xAxis = _this$props6.xAxis,
|
||||
yAxis = _this$props6.yAxis,
|
||||
top = _this$props6.top,
|
||||
left = _this$props6.left,
|
||||
width = _this$props6.width,
|
||||
height = _this$props6.height,
|
||||
isAnimationActive = _this$props6.isAnimationActive,
|
||||
id = _this$props6.id;
|
||||
if (hide || !points || !points.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var hasSinglePoint = points.length === 1;
|
||||
var layerClass = (0, _clsx["default"])('recharts-line', className);
|
||||
var needClipX = xAxis && xAxis.allowDataOverflow;
|
||||
var needClipY = yAxis && yAxis.allowDataOverflow;
|
||||
var needClip = needClipX || needClipY;
|
||||
var clipPathId = (0, _isNil["default"])(id) ? this.id : id;
|
||||
var _ref2 = (_filterProps = (0, _ReactUtils.filterProps)(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {
|
||||
r: 3,
|
||||
strokeWidth: 2
|
||||
},
|
||||
_ref2$r = _ref2.r,
|
||||
r = _ref2$r === void 0 ? 3 : _ref2$r,
|
||||
_ref2$strokeWidth = _ref2.strokeWidth,
|
||||
strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;
|
||||
var _ref3 = (0, _ReactUtils.hasClipDot)(dot) ? dot : {},
|
||||
_ref3$clipDot = _ref3.clipDot,
|
||||
clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;
|
||||
var dotSize = r * 2 + strokeWidth;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, needClipX || needClipY ? /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: needClipX ? left : left - width / 2,
|
||||
y: needClipY ? top : top - height / 2,
|
||||
width: needClipX ? width : width * 2,
|
||||
height: needClipY ? height : height * 2
|
||||
})), !clipDot && /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-dots-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: left - dotSize / 2,
|
||||
y: top - dotSize / 2,
|
||||
width: width + dotSize,
|
||||
height: height + dotSize
|
||||
}))) : null, !hasSinglePoint && this.renderCurve(needClip, clipPathId), this.renderErrorBar(needClip, clipPathId), (hasSinglePoint || dot) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, points));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curPoints: nextProps.points,
|
||||
prevPoints: prevState.curPoints
|
||||
};
|
||||
}
|
||||
if (nextProps.points !== prevState.curPoints) {
|
||||
return {
|
||||
curPoints: nextProps.points
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "repeat",
|
||||
value: function repeat(lines, count) {
|
||||
var linesUnit = lines.length % 2 !== 0 ? [].concat(_toConsumableArray(lines), [0]) : lines;
|
||||
var result = [];
|
||||
for (var i = 0; i < count; ++i) {
|
||||
result = [].concat(_toConsumableArray(result), _toConsumableArray(linesUnit));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "renderDotItem",
|
||||
value: function renderDotItem(option, props) {
|
||||
var dotItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
dotItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
dotItem = option(props);
|
||||
} else {
|
||||
var key = props.key,
|
||||
dotProps = _objectWithoutProperties(props, _excluded2);
|
||||
var className = (0, _clsx["default"])('recharts-line-dot', typeof option !== 'boolean' ? option.className : '');
|
||||
dotItem = /*#__PURE__*/_react["default"].createElement(_Dot.Dot, _extends({
|
||||
key: key
|
||||
}, dotProps, {
|
||||
className: className
|
||||
}));
|
||||
}
|
||||
return dotItem;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Line, "displayName", 'Line');
|
||||
_defineProperty(Line, "defaultProps", {
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
connectNulls: false,
|
||||
activeDot: true,
|
||||
dot: true,
|
||||
legendType: 'line',
|
||||
stroke: '#3182bd',
|
||||
strokeWidth: 1,
|
||||
fill: '#fff',
|
||||
points: [],
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animateNewValues: true,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease',
|
||||
hide: false,
|
||||
label: false
|
||||
});
|
||||
/**
|
||||
* Compose the data of each group
|
||||
* @param {Object} props The props from the component
|
||||
* @param {Object} xAxis The configuration of x-axis
|
||||
* @param {Object} yAxis The configuration of y-axis
|
||||
* @param {String} dataKey The unique key of a group
|
||||
* @return {Array} Composed data
|
||||
*/
|
||||
_defineProperty(Line, "getComposedData", function (_ref4) {
|
||||
var props = _ref4.props,
|
||||
xAxis = _ref4.xAxis,
|
||||
yAxis = _ref4.yAxis,
|
||||
xAxisTicks = _ref4.xAxisTicks,
|
||||
yAxisTicks = _ref4.yAxisTicks,
|
||||
dataKey = _ref4.dataKey,
|
||||
bandSize = _ref4.bandSize,
|
||||
displayedData = _ref4.displayedData,
|
||||
offset = _ref4.offset;
|
||||
var layout = props.layout;
|
||||
var points = displayedData.map(function (entry, index) {
|
||||
var value = (0, _ChartUtils.getValueByDataKey)(entry, dataKey);
|
||||
if (layout === 'horizontal') {
|
||||
return {
|
||||
x: (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: xAxis,
|
||||
ticks: xAxisTicks,
|
||||
bandSize: bandSize,
|
||||
entry: entry,
|
||||
index: index
|
||||
}),
|
||||
y: (0, _isNil["default"])(value) ? null : yAxis.scale(value),
|
||||
value: value,
|
||||
payload: entry
|
||||
};
|
||||
}
|
||||
return {
|
||||
x: (0, _isNil["default"])(value) ? null : xAxis.scale(value),
|
||||
y: (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: yAxis,
|
||||
ticks: yAxisTicks,
|
||||
bandSize: bandSize,
|
||||
entry: entry,
|
||||
index: index
|
||||
}),
|
||||
value: value,
|
||||
payload: entry
|
||||
};
|
||||
});
|
||||
return _objectSpread({
|
||||
points: points,
|
||||
layout: layout
|
||||
}, offset);
|
||||
});
|
||||
136
frontend/node_modules/recharts/lib/cartesian/ReferenceArea.js
generated
vendored
Normal file
136
frontend/node_modules/recharts/lib/cartesian/ReferenceArea.js
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ReferenceArea = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Label = require("../component/Label");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
var _IfOverflowMatches = require("../util/IfOverflowMatches");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _Rectangle = require("../shape/Rectangle");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Reference Line
|
||||
*/
|
||||
var getRect = function getRect(hasX1, hasX2, hasY1, hasY2, props) {
|
||||
var xValue1 = props.x1,
|
||||
xValue2 = props.x2,
|
||||
yValue1 = props.y1,
|
||||
yValue2 = props.y2,
|
||||
xAxis = props.xAxis,
|
||||
yAxis = props.yAxis;
|
||||
if (!xAxis || !yAxis) return null;
|
||||
var scales = (0, _CartesianUtils.createLabeledScales)({
|
||||
x: xAxis.scale,
|
||||
y: yAxis.scale
|
||||
});
|
||||
var p1 = {
|
||||
x: hasX1 ? scales.x.apply(xValue1, {
|
||||
position: 'start'
|
||||
}) : scales.x.rangeMin,
|
||||
y: hasY1 ? scales.y.apply(yValue1, {
|
||||
position: 'start'
|
||||
}) : scales.y.rangeMin
|
||||
};
|
||||
var p2 = {
|
||||
x: hasX2 ? scales.x.apply(xValue2, {
|
||||
position: 'end'
|
||||
}) : scales.x.rangeMax,
|
||||
y: hasY2 ? scales.y.apply(yValue2, {
|
||||
position: 'end'
|
||||
}) : scales.y.rangeMax
|
||||
};
|
||||
if ((0, _IfOverflowMatches.ifOverflowMatches)(props, 'discard') && (!scales.isInRange(p1) || !scales.isInRange(p2))) {
|
||||
return null;
|
||||
}
|
||||
return (0, _CartesianUtils.rectWithPoints)(p1, p2);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var ReferenceArea = exports.ReferenceArea = /*#__PURE__*/function (_React$Component) {
|
||||
function ReferenceArea() {
|
||||
_classCallCheck(this, ReferenceArea);
|
||||
return _callSuper(this, ReferenceArea, arguments);
|
||||
}
|
||||
_inherits(ReferenceArea, _React$Component);
|
||||
return _createClass(ReferenceArea, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props = this.props,
|
||||
x1 = _this$props.x1,
|
||||
x2 = _this$props.x2,
|
||||
y1 = _this$props.y1,
|
||||
y2 = _this$props.y2,
|
||||
className = _this$props.className,
|
||||
alwaysShow = _this$props.alwaysShow,
|
||||
clipPathId = _this$props.clipPathId;
|
||||
(0, _LogUtils.warn)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
|
||||
var hasX1 = (0, _DataUtils.isNumOrStr)(x1);
|
||||
var hasX2 = (0, _DataUtils.isNumOrStr)(x2);
|
||||
var hasY1 = (0, _DataUtils.isNumOrStr)(y1);
|
||||
var hasY2 = (0, _DataUtils.isNumOrStr)(y2);
|
||||
var shape = this.props.shape;
|
||||
if (!hasX1 && !hasX2 && !hasY1 && !hasY2 && !shape) {
|
||||
return null;
|
||||
}
|
||||
var rect = getRect(hasX1, hasX2, hasY1, hasY2, this.props);
|
||||
if (!rect && !shape) {
|
||||
return null;
|
||||
}
|
||||
var clipPath = (0, _IfOverflowMatches.ifOverflowMatches)(this.props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-reference-area', className)
|
||||
}, ReferenceArea.renderRect(shape, _objectSpread(_objectSpread({
|
||||
clipPath: clipPath
|
||||
}, (0, _ReactUtils.filterProps)(this.props, true)), rect)), _Label.Label.renderCallByParent(this.props, rect));
|
||||
}
|
||||
}]);
|
||||
}(_react["default"].Component);
|
||||
_defineProperty(ReferenceArea, "displayName", 'ReferenceArea');
|
||||
_defineProperty(ReferenceArea, "defaultProps", {
|
||||
isFront: false,
|
||||
ifOverflow: 'discard',
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
r: 10,
|
||||
fill: '#ccc',
|
||||
fillOpacity: 0.5,
|
||||
stroke: 'none',
|
||||
strokeWidth: 1
|
||||
});
|
||||
_defineProperty(ReferenceArea, "renderRect", function (option, props) {
|
||||
var rect;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
rect = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
rect = option(props);
|
||||
} else {
|
||||
rect = /*#__PURE__*/_react["default"].createElement(_Rectangle.Rectangle, _extends({}, props, {
|
||||
className: "recharts-reference-area-rect"
|
||||
}));
|
||||
}
|
||||
return rect;
|
||||
});
|
||||
134
frontend/node_modules/recharts/lib/cartesian/ReferenceDot.js
generated
vendored
Normal file
134
frontend/node_modules/recharts/lib/cartesian/ReferenceDot.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ReferenceDot = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Dot = require("../shape/Dot");
|
||||
var _Label = require("../component/Label");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _IfOverflowMatches = require("../util/IfOverflowMatches");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Reference Dot
|
||||
*/
|
||||
var getCoordinate = function getCoordinate(props) {
|
||||
var x = props.x,
|
||||
y = props.y,
|
||||
xAxis = props.xAxis,
|
||||
yAxis = props.yAxis;
|
||||
var scales = (0, _CartesianUtils.createLabeledScales)({
|
||||
x: xAxis.scale,
|
||||
y: yAxis.scale
|
||||
});
|
||||
var result = scales.apply({
|
||||
x: x,
|
||||
y: y
|
||||
}, {
|
||||
bandAware: true
|
||||
});
|
||||
if ((0, _IfOverflowMatches.ifOverflowMatches)(props, 'discard') && !scales.isInRange(result)) {
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var ReferenceDot = exports.ReferenceDot = /*#__PURE__*/function (_React$Component) {
|
||||
function ReferenceDot() {
|
||||
_classCallCheck(this, ReferenceDot);
|
||||
return _callSuper(this, ReferenceDot, arguments);
|
||||
}
|
||||
_inherits(ReferenceDot, _React$Component);
|
||||
return _createClass(ReferenceDot, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props = this.props,
|
||||
x = _this$props.x,
|
||||
y = _this$props.y,
|
||||
r = _this$props.r,
|
||||
alwaysShow = _this$props.alwaysShow,
|
||||
clipPathId = _this$props.clipPathId;
|
||||
var isX = (0, _DataUtils.isNumOrStr)(x);
|
||||
var isY = (0, _DataUtils.isNumOrStr)(y);
|
||||
(0, _LogUtils.warn)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
|
||||
if (!isX || !isY) {
|
||||
return null;
|
||||
}
|
||||
var coordinate = getCoordinate(this.props);
|
||||
if (!coordinate) {
|
||||
return null;
|
||||
}
|
||||
var cx = coordinate.x,
|
||||
cy = coordinate.y;
|
||||
var _this$props2 = this.props,
|
||||
shape = _this$props2.shape,
|
||||
className = _this$props2.className;
|
||||
var clipPath = (0, _IfOverflowMatches.ifOverflowMatches)(this.props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined;
|
||||
var dotProps = _objectSpread(_objectSpread({
|
||||
clipPath: clipPath
|
||||
}, (0, _ReactUtils.filterProps)(this.props, true)), {}, {
|
||||
cx: cx,
|
||||
cy: cy
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-reference-dot', className)
|
||||
}, ReferenceDot.renderDot(shape, dotProps), _Label.Label.renderCallByParent(this.props, {
|
||||
x: cx - r,
|
||||
y: cy - r,
|
||||
width: 2 * r,
|
||||
height: 2 * r
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
}(_react["default"].Component);
|
||||
_defineProperty(ReferenceDot, "displayName", 'ReferenceDot');
|
||||
_defineProperty(ReferenceDot, "defaultProps", {
|
||||
isFront: false,
|
||||
ifOverflow: 'discard',
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
r: 10,
|
||||
fill: '#fff',
|
||||
stroke: '#ccc',
|
||||
fillOpacity: 1,
|
||||
strokeWidth: 1
|
||||
});
|
||||
_defineProperty(ReferenceDot, "renderDot", function (option, props) {
|
||||
var dot;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
dot = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
dot = option(props);
|
||||
} else {
|
||||
dot = /*#__PURE__*/_react["default"].createElement(_Dot.Dot, _extends({}, props, {
|
||||
cx: props.cx,
|
||||
cy: props.cy,
|
||||
className: "recharts-reference-dot-dot"
|
||||
}));
|
||||
}
|
||||
return dot;
|
||||
});
|
||||
200
frontend/node_modules/recharts/lib/cartesian/ReferenceLine.js
generated
vendored
Normal file
200
frontend/node_modules/recharts/lib/cartesian/ReferenceLine.js
generated
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getEndPoints = exports.ReferenceLine = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _some = _interopRequireDefault(require("lodash/some"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Label = require("../component/Label");
|
||||
var _IfOverflowMatches = require("../util/IfOverflowMatches");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _chartLayoutContext = require("../context/chartLayoutContext");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
||||
* @fileOverview Reference Line
|
||||
*/
|
||||
/**
|
||||
* This excludes `viewBox` prop from svg for two reasons:
|
||||
* 1. The components wants viewBox of object type, and svg wants string
|
||||
* - so there's a conflict, and the component will throw if it gets string
|
||||
* 2. Internally the component calls `filterProps` which filters the viewBox away anyway
|
||||
*/
|
||||
|
||||
var renderLine = function renderLine(option, props) {
|
||||
var line;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
line = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
line = option(props);
|
||||
} else {
|
||||
line = /*#__PURE__*/_react["default"].createElement("line", _extends({}, props, {
|
||||
className: "recharts-reference-line-line"
|
||||
}));
|
||||
}
|
||||
return line;
|
||||
};
|
||||
// TODO: ScaleHelper
|
||||
var getEndPoints = exports.getEndPoints = function getEndPoints(scales, isFixedX, isFixedY, isSegment, viewBox, position, xAxisOrientation, yAxisOrientation, props) {
|
||||
var x = viewBox.x,
|
||||
y = viewBox.y,
|
||||
width = viewBox.width,
|
||||
height = viewBox.height;
|
||||
if (isFixedY) {
|
||||
var yCoord = props.y;
|
||||
var coord = scales.y.apply(yCoord, {
|
||||
position: position
|
||||
});
|
||||
if ((0, _IfOverflowMatches.ifOverflowMatches)(props, 'discard') && !scales.y.isInRange(coord)) {
|
||||
return null;
|
||||
}
|
||||
var points = [{
|
||||
x: x + width,
|
||||
y: coord
|
||||
}, {
|
||||
x: x,
|
||||
y: coord
|
||||
}];
|
||||
return yAxisOrientation === 'left' ? points.reverse() : points;
|
||||
}
|
||||
if (isFixedX) {
|
||||
var xCoord = props.x;
|
||||
var _coord = scales.x.apply(xCoord, {
|
||||
position: position
|
||||
});
|
||||
if ((0, _IfOverflowMatches.ifOverflowMatches)(props, 'discard') && !scales.x.isInRange(_coord)) {
|
||||
return null;
|
||||
}
|
||||
var _points = [{
|
||||
x: _coord,
|
||||
y: y + height
|
||||
}, {
|
||||
x: _coord,
|
||||
y: y
|
||||
}];
|
||||
return xAxisOrientation === 'top' ? _points.reverse() : _points;
|
||||
}
|
||||
if (isSegment) {
|
||||
var segment = props.segment;
|
||||
var _points2 = segment.map(function (p) {
|
||||
return scales.apply(p, {
|
||||
position: position
|
||||
});
|
||||
});
|
||||
if ((0, _IfOverflowMatches.ifOverflowMatches)(props, 'discard') && (0, _some["default"])(_points2, function (p) {
|
||||
return !scales.isInRange(p);
|
||||
})) {
|
||||
return null;
|
||||
}
|
||||
return _points2;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
function ReferenceLineImpl(props) {
|
||||
var fixedX = props.x,
|
||||
fixedY = props.y,
|
||||
segment = props.segment,
|
||||
xAxisId = props.xAxisId,
|
||||
yAxisId = props.yAxisId,
|
||||
shape = props.shape,
|
||||
className = props.className,
|
||||
alwaysShow = props.alwaysShow;
|
||||
var clipPathId = (0, _chartLayoutContext.useClipPathId)();
|
||||
var xAxis = (0, _chartLayoutContext.useXAxisOrThrow)(xAxisId);
|
||||
var yAxis = (0, _chartLayoutContext.useYAxisOrThrow)(yAxisId);
|
||||
var viewBox = (0, _chartLayoutContext.useViewBox)();
|
||||
if (!clipPathId || !viewBox) {
|
||||
return null;
|
||||
}
|
||||
(0, _LogUtils.warn)(alwaysShow === undefined, 'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');
|
||||
var scales = (0, _CartesianUtils.createLabeledScales)({
|
||||
x: xAxis.scale,
|
||||
y: yAxis.scale
|
||||
});
|
||||
var isX = (0, _DataUtils.isNumOrStr)(fixedX);
|
||||
var isY = (0, _DataUtils.isNumOrStr)(fixedY);
|
||||
var isSegment = segment && segment.length === 2;
|
||||
var endPoints = getEndPoints(scales, isX, isY, isSegment, viewBox, props.position, xAxis.orientation, yAxis.orientation, props);
|
||||
if (!endPoints) {
|
||||
return null;
|
||||
}
|
||||
var _endPoints = _slicedToArray(endPoints, 2),
|
||||
_endPoints$ = _endPoints[0],
|
||||
x1 = _endPoints$.x,
|
||||
y1 = _endPoints$.y,
|
||||
_endPoints$2 = _endPoints[1],
|
||||
x2 = _endPoints$2.x,
|
||||
y2 = _endPoints$2.y;
|
||||
var clipPath = (0, _IfOverflowMatches.ifOverflowMatches)(props, 'hidden') ? "url(#".concat(clipPathId, ")") : undefined;
|
||||
var lineProps = _objectSpread(_objectSpread({
|
||||
clipPath: clipPath
|
||||
}, (0, _ReactUtils.filterProps)(props, true)), {}, {
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-reference-line', className)
|
||||
}, renderLine(shape, lineProps), _Label.Label.renderCallByParent(props, (0, _CartesianUtils.rectWithCoords)({
|
||||
x1: x1,
|
||||
y1: y1,
|
||||
x2: x2,
|
||||
y2: y2
|
||||
})));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var ReferenceLine = exports.ReferenceLine = /*#__PURE__*/function (_React$Component) {
|
||||
function ReferenceLine() {
|
||||
_classCallCheck(this, ReferenceLine);
|
||||
return _callSuper(this, ReferenceLine, arguments);
|
||||
}
|
||||
_inherits(ReferenceLine, _React$Component);
|
||||
return _createClass(ReferenceLine, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/_react["default"].createElement(ReferenceLineImpl, this.props);
|
||||
}
|
||||
}]);
|
||||
}(_react["default"].Component);
|
||||
_defineProperty(ReferenceLine, "displayName", 'ReferenceLine');
|
||||
_defineProperty(ReferenceLine, "defaultProps", {
|
||||
isFront: false,
|
||||
ifOverflow: 'discard',
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
fill: 'none',
|
||||
stroke: '#ccc',
|
||||
fillOpacity: 1,
|
||||
strokeWidth: 1,
|
||||
position: 'middle'
|
||||
});
|
||||
428
frontend/node_modules/recharts/lib/cartesian/Scatter.js
generated
vendored
Normal file
428
frontend/node_modules/recharts/lib/cartesian/Scatter.js
generated
vendored
Normal file
@ -0,0 +1,428 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Scatter = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _ZAxis = require("./ZAxis");
|
||||
var _Curve = require("../shape/Curve");
|
||||
var _ErrorBar = require("./ErrorBar");
|
||||
var _Cell = require("../component/Cell");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _types = require("../util/types");
|
||||
var _ScatterUtils = require("../util/ScatterUtils");
|
||||
var _Scatter;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render a group of scatters
|
||||
*/
|
||||
var Scatter = exports.Scatter = /*#__PURE__*/function (_PureComponent) {
|
||||
function Scatter() {
|
||||
var _this;
|
||||
_classCallCheck(this, Scatter);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Scatter, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: false
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
});
|
||||
_defineProperty(_this, "id", (0, _DataUtils.uniqueId)('recharts-scatter-'));
|
||||
return _this;
|
||||
}
|
||||
_inherits(Scatter, _PureComponent);
|
||||
return _createClass(Scatter, [{
|
||||
key: "renderSymbolsStatically",
|
||||
value: function renderSymbolsStatically(points) {
|
||||
var _this2 = this;
|
||||
var _this$props = this.props,
|
||||
shape = _this$props.shape,
|
||||
activeShape = _this$props.activeShape,
|
||||
activeIndex = _this$props.activeIndex;
|
||||
var baseProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
return points.map(function (entry, i) {
|
||||
var isActive = activeIndex === i;
|
||||
var option = isActive ? activeShape : shape;
|
||||
var props = _objectSpread(_objectSpread({}, baseProps), entry);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-scatter-symbol"
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
,
|
||||
key: "symbol-".concat(entry === null || entry === void 0 ? void 0 : entry.cx, "-").concat(entry === null || entry === void 0 ? void 0 : entry.cy, "-").concat(entry === null || entry === void 0 ? void 0 : entry.size, "-").concat(i)
|
||||
}, (0, _types.adaptEventsOfChild)(_this2.props, entry, i), {
|
||||
role: "img"
|
||||
}), /*#__PURE__*/_react["default"].createElement(_ScatterUtils.ScatterSymbol, _extends({
|
||||
option: option,
|
||||
isActive: isActive
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
,
|
||||
key: "symbol-".concat(i)
|
||||
}, props)));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderSymbolsWithAnimation",
|
||||
value: function renderSymbolsWithAnimation() {
|
||||
var _this3 = this;
|
||||
var _this$props2 = this.props,
|
||||
points = _this$props2.points,
|
||||
isAnimationActive = _this$props2.isAnimationActive,
|
||||
animationBegin = _this$props2.animationBegin,
|
||||
animationDuration = _this$props2.animationDuration,
|
||||
animationEasing = _this$props2.animationEasing,
|
||||
animationId = _this$props2.animationId;
|
||||
var prevPoints = this.state.prevPoints;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "pie-".concat(animationId),
|
||||
onAnimationEnd: this.handleAnimationEnd,
|
||||
onAnimationStart: this.handleAnimationStart
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
var stepData = points.map(function (entry, index) {
|
||||
var prev = prevPoints && prevPoints[index];
|
||||
if (prev) {
|
||||
var interpolatorCx = (0, _DataUtils.interpolateNumber)(prev.cx, entry.cx);
|
||||
var interpolatorCy = (0, _DataUtils.interpolateNumber)(prev.cy, entry.cy);
|
||||
var interpolatorSize = (0, _DataUtils.interpolateNumber)(prev.size, entry.size);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
cx: interpolatorCx(t),
|
||||
cy: interpolatorCy(t),
|
||||
size: interpolatorSize(t)
|
||||
});
|
||||
}
|
||||
var interpolator = (0, _DataUtils.interpolateNumber)(0, entry.size);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
size: interpolator(t)
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, _this3.renderSymbolsStatically(stepData));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderSymbols",
|
||||
value: function renderSymbols() {
|
||||
var _this$props3 = this.props,
|
||||
points = _this$props3.points,
|
||||
isAnimationActive = _this$props3.isAnimationActive;
|
||||
var prevPoints = this.state.prevPoints;
|
||||
if (isAnimationActive && points && points.length && (!prevPoints || !(0, _isEqual["default"])(prevPoints, points))) {
|
||||
return this.renderSymbolsWithAnimation();
|
||||
}
|
||||
return this.renderSymbolsStatically(points);
|
||||
}
|
||||
}, {
|
||||
key: "renderErrorBar",
|
||||
value: function renderErrorBar() {
|
||||
var isAnimationActive = this.props.isAnimationActive;
|
||||
if (isAnimationActive && !this.state.isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props4 = this.props,
|
||||
points = _this$props4.points,
|
||||
xAxis = _this$props4.xAxis,
|
||||
yAxis = _this$props4.yAxis,
|
||||
children = _this$props4.children;
|
||||
var errorBarItems = (0, _ReactUtils.findAllByType)(children, _ErrorBar.ErrorBar);
|
||||
if (!errorBarItems) {
|
||||
return null;
|
||||
}
|
||||
return errorBarItems.map(function (item, i) {
|
||||
var _item$props = item.props,
|
||||
direction = _item$props.direction,
|
||||
errorDataKey = _item$props.dataKey;
|
||||
return /*#__PURE__*/_react["default"].cloneElement(item, {
|
||||
key: "".concat(direction, "-").concat(errorDataKey, "-").concat(points[i]),
|
||||
data: points,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
layout: direction === 'x' ? 'vertical' : 'horizontal',
|
||||
dataPointFormatter: function dataPointFormatter(dataPoint, dataKey) {
|
||||
return {
|
||||
x: dataPoint.cx,
|
||||
y: dataPoint.cy,
|
||||
value: direction === 'x' ? +dataPoint.node.x : +dataPoint.node.y,
|
||||
errorVal: (0, _ChartUtils.getValueByDataKey)(dataPoint, dataKey)
|
||||
};
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderLine",
|
||||
value: function renderLine() {
|
||||
var _this$props5 = this.props,
|
||||
points = _this$props5.points,
|
||||
line = _this$props5.line,
|
||||
lineType = _this$props5.lineType,
|
||||
lineJointType = _this$props5.lineJointType;
|
||||
var scatterProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customLineProps = (0, _ReactUtils.filterProps)(line, false);
|
||||
var linePoints, lineItem;
|
||||
if (lineType === 'joint') {
|
||||
linePoints = points.map(function (entry) {
|
||||
return {
|
||||
x: entry.cx,
|
||||
y: entry.cy
|
||||
};
|
||||
});
|
||||
} else if (lineType === 'fitting') {
|
||||
var _getLinearRegression = (0, _DataUtils.getLinearRegression)(points),
|
||||
xmin = _getLinearRegression.xmin,
|
||||
xmax = _getLinearRegression.xmax,
|
||||
a = _getLinearRegression.a,
|
||||
b = _getLinearRegression.b;
|
||||
var linearExp = function linearExp(x) {
|
||||
return a * x + b;
|
||||
};
|
||||
linePoints = [{
|
||||
x: xmin,
|
||||
y: linearExp(xmin)
|
||||
}, {
|
||||
x: xmax,
|
||||
y: linearExp(xmax)
|
||||
}];
|
||||
}
|
||||
var lineProps = _objectSpread(_objectSpread(_objectSpread({}, scatterProps), {}, {
|
||||
fill: 'none',
|
||||
stroke: scatterProps && scatterProps.fill
|
||||
}, customLineProps), {}, {
|
||||
points: linePoints
|
||||
});
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(line)) {
|
||||
lineItem = /*#__PURE__*/_react["default"].cloneElement(line, lineProps);
|
||||
} else if ((0, _isFunction["default"])(line)) {
|
||||
lineItem = line(lineProps);
|
||||
} else {
|
||||
lineItem = /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, lineProps, {
|
||||
type: lineJointType
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-scatter-line",
|
||||
key: "recharts-scatter-line"
|
||||
}, lineItem);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props6 = this.props,
|
||||
hide = _this$props6.hide,
|
||||
points = _this$props6.points,
|
||||
line = _this$props6.line,
|
||||
className = _this$props6.className,
|
||||
xAxis = _this$props6.xAxis,
|
||||
yAxis = _this$props6.yAxis,
|
||||
left = _this$props6.left,
|
||||
top = _this$props6.top,
|
||||
width = _this$props6.width,
|
||||
height = _this$props6.height,
|
||||
id = _this$props6.id,
|
||||
isAnimationActive = _this$props6.isAnimationActive;
|
||||
if (hide || !points || !points.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var layerClass = (0, _clsx["default"])('recharts-scatter', className);
|
||||
var needClipX = xAxis && xAxis.allowDataOverflow;
|
||||
var needClipY = yAxis && yAxis.allowDataOverflow;
|
||||
var needClip = needClipX || needClipY;
|
||||
var clipPathId = (0, _isNil["default"])(id) ? this.id : id;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass,
|
||||
clipPath: needClip ? "url(#clipPath-".concat(clipPathId, ")") : null
|
||||
}, needClipX || needClipY ? /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("clipPath", {
|
||||
id: "clipPath-".concat(clipPathId)
|
||||
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
||||
x: needClipX ? left : left - width / 2,
|
||||
y: needClipY ? top : top - height / 2,
|
||||
width: needClipX ? width : width * 2,
|
||||
height: needClipY ? height : height * 2
|
||||
}))) : null, line && this.renderLine(), this.renderErrorBar(), /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
key: "recharts-scatter-symbols"
|
||||
}, this.renderSymbols()), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, points));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curPoints: nextProps.points,
|
||||
prevPoints: prevState.curPoints
|
||||
};
|
||||
}
|
||||
if (nextProps.points !== prevState.curPoints) {
|
||||
return {
|
||||
curPoints: nextProps.points
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_Scatter = Scatter;
|
||||
_defineProperty(Scatter, "displayName", 'Scatter');
|
||||
_defineProperty(Scatter, "defaultProps", {
|
||||
xAxisId: 0,
|
||||
yAxisId: 0,
|
||||
zAxisId: 0,
|
||||
legendType: 'circle',
|
||||
lineType: 'joint',
|
||||
lineJointType: 'linear',
|
||||
data: [],
|
||||
shape: 'circle',
|
||||
hide: false,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 400,
|
||||
animationEasing: 'linear'
|
||||
});
|
||||
/**
|
||||
* Compose the data of each group
|
||||
* @param {Object} xAxis The configuration of x-axis
|
||||
* @param {Object} yAxis The configuration of y-axis
|
||||
* @param {String} dataKey The unique key of a group
|
||||
* @return {Array} Composed data
|
||||
*/
|
||||
_defineProperty(Scatter, "getComposedData", function (_ref2) {
|
||||
var xAxis = _ref2.xAxis,
|
||||
yAxis = _ref2.yAxis,
|
||||
zAxis = _ref2.zAxis,
|
||||
item = _ref2.item,
|
||||
displayedData = _ref2.displayedData,
|
||||
xAxisTicks = _ref2.xAxisTicks,
|
||||
yAxisTicks = _ref2.yAxisTicks,
|
||||
offset = _ref2.offset;
|
||||
var tooltipType = item.props.tooltipType;
|
||||
var cells = (0, _ReactUtils.findAllByType)(item.props.children, _Cell.Cell);
|
||||
var xAxisDataKey = (0, _isNil["default"])(xAxis.dataKey) ? item.props.dataKey : xAxis.dataKey;
|
||||
var yAxisDataKey = (0, _isNil["default"])(yAxis.dataKey) ? item.props.dataKey : yAxis.dataKey;
|
||||
var zAxisDataKey = zAxis && zAxis.dataKey;
|
||||
var defaultRangeZ = zAxis ? zAxis.range : _ZAxis.ZAxis.defaultProps.range;
|
||||
var defaultZ = defaultRangeZ && defaultRangeZ[0];
|
||||
var xBandSize = xAxis.scale.bandwidth ? xAxis.scale.bandwidth() : 0;
|
||||
var yBandSize = yAxis.scale.bandwidth ? yAxis.scale.bandwidth() : 0;
|
||||
var points = displayedData.map(function (entry, index) {
|
||||
var x = (0, _ChartUtils.getValueByDataKey)(entry, xAxisDataKey);
|
||||
var y = (0, _ChartUtils.getValueByDataKey)(entry, yAxisDataKey);
|
||||
var z = !(0, _isNil["default"])(zAxisDataKey) && (0, _ChartUtils.getValueByDataKey)(entry, zAxisDataKey) || '-';
|
||||
var tooltipPayload = [{
|
||||
name: (0, _isNil["default"])(xAxis.dataKey) ? item.props.name : xAxis.name || xAxis.dataKey,
|
||||
unit: xAxis.unit || '',
|
||||
value: x,
|
||||
payload: entry,
|
||||
dataKey: xAxisDataKey,
|
||||
type: tooltipType
|
||||
}, {
|
||||
name: (0, _isNil["default"])(yAxis.dataKey) ? item.props.name : yAxis.name || yAxis.dataKey,
|
||||
unit: yAxis.unit || '',
|
||||
value: y,
|
||||
payload: entry,
|
||||
dataKey: yAxisDataKey,
|
||||
type: tooltipType
|
||||
}];
|
||||
if (z !== '-') {
|
||||
tooltipPayload.push({
|
||||
name: zAxis.name || zAxis.dataKey,
|
||||
unit: zAxis.unit || '',
|
||||
value: z,
|
||||
payload: entry,
|
||||
dataKey: zAxisDataKey,
|
||||
type: tooltipType
|
||||
});
|
||||
}
|
||||
var cx = (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: xAxis,
|
||||
ticks: xAxisTicks,
|
||||
bandSize: xBandSize,
|
||||
entry: entry,
|
||||
index: index,
|
||||
dataKey: xAxisDataKey
|
||||
});
|
||||
var cy = (0, _ChartUtils.getCateCoordinateOfLine)({
|
||||
axis: yAxis,
|
||||
ticks: yAxisTicks,
|
||||
bandSize: yBandSize,
|
||||
entry: entry,
|
||||
index: index,
|
||||
dataKey: yAxisDataKey
|
||||
});
|
||||
var size = z !== '-' ? zAxis.scale(z) : defaultZ;
|
||||
var radius = Math.sqrt(Math.max(size, 0) / Math.PI);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
x: cx - radius,
|
||||
y: cy - radius,
|
||||
xAxis: xAxis,
|
||||
yAxis: yAxis,
|
||||
zAxis: zAxis,
|
||||
width: 2 * radius,
|
||||
height: 2 * radius,
|
||||
size: size,
|
||||
node: {
|
||||
x: x,
|
||||
y: y,
|
||||
z: z
|
||||
},
|
||||
tooltipPayload: tooltipPayload,
|
||||
tooltipPosition: {
|
||||
x: cx,
|
||||
y: cy
|
||||
},
|
||||
payload: entry
|
||||
}, cells && cells[index] && cells[index].props);
|
||||
});
|
||||
return _objectSpread({
|
||||
points: points
|
||||
}, offset);
|
||||
});
|
||||
93
frontend/node_modules/recharts/lib/cartesian/XAxis.js
generated
vendored
Normal file
93
frontend/node_modules/recharts/lib/cartesian/XAxis.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.XAxis = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _chartLayoutContext = require("../context/chartLayoutContext");
|
||||
var _CartesianAxis = require("./CartesianAxis");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
||||
* @fileOverview X Axis
|
||||
*/
|
||||
/** Define of XAxis props */
|
||||
|
||||
function XAxisImpl(_ref) {
|
||||
var xAxisId = _ref.xAxisId;
|
||||
var width = (0, _chartLayoutContext.useChartWidth)();
|
||||
var height = (0, _chartLayoutContext.useChartHeight)();
|
||||
var axisOptions = (0, _chartLayoutContext.useXAxisOrThrow)(xAxisId);
|
||||
if (axisOptions == null) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.
|
||||
React.createElement(_CartesianAxis.CartesianAxis, _extends({}, axisOptions, {
|
||||
className: (0, _clsx["default"])("recharts-".concat(axisOptions.axisType, " ").concat(axisOptions.axisType), axisOptions.className),
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
ticksGenerator: function ticksGenerator(axis) {
|
||||
return (0, _ChartUtils.getTicksOfAxis)(axis, true);
|
||||
}
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var XAxis = exports.XAxis = /*#__PURE__*/function (_React$Component) {
|
||||
function XAxis() {
|
||||
_classCallCheck(this, XAxis);
|
||||
return _callSuper(this, XAxis, arguments);
|
||||
}
|
||||
_inherits(XAxis, _React$Component);
|
||||
return _createClass(XAxis, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/React.createElement(XAxisImpl, this.props);
|
||||
}
|
||||
}]);
|
||||
}(React.Component);
|
||||
_defineProperty(XAxis, "displayName", 'XAxis');
|
||||
_defineProperty(XAxis, "defaultProps", {
|
||||
allowDecimals: true,
|
||||
hide: false,
|
||||
orientation: 'bottom',
|
||||
width: 0,
|
||||
height: 30,
|
||||
mirror: false,
|
||||
xAxisId: 0,
|
||||
tickCount: 5,
|
||||
type: 'category',
|
||||
padding: {
|
||||
left: 0,
|
||||
right: 0
|
||||
},
|
||||
allowDataOverflow: false,
|
||||
scale: 'auto',
|
||||
reversed: false,
|
||||
allowDuplicatedCategory: true
|
||||
});
|
||||
91
frontend/node_modules/recharts/lib/cartesian/YAxis.js
generated
vendored
Normal file
91
frontend/node_modules/recharts/lib/cartesian/YAxis.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.YAxis = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _chartLayoutContext = require("../context/chartLayoutContext");
|
||||
var _CartesianAxis = require("./CartesianAxis");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
||||
* @fileOverview Y Axis
|
||||
*/
|
||||
var YAxisImpl = function YAxisImpl(_ref) {
|
||||
var yAxisId = _ref.yAxisId;
|
||||
var width = (0, _chartLayoutContext.useChartWidth)();
|
||||
var height = (0, _chartLayoutContext.useChartHeight)();
|
||||
var axisOptions = (0, _chartLayoutContext.useYAxisOrThrow)(yAxisId);
|
||||
if (axisOptions == null) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// @ts-expect-error the axisOptions type is not exactly what CartesianAxis is expecting.
|
||||
React.createElement(_CartesianAxis.CartesianAxis, _extends({}, axisOptions, {
|
||||
className: (0, _clsx["default"])("recharts-".concat(axisOptions.axisType, " ").concat(axisOptions.axisType), axisOptions.className),
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
ticksGenerator: function ticksGenerator(axis) {
|
||||
return (0, _ChartUtils.getTicksOfAxis)(axis, true);
|
||||
}
|
||||
}))
|
||||
);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var YAxis = exports.YAxis = /*#__PURE__*/function (_React$Component) {
|
||||
function YAxis() {
|
||||
_classCallCheck(this, YAxis);
|
||||
return _callSuper(this, YAxis, arguments);
|
||||
}
|
||||
_inherits(YAxis, _React$Component);
|
||||
return _createClass(YAxis, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return /*#__PURE__*/React.createElement(YAxisImpl, this.props);
|
||||
}
|
||||
}]);
|
||||
}(React.Component);
|
||||
_defineProperty(YAxis, "displayName", 'YAxis');
|
||||
_defineProperty(YAxis, "defaultProps", {
|
||||
allowDuplicatedCategory: true,
|
||||
allowDecimals: true,
|
||||
hide: false,
|
||||
orientation: 'left',
|
||||
width: 60,
|
||||
height: 0,
|
||||
mirror: false,
|
||||
yAxisId: 0,
|
||||
tickCount: 5,
|
||||
type: 'number',
|
||||
padding: {
|
||||
top: 0,
|
||||
bottom: 0
|
||||
},
|
||||
allowDataOverflow: false,
|
||||
scale: 'auto',
|
||||
reversed: false
|
||||
});
|
||||
46
frontend/node_modules/recharts/lib/cartesian/ZAxis.js
generated
vendored
Normal file
46
frontend/node_modules/recharts/lib/cartesian/ZAxis.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ZAxis = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Z Axis
|
||||
*/
|
||||
// eslint-disable-next-line react/prefer-stateless-function -- requires static defaultProps
|
||||
var ZAxis = exports.ZAxis = /*#__PURE__*/function (_React$Component) {
|
||||
function ZAxis() {
|
||||
_classCallCheck(this, ZAxis);
|
||||
return _callSuper(this, ZAxis, arguments);
|
||||
}
|
||||
_inherits(ZAxis, _React$Component);
|
||||
return _createClass(ZAxis, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(React.Component);
|
||||
_defineProperty(ZAxis, "displayName", 'ZAxis');
|
||||
_defineProperty(ZAxis, "defaultProps", {
|
||||
zAxisId: 0,
|
||||
range: [64, 64],
|
||||
scale: 'auto',
|
||||
type: 'number'
|
||||
});
|
||||
61
frontend/node_modules/recharts/lib/cartesian/getEquidistantTicks.js
generated
vendored
Normal file
61
frontend/node_modules/recharts/lib/cartesian/getEquidistantTicks.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getEquidistantTicks = getEquidistantTicks;
|
||||
var _TickUtils = require("../util/TickUtils");
|
||||
var _getEveryNthWithCondition = require("../util/getEveryNthWithCondition");
|
||||
function getEquidistantTicks(sign, boundaries, getTickSize, ticks, minTickGap) {
|
||||
var result = (ticks || []).slice();
|
||||
var initialStart = boundaries.start,
|
||||
end = boundaries.end;
|
||||
var index = 0;
|
||||
// Premature optimisation idea 1: Estimate a lower bound, and start from there.
|
||||
// For now, start from every tick
|
||||
var stepsize = 1;
|
||||
var start = initialStart;
|
||||
var _loop = function _loop() {
|
||||
// Given stepsize, evaluate whether every stepsize-th tick can be shown.
|
||||
// If it can not, then increase the stepsize by 1, and try again.
|
||||
|
||||
var entry = ticks === null || ticks === void 0 ? void 0 : ticks[index];
|
||||
|
||||
// Break condition - If we have evaluate all the ticks, then we are done.
|
||||
if (entry === undefined) {
|
||||
return {
|
||||
v: (0, _getEveryNthWithCondition.getEveryNthWithCondition)(ticks, stepsize)
|
||||
};
|
||||
}
|
||||
|
||||
// Check if the element collides with the next element
|
||||
var i = index;
|
||||
var size;
|
||||
var getSize = function getSize() {
|
||||
if (size === undefined) {
|
||||
size = getTickSize(entry, i);
|
||||
}
|
||||
return size;
|
||||
};
|
||||
var tickCoord = entry.coordinate;
|
||||
// We will always show the first tick.
|
||||
var isShow = index === 0 || (0, _TickUtils.isVisible)(sign, tickCoord, getSize, start, end);
|
||||
if (!isShow) {
|
||||
// Start all over with a larger stepsize
|
||||
index = 0;
|
||||
start = initialStart;
|
||||
stepsize += 1;
|
||||
}
|
||||
if (isShow) {
|
||||
// If it can be shown, update the start
|
||||
start = tickCoord + sign * (getSize() / 2 + minTickGap);
|
||||
index += stepsize;
|
||||
}
|
||||
},
|
||||
_ret;
|
||||
while (stepsize <= result.length) {
|
||||
_ret = _loop();
|
||||
if (_ret) return _ret.v;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
162
frontend/node_modules/recharts/lib/cartesian/getTicks.js
generated
vendored
Normal file
162
frontend/node_modules/recharts/lib/cartesian/getTicks.js
generated
vendored
Normal file
@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getTicks = getTicks;
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _DOMUtils = require("../util/DOMUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _TickUtils = require("../util/TickUtils");
|
||||
var _getEquidistantTicks = require("./getEquidistantTicks");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function getTicksEnd(sign, boundaries, getTickSize, ticks, minTickGap) {
|
||||
var result = (ticks || []).slice();
|
||||
var len = result.length;
|
||||
var start = boundaries.start;
|
||||
var end = boundaries.end;
|
||||
var _loop = function _loop(i) {
|
||||
var entry = result[i];
|
||||
var size;
|
||||
var getSize = function getSize() {
|
||||
if (size === undefined) {
|
||||
size = getTickSize(entry, i);
|
||||
}
|
||||
return size;
|
||||
};
|
||||
if (i === len - 1) {
|
||||
var gap = sign * (entry.coordinate + sign * getSize() / 2 - end);
|
||||
result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
tickCoord: gap > 0 ? entry.coordinate - gap * sign : entry.coordinate
|
||||
});
|
||||
} else {
|
||||
result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
tickCoord: entry.coordinate
|
||||
});
|
||||
}
|
||||
var isShow = (0, _TickUtils.isVisible)(sign, entry.tickCoord, getSize, start, end);
|
||||
if (isShow) {
|
||||
end = entry.tickCoord - sign * (getSize() / 2 + minTickGap);
|
||||
result[i] = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
isShow: true
|
||||
});
|
||||
}
|
||||
};
|
||||
for (var i = len - 1; i >= 0; i--) {
|
||||
_loop(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getTicksStart(sign, boundaries, getTickSize, ticks, minTickGap, preserveEnd) {
|
||||
var result = (ticks || []).slice();
|
||||
var len = result.length;
|
||||
var start = boundaries.start,
|
||||
end = boundaries.end;
|
||||
if (preserveEnd) {
|
||||
// Try to guarantee the tail to be displayed
|
||||
var tail = ticks[len - 1];
|
||||
var tailSize = getTickSize(tail, len - 1);
|
||||
var tailGap = sign * (tail.coordinate + sign * tailSize / 2 - end);
|
||||
result[len - 1] = tail = _objectSpread(_objectSpread({}, tail), {}, {
|
||||
tickCoord: tailGap > 0 ? tail.coordinate - tailGap * sign : tail.coordinate
|
||||
});
|
||||
var isTailShow = (0, _TickUtils.isVisible)(sign, tail.tickCoord, function () {
|
||||
return tailSize;
|
||||
}, start, end);
|
||||
if (isTailShow) {
|
||||
end = tail.tickCoord - sign * (tailSize / 2 + minTickGap);
|
||||
result[len - 1] = _objectSpread(_objectSpread({}, tail), {}, {
|
||||
isShow: true
|
||||
});
|
||||
}
|
||||
}
|
||||
var count = preserveEnd ? len - 1 : len;
|
||||
var _loop2 = function _loop2(i) {
|
||||
var entry = result[i];
|
||||
var size;
|
||||
var getSize = function getSize() {
|
||||
if (size === undefined) {
|
||||
size = getTickSize(entry, i);
|
||||
}
|
||||
return size;
|
||||
};
|
||||
if (i === 0) {
|
||||
var gap = sign * (entry.coordinate - sign * getSize() / 2 - start);
|
||||
result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
tickCoord: gap < 0 ? entry.coordinate - gap * sign : entry.coordinate
|
||||
});
|
||||
} else {
|
||||
result[i] = entry = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
tickCoord: entry.coordinate
|
||||
});
|
||||
}
|
||||
var isShow = (0, _TickUtils.isVisible)(sign, entry.tickCoord, getSize, start, end);
|
||||
if (isShow) {
|
||||
start = entry.tickCoord + sign * (getSize() / 2 + minTickGap);
|
||||
result[i] = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
isShow: true
|
||||
});
|
||||
}
|
||||
};
|
||||
for (var i = 0; i < count; i++) {
|
||||
_loop2(i);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getTicks(props, fontSize, letterSpacing) {
|
||||
var tick = props.tick,
|
||||
ticks = props.ticks,
|
||||
viewBox = props.viewBox,
|
||||
minTickGap = props.minTickGap,
|
||||
orientation = props.orientation,
|
||||
interval = props.interval,
|
||||
tickFormatter = props.tickFormatter,
|
||||
unit = props.unit,
|
||||
angle = props.angle;
|
||||
if (!ticks || !ticks.length || !tick) {
|
||||
return [];
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(interval) || _Global.Global.isSsr) {
|
||||
return (0, _TickUtils.getNumberIntervalTicks)(ticks, typeof interval === 'number' && (0, _DataUtils.isNumber)(interval) ? interval : 0);
|
||||
}
|
||||
var candidates = [];
|
||||
var sizeKey = orientation === 'top' || orientation === 'bottom' ? 'width' : 'height';
|
||||
var unitSize = unit && sizeKey === 'width' ? (0, _DOMUtils.getStringSize)(unit, {
|
||||
fontSize: fontSize,
|
||||
letterSpacing: letterSpacing
|
||||
}) : {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
var getTickSize = function getTickSize(content, index) {
|
||||
var value = (0, _isFunction["default"])(tickFormatter) ? tickFormatter(content.value, index) : content.value;
|
||||
// Recharts only supports angles when sizeKey === 'width'
|
||||
return sizeKey === 'width' ? (0, _TickUtils.getAngledTickWidth)((0, _DOMUtils.getStringSize)(value, {
|
||||
fontSize: fontSize,
|
||||
letterSpacing: letterSpacing
|
||||
}), unitSize, angle) : (0, _DOMUtils.getStringSize)(value, {
|
||||
fontSize: fontSize,
|
||||
letterSpacing: letterSpacing
|
||||
})[sizeKey];
|
||||
};
|
||||
var sign = ticks.length >= 2 ? (0, _DataUtils.mathSign)(ticks[1].coordinate - ticks[0].coordinate) : 1;
|
||||
var boundaries = (0, _TickUtils.getTickBoundaries)(viewBox, sign, sizeKey);
|
||||
if (interval === 'equidistantPreserveStart') {
|
||||
return (0, _getEquidistantTicks.getEquidistantTicks)(sign, boundaries, getTickSize, ticks, minTickGap);
|
||||
}
|
||||
if (interval === 'preserveStart' || interval === 'preserveStartEnd') {
|
||||
candidates = getTicksStart(sign, boundaries, getTickSize, ticks, minTickGap, interval === 'preserveStartEnd');
|
||||
} else {
|
||||
candidates = getTicksEnd(sign, boundaries, getTickSize, ticks, minTickGap);
|
||||
}
|
||||
return candidates.filter(function (entry) {
|
||||
return entry.isShow;
|
||||
});
|
||||
}
|
||||
116
frontend/node_modules/recharts/lib/chart/AccessibilityManager.js
generated
vendored
Normal file
116
frontend/node_modules/recharts/lib/chart/AccessibilityManager.js
generated
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AccessibilityManager = void 0;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var AccessibilityManager = exports.AccessibilityManager = /*#__PURE__*/function () {
|
||||
function AccessibilityManager() {
|
||||
_classCallCheck(this, AccessibilityManager);
|
||||
_defineProperty(this, "activeIndex", 0);
|
||||
_defineProperty(this, "coordinateList", []);
|
||||
_defineProperty(this, "layout", 'horizontal');
|
||||
}
|
||||
return _createClass(AccessibilityManager, [{
|
||||
key: "setDetails",
|
||||
value: function setDetails(_ref) {
|
||||
var _ref2;
|
||||
var _ref$coordinateList = _ref.coordinateList,
|
||||
coordinateList = _ref$coordinateList === void 0 ? null : _ref$coordinateList,
|
||||
_ref$container = _ref.container,
|
||||
container = _ref$container === void 0 ? null : _ref$container,
|
||||
_ref$layout = _ref.layout,
|
||||
layout = _ref$layout === void 0 ? null : _ref$layout,
|
||||
_ref$offset = _ref.offset,
|
||||
offset = _ref$offset === void 0 ? null : _ref$offset,
|
||||
_ref$mouseHandlerCall = _ref.mouseHandlerCallback,
|
||||
mouseHandlerCallback = _ref$mouseHandlerCall === void 0 ? null : _ref$mouseHandlerCall;
|
||||
this.coordinateList = (_ref2 = coordinateList !== null && coordinateList !== void 0 ? coordinateList : this.coordinateList) !== null && _ref2 !== void 0 ? _ref2 : [];
|
||||
this.container = container !== null && container !== void 0 ? container : this.container;
|
||||
this.layout = layout !== null && layout !== void 0 ? layout : this.layout;
|
||||
this.offset = offset !== null && offset !== void 0 ? offset : this.offset;
|
||||
this.mouseHandlerCallback = mouseHandlerCallback !== null && mouseHandlerCallback !== void 0 ? mouseHandlerCallback : this.mouseHandlerCallback;
|
||||
|
||||
// Keep activeIndex in the bounds between 0 and the last coordinate index
|
||||
this.activeIndex = Math.min(Math.max(this.activeIndex, 0), this.coordinateList.length - 1);
|
||||
}
|
||||
}, {
|
||||
key: "focus",
|
||||
value: function focus() {
|
||||
this.spoofMouse();
|
||||
}
|
||||
}, {
|
||||
key: "keyboardEvent",
|
||||
value: function keyboardEvent(e) {
|
||||
// The AccessibilityManager relies on the Tooltip component. When tooltips suddenly stop existing,
|
||||
// it can cause errors. We use this function to check. We don't want arrow keys to be processed
|
||||
// if there are no tooltips, since that will cause unexpected behavior of users.
|
||||
if (this.coordinateList.length === 0) {
|
||||
return;
|
||||
}
|
||||
switch (e.key) {
|
||||
case 'ArrowRight':
|
||||
{
|
||||
if (this.layout !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
this.activeIndex = Math.min(this.activeIndex + 1, this.coordinateList.length - 1);
|
||||
this.spoofMouse();
|
||||
break;
|
||||
}
|
||||
case 'ArrowLeft':
|
||||
{
|
||||
if (this.layout !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
this.activeIndex = Math.max(this.activeIndex - 1, 0);
|
||||
this.spoofMouse();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "setIndex",
|
||||
value: function setIndex(newIndex) {
|
||||
this.activeIndex = newIndex;
|
||||
}
|
||||
}, {
|
||||
key: "spoofMouse",
|
||||
value: function spoofMouse() {
|
||||
var _window, _window2;
|
||||
if (this.layout !== 'horizontal') {
|
||||
return;
|
||||
}
|
||||
|
||||
// This can happen when the tooltips suddenly stop existing as children of the component
|
||||
// That update doesn't otherwise fire events, so we have to double check here.
|
||||
if (this.coordinateList.length === 0) {
|
||||
return;
|
||||
}
|
||||
var _this$container$getBo = this.container.getBoundingClientRect(),
|
||||
x = _this$container$getBo.x,
|
||||
y = _this$container$getBo.y,
|
||||
height = _this$container$getBo.height;
|
||||
var coordinate = this.coordinateList[this.activeIndex].coordinate;
|
||||
var scrollOffsetX = ((_window = window) === null || _window === void 0 ? void 0 : _window.scrollX) || 0;
|
||||
var scrollOffsetY = ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) || 0;
|
||||
var pageX = x + coordinate + scrollOffsetX;
|
||||
var pageY = y + this.offset.top + height / 2 + scrollOffsetY;
|
||||
this.mouseHandlerCallback({
|
||||
pageX: pageX,
|
||||
pageY: pageY
|
||||
});
|
||||
}
|
||||
}]);
|
||||
}();
|
||||
27
frontend/node_modules/recharts/lib/chart/AreaChart.js
generated
vendored
Normal file
27
frontend/node_modules/recharts/lib/chart/AreaChart.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AreaChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Area = require("../cartesian/Area");
|
||||
var _XAxis = require("../cartesian/XAxis");
|
||||
var _YAxis = require("../cartesian/YAxis");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
/**
|
||||
* @fileOverview Area Chart
|
||||
*/
|
||||
|
||||
var AreaChart = exports.AreaChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'AreaChart',
|
||||
GraphicalChild: _Area.Area,
|
||||
axisComponents: [{
|
||||
axisType: 'xAxis',
|
||||
AxisComp: _XAxis.XAxis
|
||||
}, {
|
||||
axisType: 'yAxis',
|
||||
AxisComp: _YAxis.YAxis
|
||||
}],
|
||||
formatAxisMap: _CartesianUtils.formatAxisMap
|
||||
});
|
||||
29
frontend/node_modules/recharts/lib/chart/BarChart.js
generated
vendored
Normal file
29
frontend/node_modules/recharts/lib/chart/BarChart.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BarChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Bar = require("../cartesian/Bar");
|
||||
var _XAxis = require("../cartesian/XAxis");
|
||||
var _YAxis = require("../cartesian/YAxis");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
/**
|
||||
* @fileOverview Bar Chart
|
||||
*/
|
||||
|
||||
var BarChart = exports.BarChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'BarChart',
|
||||
GraphicalChild: _Bar.Bar,
|
||||
defaultTooltipEventType: 'axis',
|
||||
validateTooltipEventTypes: ['axis', 'item'],
|
||||
axisComponents: [{
|
||||
axisType: 'xAxis',
|
||||
AxisComp: _XAxis.XAxis
|
||||
}, {
|
||||
axisType: 'yAxis',
|
||||
AxisComp: _YAxis.YAxis
|
||||
}],
|
||||
formatAxisMap: _CartesianUtils.formatAxisMap
|
||||
});
|
||||
34
frontend/node_modules/recharts/lib/chart/ComposedChart.js
generated
vendored
Normal file
34
frontend/node_modules/recharts/lib/chart/ComposedChart.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ComposedChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Area = require("../cartesian/Area");
|
||||
var _Bar = require("../cartesian/Bar");
|
||||
var _Line = require("../cartesian/Line");
|
||||
var _Scatter = require("../cartesian/Scatter");
|
||||
var _XAxis = require("../cartesian/XAxis");
|
||||
var _YAxis = require("../cartesian/YAxis");
|
||||
var _ZAxis = require("../cartesian/ZAxis");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
/**
|
||||
* @fileOverview Composed Chart
|
||||
*/
|
||||
|
||||
var ComposedChart = exports.ComposedChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'ComposedChart',
|
||||
GraphicalChild: [_Line.Line, _Area.Area, _Bar.Bar, _Scatter.Scatter],
|
||||
axisComponents: [{
|
||||
axisType: 'xAxis',
|
||||
AxisComp: _XAxis.XAxis
|
||||
}, {
|
||||
axisType: 'yAxis',
|
||||
AxisComp: _YAxis.YAxis
|
||||
}, {
|
||||
axisType: 'zAxis',
|
||||
AxisComp: _ZAxis.ZAxis
|
||||
}],
|
||||
formatAxisMap: _CartesianUtils.formatAxisMap
|
||||
});
|
||||
22
frontend/node_modules/recharts/lib/chart/FunnelChart.js
generated
vendored
Normal file
22
frontend/node_modules/recharts/lib/chart/FunnelChart.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FunnelChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Funnel = require("../numberAxis/Funnel");
|
||||
/**
|
||||
* @fileOverview Funnel Chart
|
||||
*/
|
||||
|
||||
var FunnelChart = exports.FunnelChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'FunnelChart',
|
||||
GraphicalChild: _Funnel.Funnel,
|
||||
validateTooltipEventTypes: ['item'],
|
||||
defaultTooltipEventType: 'item',
|
||||
axisComponents: [],
|
||||
defaultProps: {
|
||||
layout: 'centric'
|
||||
}
|
||||
});
|
||||
27
frontend/node_modules/recharts/lib/chart/LineChart.js
generated
vendored
Normal file
27
frontend/node_modules/recharts/lib/chart/LineChart.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.LineChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Line = require("../cartesian/Line");
|
||||
var _XAxis = require("../cartesian/XAxis");
|
||||
var _YAxis = require("../cartesian/YAxis");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
/**
|
||||
* @fileOverview Line Chart
|
||||
*/
|
||||
|
||||
var LineChart = exports.LineChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'LineChart',
|
||||
GraphicalChild: _Line.Line,
|
||||
axisComponents: [{
|
||||
axisType: 'xAxis',
|
||||
AxisComp: _XAxis.XAxis
|
||||
}, {
|
||||
axisType: 'yAxis',
|
||||
AxisComp: _YAxis.YAxis
|
||||
}],
|
||||
formatAxisMap: _CartesianUtils.formatAxisMap
|
||||
});
|
||||
39
frontend/node_modules/recharts/lib/chart/PieChart.js
generated
vendored
Normal file
39
frontend/node_modules/recharts/lib/chart/PieChart.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PieChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _PolarAngleAxis = require("../polar/PolarAngleAxis");
|
||||
var _PolarRadiusAxis = require("../polar/PolarRadiusAxis");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _Pie = require("../polar/Pie");
|
||||
/**
|
||||
* @fileOverview Pie Chart
|
||||
*/
|
||||
|
||||
var PieChart = exports.PieChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'PieChart',
|
||||
GraphicalChild: _Pie.Pie,
|
||||
validateTooltipEventTypes: ['item'],
|
||||
defaultTooltipEventType: 'item',
|
||||
legendContent: 'children',
|
||||
axisComponents: [{
|
||||
axisType: 'angleAxis',
|
||||
AxisComp: _PolarAngleAxis.PolarAngleAxis
|
||||
}, {
|
||||
axisType: 'radiusAxis',
|
||||
AxisComp: _PolarRadiusAxis.PolarRadiusAxis
|
||||
}],
|
||||
formatAxisMap: _PolarUtils.formatAxisMap,
|
||||
defaultProps: {
|
||||
layout: 'centric',
|
||||
startAngle: 0,
|
||||
endAngle: 360,
|
||||
cx: '50%',
|
||||
cy: '50%',
|
||||
innerRadius: 0,
|
||||
outerRadius: '80%'
|
||||
}
|
||||
});
|
||||
36
frontend/node_modules/recharts/lib/chart/RadarChart.js
generated
vendored
Normal file
36
frontend/node_modules/recharts/lib/chart/RadarChart.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RadarChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Radar = require("../polar/Radar");
|
||||
var _PolarAngleAxis = require("../polar/PolarAngleAxis");
|
||||
var _PolarRadiusAxis = require("../polar/PolarRadiusAxis");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
/**
|
||||
* @fileOverview Radar Chart
|
||||
*/
|
||||
|
||||
var RadarChart = exports.RadarChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'RadarChart',
|
||||
GraphicalChild: _Radar.Radar,
|
||||
axisComponents: [{
|
||||
axisType: 'angleAxis',
|
||||
AxisComp: _PolarAngleAxis.PolarAngleAxis
|
||||
}, {
|
||||
axisType: 'radiusAxis',
|
||||
AxisComp: _PolarRadiusAxis.PolarRadiusAxis
|
||||
}],
|
||||
formatAxisMap: _PolarUtils.formatAxisMap,
|
||||
defaultProps: {
|
||||
layout: 'centric',
|
||||
startAngle: 90,
|
||||
endAngle: -270,
|
||||
cx: '50%',
|
||||
cy: '50%',
|
||||
innerRadius: 0,
|
||||
outerRadius: '80%'
|
||||
}
|
||||
});
|
||||
39
frontend/node_modules/recharts/lib/chart/RadialBarChart.js
generated
vendored
Normal file
39
frontend/node_modules/recharts/lib/chart/RadialBarChart.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RadialBarChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _PolarAngleAxis = require("../polar/PolarAngleAxis");
|
||||
var _PolarRadiusAxis = require("../polar/PolarRadiusAxis");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _RadialBar = require("../polar/RadialBar");
|
||||
/**
|
||||
* @fileOverview Radar Bar Chart
|
||||
*/
|
||||
|
||||
var RadialBarChart = exports.RadialBarChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'RadialBarChart',
|
||||
GraphicalChild: _RadialBar.RadialBar,
|
||||
legendContent: 'children',
|
||||
defaultTooltipEventType: 'axis',
|
||||
validateTooltipEventTypes: ['axis', 'item'],
|
||||
axisComponents: [{
|
||||
axisType: 'angleAxis',
|
||||
AxisComp: _PolarAngleAxis.PolarAngleAxis
|
||||
}, {
|
||||
axisType: 'radiusAxis',
|
||||
AxisComp: _PolarRadiusAxis.PolarRadiusAxis
|
||||
}],
|
||||
formatAxisMap: _PolarUtils.formatAxisMap,
|
||||
defaultProps: {
|
||||
layout: 'radial',
|
||||
startAngle: 0,
|
||||
endAngle: 360,
|
||||
cx: '50%',
|
||||
cy: '50%',
|
||||
innerRadius: 0,
|
||||
outerRadius: '80%'
|
||||
}
|
||||
});
|
||||
676
frontend/node_modules/recharts/lib/chart/Sankey.js
generated
vendored
Normal file
676
frontend/node_modules/recharts/lib/chart/Sankey.js
generated
vendored
Normal file
@ -0,0 +1,676 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Sankey = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _maxBy = _interopRequireDefault(require("lodash/maxBy"));
|
||||
var _min = _interopRequireDefault(require("lodash/min"));
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _sumBy = _interopRequireDefault(require("lodash/sumBy"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Surface = require("../container/Surface");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Tooltip = require("../component/Tooltip");
|
||||
var _Rectangle = require("../shape/Rectangle");
|
||||
var _ShallowEqual = require("../util/ShallowEqual");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _excluded = ["width", "height", "className", "style", "children"],
|
||||
_excluded2 = ["sourceX", "sourceY", "sourceControlX", "targetX", "targetY", "targetControlX", "linkWidth"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @file TreemapChart
|
||||
*/
|
||||
var defaultCoordinateOfTooltip = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
var interpolationGenerator = function interpolationGenerator(a, b) {
|
||||
var ka = +a;
|
||||
var kb = b - ka;
|
||||
return function (t) {
|
||||
return ka + kb * t;
|
||||
};
|
||||
};
|
||||
var centerY = function centerY(node) {
|
||||
return node.y + node.dy / 2;
|
||||
};
|
||||
var getValue = function getValue(entry) {
|
||||
return entry && entry.value || 0;
|
||||
};
|
||||
var getSumOfIds = function getSumOfIds(links, ids) {
|
||||
return ids.reduce(function (result, id) {
|
||||
return result + getValue(links[id]);
|
||||
}, 0);
|
||||
};
|
||||
var getSumWithWeightedSource = function getSumWithWeightedSource(tree, links, ids) {
|
||||
return ids.reduce(function (result, id) {
|
||||
var link = links[id];
|
||||
var sourceNode = tree[link.source];
|
||||
return result + centerY(sourceNode) * getValue(links[id]);
|
||||
}, 0);
|
||||
};
|
||||
var getSumWithWeightedTarget = function getSumWithWeightedTarget(tree, links, ids) {
|
||||
return ids.reduce(function (result, id) {
|
||||
var link = links[id];
|
||||
var targetNode = tree[link.target];
|
||||
return result + centerY(targetNode) * getValue(links[id]);
|
||||
}, 0);
|
||||
};
|
||||
var ascendingY = function ascendingY(a, b) {
|
||||
return a.y - b.y;
|
||||
};
|
||||
var searchTargetsAndSources = function searchTargetsAndSources(links, id) {
|
||||
var sourceNodes = [];
|
||||
var sourceLinks = [];
|
||||
var targetNodes = [];
|
||||
var targetLinks = [];
|
||||
for (var i = 0, len = links.length; i < len; i++) {
|
||||
var link = links[i];
|
||||
if (link.source === id) {
|
||||
targetNodes.push(link.target);
|
||||
targetLinks.push(i);
|
||||
}
|
||||
if (link.target === id) {
|
||||
sourceNodes.push(link.source);
|
||||
sourceLinks.push(i);
|
||||
}
|
||||
}
|
||||
return {
|
||||
sourceNodes: sourceNodes,
|
||||
sourceLinks: sourceLinks,
|
||||
targetLinks: targetLinks,
|
||||
targetNodes: targetNodes
|
||||
};
|
||||
};
|
||||
var updateDepthOfTargets = function updateDepthOfTargets(tree, curNode) {
|
||||
var targetNodes = curNode.targetNodes;
|
||||
for (var i = 0, len = targetNodes.length; i < len; i++) {
|
||||
var target = tree[targetNodes[i]];
|
||||
if (target) {
|
||||
target.depth = Math.max(curNode.depth + 1, target.depth);
|
||||
updateDepthOfTargets(tree, target);
|
||||
}
|
||||
}
|
||||
};
|
||||
var getNodesTree = function getNodesTree(_ref, width, nodeWidth) {
|
||||
var nodes = _ref.nodes,
|
||||
links = _ref.links;
|
||||
var tree = nodes.map(function (entry, index) {
|
||||
var result = searchTargetsAndSources(links, index);
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, entry), result), {}, {
|
||||
value: Math.max(getSumOfIds(links, result.sourceLinks), getSumOfIds(links, result.targetLinks)),
|
||||
depth: 0
|
||||
});
|
||||
});
|
||||
for (var i = 0, len = tree.length; i < len; i++) {
|
||||
var node = tree[i];
|
||||
if (!node.sourceNodes.length) {
|
||||
updateDepthOfTargets(tree, node);
|
||||
}
|
||||
}
|
||||
var maxDepth = (0, _maxBy["default"])(tree, function (entry) {
|
||||
return entry.depth;
|
||||
}).depth;
|
||||
if (maxDepth >= 1) {
|
||||
var childWidth = (width - nodeWidth) / maxDepth;
|
||||
for (var _i = 0, _len = tree.length; _i < _len; _i++) {
|
||||
var _node = tree[_i];
|
||||
if (!_node.targetNodes.length) {
|
||||
_node.depth = maxDepth;
|
||||
}
|
||||
_node.x = _node.depth * childWidth;
|
||||
_node.dx = nodeWidth;
|
||||
}
|
||||
}
|
||||
return {
|
||||
tree: tree,
|
||||
maxDepth: maxDepth
|
||||
};
|
||||
};
|
||||
var getDepthTree = function getDepthTree(tree) {
|
||||
var result = [];
|
||||
for (var i = 0, len = tree.length; i < len; i++) {
|
||||
var node = tree[i];
|
||||
if (!result[node.depth]) {
|
||||
result[node.depth] = [];
|
||||
}
|
||||
result[node.depth].push(node);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
var updateYOfTree = function updateYOfTree(depthTree, height, nodePadding, links) {
|
||||
var yRatio = (0, _min["default"])(depthTree.map(function (nodes) {
|
||||
return (height - (nodes.length - 1) * nodePadding) / (0, _sumBy["default"])(nodes, getValue);
|
||||
}));
|
||||
for (var d = 0, maxDepth = depthTree.length; d < maxDepth; d++) {
|
||||
for (var i = 0, len = depthTree[d].length; i < len; i++) {
|
||||
var node = depthTree[d][i];
|
||||
node.y = i;
|
||||
node.dy = node.value * yRatio;
|
||||
}
|
||||
}
|
||||
return links.map(function (link) {
|
||||
return _objectSpread(_objectSpread({}, link), {}, {
|
||||
dy: getValue(link) * yRatio
|
||||
});
|
||||
});
|
||||
};
|
||||
var resolveCollisions = function resolveCollisions(depthTree, height, nodePadding) {
|
||||
var sort = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
||||
for (var i = 0, len = depthTree.length; i < len; i++) {
|
||||
var nodes = depthTree[i];
|
||||
var n = nodes.length;
|
||||
|
||||
// Sort by the value of y
|
||||
if (sort) {
|
||||
nodes.sort(ascendingY);
|
||||
}
|
||||
var y0 = 0;
|
||||
for (var j = 0; j < n; j++) {
|
||||
var node = nodes[j];
|
||||
var dy = y0 - node.y;
|
||||
if (dy > 0) {
|
||||
node.y += dy;
|
||||
}
|
||||
y0 = node.y + node.dy + nodePadding;
|
||||
}
|
||||
y0 = height + nodePadding;
|
||||
for (var _j = n - 1; _j >= 0; _j--) {
|
||||
var _node2 = nodes[_j];
|
||||
var _dy = _node2.y + _node2.dy + nodePadding - y0;
|
||||
if (_dy > 0) {
|
||||
_node2.y -= _dy;
|
||||
y0 = _node2.y;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var relaxLeftToRight = function relaxLeftToRight(tree, depthTree, links, alpha) {
|
||||
for (var i = 0, maxDepth = depthTree.length; i < maxDepth; i++) {
|
||||
var nodes = depthTree[i];
|
||||
for (var j = 0, len = nodes.length; j < len; j++) {
|
||||
var node = nodes[j];
|
||||
if (node.sourceLinks.length) {
|
||||
var sourceSum = getSumOfIds(links, node.sourceLinks);
|
||||
var weightedSum = getSumWithWeightedSource(tree, links, node.sourceLinks);
|
||||
var y = weightedSum / sourceSum;
|
||||
node.y += (y - centerY(node)) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var relaxRightToLeft = function relaxRightToLeft(tree, depthTree, links, alpha) {
|
||||
for (var i = depthTree.length - 1; i >= 0; i--) {
|
||||
var nodes = depthTree[i];
|
||||
for (var j = 0, len = nodes.length; j < len; j++) {
|
||||
var node = nodes[j];
|
||||
if (node.targetLinks.length) {
|
||||
var targetSum = getSumOfIds(links, node.targetLinks);
|
||||
var weightedSum = getSumWithWeightedTarget(tree, links, node.targetLinks);
|
||||
var y = weightedSum / targetSum;
|
||||
node.y += (y - centerY(node)) * alpha;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var updateYOfLinks = function updateYOfLinks(tree, links) {
|
||||
for (var i = 0, len = tree.length; i < len; i++) {
|
||||
var node = tree[i];
|
||||
var sy = 0;
|
||||
var ty = 0;
|
||||
node.targetLinks.sort(function (a, b) {
|
||||
return tree[links[a].target].y - tree[links[b].target].y;
|
||||
});
|
||||
node.sourceLinks.sort(function (a, b) {
|
||||
return tree[links[a].source].y - tree[links[b].source].y;
|
||||
});
|
||||
for (var j = 0, tLen = node.targetLinks.length; j < tLen; j++) {
|
||||
var link = links[node.targetLinks[j]];
|
||||
if (link) {
|
||||
link.sy = sy;
|
||||
sy += link.dy;
|
||||
}
|
||||
}
|
||||
for (var _j2 = 0, sLen = node.sourceLinks.length; _j2 < sLen; _j2++) {
|
||||
var _link = links[node.sourceLinks[_j2]];
|
||||
if (_link) {
|
||||
_link.ty = ty;
|
||||
ty += _link.dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var computeData = function computeData(_ref2) {
|
||||
var data = _ref2.data,
|
||||
width = _ref2.width,
|
||||
height = _ref2.height,
|
||||
iterations = _ref2.iterations,
|
||||
nodeWidth = _ref2.nodeWidth,
|
||||
nodePadding = _ref2.nodePadding,
|
||||
sort = _ref2.sort;
|
||||
var links = data.links;
|
||||
var _getNodesTree = getNodesTree(data, width, nodeWidth),
|
||||
tree = _getNodesTree.tree;
|
||||
var depthTree = getDepthTree(tree);
|
||||
var newLinks = updateYOfTree(depthTree, height, nodePadding, links);
|
||||
resolveCollisions(depthTree, height, nodePadding, sort);
|
||||
var alpha = 1;
|
||||
for (var i = 1; i <= iterations; i++) {
|
||||
relaxRightToLeft(tree, depthTree, newLinks, alpha *= 0.99);
|
||||
resolveCollisions(depthTree, height, nodePadding, sort);
|
||||
relaxLeftToRight(tree, depthTree, newLinks, alpha);
|
||||
resolveCollisions(depthTree, height, nodePadding, sort);
|
||||
}
|
||||
updateYOfLinks(tree, newLinks);
|
||||
return {
|
||||
nodes: tree,
|
||||
links: newLinks
|
||||
};
|
||||
};
|
||||
var getCoordinateOfTooltip = function getCoordinateOfTooltip(el, type) {
|
||||
if (type === 'node') {
|
||||
return {
|
||||
x: el.x + el.width / 2,
|
||||
y: el.y + el.height / 2
|
||||
};
|
||||
}
|
||||
return {
|
||||
x: (el.sourceX + el.targetX) / 2,
|
||||
y: (el.sourceY + el.targetY) / 2
|
||||
};
|
||||
};
|
||||
var getPayloadOfTooltip = function getPayloadOfTooltip(el, type, nameKey) {
|
||||
var payload = el.payload;
|
||||
if (type === 'node') {
|
||||
return [{
|
||||
payload: el,
|
||||
name: (0, _ChartUtils.getValueByDataKey)(payload, nameKey, ''),
|
||||
value: (0, _ChartUtils.getValueByDataKey)(payload, 'value')
|
||||
}];
|
||||
}
|
||||
if (payload.source && payload.target) {
|
||||
var sourceName = (0, _ChartUtils.getValueByDataKey)(payload.source, nameKey, '');
|
||||
var targetName = (0, _ChartUtils.getValueByDataKey)(payload.target, nameKey, '');
|
||||
return [{
|
||||
payload: el,
|
||||
name: "".concat(sourceName, " - ").concat(targetName),
|
||||
value: (0, _ChartUtils.getValueByDataKey)(payload, 'value')
|
||||
}];
|
||||
}
|
||||
return [];
|
||||
};
|
||||
var Sankey = exports.Sankey = /*#__PURE__*/function (_PureComponent) {
|
||||
function Sankey() {
|
||||
var _this;
|
||||
_classCallCheck(this, Sankey);
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Sankey, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
activeElement: null,
|
||||
activeElementType: null,
|
||||
isTooltipActive: false,
|
||||
nodes: [],
|
||||
links: []
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Sankey, _PureComponent);
|
||||
return _createClass(Sankey, [{
|
||||
key: "handleMouseEnter",
|
||||
value: function handleMouseEnter(el, type, e) {
|
||||
var _this$props = this.props,
|
||||
onMouseEnter = _this$props.onMouseEnter,
|
||||
children = _this$props.children;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (tooltipItem) {
|
||||
this.setState(function (prev) {
|
||||
if (tooltipItem.props.trigger === 'hover') {
|
||||
return _objectSpread(_objectSpread({}, prev), {}, {
|
||||
activeElement: el,
|
||||
activeElementType: type,
|
||||
isTooltipActive: true
|
||||
});
|
||||
}
|
||||
return prev;
|
||||
}, function () {
|
||||
if (onMouseEnter) {
|
||||
onMouseEnter(el, type, e);
|
||||
}
|
||||
});
|
||||
} else if (onMouseEnter) {
|
||||
onMouseEnter(el, type, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleMouseLeave",
|
||||
value: function handleMouseLeave(el, type, e) {
|
||||
var _this$props2 = this.props,
|
||||
onMouseLeave = _this$props2.onMouseLeave,
|
||||
children = _this$props2.children;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (tooltipItem) {
|
||||
this.setState(function (prev) {
|
||||
if (tooltipItem.props.trigger === 'hover') {
|
||||
return _objectSpread(_objectSpread({}, prev), {}, {
|
||||
activeElement: undefined,
|
||||
activeElementType: undefined,
|
||||
isTooltipActive: false
|
||||
});
|
||||
}
|
||||
return prev;
|
||||
}, function () {
|
||||
if (onMouseLeave) {
|
||||
onMouseLeave(el, type, e);
|
||||
}
|
||||
});
|
||||
} else if (onMouseLeave) {
|
||||
onMouseLeave(el, type, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleClick",
|
||||
value: function handleClick(el, type, e) {
|
||||
var _this$props3 = this.props,
|
||||
onClick = _this$props3.onClick,
|
||||
children = _this$props3.children;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (tooltipItem && tooltipItem.props.trigger === 'click') {
|
||||
if (this.state.isTooltipActive) {
|
||||
this.setState(function (prev) {
|
||||
return _objectSpread(_objectSpread({}, prev), {}, {
|
||||
activeElement: undefined,
|
||||
activeElementType: undefined,
|
||||
isTooltipActive: false
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.setState(function (prev) {
|
||||
return _objectSpread(_objectSpread({}, prev), {}, {
|
||||
activeElement: el,
|
||||
activeElementType: type,
|
||||
isTooltipActive: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if (onClick) onClick(el, type, e);
|
||||
}
|
||||
}, {
|
||||
key: "renderLinks",
|
||||
value: function renderLinks(links, nodes) {
|
||||
var _this2 = this;
|
||||
var _this$props4 = this.props,
|
||||
linkCurvature = _this$props4.linkCurvature,
|
||||
linkContent = _this$props4.link,
|
||||
margin = _this$props4.margin;
|
||||
var top = (0, _get["default"])(margin, 'top') || 0;
|
||||
var left = (0, _get["default"])(margin, 'left') || 0;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-sankey-links",
|
||||
key: "recharts-sankey-links"
|
||||
}, links.map(function (link, i) {
|
||||
var sourceRelativeY = link.sy,
|
||||
targetRelativeY = link.ty,
|
||||
linkWidth = link.dy;
|
||||
var source = nodes[link.source];
|
||||
var target = nodes[link.target];
|
||||
var sourceX = source.x + source.dx + left;
|
||||
var targetX = target.x + left;
|
||||
var interpolationFunc = interpolationGenerator(sourceX, targetX);
|
||||
var sourceControlX = interpolationFunc(linkCurvature);
|
||||
var targetControlX = interpolationFunc(1 - linkCurvature);
|
||||
var sourceY = source.y + sourceRelativeY + linkWidth / 2 + top;
|
||||
var targetY = target.y + targetRelativeY + linkWidth / 2 + top;
|
||||
var linkProps = _objectSpread({
|
||||
sourceX: sourceX,
|
||||
targetX: targetX,
|
||||
sourceY: sourceY,
|
||||
targetY: targetY,
|
||||
sourceControlX: sourceControlX,
|
||||
targetControlX: targetControlX,
|
||||
sourceRelativeY: sourceRelativeY,
|
||||
targetRelativeY: targetRelativeY,
|
||||
linkWidth: linkWidth,
|
||||
index: i,
|
||||
payload: _objectSpread(_objectSpread({}, link), {}, {
|
||||
source: source,
|
||||
target: target
|
||||
})
|
||||
}, (0, _ReactUtils.filterProps)(linkContent, false));
|
||||
var events = {
|
||||
onMouseEnter: _this2.handleMouseEnter.bind(_this2, linkProps, 'link'),
|
||||
onMouseLeave: _this2.handleMouseLeave.bind(_this2, linkProps, 'link'),
|
||||
onClick: _this2.handleClick.bind(_this2, linkProps, 'link')
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
key: "link-".concat(link.source, "-").concat(link.target, "-").concat(link.value)
|
||||
}, events), _this2.constructor.renderLinkItem(linkContent, linkProps));
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderNodes",
|
||||
value: function renderNodes(nodes) {
|
||||
var _this3 = this;
|
||||
var _this$props5 = this.props,
|
||||
nodeContent = _this$props5.node,
|
||||
margin = _this$props5.margin;
|
||||
var top = (0, _get["default"])(margin, 'top') || 0;
|
||||
var left = (0, _get["default"])(margin, 'left') || 0;
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-sankey-nodes",
|
||||
key: "recharts-sankey-nodes"
|
||||
}, nodes.map(function (node, i) {
|
||||
var x = node.x,
|
||||
y = node.y,
|
||||
dx = node.dx,
|
||||
dy = node.dy;
|
||||
var nodeProps = _objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(nodeContent, false)), {}, {
|
||||
x: x + left,
|
||||
y: y + top,
|
||||
width: dx,
|
||||
height: dy,
|
||||
index: i,
|
||||
payload: node
|
||||
});
|
||||
var events = {
|
||||
onMouseEnter: _this3.handleMouseEnter.bind(_this3, nodeProps, 'node'),
|
||||
onMouseLeave: _this3.handleMouseLeave.bind(_this3, nodeProps, 'node'),
|
||||
onClick: _this3.handleClick.bind(_this3, nodeProps, 'node')
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
key: "node-".concat(node.x, "-").concat(node.y, "-").concat(node.value)
|
||||
}, events), _this3.constructor.renderNodeItem(nodeContent, nodeProps));
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderTooltip",
|
||||
value: function renderTooltip() {
|
||||
var _this$props6 = this.props,
|
||||
children = _this$props6.children,
|
||||
width = _this$props6.width,
|
||||
height = _this$props6.height,
|
||||
nameKey = _this$props6.nameKey;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (!tooltipItem) {
|
||||
return null;
|
||||
}
|
||||
var _this$state = this.state,
|
||||
isTooltipActive = _this$state.isTooltipActive,
|
||||
activeElement = _this$state.activeElement,
|
||||
activeElementType = _this$state.activeElementType;
|
||||
var viewBox = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
var coordinate = activeElement ? getCoordinateOfTooltip(activeElement, activeElementType) : defaultCoordinateOfTooltip;
|
||||
var payload = activeElement ? getPayloadOfTooltip(activeElement, activeElementType, nameKey) : [];
|
||||
return /*#__PURE__*/_react["default"].cloneElement(tooltipItem, {
|
||||
viewBox: viewBox,
|
||||
active: isTooltipActive,
|
||||
coordinate: coordinate,
|
||||
label: '',
|
||||
payload: payload
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
if (!(0, _ReactUtils.validateWidthHeight)(this)) {
|
||||
return null;
|
||||
}
|
||||
var _this$props7 = this.props,
|
||||
width = _this$props7.width,
|
||||
height = _this$props7.height,
|
||||
className = _this$props7.className,
|
||||
style = _this$props7.style,
|
||||
children = _this$props7.children,
|
||||
others = _objectWithoutProperties(_this$props7, _excluded);
|
||||
var _this$state2 = this.state,
|
||||
links = _this$state2.links,
|
||||
nodes = _this$state2.nodes;
|
||||
var attrs = (0, _ReactUtils.filterProps)(others, false);
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
className: (0, _clsx["default"])('recharts-wrapper', className),
|
||||
style: _objectSpread(_objectSpread({}, style), {}, {
|
||||
position: 'relative',
|
||||
cursor: 'default',
|
||||
width: width,
|
||||
height: height
|
||||
}),
|
||||
role: "region"
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Surface.Surface, _extends({}, attrs, {
|
||||
width: width,
|
||||
height: height
|
||||
}), (0, _ReactUtils.filterSvgElements)(children), this.renderLinks(links, nodes), this.renderNodes(nodes)), this.renderTooltip());
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
var data = nextProps.data,
|
||||
width = nextProps.width,
|
||||
height = nextProps.height,
|
||||
margin = nextProps.margin,
|
||||
iterations = nextProps.iterations,
|
||||
nodeWidth = nextProps.nodeWidth,
|
||||
nodePadding = nextProps.nodePadding,
|
||||
sort = nextProps.sort;
|
||||
if (data !== prevState.prevData || width !== prevState.prevWidth || height !== prevState.prevHeight || !(0, _ShallowEqual.shallowEqual)(margin, prevState.prevMargin) || iterations !== prevState.prevIterations || nodeWidth !== prevState.prevNodeWidth || nodePadding !== prevState.prevNodePadding || sort !== prevState.sort) {
|
||||
var contentWidth = width - (margin && margin.left || 0) - (margin && margin.right || 0);
|
||||
var contentHeight = height - (margin && margin.top || 0) - (margin && margin.bottom || 0);
|
||||
var _computeData = computeData({
|
||||
data: data,
|
||||
width: contentWidth,
|
||||
height: contentHeight,
|
||||
iterations: iterations,
|
||||
nodeWidth: nodeWidth,
|
||||
nodePadding: nodePadding,
|
||||
sort: sort
|
||||
}),
|
||||
links = _computeData.links,
|
||||
nodes = _computeData.nodes;
|
||||
return _objectSpread(_objectSpread({}, prevState), {}, {
|
||||
nodes: nodes,
|
||||
links: links,
|
||||
prevData: data,
|
||||
prevWidth: iterations,
|
||||
prevHeight: height,
|
||||
prevMargin: margin,
|
||||
prevNodePadding: nodePadding,
|
||||
prevNodeWidth: nodeWidth,
|
||||
prevIterations: iterations,
|
||||
prevSort: sort
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "renderLinkItem",
|
||||
value: function renderLinkItem(option, props) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
}
|
||||
if ((0, _isFunction["default"])(option)) {
|
||||
return option(props);
|
||||
}
|
||||
var sourceX = props.sourceX,
|
||||
sourceY = props.sourceY,
|
||||
sourceControlX = props.sourceControlX,
|
||||
targetX = props.targetX,
|
||||
targetY = props.targetY,
|
||||
targetControlX = props.targetControlX,
|
||||
linkWidth = props.linkWidth,
|
||||
others = _objectWithoutProperties(props, _excluded2);
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({
|
||||
className: "recharts-sankey-link",
|
||||
d: "\n M".concat(sourceX, ",").concat(sourceY, "\n C").concat(sourceControlX, ",").concat(sourceY, " ").concat(targetControlX, ",").concat(targetY, " ").concat(targetX, ",").concat(targetY, "\n "),
|
||||
fill: "none",
|
||||
stroke: "#333",
|
||||
strokeWidth: linkWidth,
|
||||
strokeOpacity: "0.2"
|
||||
}, (0, _ReactUtils.filterProps)(others, false)));
|
||||
}
|
||||
}, {
|
||||
key: "renderNodeItem",
|
||||
value: function renderNodeItem(option, props) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
}
|
||||
if ((0, _isFunction["default"])(option)) {
|
||||
return option(props);
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Rectangle.Rectangle, _extends({
|
||||
className: "recharts-sankey-node",
|
||||
fill: "#0088fe",
|
||||
fillOpacity: "0.8"
|
||||
}, (0, _ReactUtils.filterProps)(props, false), {
|
||||
role: "img"
|
||||
}));
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Sankey, "displayName", 'Sankey');
|
||||
_defineProperty(Sankey, "defaultProps", {
|
||||
nameKey: 'name',
|
||||
dataKey: 'value',
|
||||
nodePadding: 10,
|
||||
nodeWidth: 10,
|
||||
linkCurvature: 0.5,
|
||||
iterations: 32,
|
||||
margin: {
|
||||
top: 5,
|
||||
right: 5,
|
||||
bottom: 5,
|
||||
left: 5
|
||||
},
|
||||
sort: true
|
||||
});
|
||||
33
frontend/node_modules/recharts/lib/chart/ScatterChart.js
generated
vendored
Normal file
33
frontend/node_modules/recharts/lib/chart/ScatterChart.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ScatterChart = void 0;
|
||||
var _generateCategoricalChart = require("./generateCategoricalChart");
|
||||
var _Scatter = require("../cartesian/Scatter");
|
||||
var _XAxis = require("../cartesian/XAxis");
|
||||
var _YAxis = require("../cartesian/YAxis");
|
||||
var _ZAxis = require("../cartesian/ZAxis");
|
||||
var _CartesianUtils = require("../util/CartesianUtils");
|
||||
/**
|
||||
* @fileOverview Scatter Chart
|
||||
*/
|
||||
|
||||
var ScatterChart = exports.ScatterChart = (0, _generateCategoricalChart.generateCategoricalChart)({
|
||||
chartName: 'ScatterChart',
|
||||
GraphicalChild: _Scatter.Scatter,
|
||||
defaultTooltipEventType: 'item',
|
||||
validateTooltipEventTypes: ['item'],
|
||||
axisComponents: [{
|
||||
axisType: 'xAxis',
|
||||
AxisComp: _XAxis.XAxis
|
||||
}, {
|
||||
axisType: 'yAxis',
|
||||
AxisComp: _YAxis.YAxis
|
||||
}, {
|
||||
axisType: 'zAxis',
|
||||
AxisComp: _ZAxis.ZAxis
|
||||
}],
|
||||
formatAxisMap: _CartesianUtils.formatAxisMap
|
||||
});
|
||||
212
frontend/node_modules/recharts/lib/chart/SunburstChart.js
generated
vendored
Normal file
212
frontend/node_modules/recharts/lib/chart/SunburstChart.js
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SunburstChart = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _d3Scale = require("victory-vendor/d3-scale");
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Surface = require("../container/Surface");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Sector = require("../shape/Sector");
|
||||
var _Text = require("../component/Text");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _Tooltip = require("../component/Tooltip");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
var defaultTextProps = {
|
||||
fontWeight: 'bold',
|
||||
paintOrder: 'stroke fill',
|
||||
fontSize: '.75rem',
|
||||
stroke: '#FFF',
|
||||
fill: 'black',
|
||||
pointerEvents: 'none'
|
||||
};
|
||||
function getMaxDepthOf(node) {
|
||||
if (!node.children || node.children.length === 0) return 1;
|
||||
|
||||
// Calculate depth for each child and find the maximum
|
||||
var childDepths = node.children.map(function (d) {
|
||||
return getMaxDepthOf(d);
|
||||
});
|
||||
return 1 + Math.max.apply(Math, _toConsumableArray(childDepths));
|
||||
}
|
||||
var SunburstChart = exports.SunburstChart = function SunburstChart(_ref) {
|
||||
var className = _ref.className,
|
||||
data = _ref.data,
|
||||
children = _ref.children,
|
||||
width = _ref.width,
|
||||
height = _ref.height,
|
||||
_ref$padding = _ref.padding,
|
||||
padding = _ref$padding === void 0 ? 2 : _ref$padding,
|
||||
_ref$dataKey = _ref.dataKey,
|
||||
dataKey = _ref$dataKey === void 0 ? 'value' : _ref$dataKey,
|
||||
_ref$ringPadding = _ref.ringPadding,
|
||||
ringPadding = _ref$ringPadding === void 0 ? 2 : _ref$ringPadding,
|
||||
_ref$innerRadius = _ref.innerRadius,
|
||||
innerRadius = _ref$innerRadius === void 0 ? 50 : _ref$innerRadius,
|
||||
_ref$fill = _ref.fill,
|
||||
fill = _ref$fill === void 0 ? '#333' : _ref$fill,
|
||||
_ref$stroke = _ref.stroke,
|
||||
stroke = _ref$stroke === void 0 ? '#FFF' : _ref$stroke,
|
||||
_ref$textOptions = _ref.textOptions,
|
||||
textOptions = _ref$textOptions === void 0 ? defaultTextProps : _ref$textOptions,
|
||||
_ref$outerRadius = _ref.outerRadius,
|
||||
outerRadius = _ref$outerRadius === void 0 ? Math.min(width, height) / 2 : _ref$outerRadius,
|
||||
_ref$cx = _ref.cx,
|
||||
cx = _ref$cx === void 0 ? width / 2 : _ref$cx,
|
||||
_ref$cy = _ref.cy,
|
||||
cy = _ref$cy === void 0 ? height / 2 : _ref$cy,
|
||||
_ref$startAngle = _ref.startAngle,
|
||||
startAngle = _ref$startAngle === void 0 ? 0 : _ref$startAngle,
|
||||
_ref$endAngle = _ref.endAngle,
|
||||
endAngle = _ref$endAngle === void 0 ? 360 : _ref$endAngle,
|
||||
onClick = _ref.onClick,
|
||||
onMouseEnter = _ref.onMouseEnter,
|
||||
onMouseLeave = _ref.onMouseLeave;
|
||||
var _useState = (0, _react.useState)(false),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
isTooltipActive = _useState2[0],
|
||||
setIsTooltipActive = _useState2[1];
|
||||
var _useState3 = (0, _react.useState)(null),
|
||||
_useState4 = _slicedToArray(_useState3, 2),
|
||||
activeNode = _useState4[0],
|
||||
setActiveNode = _useState4[1];
|
||||
var rScale = (0, _d3Scale.scaleLinear)([0, data[dataKey]], [0, endAngle]);
|
||||
var treeDepth = getMaxDepthOf(data);
|
||||
var thickness = (outerRadius - innerRadius) / treeDepth;
|
||||
var sectors = [];
|
||||
var positions = new Map([]);
|
||||
|
||||
// event handlers
|
||||
function handleMouseEnter(node, e) {
|
||||
if (onMouseEnter) onMouseEnter(node, e);
|
||||
setActiveNode(node);
|
||||
setIsTooltipActive(true);
|
||||
}
|
||||
function handleMouseLeave(node, e) {
|
||||
if (onMouseLeave) onMouseLeave(node, e);
|
||||
setActiveNode(null);
|
||||
setIsTooltipActive(false);
|
||||
}
|
||||
function handleClick(node) {
|
||||
if (onClick) onClick(node);
|
||||
}
|
||||
|
||||
// recursively add nodes for each data point and its children
|
||||
function drawArcs(childNodes, options) {
|
||||
var radius = options.radius,
|
||||
innerR = options.innerR,
|
||||
initialAngle = options.initialAngle,
|
||||
childColor = options.childColor;
|
||||
var currentAngle = initialAngle;
|
||||
if (!childNodes) return; // base case: no children of this node
|
||||
|
||||
childNodes.forEach(function (d) {
|
||||
var _ref2, _d$fill;
|
||||
var arcLength = rScale(d[dataKey]);
|
||||
var start = currentAngle;
|
||||
// color priority - if there's a color on the individual point use that, otherwise use parent color or default
|
||||
var fillColor = (_ref2 = (_d$fill = d === null || d === void 0 ? void 0 : d.fill) !== null && _d$fill !== void 0 ? _d$fill : childColor) !== null && _ref2 !== void 0 ? _ref2 : fill;
|
||||
var _polarToCartesian = (0, _PolarUtils.polarToCartesian)(0, 0, innerR + radius / 2, -(start + arcLength - arcLength / 2)),
|
||||
textX = _polarToCartesian.x,
|
||||
textY = _polarToCartesian.y;
|
||||
currentAngle += arcLength;
|
||||
sectors.push(
|
||||
/*#__PURE__*/
|
||||
// TODO: Missing key warning. Can we use `key={d.name}`?
|
||||
_react["default"].createElement("g", {
|
||||
"aria-label": d.name,
|
||||
tabIndex: 0
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Sector.Sector, {
|
||||
onClick: function onClick() {
|
||||
return handleClick(d);
|
||||
},
|
||||
onMouseEnter: function onMouseEnter(e) {
|
||||
return handleMouseEnter(d, e);
|
||||
},
|
||||
onMouseLeave: function onMouseLeave(e) {
|
||||
return handleMouseLeave(d, e);
|
||||
},
|
||||
fill: fillColor,
|
||||
stroke: stroke,
|
||||
strokeWidth: padding,
|
||||
startAngle: start,
|
||||
endAngle: start + arcLength,
|
||||
innerRadius: innerR,
|
||||
outerRadius: innerR + radius,
|
||||
cx: cx,
|
||||
cy: cy
|
||||
}), /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({}, textOptions, {
|
||||
alignmentBaseline: "middle",
|
||||
textAnchor: "middle",
|
||||
x: textX + cx,
|
||||
y: cy - textY
|
||||
}), d[dataKey])));
|
||||
var _polarToCartesian2 = (0, _PolarUtils.polarToCartesian)(cx, cy, innerR + radius / 2, start),
|
||||
tooltipX = _polarToCartesian2.x,
|
||||
tooltipY = _polarToCartesian2.y;
|
||||
positions.set(d.name, {
|
||||
x: tooltipX,
|
||||
y: tooltipY
|
||||
});
|
||||
return drawArcs(d.children, {
|
||||
radius: radius,
|
||||
innerR: innerR + radius + ringPadding,
|
||||
initialAngle: start,
|
||||
childColor: fillColor
|
||||
});
|
||||
});
|
||||
}
|
||||
drawArcs(data.children, {
|
||||
radius: thickness,
|
||||
innerR: innerRadius,
|
||||
initialAngle: startAngle
|
||||
});
|
||||
var layerClass = (0, _clsx["default"])('recharts-sunburst', className);
|
||||
function renderTooltip() {
|
||||
var tooltipComponent = (0, _ReactUtils.findChildByType)([children], _Tooltip.Tooltip);
|
||||
if (!tooltipComponent || !activeNode) return null;
|
||||
var viewBox = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].cloneElement(tooltipComponent, {
|
||||
viewBox: viewBox,
|
||||
coordinate: positions.get(activeNode.name),
|
||||
payload: [activeNode],
|
||||
active: isTooltipActive
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
className: (0, _clsx["default"])('recharts-wrapper', className),
|
||||
style: {
|
||||
position: 'relative',
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
role: "region"
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Surface.Surface, {
|
||||
width: width,
|
||||
height: height
|
||||
}, children, /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, sectors)), renderTooltip());
|
||||
};
|
||||
682
frontend/node_modules/recharts/lib/chart/Treemap.js
generated
vendored
Normal file
682
frontend/node_modules/recharts/lib/chart/Treemap.js
generated
vendored
Normal file
@ -0,0 +1,682 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Treemap = void 0;
|
||||
var _isNaN = _interopRequireDefault(require("lodash/isNaN"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _omit = _interopRequireDefault(require("lodash/omit"));
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _Tooltip = require("../component/Tooltip");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Surface = require("../container/Surface");
|
||||
var _Polygon = require("../shape/Polygon");
|
||||
var _Rectangle = require("../shape/Rectangle");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _Constants = require("../util/Constants");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _DOMUtils = require("../util/DOMUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["width", "height", "className", "style", "children", "type"];
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview TreemapChart
|
||||
*/
|
||||
var NODE_VALUE_KEY = 'value';
|
||||
var computeNode = function computeNode(_ref) {
|
||||
var depth = _ref.depth,
|
||||
node = _ref.node,
|
||||
index = _ref.index,
|
||||
valueKey = _ref.valueKey;
|
||||
var children = node.children;
|
||||
var childDepth = depth + 1;
|
||||
var computedChildren = children && children.length ? children.map(function (child, i) {
|
||||
return computeNode({
|
||||
depth: childDepth,
|
||||
node: child,
|
||||
index: i,
|
||||
valueKey: valueKey
|
||||
});
|
||||
}) : null;
|
||||
var nodeValue;
|
||||
if (children && children.length) {
|
||||
nodeValue = computedChildren.reduce(function (result, child) {
|
||||
return result + child[NODE_VALUE_KEY];
|
||||
}, 0);
|
||||
} else {
|
||||
// TODO need to verify valueKey
|
||||
nodeValue = (0, _isNaN["default"])(node[valueKey]) || node[valueKey] <= 0 ? 0 : node[valueKey];
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, node), {}, _defineProperty(_defineProperty(_defineProperty({
|
||||
children: computedChildren
|
||||
}, NODE_VALUE_KEY, nodeValue), "depth", depth), "index", index));
|
||||
};
|
||||
var filterRect = function filterRect(node) {
|
||||
return {
|
||||
x: node.x,
|
||||
y: node.y,
|
||||
width: node.width,
|
||||
height: node.height
|
||||
};
|
||||
};
|
||||
|
||||
// Compute the area for each child based on value & scale.
|
||||
var getAreaOfChildren = function getAreaOfChildren(children, areaValueRatio) {
|
||||
var ratio = areaValueRatio < 0 ? 0 : areaValueRatio;
|
||||
return children.map(function (child) {
|
||||
var area = child[NODE_VALUE_KEY] * ratio;
|
||||
return _objectSpread(_objectSpread({}, child), {}, {
|
||||
area: (0, _isNaN["default"])(area) || area <= 0 ? 0 : area
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Computes the score for the specified row, as the worst aspect ratio.
|
||||
var getWorstScore = function getWorstScore(row, parentSize, aspectRatio) {
|
||||
var parentArea = parentSize * parentSize;
|
||||
var rowArea = row.area * row.area;
|
||||
var _row$reduce = row.reduce(function (result, child) {
|
||||
return {
|
||||
min: Math.min(result.min, child.area),
|
||||
max: Math.max(result.max, child.area)
|
||||
};
|
||||
}, {
|
||||
min: Infinity,
|
||||
max: 0
|
||||
}),
|
||||
min = _row$reduce.min,
|
||||
max = _row$reduce.max;
|
||||
return rowArea ? Math.max(parentArea * max * aspectRatio / rowArea, rowArea / (parentArea * min * aspectRatio)) : Infinity;
|
||||
};
|
||||
var horizontalPosition = function horizontalPosition(row, parentSize, parentRect, isFlush) {
|
||||
var rowHeight = parentSize ? Math.round(row.area / parentSize) : 0;
|
||||
if (isFlush || rowHeight > parentRect.height) {
|
||||
rowHeight = parentRect.height;
|
||||
}
|
||||
var curX = parentRect.x;
|
||||
var child;
|
||||
for (var i = 0, len = row.length; i < len; i++) {
|
||||
child = row[i];
|
||||
child.x = curX;
|
||||
child.y = parentRect.y;
|
||||
child.height = rowHeight;
|
||||
child.width = Math.min(rowHeight ? Math.round(child.area / rowHeight) : 0, parentRect.x + parentRect.width - curX);
|
||||
curX += child.width;
|
||||
}
|
||||
// add the remain x to the last one of row
|
||||
child.width += parentRect.x + parentRect.width - curX;
|
||||
return _objectSpread(_objectSpread({}, parentRect), {}, {
|
||||
y: parentRect.y + rowHeight,
|
||||
height: parentRect.height - rowHeight
|
||||
});
|
||||
};
|
||||
var verticalPosition = function verticalPosition(row, parentSize, parentRect, isFlush) {
|
||||
var rowWidth = parentSize ? Math.round(row.area / parentSize) : 0;
|
||||
if (isFlush || rowWidth > parentRect.width) {
|
||||
rowWidth = parentRect.width;
|
||||
}
|
||||
var curY = parentRect.y;
|
||||
var child;
|
||||
for (var i = 0, len = row.length; i < len; i++) {
|
||||
child = row[i];
|
||||
child.x = parentRect.x;
|
||||
child.y = curY;
|
||||
child.width = rowWidth;
|
||||
child.height = Math.min(rowWidth ? Math.round(child.area / rowWidth) : 0, parentRect.y + parentRect.height - curY);
|
||||
curY += child.height;
|
||||
}
|
||||
if (child) {
|
||||
child.height += parentRect.y + parentRect.height - curY;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, parentRect), {}, {
|
||||
x: parentRect.x + rowWidth,
|
||||
width: parentRect.width - rowWidth
|
||||
});
|
||||
};
|
||||
var position = function position(row, parentSize, parentRect, isFlush) {
|
||||
if (parentSize === parentRect.width) {
|
||||
return horizontalPosition(row, parentSize, parentRect, isFlush);
|
||||
}
|
||||
return verticalPosition(row, parentSize, parentRect, isFlush);
|
||||
};
|
||||
|
||||
// Recursively arranges the specified node's children into squarified rows.
|
||||
var squarify = function squarify(node, aspectRatio) {
|
||||
var children = node.children;
|
||||
if (children && children.length) {
|
||||
var rect = filterRect(node);
|
||||
// maybe a bug
|
||||
var row = [];
|
||||
var best = Infinity; // the best row score so far
|
||||
var child, score; // the current row score
|
||||
var size = Math.min(rect.width, rect.height); // initial orientation
|
||||
var scaleChildren = getAreaOfChildren(children, rect.width * rect.height / node[NODE_VALUE_KEY]);
|
||||
var tempChildren = scaleChildren.slice();
|
||||
row.area = 0;
|
||||
while (tempChildren.length > 0) {
|
||||
// row first
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
row.push(child = tempChildren[0]);
|
||||
row.area += child.area;
|
||||
score = getWorstScore(row, size, aspectRatio);
|
||||
if (score <= best) {
|
||||
// continue with this orientation
|
||||
tempChildren.shift();
|
||||
best = score;
|
||||
} else {
|
||||
// abort, and try a different orientation
|
||||
row.area -= row.pop().area;
|
||||
rect = position(row, size, rect, false);
|
||||
size = Math.min(rect.width, rect.height);
|
||||
row.length = row.area = 0;
|
||||
best = Infinity;
|
||||
}
|
||||
}
|
||||
if (row.length) {
|
||||
rect = position(row, size, rect, true);
|
||||
row.length = row.area = 0;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, node), {}, {
|
||||
children: scaleChildren.map(function (c) {
|
||||
return squarify(c, aspectRatio);
|
||||
})
|
||||
});
|
||||
}
|
||||
return node;
|
||||
};
|
||||
var defaultState = {
|
||||
isTooltipActive: false,
|
||||
isAnimationFinished: false,
|
||||
activeNode: null,
|
||||
formatRoot: null,
|
||||
currentRoot: null,
|
||||
nestIndex: []
|
||||
};
|
||||
var Treemap = exports.Treemap = /*#__PURE__*/function (_PureComponent) {
|
||||
function Treemap() {
|
||||
var _this;
|
||||
_classCallCheck(this, Treemap);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Treemap, [].concat(args));
|
||||
_defineProperty(_this, "state", _objectSpread({}, defaultState));
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Treemap, _PureComponent);
|
||||
return _createClass(Treemap, [{
|
||||
key: "handleMouseEnter",
|
||||
value: function handleMouseEnter(node, e) {
|
||||
e.persist();
|
||||
var _this$props = this.props,
|
||||
onMouseEnter = _this$props.onMouseEnter,
|
||||
children = _this$props.children;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (tooltipItem) {
|
||||
this.setState({
|
||||
isTooltipActive: true,
|
||||
activeNode: node
|
||||
}, function () {
|
||||
if (onMouseEnter) {
|
||||
onMouseEnter(node, e);
|
||||
}
|
||||
});
|
||||
} else if (onMouseEnter) {
|
||||
onMouseEnter(node, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleMouseLeave",
|
||||
value: function handleMouseLeave(node, e) {
|
||||
e.persist();
|
||||
var _this$props2 = this.props,
|
||||
onMouseLeave = _this$props2.onMouseLeave,
|
||||
children = _this$props2.children;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (tooltipItem) {
|
||||
this.setState({
|
||||
isTooltipActive: false,
|
||||
activeNode: null
|
||||
}, function () {
|
||||
if (onMouseLeave) {
|
||||
onMouseLeave(node, e);
|
||||
}
|
||||
});
|
||||
} else if (onMouseLeave) {
|
||||
onMouseLeave(node, e);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleClick",
|
||||
value: function handleClick(node) {
|
||||
var _this$props3 = this.props,
|
||||
onClick = _this$props3.onClick,
|
||||
type = _this$props3.type;
|
||||
if (type === 'nest' && node.children) {
|
||||
var _this$props4 = this.props,
|
||||
width = _this$props4.width,
|
||||
height = _this$props4.height,
|
||||
dataKey = _this$props4.dataKey,
|
||||
aspectRatio = _this$props4.aspectRatio;
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: _objectSpread(_objectSpread({}, node), {}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
}),
|
||||
index: 0,
|
||||
valueKey: dataKey
|
||||
});
|
||||
var formatRoot = squarify(root, aspectRatio);
|
||||
var nestIndex = this.state.nestIndex;
|
||||
nestIndex.push(node);
|
||||
this.setState({
|
||||
formatRoot: formatRoot,
|
||||
currentRoot: root,
|
||||
nestIndex: nestIndex
|
||||
});
|
||||
}
|
||||
if (onClick) {
|
||||
onClick(node);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "handleNestIndex",
|
||||
value: function handleNestIndex(node, i) {
|
||||
var nestIndex = this.state.nestIndex;
|
||||
var _this$props5 = this.props,
|
||||
width = _this$props5.width,
|
||||
height = _this$props5.height,
|
||||
dataKey = _this$props5.dataKey,
|
||||
aspectRatio = _this$props5.aspectRatio;
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: _objectSpread(_objectSpread({}, node), {}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
}),
|
||||
index: 0,
|
||||
valueKey: dataKey
|
||||
});
|
||||
var formatRoot = squarify(root, aspectRatio);
|
||||
nestIndex = nestIndex.slice(0, i + 1);
|
||||
this.setState({
|
||||
formatRoot: formatRoot,
|
||||
currentRoot: node,
|
||||
nestIndex: nestIndex
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderItem",
|
||||
value: function renderItem(content, nodeProps, isLeaf) {
|
||||
var _this2 = this;
|
||||
var _this$props6 = this.props,
|
||||
isAnimationActive = _this$props6.isAnimationActive,
|
||||
animationBegin = _this$props6.animationBegin,
|
||||
animationDuration = _this$props6.animationDuration,
|
||||
animationEasing = _this$props6.animationEasing,
|
||||
isUpdateAnimationActive = _this$props6.isUpdateAnimationActive,
|
||||
type = _this$props6.type,
|
||||
animationId = _this$props6.animationId,
|
||||
colorPanel = _this$props6.colorPanel;
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var width = nodeProps.width,
|
||||
height = nodeProps.height,
|
||||
x = nodeProps.x,
|
||||
y = nodeProps.y,
|
||||
depth = nodeProps.depth;
|
||||
var translateX = parseInt("".concat((Math.random() * 2 - 1) * width), 10);
|
||||
var event = {};
|
||||
if (isLeaf || type === 'nest') {
|
||||
event = {
|
||||
onMouseEnter: this.handleMouseEnter.bind(this, nodeProps),
|
||||
onMouseLeave: this.handleMouseLeave.bind(this, nodeProps),
|
||||
onClick: this.handleClick.bind(this, nodeProps)
|
||||
};
|
||||
}
|
||||
if (!isAnimationActive) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, event, this.constructor.renderContentItem(content, _objectSpread(_objectSpread({}, nodeProps), {}, {
|
||||
isAnimationActive: false,
|
||||
isUpdateAnimationActive: false,
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
}), type, colorPanel));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
key: "treemap-".concat(animationId),
|
||||
from: {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
to: {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
},
|
||||
onAnimationStart: this.handleAnimationStart,
|
||||
onAnimationEnd: this.handleAnimationEnd
|
||||
}, function (_ref2) {
|
||||
var currX = _ref2.x,
|
||||
currY = _ref2.y,
|
||||
currWidth = _ref2.width,
|
||||
currHeight = _ref2.height;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
from: "translate(".concat(translateX, "px, ").concat(translateX, "px)"),
|
||||
to: "translate(0, 0)",
|
||||
attributeName: "transform",
|
||||
begin: animationBegin,
|
||||
easing: animationEasing,
|
||||
isActive: isAnimationActive,
|
||||
duration: animationDuration
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Layer.Layer, event, function () {
|
||||
// when animation Duration , only render depth=1 nodes
|
||||
if (depth > 2 && !isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
return _this2.constructor.renderContentItem(content, _objectSpread(_objectSpread({}, nodeProps), {}, {
|
||||
isAnimationActive: isAnimationActive,
|
||||
isUpdateAnimationActive: !isUpdateAnimationActive,
|
||||
width: currWidth,
|
||||
height: currHeight,
|
||||
x: currX,
|
||||
y: currY
|
||||
}), type, colorPanel);
|
||||
}()));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderNode",
|
||||
value: function renderNode(root, node) {
|
||||
var _this3 = this;
|
||||
var _this$props7 = this.props,
|
||||
content = _this$props7.content,
|
||||
type = _this$props7.type;
|
||||
var nodeProps = _objectSpread(_objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(this.props, false)), node), {}, {
|
||||
root: root
|
||||
});
|
||||
var isLeaf = !node.children || !node.children.length;
|
||||
var currentRoot = this.state.currentRoot;
|
||||
var isCurrentRootChild = (currentRoot.children || []).filter(function (item) {
|
||||
return item.depth === node.depth && item.name === node.name;
|
||||
});
|
||||
if (!isCurrentRootChild.length && root.depth && type === 'nest') {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
key: "recharts-treemap-node-".concat(nodeProps.x, "-").concat(nodeProps.y, "-").concat(nodeProps.name),
|
||||
className: "recharts-treemap-depth-".concat(node.depth)
|
||||
}, this.renderItem(content, nodeProps, isLeaf), node.children && node.children.length ? node.children.map(function (child) {
|
||||
return _this3.renderNode(node, child);
|
||||
}) : null);
|
||||
}
|
||||
}, {
|
||||
key: "renderAllNodes",
|
||||
value: function renderAllNodes() {
|
||||
var formatRoot = this.state.formatRoot;
|
||||
if (!formatRoot) {
|
||||
return null;
|
||||
}
|
||||
return this.renderNode(formatRoot, formatRoot);
|
||||
}
|
||||
}, {
|
||||
key: "renderTooltip",
|
||||
value: function renderTooltip() {
|
||||
var _this$props8 = this.props,
|
||||
children = _this$props8.children,
|
||||
nameKey = _this$props8.nameKey;
|
||||
var tooltipItem = (0, _ReactUtils.findChildByType)(children, _Tooltip.Tooltip);
|
||||
if (!tooltipItem) {
|
||||
return null;
|
||||
}
|
||||
var _this$props9 = this.props,
|
||||
width = _this$props9.width,
|
||||
height = _this$props9.height;
|
||||
var _this$state = this.state,
|
||||
isTooltipActive = _this$state.isTooltipActive,
|
||||
activeNode = _this$state.activeNode;
|
||||
var viewBox = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
var coordinate = activeNode ? {
|
||||
x: activeNode.x + activeNode.width / 2,
|
||||
y: activeNode.y + activeNode.height / 2
|
||||
} : null;
|
||||
var payload = isTooltipActive && activeNode ? [{
|
||||
payload: activeNode,
|
||||
name: (0, _ChartUtils.getValueByDataKey)(activeNode, nameKey, ''),
|
||||
value: (0, _ChartUtils.getValueByDataKey)(activeNode, NODE_VALUE_KEY)
|
||||
}] : [];
|
||||
return /*#__PURE__*/_react["default"].cloneElement(tooltipItem, {
|
||||
viewBox: viewBox,
|
||||
active: isTooltipActive,
|
||||
coordinate: coordinate,
|
||||
label: '',
|
||||
payload: payload
|
||||
});
|
||||
}
|
||||
|
||||
// render nest treemap
|
||||
}, {
|
||||
key: "renderNestIndex",
|
||||
value: function renderNestIndex() {
|
||||
var _this4 = this;
|
||||
var _this$props10 = this.props,
|
||||
nameKey = _this$props10.nameKey,
|
||||
nestIndexContent = _this$props10.nestIndexContent;
|
||||
var nestIndex = this.state.nestIndex;
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
className: "recharts-treemap-nest-index-wrapper",
|
||||
style: {
|
||||
marginTop: '8px',
|
||||
textAlign: 'center'
|
||||
}
|
||||
}, nestIndex.map(function (item, i) {
|
||||
// TODO need to verify nameKey type
|
||||
var name = (0, _get["default"])(item, nameKey, 'root');
|
||||
var content = null;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(nestIndexContent)) {
|
||||
content = /*#__PURE__*/_react["default"].cloneElement(nestIndexContent, item, i);
|
||||
}
|
||||
if ((0, _isFunction["default"])(nestIndexContent)) {
|
||||
content = nestIndexContent(item, i);
|
||||
} else {
|
||||
content = name;
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
||||
_react["default"].createElement("div", {
|
||||
onClick: _this4.handleNestIndex.bind(_this4, item, i),
|
||||
key: "nest-index-".concat((0, _DataUtils.uniqueId)()),
|
||||
className: "recharts-treemap-nest-index-box",
|
||||
style: {
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
padding: '0 7px',
|
||||
background: '#000',
|
||||
color: '#fff',
|
||||
marginRight: '3px'
|
||||
}
|
||||
}, content)
|
||||
);
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
if (!(0, _ReactUtils.validateWidthHeight)(this)) {
|
||||
return null;
|
||||
}
|
||||
var _this$props11 = this.props,
|
||||
width = _this$props11.width,
|
||||
height = _this$props11.height,
|
||||
className = _this$props11.className,
|
||||
style = _this$props11.style,
|
||||
children = _this$props11.children,
|
||||
type = _this$props11.type,
|
||||
others = _objectWithoutProperties(_this$props11, _excluded);
|
||||
var attrs = (0, _ReactUtils.filterProps)(others, false);
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
className: (0, _clsx["default"])('recharts-wrapper', className),
|
||||
style: _objectSpread(_objectSpread({}, style), {}, {
|
||||
position: 'relative',
|
||||
cursor: 'default',
|
||||
width: width,
|
||||
height: height
|
||||
}),
|
||||
role: "region"
|
||||
}, /*#__PURE__*/_react["default"].createElement(_Surface.Surface, _extends({}, attrs, {
|
||||
width: width,
|
||||
height: type === 'nest' ? height - 30 : height
|
||||
}), this.renderAllNodes(), (0, _ReactUtils.filterSvgElements)(children)), this.renderTooltip(), type === 'nest' && this.renderNestIndex());
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.data !== prevState.prevData || nextProps.type !== prevState.prevType || nextProps.width !== prevState.prevWidth || nextProps.height !== prevState.prevHeight || nextProps.dataKey !== prevState.prevDataKey || nextProps.aspectRatio !== prevState.prevAspectRatio) {
|
||||
var root = computeNode({
|
||||
depth: 0,
|
||||
node: {
|
||||
children: nextProps.data,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: nextProps.width,
|
||||
height: nextProps.height
|
||||
},
|
||||
index: 0,
|
||||
valueKey: nextProps.dataKey
|
||||
});
|
||||
var formatRoot = squarify(root, nextProps.aspectRatio);
|
||||
return _objectSpread(_objectSpread({}, prevState), {}, {
|
||||
formatRoot: formatRoot,
|
||||
currentRoot: root,
|
||||
nestIndex: [root],
|
||||
prevAspectRatio: nextProps.aspectRatio,
|
||||
prevData: nextProps.data,
|
||||
prevWidth: nextProps.width,
|
||||
prevHeight: nextProps.height,
|
||||
prevDataKey: nextProps.dataKey,
|
||||
prevType: nextProps.type
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "renderContentItem",
|
||||
value: function renderContentItem(content, nodeProps, type, colorPanel) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(content)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(content, nodeProps);
|
||||
}
|
||||
if ((0, _isFunction["default"])(content)) {
|
||||
return content(nodeProps);
|
||||
}
|
||||
// optimize default shape
|
||||
var x = nodeProps.x,
|
||||
y = nodeProps.y,
|
||||
width = nodeProps.width,
|
||||
height = nodeProps.height,
|
||||
index = nodeProps.index;
|
||||
var arrow = null;
|
||||
if (width > 10 && height > 10 && nodeProps.children && type === 'nest') {
|
||||
arrow = /*#__PURE__*/_react["default"].createElement(_Polygon.Polygon, {
|
||||
points: [{
|
||||
x: x + 2,
|
||||
y: y + height / 2
|
||||
}, {
|
||||
x: x + 6,
|
||||
y: y + height / 2 + 3
|
||||
}, {
|
||||
x: x + 2,
|
||||
y: y + height / 2 + 6
|
||||
}]
|
||||
});
|
||||
}
|
||||
var text = null;
|
||||
var nameSize = (0, _DOMUtils.getStringSize)(nodeProps.name);
|
||||
if (width > 20 && height > 20 && nameSize.width < width && nameSize.height < height) {
|
||||
text = /*#__PURE__*/_react["default"].createElement("text", {
|
||||
x: x + 8,
|
||||
y: y + height / 2 + 7,
|
||||
fontSize: 14
|
||||
}, nodeProps.name);
|
||||
}
|
||||
var colors = colorPanel || _Constants.COLOR_PANEL;
|
||||
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement(_Rectangle.Rectangle, _extends({
|
||||
fill: nodeProps.depth < 2 ? colors[index % colors.length] : 'rgba(255,255,255,0)',
|
||||
stroke: "#fff"
|
||||
}, (0, _omit["default"])(nodeProps, 'children'), {
|
||||
role: "img"
|
||||
})), arrow, text);
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Treemap, "displayName", 'Treemap');
|
||||
_defineProperty(Treemap, "defaultProps", {
|
||||
aspectRatio: 0.5 * (1 + Math.sqrt(5)),
|
||||
dataKey: 'value',
|
||||
type: 'flat',
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
isUpdateAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'linear'
|
||||
});
|
||||
2106
frontend/node_modules/recharts/lib/chart/generateCategoricalChart.js
generated
vendored
Normal file
2106
frontend/node_modules/recharts/lib/chart/generateCategoricalChart.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
frontend/node_modules/recharts/lib/chart/types.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/lib/chart/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";
|
||||
14
frontend/node_modules/recharts/lib/component/Cell.js
generated
vendored
Normal file
14
frontend/node_modules/recharts/lib/component/Cell.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Cell = void 0;
|
||||
/**
|
||||
* @fileOverview Cross
|
||||
*/
|
||||
|
||||
var Cell = exports.Cell = function Cell(_props) {
|
||||
return null;
|
||||
};
|
||||
Cell.displayName = 'Cell';
|
||||
87
frontend/node_modules/recharts/lib/component/Cursor.js
generated
vendored
Normal file
87
frontend/node_modules/recharts/lib/component/Cursor.js
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Cursor = Cursor;
|
||||
var _react = require("react");
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Curve = require("../shape/Curve");
|
||||
var _Cross = require("../shape/Cross");
|
||||
var _getCursorRectangle = require("../util/cursor/getCursorRectangle");
|
||||
var _Rectangle = require("../shape/Rectangle");
|
||||
var _getRadialCursorPoints = require("../util/cursor/getRadialCursorPoints");
|
||||
var _Sector = require("../shape/Sector");
|
||||
var _getCursorPoints = require("../util/cursor/getCursorPoints");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
/*
|
||||
* Cursor is the background, or a highlight,
|
||||
* that shows when user mouses over or activates
|
||||
* an area.
|
||||
*
|
||||
* It usually shows together with a tooltip
|
||||
* to emphasise which part of the chart does the tooltip refer to.
|
||||
*/
|
||||
function Cursor(props) {
|
||||
var _element$props$cursor, _defaultProps;
|
||||
var element = props.element,
|
||||
tooltipEventType = props.tooltipEventType,
|
||||
isActive = props.isActive,
|
||||
activeCoordinate = props.activeCoordinate,
|
||||
activePayload = props.activePayload,
|
||||
offset = props.offset,
|
||||
activeTooltipIndex = props.activeTooltipIndex,
|
||||
tooltipAxisBandSize = props.tooltipAxisBandSize,
|
||||
layout = props.layout,
|
||||
chartName = props.chartName;
|
||||
var elementPropsCursor = (_element$props$cursor = element.props.cursor) !== null && _element$props$cursor !== void 0 ? _element$props$cursor : (_defaultProps = element.type.defaultProps) === null || _defaultProps === void 0 ? void 0 : _defaultProps.cursor;
|
||||
if (!element || !elementPropsCursor || !isActive || !activeCoordinate || chartName !== 'ScatterChart' && tooltipEventType !== 'axis') {
|
||||
return null;
|
||||
}
|
||||
var restProps;
|
||||
var cursorComp = _Curve.Curve;
|
||||
if (chartName === 'ScatterChart') {
|
||||
restProps = activeCoordinate;
|
||||
cursorComp = _Cross.Cross;
|
||||
} else if (chartName === 'BarChart') {
|
||||
restProps = (0, _getCursorRectangle.getCursorRectangle)(layout, activeCoordinate, offset, tooltipAxisBandSize);
|
||||
cursorComp = _Rectangle.Rectangle;
|
||||
} else if (layout === 'radial') {
|
||||
var _getRadialCursorPoint = (0, _getRadialCursorPoints.getRadialCursorPoints)(activeCoordinate),
|
||||
cx = _getRadialCursorPoint.cx,
|
||||
cy = _getRadialCursorPoint.cy,
|
||||
radius = _getRadialCursorPoint.radius,
|
||||
startAngle = _getRadialCursorPoint.startAngle,
|
||||
endAngle = _getRadialCursorPoint.endAngle;
|
||||
restProps = {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle,
|
||||
innerRadius: radius,
|
||||
outerRadius: radius
|
||||
};
|
||||
cursorComp = _Sector.Sector;
|
||||
} else {
|
||||
restProps = {
|
||||
points: (0, _getCursorPoints.getCursorPoints)(layout, activeCoordinate, offset)
|
||||
};
|
||||
cursorComp = _Curve.Curve;
|
||||
}
|
||||
var cursorProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
||||
stroke: '#ccc',
|
||||
pointerEvents: 'none'
|
||||
}, offset), restProps), (0, _ReactUtils.filterProps)(elementPropsCursor, false)), {}, {
|
||||
payload: activePayload,
|
||||
payloadIndex: activeTooltipIndex,
|
||||
className: (0, _clsx["default"])('recharts-tooltip-cursor', elementPropsCursor.className)
|
||||
});
|
||||
return /*#__PURE__*/(0, _react.isValidElement)(elementPropsCursor) ? /*#__PURE__*/(0, _react.cloneElement)(elementPropsCursor, cursorProps) : /*#__PURE__*/(0, _react.createElement)(cursorComp, cursorProps);
|
||||
}
|
||||
40
frontend/node_modules/recharts/lib/component/Customized.js
generated
vendored
Normal file
40
frontend/node_modules/recharts/lib/component/Customized.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Customized = Customized;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _excluded = ["component"];
|
||||
/**
|
||||
* @fileOverview Customized
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
/**
|
||||
* custom svg elements by rechart instance props and state.
|
||||
* @returns {Object} svg elements
|
||||
*/
|
||||
function Customized(_ref) {
|
||||
var component = _ref.component,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
var child;
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(component)) {
|
||||
child = /*#__PURE__*/(0, _react.cloneElement)(component, props);
|
||||
} else if ((0, _isFunction["default"])(component)) {
|
||||
child = /*#__PURE__*/(0, _react.createElement)(component, props);
|
||||
} else {
|
||||
(0, _LogUtils.warn)(false, "Customized's props `component` must be React.element or Function, but got %s.", _typeof(component));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-customized-wrapper"
|
||||
}, child);
|
||||
}
|
||||
Customized.displayName = 'Customized';
|
||||
193
frontend/node_modules/recharts/lib/component/DefaultLegendContent.js
generated
vendored
Normal file
193
frontend/node_modules/recharts/lib/component/DefaultLegendContent.js
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DefaultLegendContent = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx2 = _interopRequireDefault(require("clsx"));
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _Surface = require("../container/Surface");
|
||||
var _Symbols = require("../shape/Symbols");
|
||||
var _types = require("../util/types");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Default Legend Content
|
||||
*/
|
||||
var SIZE = 32;
|
||||
var DefaultLegendContent = exports.DefaultLegendContent = /*#__PURE__*/function (_PureComponent) {
|
||||
function DefaultLegendContent() {
|
||||
_classCallCheck(this, DefaultLegendContent);
|
||||
return _callSuper(this, DefaultLegendContent, arguments);
|
||||
}
|
||||
_inherits(DefaultLegendContent, _PureComponent);
|
||||
return _createClass(DefaultLegendContent, [{
|
||||
key: "renderIcon",
|
||||
value:
|
||||
/**
|
||||
* Render the path of icon
|
||||
* @param {Object} data Data of each legend item
|
||||
* @return {String} Path element
|
||||
*/
|
||||
function renderIcon(data) {
|
||||
var inactiveColor = this.props.inactiveColor;
|
||||
var halfSize = SIZE / 2;
|
||||
var sixthSize = SIZE / 6;
|
||||
var thirdSize = SIZE / 3;
|
||||
var color = data.inactive ? inactiveColor : data.color;
|
||||
if (data.type === 'plainline') {
|
||||
return /*#__PURE__*/_react["default"].createElement("line", {
|
||||
strokeWidth: 4,
|
||||
fill: "none",
|
||||
stroke: color,
|
||||
strokeDasharray: data.payload.strokeDasharray,
|
||||
x1: 0,
|
||||
y1: halfSize,
|
||||
x2: SIZE,
|
||||
y2: halfSize,
|
||||
className: "recharts-legend-icon"
|
||||
});
|
||||
}
|
||||
if (data.type === 'line') {
|
||||
return /*#__PURE__*/_react["default"].createElement("path", {
|
||||
strokeWidth: 4,
|
||||
fill: "none",
|
||||
stroke: color,
|
||||
d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
|
||||
className: "recharts-legend-icon"
|
||||
});
|
||||
}
|
||||
if (data.type === 'rect') {
|
||||
return /*#__PURE__*/_react["default"].createElement("path", {
|
||||
stroke: "none",
|
||||
fill: color,
|
||||
d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
|
||||
className: "recharts-legend-icon"
|
||||
});
|
||||
}
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(data.legendIcon)) {
|
||||
var iconProps = _objectSpread({}, data);
|
||||
delete iconProps.legendIcon;
|
||||
return /*#__PURE__*/_react["default"].cloneElement(data.legendIcon, iconProps);
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Symbols.Symbols, {
|
||||
fill: color,
|
||||
cx: halfSize,
|
||||
cy: halfSize,
|
||||
size: SIZE,
|
||||
sizeType: "diameter",
|
||||
type: data.type
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw items of legend
|
||||
* @return {ReactElement} Items
|
||||
*/
|
||||
}, {
|
||||
key: "renderItems",
|
||||
value: function renderItems() {
|
||||
var _this = this;
|
||||
var _this$props = this.props,
|
||||
payload = _this$props.payload,
|
||||
iconSize = _this$props.iconSize,
|
||||
layout = _this$props.layout,
|
||||
formatter = _this$props.formatter,
|
||||
inactiveColor = _this$props.inactiveColor;
|
||||
var viewBox = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: SIZE,
|
||||
height: SIZE
|
||||
};
|
||||
var itemStyle = {
|
||||
display: layout === 'horizontal' ? 'inline-block' : 'block',
|
||||
marginRight: 10
|
||||
};
|
||||
var svgStyle = {
|
||||
display: 'inline-block',
|
||||
verticalAlign: 'middle',
|
||||
marginRight: 4
|
||||
};
|
||||
return payload.map(function (entry, i) {
|
||||
var finalFormatter = entry.formatter || formatter;
|
||||
var className = (0, _clsx2["default"])(_defineProperty(_defineProperty({
|
||||
'recharts-legend-item': true
|
||||
}, "legend-item-".concat(i), true), "inactive", entry.inactive));
|
||||
if (entry.type === 'none') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Do not render entry.value as functions. Always require static string properties.
|
||||
var entryValue = !(0, _isFunction["default"])(entry.value) ? entry.value : null;
|
||||
(0, _LogUtils.warn)(!(0, _isFunction["default"])(entry.value), "The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name=\"Name of my Data\"/>" // eslint-disable-line max-len
|
||||
);
|
||||
var color = entry.inactive ? inactiveColor : entry.color;
|
||||
return /*#__PURE__*/_react["default"].createElement("li", _extends({
|
||||
className: className,
|
||||
style: itemStyle
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
,
|
||||
key: "legend-item-".concat(i)
|
||||
}, (0, _types.adaptEventsOfChild)(_this.props, entry, i)), /*#__PURE__*/_react["default"].createElement(_Surface.Surface, {
|
||||
width: iconSize,
|
||||
height: iconSize,
|
||||
viewBox: viewBox,
|
||||
style: svgStyle
|
||||
}, _this.renderIcon(entry)), /*#__PURE__*/_react["default"].createElement("span", {
|
||||
className: "recharts-legend-item-text",
|
||||
style: {
|
||||
color: color
|
||||
}
|
||||
}, finalFormatter ? finalFormatter(entryValue, entry, i) : entryValue));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props2 = this.props,
|
||||
payload = _this$props2.payload,
|
||||
layout = _this$props2.layout,
|
||||
align = _this$props2.align;
|
||||
if (!payload || !payload.length) {
|
||||
return null;
|
||||
}
|
||||
var finalStyle = {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
textAlign: layout === 'horizontal' ? align : 'left'
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement("ul", {
|
||||
className: "recharts-default-legend",
|
||||
style: finalStyle
|
||||
}, this.renderItems());
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(DefaultLegendContent, "displayName", 'Legend');
|
||||
_defineProperty(DefaultLegendContent, "defaultProps", {
|
||||
iconSize: 14,
|
||||
layout: 'horizontal',
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
inactiveColor: '#ccc'
|
||||
});
|
||||
133
frontend/node_modules/recharts/lib/component/DefaultTooltipContent.js
generated
vendored
Normal file
133
frontend/node_modules/recharts/lib/component/DefaultTooltipContent.js
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DefaultTooltipContent = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Default Tooltip Content
|
||||
*/
|
||||
function defaultFormatter(value) {
|
||||
return Array.isArray(value) && (0, _DataUtils.isNumOrStr)(value[0]) && (0, _DataUtils.isNumOrStr)(value[1]) ? value.join(' ~ ') : value;
|
||||
}
|
||||
var DefaultTooltipContent = exports.DefaultTooltipContent = function DefaultTooltipContent(props) {
|
||||
var _props$separator = props.separator,
|
||||
separator = _props$separator === void 0 ? ' : ' : _props$separator,
|
||||
_props$contentStyle = props.contentStyle,
|
||||
contentStyle = _props$contentStyle === void 0 ? {} : _props$contentStyle,
|
||||
_props$itemStyle = props.itemStyle,
|
||||
itemStyle = _props$itemStyle === void 0 ? {} : _props$itemStyle,
|
||||
_props$labelStyle = props.labelStyle,
|
||||
labelStyle = _props$labelStyle === void 0 ? {} : _props$labelStyle,
|
||||
payload = props.payload,
|
||||
formatter = props.formatter,
|
||||
itemSorter = props.itemSorter,
|
||||
wrapperClassName = props.wrapperClassName,
|
||||
labelClassName = props.labelClassName,
|
||||
label = props.label,
|
||||
labelFormatter = props.labelFormatter,
|
||||
_props$accessibilityL = props.accessibilityLayer,
|
||||
accessibilityLayer = _props$accessibilityL === void 0 ? false : _props$accessibilityL;
|
||||
var renderContent = function renderContent() {
|
||||
if (payload && payload.length) {
|
||||
var listStyle = {
|
||||
padding: 0,
|
||||
margin: 0
|
||||
};
|
||||
var items = (itemSorter ? (0, _sortBy["default"])(payload, itemSorter) : payload).map(function (entry, i) {
|
||||
if (entry.type === 'none') {
|
||||
return null;
|
||||
}
|
||||
var finalItemStyle = _objectSpread({
|
||||
display: 'block',
|
||||
paddingTop: 4,
|
||||
paddingBottom: 4,
|
||||
color: entry.color || '#000'
|
||||
}, itemStyle);
|
||||
var finalFormatter = entry.formatter || formatter || defaultFormatter;
|
||||
var value = entry.value,
|
||||
name = entry.name;
|
||||
var finalValue = value;
|
||||
var finalName = name;
|
||||
if (finalFormatter && finalValue != null && finalName != null) {
|
||||
var formatted = finalFormatter(value, name, entry, i, payload);
|
||||
if (Array.isArray(formatted)) {
|
||||
var _formatted = _slicedToArray(formatted, 2);
|
||||
finalValue = _formatted[0];
|
||||
finalName = _formatted[1];
|
||||
} else {
|
||||
finalValue = formatted;
|
||||
}
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
_react["default"].createElement("li", {
|
||||
className: "recharts-tooltip-item",
|
||||
key: "tooltip-item-".concat(i),
|
||||
style: finalItemStyle
|
||||
}, (0, _DataUtils.isNumOrStr)(finalName) ? /*#__PURE__*/_react["default"].createElement("span", {
|
||||
className: "recharts-tooltip-item-name"
|
||||
}, finalName) : null, (0, _DataUtils.isNumOrStr)(finalName) ? /*#__PURE__*/_react["default"].createElement("span", {
|
||||
className: "recharts-tooltip-item-separator"
|
||||
}, separator) : null, /*#__PURE__*/_react["default"].createElement("span", {
|
||||
className: "recharts-tooltip-item-value"
|
||||
}, finalValue), /*#__PURE__*/_react["default"].createElement("span", {
|
||||
className: "recharts-tooltip-item-unit"
|
||||
}, entry.unit || ''))
|
||||
);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("ul", {
|
||||
className: "recharts-tooltip-item-list",
|
||||
style: listStyle
|
||||
}, items);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var finalStyle = _objectSpread({
|
||||
margin: 0,
|
||||
padding: 10,
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #ccc',
|
||||
whiteSpace: 'nowrap'
|
||||
}, contentStyle);
|
||||
var finalLabelStyle = _objectSpread({
|
||||
margin: 0
|
||||
}, labelStyle);
|
||||
var hasLabel = !(0, _isNil["default"])(label);
|
||||
var finalLabel = hasLabel ? label : '';
|
||||
var wrapperCN = (0, _clsx["default"])('recharts-default-tooltip', wrapperClassName);
|
||||
var labelCN = (0, _clsx["default"])('recharts-tooltip-label', labelClassName);
|
||||
if (hasLabel && labelFormatter && payload !== undefined && payload !== null) {
|
||||
finalLabel = labelFormatter(label, payload);
|
||||
}
|
||||
var accessibilityAttributes = accessibilityLayer ? {
|
||||
role: 'status',
|
||||
'aria-live': 'assertive'
|
||||
} : {};
|
||||
return /*#__PURE__*/_react["default"].createElement("div", _extends({
|
||||
className: wrapperCN,
|
||||
style: finalStyle
|
||||
}, accessibilityAttributes), /*#__PURE__*/_react["default"].createElement("p", {
|
||||
className: labelCN,
|
||||
style: finalLabelStyle
|
||||
}, /*#__PURE__*/_react["default"].isValidElement(finalLabel) ? finalLabel : "".concat(finalLabel)), renderContent());
|
||||
};
|
||||
478
frontend/node_modules/recharts/lib/component/Label.js
generated
vendored
Normal file
478
frontend/node_modules/recharts/lib/component/Label.js
generated
vendored
Normal file
@ -0,0 +1,478 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Label = Label;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Text = require("./Text");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _excluded = ["offset"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
var getLabel = function getLabel(props) {
|
||||
var value = props.value,
|
||||
formatter = props.formatter;
|
||||
var label = (0, _isNil["default"])(props.children) ? value : props.children;
|
||||
if ((0, _isFunction["default"])(formatter)) {
|
||||
return formatter(label);
|
||||
}
|
||||
return label;
|
||||
};
|
||||
var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {
|
||||
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
|
||||
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
|
||||
return sign * deltaAngle;
|
||||
};
|
||||
var renderRadialLabel = function renderRadialLabel(labelProps, label, attrs) {
|
||||
var position = labelProps.position,
|
||||
viewBox = labelProps.viewBox,
|
||||
offset = labelProps.offset,
|
||||
className = labelProps.className;
|
||||
var _ref = viewBox,
|
||||
cx = _ref.cx,
|
||||
cy = _ref.cy,
|
||||
innerRadius = _ref.innerRadius,
|
||||
outerRadius = _ref.outerRadius,
|
||||
startAngle = _ref.startAngle,
|
||||
endAngle = _ref.endAngle,
|
||||
clockWise = _ref.clockWise;
|
||||
var radius = (innerRadius + outerRadius) / 2;
|
||||
var deltaAngle = getDeltaAngle(startAngle, endAngle);
|
||||
var sign = deltaAngle >= 0 ? 1 : -1;
|
||||
var labelAngle, direction;
|
||||
if (position === 'insideStart') {
|
||||
labelAngle = startAngle + sign * offset;
|
||||
direction = clockWise;
|
||||
} else if (position === 'insideEnd') {
|
||||
labelAngle = endAngle - sign * offset;
|
||||
direction = !clockWise;
|
||||
} else if (position === 'end') {
|
||||
labelAngle = endAngle + sign * offset;
|
||||
direction = clockWise;
|
||||
}
|
||||
direction = deltaAngle <= 0 ? direction : !direction;
|
||||
var startPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, labelAngle);
|
||||
var endPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359);
|
||||
var path = "M".concat(startPoint.x, ",").concat(startPoint.y, "\n A").concat(radius, ",").concat(radius, ",0,1,").concat(direction ? 0 : 1, ",\n ").concat(endPoint.x, ",").concat(endPoint.y);
|
||||
var id = (0, _isNil["default"])(labelProps.id) ? (0, _DataUtils.uniqueId)('recharts-radial-line-') : labelProps.id;
|
||||
return /*#__PURE__*/_react["default"].createElement("text", _extends({}, attrs, {
|
||||
dominantBaseline: "central",
|
||||
className: (0, _clsx["default"])('recharts-radial-bar-label', className)
|
||||
}), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("path", {
|
||||
id: id,
|
||||
d: path
|
||||
})), /*#__PURE__*/_react["default"].createElement("textPath", {
|
||||
xlinkHref: "#".concat(id)
|
||||
}, label));
|
||||
};
|
||||
var getAttrsOfPolarLabel = function getAttrsOfPolarLabel(props) {
|
||||
var viewBox = props.viewBox,
|
||||
offset = props.offset,
|
||||
position = props.position;
|
||||
var _ref2 = viewBox,
|
||||
cx = _ref2.cx,
|
||||
cy = _ref2.cy,
|
||||
innerRadius = _ref2.innerRadius,
|
||||
outerRadius = _ref2.outerRadius,
|
||||
startAngle = _ref2.startAngle,
|
||||
endAngle = _ref2.endAngle;
|
||||
var midAngle = (startAngle + endAngle) / 2;
|
||||
if (position === 'outside') {
|
||||
var _polarToCartesian = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius + offset, midAngle),
|
||||
_x = _polarToCartesian.x,
|
||||
_y = _polarToCartesian.y;
|
||||
return {
|
||||
x: _x,
|
||||
y: _y,
|
||||
textAnchor: _x >= cx ? 'start' : 'end',
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
}
|
||||
if (position === 'center') {
|
||||
return {
|
||||
x: cx,
|
||||
y: cy,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
}
|
||||
if (position === 'centerTop') {
|
||||
return {
|
||||
x: cx,
|
||||
y: cy,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'start'
|
||||
};
|
||||
}
|
||||
if (position === 'centerBottom') {
|
||||
return {
|
||||
x: cx,
|
||||
y: cy,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'end'
|
||||
};
|
||||
}
|
||||
var r = (innerRadius + outerRadius) / 2;
|
||||
var _polarToCartesian2 = (0, _PolarUtils.polarToCartesian)(cx, cy, r, midAngle),
|
||||
x = _polarToCartesian2.x,
|
||||
y = _polarToCartesian2.y;
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
};
|
||||
var getAttrsOfCartesianLabel = function getAttrsOfCartesianLabel(props) {
|
||||
var viewBox = props.viewBox,
|
||||
parentViewBox = props.parentViewBox,
|
||||
offset = props.offset,
|
||||
position = props.position;
|
||||
var _ref3 = viewBox,
|
||||
x = _ref3.x,
|
||||
y = _ref3.y,
|
||||
width = _ref3.width,
|
||||
height = _ref3.height;
|
||||
|
||||
// Define vertical offsets and position inverts based on the value being positive or negative
|
||||
var verticalSign = height >= 0 ? 1 : -1;
|
||||
var verticalOffset = verticalSign * offset;
|
||||
var verticalEnd = verticalSign > 0 ? 'end' : 'start';
|
||||
var verticalStart = verticalSign > 0 ? 'start' : 'end';
|
||||
|
||||
// Define horizontal offsets and position inverts based on the value being positive or negative
|
||||
var horizontalSign = width >= 0 ? 1 : -1;
|
||||
var horizontalOffset = horizontalSign * offset;
|
||||
var horizontalEnd = horizontalSign > 0 ? 'end' : 'start';
|
||||
var horizontalStart = horizontalSign > 0 ? 'start' : 'end';
|
||||
if (position === 'top') {
|
||||
var attrs = {
|
||||
x: x + width / 2,
|
||||
y: y - verticalSign * offset,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: verticalEnd
|
||||
};
|
||||
return _objectSpread(_objectSpread({}, attrs), parentViewBox ? {
|
||||
height: Math.max(y - parentViewBox.y, 0),
|
||||
width: width
|
||||
} : {});
|
||||
}
|
||||
if (position === 'bottom') {
|
||||
var _attrs = {
|
||||
x: x + width / 2,
|
||||
y: y + height + verticalOffset,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: verticalStart
|
||||
};
|
||||
return _objectSpread(_objectSpread({}, _attrs), parentViewBox ? {
|
||||
height: Math.max(parentViewBox.y + parentViewBox.height - (y + height), 0),
|
||||
width: width
|
||||
} : {});
|
||||
}
|
||||
if (position === 'left') {
|
||||
var _attrs2 = {
|
||||
x: x - horizontalOffset,
|
||||
y: y + height / 2,
|
||||
textAnchor: horizontalEnd,
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
return _objectSpread(_objectSpread({}, _attrs2), parentViewBox ? {
|
||||
width: Math.max(_attrs2.x - parentViewBox.x, 0),
|
||||
height: height
|
||||
} : {});
|
||||
}
|
||||
if (position === 'right') {
|
||||
var _attrs3 = {
|
||||
x: x + width + horizontalOffset,
|
||||
y: y + height / 2,
|
||||
textAnchor: horizontalStart,
|
||||
verticalAnchor: 'middle'
|
||||
};
|
||||
return _objectSpread(_objectSpread({}, _attrs3), parentViewBox ? {
|
||||
width: Math.max(parentViewBox.x + parentViewBox.width - _attrs3.x, 0),
|
||||
height: height
|
||||
} : {});
|
||||
}
|
||||
var sizeAttrs = parentViewBox ? {
|
||||
width: width,
|
||||
height: height
|
||||
} : {};
|
||||
if (position === 'insideLeft') {
|
||||
return _objectSpread({
|
||||
x: x + horizontalOffset,
|
||||
y: y + height / 2,
|
||||
textAnchor: horizontalStart,
|
||||
verticalAnchor: 'middle'
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideRight') {
|
||||
return _objectSpread({
|
||||
x: x + width - horizontalOffset,
|
||||
y: y + height / 2,
|
||||
textAnchor: horizontalEnd,
|
||||
verticalAnchor: 'middle'
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideTop') {
|
||||
return _objectSpread({
|
||||
x: x + width / 2,
|
||||
y: y + verticalOffset,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: verticalStart
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideBottom') {
|
||||
return _objectSpread({
|
||||
x: x + width / 2,
|
||||
y: y + height - verticalOffset,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: verticalEnd
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideTopLeft') {
|
||||
return _objectSpread({
|
||||
x: x + horizontalOffset,
|
||||
y: y + verticalOffset,
|
||||
textAnchor: horizontalStart,
|
||||
verticalAnchor: verticalStart
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideTopRight') {
|
||||
return _objectSpread({
|
||||
x: x + width - horizontalOffset,
|
||||
y: y + verticalOffset,
|
||||
textAnchor: horizontalEnd,
|
||||
verticalAnchor: verticalStart
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideBottomLeft') {
|
||||
return _objectSpread({
|
||||
x: x + horizontalOffset,
|
||||
y: y + height - verticalOffset,
|
||||
textAnchor: horizontalStart,
|
||||
verticalAnchor: verticalEnd
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if (position === 'insideBottomRight') {
|
||||
return _objectSpread({
|
||||
x: x + width - horizontalOffset,
|
||||
y: y + height - verticalOffset,
|
||||
textAnchor: horizontalEnd,
|
||||
verticalAnchor: verticalEnd
|
||||
}, sizeAttrs);
|
||||
}
|
||||
if ((0, _isObject["default"])(position) && ((0, _DataUtils.isNumber)(position.x) || (0, _DataUtils.isPercent)(position.x)) && ((0, _DataUtils.isNumber)(position.y) || (0, _DataUtils.isPercent)(position.y))) {
|
||||
return _objectSpread({
|
||||
x: x + (0, _DataUtils.getPercentValue)(position.x, width),
|
||||
y: y + (0, _DataUtils.getPercentValue)(position.y, height),
|
||||
textAnchor: 'end',
|
||||
verticalAnchor: 'end'
|
||||
}, sizeAttrs);
|
||||
}
|
||||
return _objectSpread({
|
||||
x: x + width / 2,
|
||||
y: y + height / 2,
|
||||
textAnchor: 'middle',
|
||||
verticalAnchor: 'middle'
|
||||
}, sizeAttrs);
|
||||
};
|
||||
var isPolar = function isPolar(viewBox) {
|
||||
return 'cx' in viewBox && (0, _DataUtils.isNumber)(viewBox.cx);
|
||||
};
|
||||
function Label(_ref4) {
|
||||
var _ref4$offset = _ref4.offset,
|
||||
offset = _ref4$offset === void 0 ? 5 : _ref4$offset,
|
||||
restProps = _objectWithoutProperties(_ref4, _excluded);
|
||||
var props = _objectSpread({
|
||||
offset: offset
|
||||
}, restProps);
|
||||
var viewBox = props.viewBox,
|
||||
position = props.position,
|
||||
value = props.value,
|
||||
children = props.children,
|
||||
content = props.content,
|
||||
_props$className = props.className,
|
||||
className = _props$className === void 0 ? '' : _props$className,
|
||||
textBreakAll = props.textBreakAll;
|
||||
if (!viewBox || (0, _isNil["default"])(value) && (0, _isNil["default"])(children) && ! /*#__PURE__*/(0, _react.isValidElement)(content) && !(0, _isFunction["default"])(content)) {
|
||||
return null;
|
||||
}
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(content)) {
|
||||
return /*#__PURE__*/(0, _react.cloneElement)(content, props);
|
||||
}
|
||||
var label;
|
||||
if ((0, _isFunction["default"])(content)) {
|
||||
label = /*#__PURE__*/(0, _react.createElement)(content, props);
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(label)) {
|
||||
return label;
|
||||
}
|
||||
} else {
|
||||
label = getLabel(props);
|
||||
}
|
||||
var isPolarLabel = isPolar(viewBox);
|
||||
var attrs = (0, _ReactUtils.filterProps)(props, true);
|
||||
if (isPolarLabel && (position === 'insideStart' || position === 'insideEnd' || position === 'end')) {
|
||||
return renderRadialLabel(props, label, attrs);
|
||||
}
|
||||
var positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props) : getAttrsOfCartesianLabel(props);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({
|
||||
className: (0, _clsx["default"])('recharts-label', className)
|
||||
}, attrs, positionAttrs, {
|
||||
breakAll: textBreakAll
|
||||
}), label);
|
||||
}
|
||||
Label.displayName = 'Label';
|
||||
var parseViewBox = function parseViewBox(props) {
|
||||
var cx = props.cx,
|
||||
cy = props.cy,
|
||||
angle = props.angle,
|
||||
startAngle = props.startAngle,
|
||||
endAngle = props.endAngle,
|
||||
r = props.r,
|
||||
radius = props.radius,
|
||||
innerRadius = props.innerRadius,
|
||||
outerRadius = props.outerRadius,
|
||||
x = props.x,
|
||||
y = props.y,
|
||||
top = props.top,
|
||||
left = props.left,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
clockWise = props.clockWise,
|
||||
labelViewBox = props.labelViewBox;
|
||||
if (labelViewBox) {
|
||||
return labelViewBox;
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(width) && (0, _DataUtils.isNumber)(height)) {
|
||||
if ((0, _DataUtils.isNumber)(x) && (0, _DataUtils.isNumber)(y)) {
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(top) && (0, _DataUtils.isNumber)(left)) {
|
||||
return {
|
||||
x: top,
|
||||
y: left,
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
}
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(x) && (0, _DataUtils.isNumber)(y)) {
|
||||
return {
|
||||
x: x,
|
||||
y: y,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
if ((0, _DataUtils.isNumber)(cx) && (0, _DataUtils.isNumber)(cy)) {
|
||||
return {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
startAngle: startAngle || angle || 0,
|
||||
endAngle: endAngle || angle || 0,
|
||||
innerRadius: innerRadius || 0,
|
||||
outerRadius: outerRadius || radius || r || 0,
|
||||
clockWise: clockWise
|
||||
};
|
||||
}
|
||||
if (props.viewBox) {
|
||||
return props.viewBox;
|
||||
}
|
||||
return {};
|
||||
};
|
||||
var parseLabel = function parseLabel(label, viewBox) {
|
||||
if (!label) {
|
||||
return null;
|
||||
}
|
||||
if (label === true) {
|
||||
return /*#__PURE__*/_react["default"].createElement(Label, {
|
||||
key: "label-implicit",
|
||||
viewBox: viewBox
|
||||
});
|
||||
}
|
||||
if ((0, _DataUtils.isNumOrStr)(label)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(Label, {
|
||||
key: "label-implicit",
|
||||
viewBox: viewBox,
|
||||
value: label
|
||||
});
|
||||
}
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(label)) {
|
||||
if (label.type === Label) {
|
||||
return /*#__PURE__*/(0, _react.cloneElement)(label, {
|
||||
key: 'label-implicit',
|
||||
viewBox: viewBox
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(Label, {
|
||||
key: "label-implicit",
|
||||
content: label,
|
||||
viewBox: viewBox
|
||||
});
|
||||
}
|
||||
if ((0, _isFunction["default"])(label)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(Label, {
|
||||
key: "label-implicit",
|
||||
content: label,
|
||||
viewBox: viewBox
|
||||
});
|
||||
}
|
||||
if ((0, _isObject["default"])(label)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(Label, _extends({
|
||||
viewBox: viewBox
|
||||
}, label, {
|
||||
key: "label-implicit"
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var renderCallByParent = function renderCallByParent(parentProps, viewBox) {
|
||||
var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||||
if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {
|
||||
return null;
|
||||
}
|
||||
var children = parentProps.children;
|
||||
var parentViewBox = parseViewBox(parentProps);
|
||||
var explicitChildren = (0, _ReactUtils.findAllByType)(children, Label).map(function (child, index) {
|
||||
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
||||
viewBox: viewBox || parentViewBox,
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key: "label-".concat(index)
|
||||
});
|
||||
});
|
||||
if (!checkPropsLabel) {
|
||||
return explicitChildren;
|
||||
}
|
||||
var implicitLabel = parseLabel(parentProps.label, viewBox || parentViewBox);
|
||||
return [implicitLabel].concat(_toConsumableArray(explicitChildren));
|
||||
};
|
||||
Label.parseViewBox = parseViewBox;
|
||||
Label.renderCallByParent = renderCallByParent;
|
||||
118
frontend/node_modules/recharts/lib/component/LabelList.js
generated
vendored
Normal file
118
frontend/node_modules/recharts/lib/component/LabelList.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.LabelList = LabelList;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _last = _interopRequireDefault(require("lodash/last"));
|
||||
var _Label = require("./Label");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _excluded = ["valueAccessor"],
|
||||
_excluded2 = ["data", "dataKey", "clockWise", "id", "textBreakAll"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
var defaultAccessor = function defaultAccessor(entry) {
|
||||
return Array.isArray(entry.value) ? (0, _last["default"])(entry.value) : entry.value;
|
||||
};
|
||||
function LabelList(_ref) {
|
||||
var _ref$valueAccessor = _ref.valueAccessor,
|
||||
valueAccessor = _ref$valueAccessor === void 0 ? defaultAccessor : _ref$valueAccessor,
|
||||
restProps = _objectWithoutProperties(_ref, _excluded);
|
||||
var data = restProps.data,
|
||||
dataKey = restProps.dataKey,
|
||||
clockWise = restProps.clockWise,
|
||||
id = restProps.id,
|
||||
textBreakAll = restProps.textBreakAll,
|
||||
others = _objectWithoutProperties(restProps, _excluded2);
|
||||
if (!data || !data.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-label-list"
|
||||
}, data.map(function (entry, index) {
|
||||
var value = (0, _isNil["default"])(dataKey) ? valueAccessor(entry, index) : (0, _ChartUtils.getValueByDataKey)(entry && entry.payload, dataKey);
|
||||
var idProps = (0, _isNil["default"])(id) ? {} : {
|
||||
id: "".concat(id, "-").concat(index)
|
||||
};
|
||||
return /*#__PURE__*/_react["default"].createElement(_Label.Label, _extends({}, (0, _ReactUtils.filterProps)(entry, true), others, idProps, {
|
||||
parentViewBox: entry.parentViewBox,
|
||||
value: value,
|
||||
textBreakAll: textBreakAll,
|
||||
viewBox: _Label.Label.parseViewBox((0, _isNil["default"])(clockWise) ? entry : _objectSpread(_objectSpread({}, entry), {}, {
|
||||
clockWise: clockWise
|
||||
})),
|
||||
key: "label-".concat(index) // eslint-disable-line react/no-array-index-key
|
||||
,
|
||||
index: index
|
||||
}));
|
||||
}));
|
||||
}
|
||||
LabelList.displayName = 'LabelList';
|
||||
function parseLabelList(label, data) {
|
||||
if (!label) {
|
||||
return null;
|
||||
}
|
||||
if (label === true) {
|
||||
return /*#__PURE__*/_react["default"].createElement(LabelList, {
|
||||
key: "labelList-implicit",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(label) || (0, _isFunction["default"])(label)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(LabelList, {
|
||||
key: "labelList-implicit",
|
||||
data: data,
|
||||
content: label
|
||||
});
|
||||
}
|
||||
if ((0, _isObject["default"])(label)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(LabelList, _extends({
|
||||
data: data
|
||||
}, label, {
|
||||
key: "labelList-implicit"
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function renderCallByParent(parentProps, data) {
|
||||
var checkPropsLabel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||||
if (!parentProps || !parentProps.children && checkPropsLabel && !parentProps.label) {
|
||||
return null;
|
||||
}
|
||||
var children = parentProps.children;
|
||||
var explicitChildren = (0, _ReactUtils.findAllByType)(children, LabelList).map(function (child, index) {
|
||||
return /*#__PURE__*/(0, _react.cloneElement)(child, {
|
||||
data: data,
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key: "labelList-".concat(index)
|
||||
});
|
||||
});
|
||||
if (!checkPropsLabel) {
|
||||
return explicitChildren;
|
||||
}
|
||||
var implicitLabelList = parseLabelList(parentProps.label, data);
|
||||
return [implicitLabelList].concat(_toConsumableArray(explicitChildren));
|
||||
}
|
||||
LabelList.renderCallByParent = renderCallByParent;
|
||||
210
frontend/node_modules/recharts/lib/component/Legend.js
generated
vendored
Normal file
210
frontend/node_modules/recharts/lib/component/Legend.js
generated
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Legend = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _DefaultLegendContent = require("./DefaultLegendContent");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _getUniqPayload = require("../util/payload/getUniqPayload");
|
||||
var _excluded = ["ref"];
|
||||
/**
|
||||
* @fileOverview Legend
|
||||
*/
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function defaultUniqBy(entry) {
|
||||
return entry.value;
|
||||
}
|
||||
function renderContent(content, props) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(content)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(content, props);
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
return /*#__PURE__*/_react["default"].createElement(content, props);
|
||||
}
|
||||
var ref = props.ref,
|
||||
otherProps = _objectWithoutProperties(props, _excluded);
|
||||
return /*#__PURE__*/_react["default"].createElement(_DefaultLegendContent.DefaultLegendContent, otherProps);
|
||||
}
|
||||
var EPS = 1;
|
||||
var Legend = exports.Legend = /*#__PURE__*/function (_PureComponent) {
|
||||
function Legend() {
|
||||
var _this;
|
||||
_classCallCheck(this, Legend);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Legend, [].concat(args));
|
||||
_defineProperty(_this, "lastBoundingBox", {
|
||||
width: -1,
|
||||
height: -1
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Legend, _PureComponent);
|
||||
return _createClass(Legend, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
this.updateBBox();
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
this.updateBBox();
|
||||
}
|
||||
}, {
|
||||
key: "getBBox",
|
||||
value: function getBBox() {
|
||||
if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {
|
||||
var box = this.wrapperNode.getBoundingClientRect();
|
||||
box.height = this.wrapperNode.offsetHeight;
|
||||
box.width = this.wrapperNode.offsetWidth;
|
||||
return box;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "updateBBox",
|
||||
value: function updateBBox() {
|
||||
var onBBoxUpdate = this.props.onBBoxUpdate;
|
||||
var box = this.getBBox();
|
||||
if (box) {
|
||||
if (Math.abs(box.width - this.lastBoundingBox.width) > EPS || Math.abs(box.height - this.lastBoundingBox.height) > EPS) {
|
||||
this.lastBoundingBox.width = box.width;
|
||||
this.lastBoundingBox.height = box.height;
|
||||
if (onBBoxUpdate) {
|
||||
onBBoxUpdate(box);
|
||||
}
|
||||
}
|
||||
} else if (this.lastBoundingBox.width !== -1 || this.lastBoundingBox.height !== -1) {
|
||||
this.lastBoundingBox.width = -1;
|
||||
this.lastBoundingBox.height = -1;
|
||||
if (onBBoxUpdate) {
|
||||
onBBoxUpdate(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "getBBoxSnapshot",
|
||||
value: function getBBoxSnapshot() {
|
||||
if (this.lastBoundingBox.width >= 0 && this.lastBoundingBox.height >= 0) {
|
||||
return _objectSpread({}, this.lastBoundingBox);
|
||||
}
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "getDefaultPosition",
|
||||
value: function getDefaultPosition(style) {
|
||||
var _this$props = this.props,
|
||||
layout = _this$props.layout,
|
||||
align = _this$props.align,
|
||||
verticalAlign = _this$props.verticalAlign,
|
||||
margin = _this$props.margin,
|
||||
chartWidth = _this$props.chartWidth,
|
||||
chartHeight = _this$props.chartHeight;
|
||||
var hPos, vPos;
|
||||
if (!style || (style.left === undefined || style.left === null) && (style.right === undefined || style.right === null)) {
|
||||
if (align === 'center' && layout === 'vertical') {
|
||||
var box = this.getBBoxSnapshot();
|
||||
hPos = {
|
||||
left: ((chartWidth || 0) - box.width) / 2
|
||||
};
|
||||
} else {
|
||||
hPos = align === 'right' ? {
|
||||
right: margin && margin.right || 0
|
||||
} : {
|
||||
left: margin && margin.left || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
if (!style || (style.top === undefined || style.top === null) && (style.bottom === undefined || style.bottom === null)) {
|
||||
if (verticalAlign === 'middle') {
|
||||
var _box = this.getBBoxSnapshot();
|
||||
vPos = {
|
||||
top: ((chartHeight || 0) - _box.height) / 2
|
||||
};
|
||||
} else {
|
||||
vPos = verticalAlign === 'bottom' ? {
|
||||
bottom: margin && margin.bottom || 0
|
||||
} : {
|
||||
top: margin && margin.top || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, hPos), vPos);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
var _this$props2 = this.props,
|
||||
content = _this$props2.content,
|
||||
width = _this$props2.width,
|
||||
height = _this$props2.height,
|
||||
wrapperStyle = _this$props2.wrapperStyle,
|
||||
payloadUniqBy = _this$props2.payloadUniqBy,
|
||||
payload = _this$props2.payload;
|
||||
var outerStyle = _objectSpread(_objectSpread({
|
||||
position: 'absolute',
|
||||
width: width || 'auto',
|
||||
height: height || 'auto'
|
||||
}, this.getDefaultPosition(wrapperStyle)), wrapperStyle);
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
className: "recharts-legend-wrapper",
|
||||
style: outerStyle,
|
||||
ref: function ref(node) {
|
||||
_this2.wrapperNode = node;
|
||||
}
|
||||
}, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {
|
||||
payload: (0, _getUniqPayload.getUniqPayload)(payload, payloadUniqBy, defaultUniqBy)
|
||||
})));
|
||||
}
|
||||
}], [{
|
||||
key: "getWithHeight",
|
||||
value: function getWithHeight(item, chartWidth) {
|
||||
var _this$defaultProps$it = _objectSpread(_objectSpread({}, this.defaultProps), item.props),
|
||||
layout = _this$defaultProps$it.layout;
|
||||
if (layout === 'vertical' && (0, _DataUtils.isNumber)(item.props.height)) {
|
||||
return {
|
||||
height: item.props.height
|
||||
};
|
||||
}
|
||||
if (layout === 'horizontal') {
|
||||
return {
|
||||
width: item.props.width || chartWidth
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Legend, "displayName", 'Legend');
|
||||
_defineProperty(Legend, "defaultProps", {
|
||||
iconSize: 14,
|
||||
layout: 'horizontal',
|
||||
align: 'center',
|
||||
verticalAlign: 'bottom'
|
||||
});
|
||||
167
frontend/node_modules/recharts/lib/component/ResponsiveContainer.js
generated
vendored
Normal file
167
frontend/node_modules/recharts/lib/component/ResponsiveContainer.js
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ResponsiveContainer = void 0;
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /**
|
||||
* @fileOverview Wrapper component to make charts adapt to the size of parent * DOM
|
||||
*/
|
||||
var ResponsiveContainer = exports.ResponsiveContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
||||
var aspect = _ref.aspect,
|
||||
_ref$initialDimension = _ref.initialDimension,
|
||||
initialDimension = _ref$initialDimension === void 0 ? {
|
||||
width: -1,
|
||||
height: -1
|
||||
} : _ref$initialDimension,
|
||||
_ref$width = _ref.width,
|
||||
width = _ref$width === void 0 ? '100%' : _ref$width,
|
||||
_ref$height = _ref.height,
|
||||
height = _ref$height === void 0 ? '100%' : _ref$height,
|
||||
_ref$minWidth = _ref.minWidth,
|
||||
minWidth = _ref$minWidth === void 0 ? 0 : _ref$minWidth,
|
||||
minHeight = _ref.minHeight,
|
||||
maxHeight = _ref.maxHeight,
|
||||
children = _ref.children,
|
||||
_ref$debounce = _ref.debounce,
|
||||
debounce = _ref$debounce === void 0 ? 0 : _ref$debounce,
|
||||
id = _ref.id,
|
||||
className = _ref.className,
|
||||
onResize = _ref.onResize,
|
||||
_ref$style = _ref.style,
|
||||
style = _ref$style === void 0 ? {} : _ref$style;
|
||||
var containerRef = (0, _react.useRef)(null);
|
||||
var onResizeRef = (0, _react.useRef)();
|
||||
onResizeRef.current = onResize;
|
||||
(0, _react.useImperativeHandle)(ref, function () {
|
||||
return Object.defineProperty(containerRef.current, 'current', {
|
||||
get: function get() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('The usage of ref.current.current is deprecated and will no longer be supported.');
|
||||
return containerRef.current;
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
});
|
||||
var _useState = (0, _react.useState)({
|
||||
containerWidth: initialDimension.width,
|
||||
containerHeight: initialDimension.height
|
||||
}),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
sizes = _useState2[0],
|
||||
setSizes = _useState2[1];
|
||||
var setContainerSize = (0, _react.useCallback)(function (newWidth, newHeight) {
|
||||
setSizes(function (prevState) {
|
||||
var roundedWidth = Math.round(newWidth);
|
||||
var roundedHeight = Math.round(newHeight);
|
||||
if (prevState.containerWidth === roundedWidth && prevState.containerHeight === roundedHeight) {
|
||||
return prevState;
|
||||
}
|
||||
return {
|
||||
containerWidth: roundedWidth,
|
||||
containerHeight: roundedHeight
|
||||
};
|
||||
});
|
||||
}, []);
|
||||
(0, _react.useEffect)(function () {
|
||||
var callback = function callback(entries) {
|
||||
var _onResizeRef$current;
|
||||
var _entries$0$contentRec = entries[0].contentRect,
|
||||
containerWidth = _entries$0$contentRec.width,
|
||||
containerHeight = _entries$0$contentRec.height;
|
||||
setContainerSize(containerWidth, containerHeight);
|
||||
(_onResizeRef$current = onResizeRef.current) === null || _onResizeRef$current === void 0 || _onResizeRef$current.call(onResizeRef, containerWidth, containerHeight);
|
||||
};
|
||||
if (debounce > 0) {
|
||||
callback = (0, _throttle["default"])(callback, debounce, {
|
||||
trailing: true,
|
||||
leading: false
|
||||
});
|
||||
}
|
||||
var observer = new ResizeObserver(callback);
|
||||
var _containerRef$current = containerRef.current.getBoundingClientRect(),
|
||||
containerWidth = _containerRef$current.width,
|
||||
containerHeight = _containerRef$current.height;
|
||||
setContainerSize(containerWidth, containerHeight);
|
||||
observer.observe(containerRef.current);
|
||||
return function () {
|
||||
observer.disconnect();
|
||||
};
|
||||
}, [setContainerSize, debounce]);
|
||||
var chartContent = (0, _react.useMemo)(function () {
|
||||
var containerWidth = sizes.containerWidth,
|
||||
containerHeight = sizes.containerHeight;
|
||||
if (containerWidth < 0 || containerHeight < 0) {
|
||||
return null;
|
||||
}
|
||||
(0, _LogUtils.warn)((0, _DataUtils.isPercent)(width) || (0, _DataUtils.isPercent)(height), "The width(%s) and height(%s) are both fixed numbers,\n maybe you don't need to use a ResponsiveContainer.", width, height);
|
||||
(0, _LogUtils.warn)(!aspect || aspect > 0, 'The aspect(%s) must be greater than zero.', aspect);
|
||||
var calculatedWidth = (0, _DataUtils.isPercent)(width) ? containerWidth : width;
|
||||
var calculatedHeight = (0, _DataUtils.isPercent)(height) ? containerHeight : height;
|
||||
if (aspect && aspect > 0) {
|
||||
// Preserve the desired aspect ratio
|
||||
if (calculatedWidth) {
|
||||
// Will default to using width for aspect ratio
|
||||
calculatedHeight = calculatedWidth / aspect;
|
||||
} else if (calculatedHeight) {
|
||||
// But we should also take height into consideration
|
||||
calculatedWidth = calculatedHeight * aspect;
|
||||
}
|
||||
|
||||
// if maxHeight is set, overwrite if calculatedHeight is greater than maxHeight
|
||||
if (maxHeight && calculatedHeight > maxHeight) {
|
||||
calculatedHeight = maxHeight;
|
||||
}
|
||||
}
|
||||
(0, _LogUtils.warn)(calculatedWidth > 0 || calculatedHeight > 0, "The width(%s) and height(%s) of chart should be greater than 0,\n please check the style of container, or the props width(%s) and height(%s),\n or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the\n height and width.", calculatedWidth, calculatedHeight, width, height, minWidth, minHeight, aspect);
|
||||
var isCharts = !Array.isArray(children) && (0, _ReactUtils.getDisplayName)(children.type).endsWith('Chart');
|
||||
return _react["default"].Children.map(children, function (child) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(child)) {
|
||||
return /*#__PURE__*/(0, _react.cloneElement)(child, _objectSpread({
|
||||
width: calculatedWidth,
|
||||
height: calculatedHeight
|
||||
}, isCharts ? {
|
||||
style: _objectSpread({
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
maxHeight: calculatedHeight,
|
||||
maxWidth: calculatedWidth
|
||||
}, child.props.style)
|
||||
} : {}));
|
||||
}
|
||||
return child;
|
||||
});
|
||||
}, [aspect, children, height, maxHeight, minHeight, minWidth, sizes, width]);
|
||||
return /*#__PURE__*/_react["default"].createElement("div", {
|
||||
id: id ? "".concat(id) : undefined,
|
||||
className: (0, _clsx["default"])('recharts-responsive-container', className),
|
||||
style: _objectSpread(_objectSpread({}, style), {}, {
|
||||
width: width,
|
||||
height: height,
|
||||
minWidth: minWidth,
|
||||
minHeight: minHeight,
|
||||
maxHeight: maxHeight
|
||||
}),
|
||||
ref: containerRef
|
||||
}, chartContent);
|
||||
});
|
||||
260
frontend/node_modules/recharts/lib/component/Text.js
generated
vendored
Normal file
260
frontend/node_modules/recharts/lib/component/Text.js
generated
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Text = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _DOMUtils = require("../util/DOMUtils");
|
||||
var _ReduceCSSCalc = require("../util/ReduceCSSCalc");
|
||||
var _excluded = ["x", "y", "lineHeight", "capHeight", "scaleToFit", "textAnchor", "verticalAnchor", "fill"],
|
||||
_excluded2 = ["dx", "dy", "angle", "className", "breakAll"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
var BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
|
||||
var calculateWordWidths = function calculateWordWidths(_ref) {
|
||||
var children = _ref.children,
|
||||
breakAll = _ref.breakAll,
|
||||
style = _ref.style;
|
||||
try {
|
||||
var words = [];
|
||||
if (!(0, _isNil["default"])(children)) {
|
||||
if (breakAll) {
|
||||
words = children.toString().split('');
|
||||
} else {
|
||||
words = children.toString().split(BREAKING_SPACES);
|
||||
}
|
||||
}
|
||||
var wordsWithComputedWidth = words.map(function (word) {
|
||||
return {
|
||||
word: word,
|
||||
width: (0, _DOMUtils.getStringSize)(word, style).width
|
||||
};
|
||||
});
|
||||
var spaceWidth = breakAll ? 0 : (0, _DOMUtils.getStringSize)("\xA0", style).width;
|
||||
return {
|
||||
wordsWithComputedWidth: wordsWithComputedWidth,
|
||||
spaceWidth: spaceWidth
|
||||
};
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
var calculateWordsByLines = function calculateWordsByLines(_ref2, initialWordsWithComputedWith, spaceWidth, lineWidth, scaleToFit) {
|
||||
var maxLines = _ref2.maxLines,
|
||||
children = _ref2.children,
|
||||
style = _ref2.style,
|
||||
breakAll = _ref2.breakAll;
|
||||
var shouldLimitLines = (0, _DataUtils.isNumber)(maxLines);
|
||||
var text = children;
|
||||
var calculate = function calculate() {
|
||||
var words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
return words.reduce(function (result, _ref3) {
|
||||
var word = _ref3.word,
|
||||
width = _ref3.width;
|
||||
var currentLine = result[result.length - 1];
|
||||
if (currentLine && (lineWidth == null || scaleToFit || currentLine.width + width + spaceWidth < Number(lineWidth))) {
|
||||
// Word can be added to an existing line
|
||||
currentLine.words.push(word);
|
||||
currentLine.width += width + spaceWidth;
|
||||
} else {
|
||||
// Add first word to line or word is too long to scaleToFit on existing line
|
||||
var newLine = {
|
||||
words: [word],
|
||||
width: width
|
||||
};
|
||||
result.push(newLine);
|
||||
}
|
||||
return result;
|
||||
}, []);
|
||||
};
|
||||
var originalResult = calculate(initialWordsWithComputedWith);
|
||||
var findLongestLine = function findLongestLine(words) {
|
||||
return words.reduce(function (a, b) {
|
||||
return a.width > b.width ? a : b;
|
||||
});
|
||||
};
|
||||
if (!shouldLimitLines) {
|
||||
return originalResult;
|
||||
}
|
||||
var suffix = '…';
|
||||
var checkOverflow = function checkOverflow(index) {
|
||||
var tempText = text.slice(0, index);
|
||||
var words = calculateWordWidths({
|
||||
breakAll: breakAll,
|
||||
style: style,
|
||||
children: tempText + suffix
|
||||
}).wordsWithComputedWidth;
|
||||
var result = calculate(words);
|
||||
var doesOverflow = result.length > maxLines || findLongestLine(result).width > Number(lineWidth);
|
||||
return [doesOverflow, result];
|
||||
};
|
||||
var start = 0;
|
||||
var end = text.length - 1;
|
||||
var iterations = 0;
|
||||
var trimmedResult;
|
||||
while (start <= end && iterations <= text.length - 1) {
|
||||
var middle = Math.floor((start + end) / 2);
|
||||
var prev = middle - 1;
|
||||
var _checkOverflow = checkOverflow(prev),
|
||||
_checkOverflow2 = _slicedToArray(_checkOverflow, 2),
|
||||
doesPrevOverflow = _checkOverflow2[0],
|
||||
result = _checkOverflow2[1];
|
||||
var _checkOverflow3 = checkOverflow(middle),
|
||||
_checkOverflow4 = _slicedToArray(_checkOverflow3, 1),
|
||||
doesMiddleOverflow = _checkOverflow4[0];
|
||||
if (!doesPrevOverflow && !doesMiddleOverflow) {
|
||||
start = middle + 1;
|
||||
}
|
||||
if (doesPrevOverflow && doesMiddleOverflow) {
|
||||
end = middle - 1;
|
||||
}
|
||||
if (!doesPrevOverflow && doesMiddleOverflow) {
|
||||
trimmedResult = result;
|
||||
break;
|
||||
}
|
||||
iterations++;
|
||||
}
|
||||
|
||||
// Fallback to originalResult (result without trimming) if we cannot find the
|
||||
// where to trim. This should not happen :tm:
|
||||
return trimmedResult || originalResult;
|
||||
};
|
||||
var getWordsWithoutCalculate = function getWordsWithoutCalculate(children) {
|
||||
var words = !(0, _isNil["default"])(children) ? children.toString().split(BREAKING_SPACES) : [];
|
||||
return [{
|
||||
words: words
|
||||
}];
|
||||
};
|
||||
var getWordsByLines = function getWordsByLines(_ref4) {
|
||||
var width = _ref4.width,
|
||||
scaleToFit = _ref4.scaleToFit,
|
||||
children = _ref4.children,
|
||||
style = _ref4.style,
|
||||
breakAll = _ref4.breakAll,
|
||||
maxLines = _ref4.maxLines;
|
||||
// Only perform calculations if using features that require them (multiline, scaleToFit)
|
||||
if ((width || scaleToFit) && !_Global.Global.isSsr) {
|
||||
var wordsWithComputedWidth, spaceWidth;
|
||||
var wordWidths = calculateWordWidths({
|
||||
breakAll: breakAll,
|
||||
children: children,
|
||||
style: style
|
||||
});
|
||||
if (wordWidths) {
|
||||
var wcw = wordWidths.wordsWithComputedWidth,
|
||||
sw = wordWidths.spaceWidth;
|
||||
wordsWithComputedWidth = wcw;
|
||||
spaceWidth = sw;
|
||||
} else {
|
||||
return getWordsWithoutCalculate(children);
|
||||
}
|
||||
return calculateWordsByLines({
|
||||
breakAll: breakAll,
|
||||
children: children,
|
||||
maxLines: maxLines,
|
||||
style: style
|
||||
}, wordsWithComputedWidth, spaceWidth, width, scaleToFit);
|
||||
}
|
||||
return getWordsWithoutCalculate(children);
|
||||
};
|
||||
var DEFAULT_FILL = '#808080';
|
||||
var Text = exports.Text = function Text(_ref5) {
|
||||
var _ref5$x = _ref5.x,
|
||||
propsX = _ref5$x === void 0 ? 0 : _ref5$x,
|
||||
_ref5$y = _ref5.y,
|
||||
propsY = _ref5$y === void 0 ? 0 : _ref5$y,
|
||||
_ref5$lineHeight = _ref5.lineHeight,
|
||||
lineHeight = _ref5$lineHeight === void 0 ? '1em' : _ref5$lineHeight,
|
||||
_ref5$capHeight = _ref5.capHeight,
|
||||
capHeight = _ref5$capHeight === void 0 ? '0.71em' : _ref5$capHeight,
|
||||
_ref5$scaleToFit = _ref5.scaleToFit,
|
||||
scaleToFit = _ref5$scaleToFit === void 0 ? false : _ref5$scaleToFit,
|
||||
_ref5$textAnchor = _ref5.textAnchor,
|
||||
textAnchor = _ref5$textAnchor === void 0 ? 'start' : _ref5$textAnchor,
|
||||
_ref5$verticalAnchor = _ref5.verticalAnchor,
|
||||
verticalAnchor = _ref5$verticalAnchor === void 0 ? 'end' : _ref5$verticalAnchor,
|
||||
_ref5$fill = _ref5.fill,
|
||||
fill = _ref5$fill === void 0 ? DEFAULT_FILL : _ref5$fill,
|
||||
props = _objectWithoutProperties(_ref5, _excluded);
|
||||
var wordsByLines = (0, _react.useMemo)(function () {
|
||||
return getWordsByLines({
|
||||
breakAll: props.breakAll,
|
||||
children: props.children,
|
||||
maxLines: props.maxLines,
|
||||
scaleToFit: scaleToFit,
|
||||
style: props.style,
|
||||
width: props.width
|
||||
});
|
||||
}, [props.breakAll, props.children, props.maxLines, scaleToFit, props.style, props.width]);
|
||||
var dx = props.dx,
|
||||
dy = props.dy,
|
||||
angle = props.angle,
|
||||
className = props.className,
|
||||
breakAll = props.breakAll,
|
||||
textProps = _objectWithoutProperties(props, _excluded2);
|
||||
if (!(0, _DataUtils.isNumOrStr)(propsX) || !(0, _DataUtils.isNumOrStr)(propsY)) {
|
||||
return null;
|
||||
}
|
||||
var x = propsX + ((0, _DataUtils.isNumber)(dx) ? dx : 0);
|
||||
var y = propsY + ((0, _DataUtils.isNumber)(dy) ? dy : 0);
|
||||
var startDy;
|
||||
switch (verticalAnchor) {
|
||||
case 'start':
|
||||
startDy = (0, _ReduceCSSCalc.reduceCSSCalc)("calc(".concat(capHeight, ")"));
|
||||
break;
|
||||
case 'middle':
|
||||
startDy = (0, _ReduceCSSCalc.reduceCSSCalc)("calc(".concat((wordsByLines.length - 1) / 2, " * -").concat(lineHeight, " + (").concat(capHeight, " / 2))"));
|
||||
break;
|
||||
default:
|
||||
startDy = (0, _ReduceCSSCalc.reduceCSSCalc)("calc(".concat(wordsByLines.length - 1, " * -").concat(lineHeight, ")"));
|
||||
break;
|
||||
}
|
||||
var transforms = [];
|
||||
if (scaleToFit) {
|
||||
var lineWidth = wordsByLines[0].width;
|
||||
var width = props.width;
|
||||
transforms.push("scale(".concat(((0, _DataUtils.isNumber)(width) ? width / lineWidth : 1) / lineWidth, ")"));
|
||||
}
|
||||
if (angle) {
|
||||
transforms.push("rotate(".concat(angle, ", ").concat(x, ", ").concat(y, ")"));
|
||||
}
|
||||
if (transforms.length) {
|
||||
textProps.transform = transforms.join(' ');
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("text", _extends({}, (0, _ReactUtils.filterProps)(textProps, true), {
|
||||
x: x,
|
||||
y: y,
|
||||
className: (0, _clsx["default"])('recharts-text', className),
|
||||
textAnchor: textAnchor,
|
||||
fill: fill.includes('url') ? DEFAULT_FILL : fill
|
||||
}), wordsByLines.map(function (line, index) {
|
||||
var words = line.words.join(breakAll ? '' : ' ');
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// duplicate words will cause duplicate keys
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
_react["default"].createElement("tspan", {
|
||||
x: x,
|
||||
dy: index === 0 ? startDy : lineHeight,
|
||||
key: "".concat(words, "-").concat(index)
|
||||
}, words)
|
||||
);
|
||||
}));
|
||||
};
|
||||
133
frontend/node_modules/recharts/lib/component/Tooltip.js
generated
vendored
Normal file
133
frontend/node_modules/recharts/lib/component/Tooltip.js
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Tooltip = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _DefaultTooltipContent = require("./DefaultTooltipContent");
|
||||
var _TooltipBoundingBox = require("./TooltipBoundingBox");
|
||||
var _Global = require("../util/Global");
|
||||
var _getUniqPayload = require("../util/payload/getUniqPayload");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Tooltip
|
||||
*/
|
||||
function defaultUniqBy(entry) {
|
||||
return entry.dataKey;
|
||||
}
|
||||
function renderContent(content, props) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(content)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(content, props);
|
||||
}
|
||||
if (typeof content === 'function') {
|
||||
return /*#__PURE__*/_react["default"].createElement(content, props);
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_DefaultTooltipContent.DefaultTooltipContent, props);
|
||||
}
|
||||
var Tooltip = exports.Tooltip = /*#__PURE__*/function (_PureComponent) {
|
||||
function Tooltip() {
|
||||
_classCallCheck(this, Tooltip);
|
||||
return _callSuper(this, Tooltip, arguments);
|
||||
}
|
||||
_inherits(Tooltip, _PureComponent);
|
||||
return _createClass(Tooltip, [{
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this = this;
|
||||
var _this$props = this.props,
|
||||
active = _this$props.active,
|
||||
allowEscapeViewBox = _this$props.allowEscapeViewBox,
|
||||
animationDuration = _this$props.animationDuration,
|
||||
animationEasing = _this$props.animationEasing,
|
||||
content = _this$props.content,
|
||||
coordinate = _this$props.coordinate,
|
||||
filterNull = _this$props.filterNull,
|
||||
isAnimationActive = _this$props.isAnimationActive,
|
||||
offset = _this$props.offset,
|
||||
payload = _this$props.payload,
|
||||
payloadUniqBy = _this$props.payloadUniqBy,
|
||||
position = _this$props.position,
|
||||
reverseDirection = _this$props.reverseDirection,
|
||||
useTranslate3d = _this$props.useTranslate3d,
|
||||
viewBox = _this$props.viewBox,
|
||||
wrapperStyle = _this$props.wrapperStyle;
|
||||
var finalPayload = payload !== null && payload !== void 0 ? payload : [];
|
||||
if (filterNull && finalPayload.length) {
|
||||
finalPayload = (0, _getUniqPayload.getUniqPayload)(payload.filter(function (entry) {
|
||||
return entry.value != null && (entry.hide !== true || _this.props.includeHidden);
|
||||
}), payloadUniqBy, defaultUniqBy);
|
||||
}
|
||||
var hasPayload = finalPayload.length > 0;
|
||||
return /*#__PURE__*/_react["default"].createElement(_TooltipBoundingBox.TooltipBoundingBox, {
|
||||
allowEscapeViewBox: allowEscapeViewBox,
|
||||
animationDuration: animationDuration,
|
||||
animationEasing: animationEasing,
|
||||
isAnimationActive: isAnimationActive,
|
||||
active: active,
|
||||
coordinate: coordinate,
|
||||
hasPayload: hasPayload,
|
||||
offset: offset,
|
||||
position: position,
|
||||
reverseDirection: reverseDirection,
|
||||
useTranslate3d: useTranslate3d,
|
||||
viewBox: viewBox,
|
||||
wrapperStyle: wrapperStyle
|
||||
}, renderContent(content, _objectSpread(_objectSpread({}, this.props), {}, {
|
||||
payload: finalPayload
|
||||
})));
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Tooltip, "displayName", 'Tooltip');
|
||||
_defineProperty(Tooltip, "defaultProps", {
|
||||
accessibilityLayer: false,
|
||||
allowEscapeViewBox: {
|
||||
x: false,
|
||||
y: false
|
||||
},
|
||||
animationDuration: 400,
|
||||
animationEasing: 'ease',
|
||||
contentStyle: {},
|
||||
coordinate: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
cursor: true,
|
||||
cursorStyle: {},
|
||||
filterNull: true,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
itemStyle: {},
|
||||
labelStyle: {},
|
||||
offset: 10,
|
||||
reverseDirection: {
|
||||
x: false,
|
||||
y: false
|
||||
},
|
||||
separator: ' : ',
|
||||
trigger: 'hover',
|
||||
useTranslate3d: false,
|
||||
viewBox: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
height: 0,
|
||||
width: 0
|
||||
},
|
||||
wrapperStyle: {}
|
||||
});
|
||||
164
frontend/node_modules/recharts/lib/component/TooltipBoundingBox.js
generated
vendored
Normal file
164
frontend/node_modules/recharts/lib/component/TooltipBoundingBox.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TooltipBoundingBox = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _translate = require("../util/tooltip/translate");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var EPSILON = 1;
|
||||
var TooltipBoundingBox = exports.TooltipBoundingBox = /*#__PURE__*/function (_PureComponent) {
|
||||
function TooltipBoundingBox() {
|
||||
var _this;
|
||||
_classCallCheck(this, TooltipBoundingBox);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, TooltipBoundingBox, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
dismissed: false,
|
||||
dismissedAtCoordinate: {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
lastBoundingBox: {
|
||||
width: -1,
|
||||
height: -1
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleKeyDown", function (event) {
|
||||
if (event.key === 'Escape') {
|
||||
var _this$props$coordinat, _this$props$coordinat2, _this$props$coordinat3, _this$props$coordinat4;
|
||||
_this.setState({
|
||||
dismissed: true,
|
||||
dismissedAtCoordinate: {
|
||||
x: (_this$props$coordinat = (_this$props$coordinat2 = _this.props.coordinate) === null || _this$props$coordinat2 === void 0 ? void 0 : _this$props$coordinat2.x) !== null && _this$props$coordinat !== void 0 ? _this$props$coordinat : 0,
|
||||
y: (_this$props$coordinat3 = (_this$props$coordinat4 = _this.props.coordinate) === null || _this$props$coordinat4 === void 0 ? void 0 : _this$props$coordinat4.y) !== null && _this$props$coordinat3 !== void 0 ? _this$props$coordinat3 : 0
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(TooltipBoundingBox, _PureComponent);
|
||||
return _createClass(TooltipBoundingBox, [{
|
||||
key: "updateBBox",
|
||||
value: function updateBBox() {
|
||||
if (this.wrapperNode && this.wrapperNode.getBoundingClientRect) {
|
||||
var box = this.wrapperNode.getBoundingClientRect();
|
||||
if (Math.abs(box.width - this.state.lastBoundingBox.width) > EPSILON || Math.abs(box.height - this.state.lastBoundingBox.height) > EPSILON) {
|
||||
this.setState({
|
||||
lastBoundingBox: {
|
||||
width: box.width,
|
||||
height: box.height
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (this.state.lastBoundingBox.width !== -1 || this.state.lastBoundingBox.height !== -1) {
|
||||
this.setState({
|
||||
lastBoundingBox: {
|
||||
width: -1,
|
||||
height: -1
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
document.addEventListener('keydown', this.handleKeyDown);
|
||||
this.updateBBox();
|
||||
}
|
||||
}, {
|
||||
key: "componentWillUnmount",
|
||||
value: function componentWillUnmount() {
|
||||
document.removeEventListener('keydown', this.handleKeyDown);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidUpdate",
|
||||
value: function componentDidUpdate() {
|
||||
var _this$props$coordinat5, _this$props$coordinat6;
|
||||
if (this.props.active) {
|
||||
this.updateBBox();
|
||||
}
|
||||
if (!this.state.dismissed) {
|
||||
return;
|
||||
}
|
||||
if (((_this$props$coordinat5 = this.props.coordinate) === null || _this$props$coordinat5 === void 0 ? void 0 : _this$props$coordinat5.x) !== this.state.dismissedAtCoordinate.x || ((_this$props$coordinat6 = this.props.coordinate) === null || _this$props$coordinat6 === void 0 ? void 0 : _this$props$coordinat6.y) !== this.state.dismissedAtCoordinate.y) {
|
||||
this.state.dismissed = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this2 = this;
|
||||
var _this$props = this.props,
|
||||
active = _this$props.active,
|
||||
allowEscapeViewBox = _this$props.allowEscapeViewBox,
|
||||
animationDuration = _this$props.animationDuration,
|
||||
animationEasing = _this$props.animationEasing,
|
||||
children = _this$props.children,
|
||||
coordinate = _this$props.coordinate,
|
||||
hasPayload = _this$props.hasPayload,
|
||||
isAnimationActive = _this$props.isAnimationActive,
|
||||
offset = _this$props.offset,
|
||||
position = _this$props.position,
|
||||
reverseDirection = _this$props.reverseDirection,
|
||||
useTranslate3d = _this$props.useTranslate3d,
|
||||
viewBox = _this$props.viewBox,
|
||||
wrapperStyle = _this$props.wrapperStyle;
|
||||
var _getTooltipTranslate = (0, _translate.getTooltipTranslate)({
|
||||
allowEscapeViewBox: allowEscapeViewBox,
|
||||
coordinate: coordinate,
|
||||
offsetTopLeft: offset,
|
||||
position: position,
|
||||
reverseDirection: reverseDirection,
|
||||
tooltipBox: this.state.lastBoundingBox,
|
||||
useTranslate3d: useTranslate3d,
|
||||
viewBox: viewBox
|
||||
}),
|
||||
cssClasses = _getTooltipTranslate.cssClasses,
|
||||
cssProperties = _getTooltipTranslate.cssProperties;
|
||||
var outerStyle = _objectSpread(_objectSpread({
|
||||
transition: isAnimationActive && active ? "transform ".concat(animationDuration, "ms ").concat(animationEasing) : undefined
|
||||
}, cssProperties), {}, {
|
||||
pointerEvents: 'none',
|
||||
visibility: !this.state.dismissed && active && hasPayload ? 'visible' : 'hidden',
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0
|
||||
}, wrapperStyle);
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// This element allow listening to the `Escape` key.
|
||||
// See https://github.com/recharts/recharts/pull/2925
|
||||
_react["default"].createElement("div", {
|
||||
tabIndex: -1,
|
||||
className: cssClasses,
|
||||
style: outerStyle,
|
||||
ref: function ref(node) {
|
||||
_this2.wrapperNode = node;
|
||||
}
|
||||
}, children)
|
||||
);
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
25
frontend/node_modules/recharts/lib/container/Layer.js
generated
vendored
Normal file
25
frontend/node_modules/recharts/lib/container/Layer.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Layer = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["children", "className"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
var Layer = exports.Layer = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
||||
var children = props.children,
|
||||
className = props.className,
|
||||
others = _objectWithoutProperties(props, _excluded);
|
||||
var layerClass = (0, _clsx["default"])('recharts-layer', className);
|
||||
return /*#__PURE__*/_react["default"].createElement("g", _extends({
|
||||
className: layerClass
|
||||
}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
ref: ref
|
||||
}), children);
|
||||
});
|
||||
42
frontend/node_modules/recharts/lib/container/Surface.js
generated
vendored
Normal file
42
frontend/node_modules/recharts/lib/container/Surface.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Surface = Surface;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["children", "width", "height", "viewBox", "className", "style", "title", "desc"];
|
||||
/**
|
||||
* @fileOverview Surface
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function Surface(props) {
|
||||
var children = props.children,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
viewBox = props.viewBox,
|
||||
className = props.className,
|
||||
style = props.style,
|
||||
title = props.title,
|
||||
desc = props.desc,
|
||||
others = _objectWithoutProperties(props, _excluded);
|
||||
var svgView = viewBox || {
|
||||
width: width,
|
||||
height: height,
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
var layerClass = (0, _clsx["default"])('recharts-surface', className);
|
||||
return /*#__PURE__*/_react["default"].createElement("svg", _extends({}, (0, _ReactUtils.filterProps)(others, true, 'svg'), {
|
||||
className: layerClass,
|
||||
width: width,
|
||||
height: height,
|
||||
style: style,
|
||||
viewBox: "".concat(svgView.x, " ").concat(svgView.y, " ").concat(svgView.width, " ").concat(svgView.height)
|
||||
}), /*#__PURE__*/_react["default"].createElement("title", null, title), /*#__PURE__*/_react["default"].createElement("desc", null, desc), children);
|
||||
}
|
||||
171
frontend/node_modules/recharts/lib/context/chartLayoutContext.js
generated
vendored
Normal file
171
frontend/node_modules/recharts/lib/context/chartLayoutContext.js
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.useYAxisWithFiniteDomainOrRandom = exports.useYAxisOrThrow = exports.useXAxisOrThrow = exports.useViewBox = exports.useOffset = exports.useClipPathId = exports.useChartWidth = exports.useChartHeight = exports.useArbitraryYAxis = exports.useArbitraryXAxis = exports.YAxisContext = exports.XAxisContext = exports.ViewBoxContext = exports.OffsetContext = exports.ClipPathIdContext = exports.ChartWidthContext = exports.ChartLayoutContextProvider = exports.ChartHeightContext = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
||||
var _find = _interopRequireDefault(require("lodash/find"));
|
||||
var _every = _interopRequireDefault(require("lodash/every"));
|
||||
var _calculateViewBox = require("../util/calculateViewBox");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
var XAxisContext = exports.XAxisContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
||||
var YAxisContext = exports.YAxisContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
||||
var ViewBoxContext = exports.ViewBoxContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
||||
var OffsetContext = exports.OffsetContext = /*#__PURE__*/(0, _react.createContext)({});
|
||||
var ClipPathIdContext = exports.ClipPathIdContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
||||
var ChartHeightContext = exports.ChartHeightContext = /*#__PURE__*/(0, _react.createContext)(0);
|
||||
var ChartWidthContext = exports.ChartWidthContext = /*#__PURE__*/(0, _react.createContext)(0);
|
||||
|
||||
/**
|
||||
* Will add all the properties required to render all individual Recharts components into a React Context.
|
||||
*
|
||||
* If you want to read these properties, see the collection of hooks exported from this file.
|
||||
*
|
||||
* @param {object} props CategoricalChartState, plus children
|
||||
* @returns {ReactElement} React Context Provider
|
||||
*/
|
||||
var ChartLayoutContextProvider = exports.ChartLayoutContextProvider = function ChartLayoutContextProvider(props) {
|
||||
var _props$state = props.state,
|
||||
xAxisMap = _props$state.xAxisMap,
|
||||
yAxisMap = _props$state.yAxisMap,
|
||||
offset = _props$state.offset,
|
||||
clipPathId = props.clipPathId,
|
||||
children = props.children,
|
||||
width = props.width,
|
||||
height = props.height;
|
||||
|
||||
/**
|
||||
* Perhaps we should compute this property when reading? Let's see what is more often used
|
||||
*/
|
||||
var viewBox = (0, _calculateViewBox.calculateViewBox)(offset);
|
||||
|
||||
/*
|
||||
* This pretends to be a single context but actually is split into multiple smaller ones.
|
||||
* Why?
|
||||
* Because one React Context only allows to set one value.
|
||||
* But we need to set multiple values.
|
||||
* If we do that with one context, then we force re-render on components that might not even be interested
|
||||
* in the part of the state that has changed.
|
||||
*
|
||||
* By splitting into smaller contexts, we allow each components to be optimized and only re-render when its dependencies change.
|
||||
*
|
||||
* To actually achieve the optimal re-render, it is necessary to use React.memo().
|
||||
* See the test file for details.
|
||||
*/
|
||||
return /*#__PURE__*/_react["default"].createElement(XAxisContext.Provider, {
|
||||
value: xAxisMap
|
||||
}, /*#__PURE__*/_react["default"].createElement(YAxisContext.Provider, {
|
||||
value: yAxisMap
|
||||
}, /*#__PURE__*/_react["default"].createElement(OffsetContext.Provider, {
|
||||
value: offset
|
||||
}, /*#__PURE__*/_react["default"].createElement(ViewBoxContext.Provider, {
|
||||
value: viewBox
|
||||
}, /*#__PURE__*/_react["default"].createElement(ClipPathIdContext.Provider, {
|
||||
value: clipPathId
|
||||
}, /*#__PURE__*/_react["default"].createElement(ChartHeightContext.Provider, {
|
||||
value: height
|
||||
}, /*#__PURE__*/_react["default"].createElement(ChartWidthContext.Provider, {
|
||||
value: width
|
||||
}, children)))))));
|
||||
};
|
||||
var useClipPathId = exports.useClipPathId = function useClipPathId() {
|
||||
return (0, _react.useContext)(ClipPathIdContext);
|
||||
};
|
||||
function getKeysForDebug(object) {
|
||||
var keys = Object.keys(object);
|
||||
if (keys.length === 0) {
|
||||
return 'There are no available ids.';
|
||||
}
|
||||
return "Available ids are: ".concat(keys, ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist.
|
||||
*
|
||||
* @param xAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as <XAxis id='foo' />
|
||||
* @returns axis configuration object
|
||||
* @throws Error if no axis with this ID exists
|
||||
*/
|
||||
var useXAxisOrThrow = exports.useXAxisOrThrow = function useXAxisOrThrow(xAxisId) {
|
||||
var xAxisMap = (0, _react.useContext)(XAxisContext);
|
||||
!(xAxisMap != null) ? process.env.NODE_ENV !== "production" ? (0, _tinyInvariant["default"])(false, 'Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?') : (0, _tinyInvariant["default"])(false) : void 0;
|
||||
var xAxis = xAxisMap[xAxisId];
|
||||
!(xAxis != null) ? process.env.NODE_ENV !== "production" ? (0, _tinyInvariant["default"])(false, "Could not find xAxis by id \"".concat(xAxisId, "\" [").concat(_typeof(xAxisId), "]. ").concat(getKeysForDebug(xAxisMap))) : (0, _tinyInvariant["default"])(false) : void 0;
|
||||
return xAxis;
|
||||
};
|
||||
|
||||
/**
|
||||
* This will find an arbitrary first XAxis. If there's exactly one it always returns that one
|
||||
* - but if there are multiple then it can return any of those.
|
||||
*
|
||||
* If you want specific XAxis out of multiple then prefer using useXAxisOrThrow
|
||||
*
|
||||
* @returns X axisOptions, or undefined - if there are no X axes
|
||||
*/
|
||||
var useArbitraryXAxis = exports.useArbitraryXAxis = function useArbitraryXAxis() {
|
||||
var xAxisMap = (0, _react.useContext)(XAxisContext);
|
||||
return (0, _DataUtils.getAnyElementOfObject)(xAxisMap);
|
||||
};
|
||||
|
||||
/**
|
||||
* This will find an arbitrary first YAxis. If there's exactly one it always returns that one
|
||||
* - but if there are multiple then it can return any of those.
|
||||
*
|
||||
* If you want specific YAxis out of multiple then prefer using useXAxisOrThrow
|
||||
*
|
||||
* @returns Y axisOptions, or undefined - if there are no Y axes
|
||||
*/
|
||||
var useArbitraryYAxis = exports.useArbitraryYAxis = function useArbitraryYAxis() {
|
||||
var yAxisMap = (0, _react.useContext)(YAxisContext);
|
||||
return (0, _DataUtils.getAnyElementOfObject)(yAxisMap);
|
||||
};
|
||||
|
||||
/**
|
||||
* This hooks will:
|
||||
* 1st attempt to find an YAxis that has all elements in its domain finite
|
||||
* If no such axis exists, it will return an arbitrary YAxis
|
||||
* if there are no Y axes then it returns undefined
|
||||
*
|
||||
* @returns Either Y axisOptions, or undefined if there are no Y axes
|
||||
*/
|
||||
var useYAxisWithFiniteDomainOrRandom = exports.useYAxisWithFiniteDomainOrRandom = function useYAxisWithFiniteDomainOrRandom() {
|
||||
var yAxisMap = (0, _react.useContext)(YAxisContext);
|
||||
var yAxisWithFiniteDomain = (0, _find["default"])(yAxisMap, function (axis) {
|
||||
return (0, _every["default"])(axis.domain, Number.isFinite);
|
||||
});
|
||||
return yAxisWithFiniteDomain || (0, _DataUtils.getAnyElementOfObject)(yAxisMap);
|
||||
};
|
||||
|
||||
/**
|
||||
* This either finds and returns Axis by the specified ID, or throws an exception if an axis with this ID does not exist.
|
||||
*
|
||||
* @param yAxisId identifier of the axis - it's either autogenerated ('0'), or passed via `id` prop as <YAxis id='foo' />
|
||||
* @returns axis configuration object
|
||||
* @throws Error if no axis with this ID exists
|
||||
*/
|
||||
var useYAxisOrThrow = exports.useYAxisOrThrow = function useYAxisOrThrow(yAxisId) {
|
||||
var yAxisMap = (0, _react.useContext)(YAxisContext);
|
||||
!(yAxisMap != null) ? process.env.NODE_ENV !== "production" ? (0, _tinyInvariant["default"])(false, 'Could not find Recharts context; are you sure this is rendered inside a Recharts wrapper component?') : (0, _tinyInvariant["default"])(false) : void 0;
|
||||
var yAxis = yAxisMap[yAxisId];
|
||||
!(yAxis != null) ? process.env.NODE_ENV !== "production" ? (0, _tinyInvariant["default"])(false, "Could not find yAxis by id \"".concat(yAxisId, "\" [").concat(_typeof(yAxisId), "]. ").concat(getKeysForDebug(yAxisMap))) : (0, _tinyInvariant["default"])(false) : void 0;
|
||||
return yAxis;
|
||||
};
|
||||
var useViewBox = exports.useViewBox = function useViewBox() {
|
||||
var viewBox = (0, _react.useContext)(ViewBoxContext);
|
||||
return viewBox;
|
||||
};
|
||||
var useOffset = exports.useOffset = function useOffset() {
|
||||
return (0, _react.useContext)(OffsetContext);
|
||||
};
|
||||
var useChartWidth = exports.useChartWidth = function useChartWidth() {
|
||||
return (0, _react.useContext)(ChartWidthContext);
|
||||
};
|
||||
var useChartHeight = exports.useChartHeight = function useChartHeight() {
|
||||
return (0, _react.useContext)(ChartHeightContext);
|
||||
};
|
||||
383
frontend/node_modules/recharts/lib/index.js
generated
vendored
Normal file
383
frontend/node_modules/recharts/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,383 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Area", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Area.Area;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "AreaChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _AreaChart.AreaChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Bar", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Bar.Bar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "BarChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _BarChart.BarChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Brush", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Brush.Brush;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "CartesianAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _CartesianAxis.CartesianAxis;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "CartesianGrid", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _CartesianGrid.CartesianGrid;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Cell", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Cell.Cell;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ComposedChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ComposedChart.ComposedChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Cross", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Cross.Cross;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Curve", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Curve.Curve;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Customized", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Customized.Customized;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "DefaultLegendContent", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DefaultLegendContent.DefaultLegendContent;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "DefaultTooltipContent", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _DefaultTooltipContent.DefaultTooltipContent;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Dot", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Dot.Dot;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ErrorBar", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ErrorBar.ErrorBar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Funnel", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Funnel.Funnel;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "FunnelChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _FunnelChart.FunnelChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Global", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Global.Global;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Label", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Label.Label;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "LabelList", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _LabelList.LabelList;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Layer", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Layer.Layer;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Legend", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Legend.Legend;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Line", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Line.Line;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "LineChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _LineChart.LineChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Pie", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Pie.Pie;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PieChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PieChart.PieChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PolarAngleAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PolarAngleAxis.PolarAngleAxis;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PolarGrid", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PolarGrid.PolarGrid;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PolarRadiusAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _PolarRadiusAxis.PolarRadiusAxis;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Polygon", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Polygon.Polygon;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Radar", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Radar.Radar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "RadarChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _RadarChart.RadarChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "RadialBar", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _RadialBar.RadialBar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "RadialBarChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _RadialBarChart.RadialBarChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Rectangle", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Rectangle.Rectangle;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ReferenceArea", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ReferenceArea.ReferenceArea;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ReferenceDot", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ReferenceDot.ReferenceDot;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ReferenceLine", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ReferenceLine.ReferenceLine;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ResponsiveContainer", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ResponsiveContainer.ResponsiveContainer;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Sankey", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Sankey.Sankey;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Scatter", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Scatter.Scatter;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ScatterChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ScatterChart.ScatterChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Sector", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Sector.Sector;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "SunburstChart", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _SunburstChart.SunburstChart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Surface", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Surface.Surface;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Symbols", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Symbols.Symbols;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Text", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Text.Text;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Tooltip", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Tooltip.Tooltip;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Trapezoid", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Trapezoid.Trapezoid;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "Treemap", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Treemap.Treemap;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "XAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _XAxis.XAxis;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "YAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _YAxis.YAxis;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ZAxis", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ZAxis.ZAxis;
|
||||
}
|
||||
});
|
||||
var _Surface = require("./container/Surface");
|
||||
var _Layer = require("./container/Layer");
|
||||
var _Legend = require("./component/Legend");
|
||||
var _DefaultLegendContent = require("./component/DefaultLegendContent");
|
||||
var _Tooltip = require("./component/Tooltip");
|
||||
var _DefaultTooltipContent = require("./component/DefaultTooltipContent");
|
||||
var _ResponsiveContainer = require("./component/ResponsiveContainer");
|
||||
var _Cell = require("./component/Cell");
|
||||
var _Text = require("./component/Text");
|
||||
var _Label = require("./component/Label");
|
||||
var _LabelList = require("./component/LabelList");
|
||||
var _Customized = require("./component/Customized");
|
||||
var _Sector = require("./shape/Sector");
|
||||
var _Curve = require("./shape/Curve");
|
||||
var _Rectangle = require("./shape/Rectangle");
|
||||
var _Polygon = require("./shape/Polygon");
|
||||
var _Dot = require("./shape/Dot");
|
||||
var _Cross = require("./shape/Cross");
|
||||
var _Symbols = require("./shape/Symbols");
|
||||
var _PolarGrid = require("./polar/PolarGrid");
|
||||
var _PolarRadiusAxis = require("./polar/PolarRadiusAxis");
|
||||
var _PolarAngleAxis = require("./polar/PolarAngleAxis");
|
||||
var _Pie = require("./polar/Pie");
|
||||
var _Radar = require("./polar/Radar");
|
||||
var _RadialBar = require("./polar/RadialBar");
|
||||
var _Brush = require("./cartesian/Brush");
|
||||
var _ReferenceLine = require("./cartesian/ReferenceLine");
|
||||
var _ReferenceDot = require("./cartesian/ReferenceDot");
|
||||
var _ReferenceArea = require("./cartesian/ReferenceArea");
|
||||
var _CartesianAxis = require("./cartesian/CartesianAxis");
|
||||
var _CartesianGrid = require("./cartesian/CartesianGrid");
|
||||
var _Line = require("./cartesian/Line");
|
||||
var _Area = require("./cartesian/Area");
|
||||
var _Bar = require("./cartesian/Bar");
|
||||
var _Scatter = require("./cartesian/Scatter");
|
||||
var _XAxis = require("./cartesian/XAxis");
|
||||
var _YAxis = require("./cartesian/YAxis");
|
||||
var _ZAxis = require("./cartesian/ZAxis");
|
||||
var _ErrorBar = require("./cartesian/ErrorBar");
|
||||
var _LineChart = require("./chart/LineChart");
|
||||
var _BarChart = require("./chart/BarChart");
|
||||
var _PieChart = require("./chart/PieChart");
|
||||
var _Treemap = require("./chart/Treemap");
|
||||
var _Sankey = require("./chart/Sankey");
|
||||
var _RadarChart = require("./chart/RadarChart");
|
||||
var _ScatterChart = require("./chart/ScatterChart");
|
||||
var _AreaChart = require("./chart/AreaChart");
|
||||
var _RadialBarChart = require("./chart/RadialBarChart");
|
||||
var _ComposedChart = require("./chart/ComposedChart");
|
||||
var _SunburstChart = require("./chart/SunburstChart");
|
||||
var _Funnel = require("./numberAxis/Funnel");
|
||||
var _FunnelChart = require("./chart/FunnelChart");
|
||||
var _Trapezoid = require("./shape/Trapezoid");
|
||||
var _Global = require("./util/Global");
|
||||
389
frontend/node_modules/recharts/lib/numberAxis/Funnel.js
generated
vendored
Normal file
389
frontend/node_modules/recharts/lib/numberAxis/Funnel.js
generated
vendored
Normal file
@ -0,0 +1,389 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Funnel = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
|
||||
var _isString = _interopRequireDefault(require("lodash/isString"));
|
||||
var _omit = _interopRequireDefault(require("lodash/omit"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _Cell = require("../component/Cell");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _types = require("../util/types");
|
||||
var _FunnelUtils = require("../util/FunnelUtils");
|
||||
var _Funnel;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render sectors of a funnel
|
||||
*/
|
||||
var Funnel = exports.Funnel = /*#__PURE__*/function (_PureComponent) {
|
||||
function Funnel() {
|
||||
var _this;
|
||||
_classCallCheck(this, Funnel);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Funnel, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: false
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Funnel, _PureComponent);
|
||||
return _createClass(Funnel, [{
|
||||
key: "isActiveIndex",
|
||||
value: function isActiveIndex(i) {
|
||||
var activeIndex = this.props.activeIndex;
|
||||
if (Array.isArray(activeIndex)) {
|
||||
return activeIndex.indexOf(i) !== -1;
|
||||
}
|
||||
return i === activeIndex;
|
||||
}
|
||||
}, {
|
||||
key: "renderTrapezoidsStatically",
|
||||
value: function renderTrapezoidsStatically(trapezoids) {
|
||||
var _this2 = this;
|
||||
var _this$props = this.props,
|
||||
shape = _this$props.shape,
|
||||
activeShape = _this$props.activeShape;
|
||||
return trapezoids.map(function (entry, i) {
|
||||
var trapezoidOptions = _this2.isActiveIndex(i) ? activeShape : shape;
|
||||
var trapezoidProps = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
isActive: _this2.isActiveIndex(i),
|
||||
stroke: entry.stroke
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: "recharts-funnel-trapezoid"
|
||||
}, (0, _types.adaptEventsOfChild)(_this2.props, entry, i), {
|
||||
key: "trapezoid-".concat(entry === null || entry === void 0 ? void 0 : entry.x, "-").concat(entry === null || entry === void 0 ? void 0 : entry.y, "-").concat(entry === null || entry === void 0 ? void 0 : entry.name, "-").concat(entry === null || entry === void 0 ? void 0 : entry.value),
|
||||
role: "img"
|
||||
}), /*#__PURE__*/_react["default"].createElement(_FunnelUtils.FunnelTrapezoid, _extends({
|
||||
option: trapezoidOptions
|
||||
}, trapezoidProps)));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderTrapezoidsWithAnimation",
|
||||
value: function renderTrapezoidsWithAnimation() {
|
||||
var _this3 = this;
|
||||
var _this$props2 = this.props,
|
||||
trapezoids = _this$props2.trapezoids,
|
||||
isAnimationActive = _this$props2.isAnimationActive,
|
||||
animationBegin = _this$props2.animationBegin,
|
||||
animationDuration = _this$props2.animationDuration,
|
||||
animationEasing = _this$props2.animationEasing,
|
||||
animationId = _this$props2.animationId;
|
||||
var prevTrapezoids = this.state.prevTrapezoids;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "funnel-".concat(animationId),
|
||||
onAnimationStart: this.handleAnimationStart,
|
||||
onAnimationEnd: this.handleAnimationEnd
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
var stepData = trapezoids.map(function (entry, index) {
|
||||
var prev = prevTrapezoids && prevTrapezoids[index];
|
||||
if (prev) {
|
||||
var _interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var _interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
var _interpolatorUpperWidth = (0, _DataUtils.interpolateNumber)(prev.upperWidth, entry.upperWidth);
|
||||
var _interpolatorLowerWidth = (0, _DataUtils.interpolateNumber)(prev.lowerWidth, entry.lowerWidth);
|
||||
var _interpolatorHeight = (0, _DataUtils.interpolateNumber)(prev.height, entry.height);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: _interpolatorX(t),
|
||||
y: _interpolatorY(t),
|
||||
upperWidth: _interpolatorUpperWidth(t),
|
||||
lowerWidth: _interpolatorLowerWidth(t),
|
||||
height: _interpolatorHeight(t)
|
||||
});
|
||||
}
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(entry.x + entry.upperWidth / 2, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(entry.y + entry.height / 2, entry.y);
|
||||
var interpolatorUpperWidth = (0, _DataUtils.interpolateNumber)(0, entry.upperWidth);
|
||||
var interpolatorLowerWidth = (0, _DataUtils.interpolateNumber)(0, entry.lowerWidth);
|
||||
var interpolatorHeight = (0, _DataUtils.interpolateNumber)(0, entry.height);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t),
|
||||
upperWidth: interpolatorUpperWidth(t),
|
||||
lowerWidth: interpolatorLowerWidth(t),
|
||||
height: interpolatorHeight(t)
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, _this3.renderTrapezoidsStatically(stepData));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderTrapezoids",
|
||||
value: function renderTrapezoids() {
|
||||
var _this$props3 = this.props,
|
||||
trapezoids = _this$props3.trapezoids,
|
||||
isAnimationActive = _this$props3.isAnimationActive;
|
||||
var prevTrapezoids = this.state.prevTrapezoids;
|
||||
if (isAnimationActive && trapezoids && trapezoids.length && (!prevTrapezoids || !(0, _isEqual["default"])(prevTrapezoids, trapezoids))) {
|
||||
return this.renderTrapezoidsWithAnimation();
|
||||
}
|
||||
return this.renderTrapezoidsStatically(trapezoids);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props4 = this.props,
|
||||
hide = _this$props4.hide,
|
||||
trapezoids = _this$props4.trapezoids,
|
||||
className = _this$props4.className,
|
||||
isAnimationActive = _this$props4.isAnimationActive;
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
if (hide || !trapezoids || !trapezoids.length) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-trapezoids', className);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, this.renderTrapezoids(), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, trapezoids));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curTrapezoids: nextProps.trapezoids,
|
||||
prevTrapezoids: prevState.curTrapezoids
|
||||
};
|
||||
}
|
||||
if (nextProps.trapezoids !== prevState.curTrapezoids) {
|
||||
return {
|
||||
curTrapezoids: nextProps.trapezoids
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_Funnel = Funnel;
|
||||
_defineProperty(Funnel, "displayName", 'Funnel');
|
||||
_defineProperty(Funnel, "defaultProps", {
|
||||
stroke: '#fff',
|
||||
fill: '#808080',
|
||||
legendType: 'rect',
|
||||
labelLine: true,
|
||||
hide: false,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 400,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease',
|
||||
nameKey: 'name',
|
||||
lastShapeType: 'triangle'
|
||||
});
|
||||
_defineProperty(Funnel, "getRealFunnelData", function (item) {
|
||||
var _item$props = item.props,
|
||||
data = _item$props.data,
|
||||
children = _item$props.children;
|
||||
var presentationProps = (0, _ReactUtils.filterProps)(item.props, false);
|
||||
var cells = (0, _ReactUtils.findAllByType)(children, _Cell.Cell);
|
||||
if (data && data.length) {
|
||||
return data.map(function (entry, index) {
|
||||
return _objectSpread(_objectSpread(_objectSpread({
|
||||
payload: entry
|
||||
}, presentationProps), entry), cells && cells[index] && cells[index].props);
|
||||
});
|
||||
}
|
||||
if (cells && cells.length) {
|
||||
return cells.map(function (cell) {
|
||||
return _objectSpread(_objectSpread({}, presentationProps), cell.props);
|
||||
});
|
||||
}
|
||||
return [];
|
||||
});
|
||||
_defineProperty(Funnel, "getRealWidthHeight", function (item, offset) {
|
||||
var customWidth = item.props.width;
|
||||
var width = offset.width,
|
||||
height = offset.height,
|
||||
left = offset.left,
|
||||
right = offset.right,
|
||||
top = offset.top,
|
||||
bottom = offset.bottom;
|
||||
var realHeight = height;
|
||||
var realWidth = width;
|
||||
if ((0, _isNumber["default"])(customWidth)) {
|
||||
realWidth = customWidth;
|
||||
} else if ((0, _isString["default"])(customWidth)) {
|
||||
realWidth = realWidth * parseFloat(customWidth) / 100;
|
||||
}
|
||||
return {
|
||||
realWidth: realWidth - left - right - 50,
|
||||
realHeight: realHeight - bottom - top,
|
||||
offsetX: (width - realWidth) / 2,
|
||||
offsetY: (height - realHeight) / 2
|
||||
};
|
||||
});
|
||||
_defineProperty(Funnel, "getComposedData", function (_ref2) {
|
||||
var item = _ref2.item,
|
||||
offset = _ref2.offset;
|
||||
var funnelData = _Funnel.getRealFunnelData(item);
|
||||
var _item$props2 = item.props,
|
||||
dataKey = _item$props2.dataKey,
|
||||
nameKey = _item$props2.nameKey,
|
||||
tooltipType = _item$props2.tooltipType,
|
||||
lastShapeType = _item$props2.lastShapeType,
|
||||
reversed = _item$props2.reversed;
|
||||
var left = offset.left,
|
||||
top = offset.top;
|
||||
var _Funnel$getRealWidthH = _Funnel.getRealWidthHeight(item, offset),
|
||||
realHeight = _Funnel$getRealWidthH.realHeight,
|
||||
realWidth = _Funnel$getRealWidthH.realWidth,
|
||||
offsetX = _Funnel$getRealWidthH.offsetX,
|
||||
offsetY = _Funnel$getRealWidthH.offsetY;
|
||||
var maxValue = Math.max.apply(null, funnelData.map(function (entry) {
|
||||
return (0, _ChartUtils.getValueByDataKey)(entry, dataKey, 0);
|
||||
}));
|
||||
var len = funnelData.length;
|
||||
var rowHeight = realHeight / len;
|
||||
var parentViewBox = {
|
||||
x: offset.left,
|
||||
y: offset.top,
|
||||
width: offset.width,
|
||||
height: offset.height
|
||||
};
|
||||
var trapezoids = funnelData.map(function (entry, i) {
|
||||
var rawVal = (0, _ChartUtils.getValueByDataKey)(entry, dataKey, 0);
|
||||
var name = (0, _ChartUtils.getValueByDataKey)(entry, nameKey, i);
|
||||
var val = rawVal;
|
||||
var nextVal;
|
||||
if (i !== len - 1) {
|
||||
nextVal = (0, _ChartUtils.getValueByDataKey)(funnelData[i + 1], dataKey, 0);
|
||||
if (nextVal instanceof Array) {
|
||||
var _nextVal = nextVal;
|
||||
var _nextVal2 = _slicedToArray(_nextVal, 1);
|
||||
nextVal = _nextVal2[0];
|
||||
}
|
||||
} else if (rawVal instanceof Array && rawVal.length === 2) {
|
||||
var _rawVal = _slicedToArray(rawVal, 2);
|
||||
val = _rawVal[0];
|
||||
nextVal = _rawVal[1];
|
||||
} else if (lastShapeType === 'rectangle') {
|
||||
nextVal = val;
|
||||
} else {
|
||||
nextVal = 0;
|
||||
}
|
||||
var x = (maxValue - val) * realWidth / (2 * maxValue) + top + 25 + offsetX;
|
||||
var y = rowHeight * i + left + offsetY;
|
||||
var upperWidth = val / maxValue * realWidth;
|
||||
var lowerWidth = nextVal / maxValue * realWidth;
|
||||
var tooltipPayload = [{
|
||||
name: name,
|
||||
value: val,
|
||||
payload: entry,
|
||||
dataKey: dataKey,
|
||||
type: tooltipType
|
||||
}];
|
||||
var tooltipPosition = {
|
||||
x: x + upperWidth / 2,
|
||||
y: y + rowHeight / 2
|
||||
};
|
||||
return _objectSpread(_objectSpread({
|
||||
x: x,
|
||||
y: y,
|
||||
width: Math.max(upperWidth, lowerWidth),
|
||||
upperWidth: upperWidth,
|
||||
lowerWidth: lowerWidth,
|
||||
height: rowHeight,
|
||||
name: name,
|
||||
val: val,
|
||||
tooltipPayload: tooltipPayload,
|
||||
tooltipPosition: tooltipPosition
|
||||
}, (0, _omit["default"])(entry, 'width')), {}, {
|
||||
payload: entry,
|
||||
parentViewBox: parentViewBox,
|
||||
labelViewBox: {
|
||||
x: x + (upperWidth - lowerWidth) / 4,
|
||||
y: y,
|
||||
width: Math.abs(upperWidth - lowerWidth) / 2 + Math.min(upperWidth, lowerWidth),
|
||||
height: rowHeight
|
||||
}
|
||||
});
|
||||
});
|
||||
if (reversed) {
|
||||
trapezoids = trapezoids.map(function (entry, index) {
|
||||
var newY = entry.y - index * rowHeight + (len - 1 - index) * rowHeight;
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
upperWidth: entry.lowerWidth,
|
||||
lowerWidth: entry.upperWidth,
|
||||
x: entry.x - (entry.lowerWidth - entry.upperWidth) / 2,
|
||||
y: entry.y - index * rowHeight + (len - 1 - index) * rowHeight,
|
||||
tooltipPosition: _objectSpread(_objectSpread({}, entry.tooltipPosition), {}, {
|
||||
y: newY + rowHeight / 2
|
||||
}),
|
||||
labelViewBox: _objectSpread(_objectSpread({}, entry.labelViewBox), {}, {
|
||||
y: newY
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
return {
|
||||
trapezoids: trapezoids,
|
||||
data: funnelData
|
||||
};
|
||||
});
|
||||
561
frontend/node_modules/recharts/lib/polar/Pie.js
generated
vendored
Normal file
561
frontend/node_modules/recharts/lib/polar/Pie.js
generated
vendored
Normal file
@ -0,0 +1,561 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Pie = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Curve = require("../shape/Curve");
|
||||
var _Text = require("../component/Text");
|
||||
var _Label = require("../component/Label");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _Cell = require("../component/Cell");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _LogUtils = require("../util/LogUtils");
|
||||
var _types = require("../util/types");
|
||||
var _ActiveShapeUtils = require("../util/ActiveShapeUtils");
|
||||
var _Pie;
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render sectors of a pie
|
||||
*/
|
||||
var Pie = exports.Pie = /*#__PURE__*/function (_PureComponent) {
|
||||
function Pie(props) {
|
||||
var _this;
|
||||
_classCallCheck(this, Pie);
|
||||
_this = _callSuper(this, Pie, [props]);
|
||||
_defineProperty(_this, "pieRef", null);
|
||||
_defineProperty(_this, "sectorRefs", []);
|
||||
_defineProperty(_this, "id", (0, _DataUtils.uniqueId)('recharts-pie-'));
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
_this.state = {
|
||||
isAnimationFinished: !props.isAnimationActive,
|
||||
prevIsAnimationActive: props.isAnimationActive,
|
||||
prevAnimationId: props.animationId,
|
||||
sectorToFocus: 0
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
_inherits(Pie, _PureComponent);
|
||||
return _createClass(Pie, [{
|
||||
key: "isActiveIndex",
|
||||
value: function isActiveIndex(i) {
|
||||
var activeIndex = this.props.activeIndex;
|
||||
if (Array.isArray(activeIndex)) {
|
||||
return activeIndex.indexOf(i) !== -1;
|
||||
}
|
||||
return i === activeIndex;
|
||||
}
|
||||
}, {
|
||||
key: "hasActiveIndex",
|
||||
value: function hasActiveIndex() {
|
||||
var activeIndex = this.props.activeIndex;
|
||||
return Array.isArray(activeIndex) ? activeIndex.length !== 0 : activeIndex || activeIndex === 0;
|
||||
}
|
||||
}, {
|
||||
key: "renderLabels",
|
||||
value: function renderLabels(sectors) {
|
||||
var isAnimationActive = this.props.isAnimationActive;
|
||||
if (isAnimationActive && !this.state.isAnimationFinished) {
|
||||
return null;
|
||||
}
|
||||
var _this$props = this.props,
|
||||
label = _this$props.label,
|
||||
labelLine = _this$props.labelLine,
|
||||
dataKey = _this$props.dataKey,
|
||||
valueKey = _this$props.valueKey;
|
||||
var pieProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customLabelProps = (0, _ReactUtils.filterProps)(label, false);
|
||||
var customLabelLineProps = (0, _ReactUtils.filterProps)(labelLine, false);
|
||||
var offsetRadius = label && label.offsetRadius || 20;
|
||||
var labels = sectors.map(function (entry, i) {
|
||||
var midAngle = (entry.startAngle + entry.endAngle) / 2;
|
||||
var endPoint = (0, _PolarUtils.polarToCartesian)(entry.cx, entry.cy, entry.outerRadius + offsetRadius, midAngle);
|
||||
var labelProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, pieProps), entry), {}, {
|
||||
stroke: 'none'
|
||||
}, customLabelProps), {}, {
|
||||
index: i,
|
||||
textAnchor: Pie.getTextAnchor(endPoint.x, entry.cx)
|
||||
}, endPoint);
|
||||
var lineProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, pieProps), entry), {}, {
|
||||
fill: 'none',
|
||||
stroke: entry.fill
|
||||
}, customLabelLineProps), {}, {
|
||||
index: i,
|
||||
points: [(0, _PolarUtils.polarToCartesian)(entry.cx, entry.cy, entry.outerRadius, midAngle), endPoint]
|
||||
});
|
||||
var realDataKey = dataKey;
|
||||
// TODO: compatible to lower versions
|
||||
if ((0, _isNil["default"])(dataKey) && (0, _isNil["default"])(valueKey)) {
|
||||
realDataKey = 'value';
|
||||
} else if ((0, _isNil["default"])(dataKey)) {
|
||||
realDataKey = valueKey;
|
||||
}
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
_react["default"].createElement(_Layer.Layer, {
|
||||
key: "label-".concat(entry.startAngle, "-").concat(entry.endAngle, "-").concat(entry.midAngle, "-").concat(i)
|
||||
}, labelLine && Pie.renderLabelLineItem(labelLine, lineProps, 'line'), Pie.renderLabelItem(label, labelProps, (0, _ChartUtils.getValueByDataKey)(entry, realDataKey)))
|
||||
);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-pie-labels"
|
||||
}, labels);
|
||||
}
|
||||
}, {
|
||||
key: "renderSectorsStatically",
|
||||
value: function renderSectorsStatically(sectors) {
|
||||
var _this2 = this;
|
||||
var _this$props2 = this.props,
|
||||
activeShape = _this$props2.activeShape,
|
||||
blendStroke = _this$props2.blendStroke,
|
||||
inactiveShapeProp = _this$props2.inactiveShape;
|
||||
return sectors.map(function (entry, i) {
|
||||
if ((entry === null || entry === void 0 ? void 0 : entry.startAngle) === 0 && (entry === null || entry === void 0 ? void 0 : entry.endAngle) === 0 && sectors.length !== 1) return null;
|
||||
var isActive = _this2.isActiveIndex(i);
|
||||
var inactiveShape = inactiveShapeProp && _this2.hasActiveIndex() ? inactiveShapeProp : null;
|
||||
var sectorOptions = isActive ? activeShape : inactiveShape;
|
||||
var sectorProps = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
stroke: blendStroke ? entry.fill : entry.stroke,
|
||||
tabIndex: -1
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
ref: function ref(_ref) {
|
||||
if (_ref && !_this2.sectorRefs.includes(_ref)) {
|
||||
_this2.sectorRefs.push(_ref);
|
||||
}
|
||||
},
|
||||
tabIndex: -1,
|
||||
className: "recharts-pie-sector"
|
||||
}, (0, _types.adaptEventsOfChild)(_this2.props, entry, i), {
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key: "sector-".concat(entry === null || entry === void 0 ? void 0 : entry.startAngle, "-").concat(entry === null || entry === void 0 ? void 0 : entry.endAngle, "-").concat(entry.midAngle, "-").concat(i)
|
||||
}), /*#__PURE__*/_react["default"].createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
option: sectorOptions,
|
||||
isActive: isActive,
|
||||
shapeType: "sector"
|
||||
}, sectorProps)));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderSectorsWithAnimation",
|
||||
value: function renderSectorsWithAnimation() {
|
||||
var _this3 = this;
|
||||
var _this$props3 = this.props,
|
||||
sectors = _this$props3.sectors,
|
||||
isAnimationActive = _this$props3.isAnimationActive,
|
||||
animationBegin = _this$props3.animationBegin,
|
||||
animationDuration = _this$props3.animationDuration,
|
||||
animationEasing = _this$props3.animationEasing,
|
||||
animationId = _this$props3.animationId;
|
||||
var _this$state = this.state,
|
||||
prevSectors = _this$state.prevSectors,
|
||||
prevIsAnimationActive = _this$state.prevIsAnimationActive;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "pie-".concat(animationId, "-").concat(prevIsAnimationActive),
|
||||
onAnimationStart: this.handleAnimationStart,
|
||||
onAnimationEnd: this.handleAnimationEnd
|
||||
}, function (_ref2) {
|
||||
var t = _ref2.t;
|
||||
var stepData = [];
|
||||
var first = sectors && sectors[0];
|
||||
var curAngle = first.startAngle;
|
||||
sectors.forEach(function (entry, index) {
|
||||
var prev = prevSectors && prevSectors[index];
|
||||
var paddingAngle = index > 0 ? (0, _get["default"])(entry, 'paddingAngle', 0) : 0;
|
||||
if (prev) {
|
||||
var angleIp = (0, _DataUtils.interpolateNumber)(prev.endAngle - prev.startAngle, entry.endAngle - entry.startAngle);
|
||||
var latest = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
startAngle: curAngle + paddingAngle,
|
||||
endAngle: curAngle + angleIp(t) + paddingAngle
|
||||
});
|
||||
stepData.push(latest);
|
||||
curAngle = latest.endAngle;
|
||||
} else {
|
||||
var endAngle = entry.endAngle,
|
||||
startAngle = entry.startAngle;
|
||||
var interpolatorAngle = (0, _DataUtils.interpolateNumber)(0, endAngle - startAngle);
|
||||
var deltaAngle = interpolatorAngle(t);
|
||||
var _latest = _objectSpread(_objectSpread({}, entry), {}, {
|
||||
startAngle: curAngle + paddingAngle,
|
||||
endAngle: curAngle + deltaAngle + paddingAngle
|
||||
});
|
||||
stepData.push(_latest);
|
||||
curAngle = _latest.endAngle;
|
||||
}
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, _this3.renderSectorsStatically(stepData));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "attachKeyboardHandlers",
|
||||
value: function attachKeyboardHandlers(pieRef) {
|
||||
var _this4 = this;
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
pieRef.onkeydown = function (e) {
|
||||
if (!e.altKey) {
|
||||
switch (e.key) {
|
||||
case 'ArrowLeft':
|
||||
{
|
||||
var next = ++_this4.state.sectorToFocus % _this4.sectorRefs.length;
|
||||
_this4.sectorRefs[next].focus();
|
||||
_this4.setState({
|
||||
sectorToFocus: next
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'ArrowRight':
|
||||
{
|
||||
var _next = --_this4.state.sectorToFocus < 0 ? _this4.sectorRefs.length - 1 : _this4.state.sectorToFocus % _this4.sectorRefs.length;
|
||||
_this4.sectorRefs[_next].focus();
|
||||
_this4.setState({
|
||||
sectorToFocus: _next
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'Escape':
|
||||
{
|
||||
_this4.sectorRefs[_this4.state.sectorToFocus].blur();
|
||||
_this4.setState({
|
||||
sectorToFocus: 0
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// There is nothing to do here
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "renderSectors",
|
||||
value: function renderSectors() {
|
||||
var _this$props4 = this.props,
|
||||
sectors = _this$props4.sectors,
|
||||
isAnimationActive = _this$props4.isAnimationActive;
|
||||
var prevSectors = this.state.prevSectors;
|
||||
if (isAnimationActive && sectors && sectors.length && (!prevSectors || !(0, _isEqual["default"])(prevSectors, sectors))) {
|
||||
return this.renderSectorsWithAnimation();
|
||||
}
|
||||
return this.renderSectorsStatically(sectors);
|
||||
}
|
||||
}, {
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
if (this.pieRef) {
|
||||
this.attachKeyboardHandlers(this.pieRef);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this5 = this;
|
||||
var _this$props5 = this.props,
|
||||
hide = _this$props5.hide,
|
||||
sectors = _this$props5.sectors,
|
||||
className = _this$props5.className,
|
||||
label = _this$props5.label,
|
||||
cx = _this$props5.cx,
|
||||
cy = _this$props5.cy,
|
||||
innerRadius = _this$props5.innerRadius,
|
||||
outerRadius = _this$props5.outerRadius,
|
||||
isAnimationActive = _this$props5.isAnimationActive;
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
if (hide || !sectors || !sectors.length || !(0, _DataUtils.isNumber)(cx) || !(0, _DataUtils.isNumber)(cy) || !(0, _DataUtils.isNumber)(innerRadius) || !(0, _DataUtils.isNumber)(outerRadius)) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-pie', className);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
tabIndex: this.props.rootTabIndex,
|
||||
className: layerClass,
|
||||
ref: function ref(_ref3) {
|
||||
_this5.pieRef = _ref3;
|
||||
}
|
||||
}, this.renderSectors(), label && this.renderLabels(sectors), _Label.Label.renderCallByParent(this.props, null, false), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, sectors, false));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (prevState.prevIsAnimationActive !== nextProps.isAnimationActive) {
|
||||
return {
|
||||
prevIsAnimationActive: nextProps.isAnimationActive,
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curSectors: nextProps.sectors,
|
||||
prevSectors: [],
|
||||
isAnimationFinished: true
|
||||
};
|
||||
}
|
||||
if (nextProps.isAnimationActive && nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curSectors: nextProps.sectors,
|
||||
prevSectors: prevState.curSectors,
|
||||
isAnimationFinished: true
|
||||
};
|
||||
}
|
||||
if (nextProps.sectors !== prevState.curSectors) {
|
||||
return {
|
||||
curSectors: nextProps.sectors,
|
||||
isAnimationFinished: true
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "getTextAnchor",
|
||||
value: function getTextAnchor(x, cx) {
|
||||
if (x > cx) {
|
||||
return 'start';
|
||||
}
|
||||
if (x < cx) {
|
||||
return 'end';
|
||||
}
|
||||
return 'middle';
|
||||
}
|
||||
}, {
|
||||
key: "renderLabelLineItem",
|
||||
value: function renderLabelLineItem(option, props, key) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
}
|
||||
if ((0, _isFunction["default"])(option)) {
|
||||
return option(props);
|
||||
}
|
||||
var className = (0, _clsx["default"])('recharts-pie-label-line', typeof option !== 'boolean' ? option.className : '');
|
||||
return /*#__PURE__*/_react["default"].createElement(_Curve.Curve, _extends({}, props, {
|
||||
key: key,
|
||||
type: "linear",
|
||||
className: className
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderLabelItem",
|
||||
value: function renderLabelItem(option, props, value) {
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
return /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
}
|
||||
var label = value;
|
||||
if ((0, _isFunction["default"])(option)) {
|
||||
label = option(props);
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(label)) {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
var className = (0, _clsx["default"])('recharts-pie-label-text', typeof option !== 'boolean' && !(0, _isFunction["default"])(option) ? option.className : '');
|
||||
return /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({}, props, {
|
||||
alignmentBaseline: "middle",
|
||||
className: className
|
||||
}), label);
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_Pie = Pie;
|
||||
_defineProperty(Pie, "displayName", 'Pie');
|
||||
_defineProperty(Pie, "defaultProps", {
|
||||
stroke: '#fff',
|
||||
fill: '#808080',
|
||||
legendType: 'rect',
|
||||
cx: '50%',
|
||||
cy: '50%',
|
||||
startAngle: 0,
|
||||
endAngle: 360,
|
||||
innerRadius: 0,
|
||||
outerRadius: '80%',
|
||||
paddingAngle: 0,
|
||||
labelLine: true,
|
||||
hide: false,
|
||||
minAngle: 0,
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 400,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease',
|
||||
nameKey: 'name',
|
||||
blendStroke: false,
|
||||
rootTabIndex: 0
|
||||
});
|
||||
_defineProperty(Pie, "parseDeltaAngle", function (startAngle, endAngle) {
|
||||
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
|
||||
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
|
||||
return sign * deltaAngle;
|
||||
});
|
||||
_defineProperty(Pie, "getRealPieData", function (itemProps) {
|
||||
var data = itemProps.data,
|
||||
children = itemProps.children;
|
||||
var presentationProps = (0, _ReactUtils.filterProps)(itemProps, false);
|
||||
var cells = (0, _ReactUtils.findAllByType)(children, _Cell.Cell);
|
||||
if (data && data.length) {
|
||||
return data.map(function (entry, index) {
|
||||
return _objectSpread(_objectSpread(_objectSpread({
|
||||
payload: entry
|
||||
}, presentationProps), entry), cells && cells[index] && cells[index].props);
|
||||
});
|
||||
}
|
||||
if (cells && cells.length) {
|
||||
return cells.map(function (cell) {
|
||||
return _objectSpread(_objectSpread({}, presentationProps), cell.props);
|
||||
});
|
||||
}
|
||||
return [];
|
||||
});
|
||||
_defineProperty(Pie, "parseCoordinateOfPie", function (itemProps, offset) {
|
||||
var top = offset.top,
|
||||
left = offset.left,
|
||||
width = offset.width,
|
||||
height = offset.height;
|
||||
var maxPieRadius = (0, _PolarUtils.getMaxRadius)(width, height);
|
||||
var cx = left + (0, _DataUtils.getPercentValue)(itemProps.cx, width, width / 2);
|
||||
var cy = top + (0, _DataUtils.getPercentValue)(itemProps.cy, height, height / 2);
|
||||
var innerRadius = (0, _DataUtils.getPercentValue)(itemProps.innerRadius, maxPieRadius, 0);
|
||||
var outerRadius = (0, _DataUtils.getPercentValue)(itemProps.outerRadius, maxPieRadius, maxPieRadius * 0.8);
|
||||
var maxRadius = itemProps.maxRadius || Math.sqrt(width * width + height * height) / 2;
|
||||
return {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
maxRadius: maxRadius
|
||||
};
|
||||
});
|
||||
_defineProperty(Pie, "getComposedData", function (_ref4) {
|
||||
var item = _ref4.item,
|
||||
offset = _ref4.offset;
|
||||
var itemProps = item.type.defaultProps !== undefined ? _objectSpread(_objectSpread({}, item.type.defaultProps), item.props) : item.props;
|
||||
var pieData = _Pie.getRealPieData(itemProps);
|
||||
if (!pieData || !pieData.length) {
|
||||
return null;
|
||||
}
|
||||
var cornerRadius = itemProps.cornerRadius,
|
||||
startAngle = itemProps.startAngle,
|
||||
endAngle = itemProps.endAngle,
|
||||
paddingAngle = itemProps.paddingAngle,
|
||||
dataKey = itemProps.dataKey,
|
||||
nameKey = itemProps.nameKey,
|
||||
valueKey = itemProps.valueKey,
|
||||
tooltipType = itemProps.tooltipType;
|
||||
var minAngle = Math.abs(itemProps.minAngle);
|
||||
var coordinate = _Pie.parseCoordinateOfPie(itemProps, offset);
|
||||
var deltaAngle = _Pie.parseDeltaAngle(startAngle, endAngle);
|
||||
var absDeltaAngle = Math.abs(deltaAngle);
|
||||
var realDataKey = dataKey;
|
||||
if ((0, _isNil["default"])(dataKey) && (0, _isNil["default"])(valueKey)) {
|
||||
(0, _LogUtils.warn)(false, "Use \"dataKey\" to specify the value of pie,\n the props \"valueKey\" will be deprecated in 1.1.0");
|
||||
realDataKey = 'value';
|
||||
} else if ((0, _isNil["default"])(dataKey)) {
|
||||
(0, _LogUtils.warn)(false, "Use \"dataKey\" to specify the value of pie,\n the props \"valueKey\" will be deprecated in 1.1.0");
|
||||
realDataKey = valueKey;
|
||||
}
|
||||
var notZeroItemCount = pieData.filter(function (entry) {
|
||||
return (0, _ChartUtils.getValueByDataKey)(entry, realDataKey, 0) !== 0;
|
||||
}).length;
|
||||
var totalPadingAngle = (absDeltaAngle >= 360 ? notZeroItemCount : notZeroItemCount - 1) * paddingAngle;
|
||||
var realTotalAngle = absDeltaAngle - notZeroItemCount * minAngle - totalPadingAngle;
|
||||
var sum = pieData.reduce(function (result, entry) {
|
||||
var val = (0, _ChartUtils.getValueByDataKey)(entry, realDataKey, 0);
|
||||
return result + ((0, _DataUtils.isNumber)(val) ? val : 0);
|
||||
}, 0);
|
||||
var sectors;
|
||||
if (sum > 0) {
|
||||
var prev;
|
||||
sectors = pieData.map(function (entry, i) {
|
||||
var val = (0, _ChartUtils.getValueByDataKey)(entry, realDataKey, 0);
|
||||
var name = (0, _ChartUtils.getValueByDataKey)(entry, nameKey, i);
|
||||
var percent = ((0, _DataUtils.isNumber)(val) ? val : 0) / sum;
|
||||
var tempStartAngle;
|
||||
if (i) {
|
||||
tempStartAngle = prev.endAngle + (0, _DataUtils.mathSign)(deltaAngle) * paddingAngle * (val !== 0 ? 1 : 0);
|
||||
} else {
|
||||
tempStartAngle = startAngle;
|
||||
}
|
||||
var tempEndAngle = tempStartAngle + (0, _DataUtils.mathSign)(deltaAngle) * ((val !== 0 ? minAngle : 0) + percent * realTotalAngle);
|
||||
var midAngle = (tempStartAngle + tempEndAngle) / 2;
|
||||
var middleRadius = (coordinate.innerRadius + coordinate.outerRadius) / 2;
|
||||
var tooltipPayload = [{
|
||||
name: name,
|
||||
value: val,
|
||||
payload: entry,
|
||||
dataKey: realDataKey,
|
||||
type: tooltipType
|
||||
}];
|
||||
var tooltipPosition = (0, _PolarUtils.polarToCartesian)(coordinate.cx, coordinate.cy, middleRadius, midAngle);
|
||||
prev = _objectSpread(_objectSpread(_objectSpread({
|
||||
percent: percent,
|
||||
cornerRadius: cornerRadius,
|
||||
name: name,
|
||||
tooltipPayload: tooltipPayload,
|
||||
midAngle: midAngle,
|
||||
middleRadius: middleRadius,
|
||||
tooltipPosition: tooltipPosition
|
||||
}, entry), coordinate), {}, {
|
||||
value: (0, _ChartUtils.getValueByDataKey)(entry, realDataKey),
|
||||
startAngle: tempStartAngle,
|
||||
endAngle: tempEndAngle,
|
||||
payload: entry,
|
||||
paddingAngle: (0, _DataUtils.mathSign)(deltaAngle) * paddingAngle
|
||||
});
|
||||
return prev;
|
||||
});
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, coordinate), {}, {
|
||||
sectors: sectors,
|
||||
data: pieData
|
||||
});
|
||||
});
|
||||
212
frontend/node_modules/recharts/lib/polar/PolarAngleAxis.js
generated
vendored
Normal file
212
frontend/node_modules/recharts/lib/polar/PolarAngleAxis.js
generated
vendored
Normal file
@ -0,0 +1,212 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PolarAngleAxis = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Dot = require("../shape/Dot");
|
||||
var _Polygon = require("../shape/Polygon");
|
||||
var _Text = require("../component/Text");
|
||||
var _types = require("../util/types");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Axis of radial direction
|
||||
*/
|
||||
var RADIAN = Math.PI / 180;
|
||||
var eps = 1e-5;
|
||||
var PolarAngleAxis = exports.PolarAngleAxis = /*#__PURE__*/function (_PureComponent) {
|
||||
function PolarAngleAxis() {
|
||||
_classCallCheck(this, PolarAngleAxis);
|
||||
return _callSuper(this, PolarAngleAxis, arguments);
|
||||
}
|
||||
_inherits(PolarAngleAxis, _PureComponent);
|
||||
return _createClass(PolarAngleAxis, [{
|
||||
key: "getTickLineCoord",
|
||||
value:
|
||||
/**
|
||||
* Calculate the coordinate of line endpoint
|
||||
* @param {Object} data The Data if ticks
|
||||
* @return {Object} (x0, y0): The start point of text,
|
||||
* (x1, y1): The end point close to text,
|
||||
* (x2, y2): The end point close to axis
|
||||
*/
|
||||
function getTickLineCoord(data) {
|
||||
var _this$props = this.props,
|
||||
cx = _this$props.cx,
|
||||
cy = _this$props.cy,
|
||||
radius = _this$props.radius,
|
||||
orientation = _this$props.orientation,
|
||||
tickSize = _this$props.tickSize;
|
||||
var tickLineSize = tickSize || 8;
|
||||
var p1 = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, data.coordinate);
|
||||
var p2 = (0, _PolarUtils.polarToCartesian)(cx, cy, radius + (orientation === 'inner' ? -1 : 1) * tickLineSize, data.coordinate);
|
||||
return {
|
||||
x1: p1.x,
|
||||
y1: p1.y,
|
||||
x2: p2.x,
|
||||
y2: p2.y
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text-anchor of each tick
|
||||
* @param {Object} data Data of ticks
|
||||
* @return {String} text-anchor
|
||||
*/
|
||||
}, {
|
||||
key: "getTickTextAnchor",
|
||||
value: function getTickTextAnchor(data) {
|
||||
var orientation = this.props.orientation;
|
||||
var cos = Math.cos(-data.coordinate * RADIAN);
|
||||
var textAnchor;
|
||||
if (cos > eps) {
|
||||
textAnchor = orientation === 'outer' ? 'start' : 'end';
|
||||
} else if (cos < -eps) {
|
||||
textAnchor = orientation === 'outer' ? 'end' : 'start';
|
||||
} else {
|
||||
textAnchor = 'middle';
|
||||
}
|
||||
return textAnchor;
|
||||
}
|
||||
}, {
|
||||
key: "renderAxisLine",
|
||||
value: function renderAxisLine() {
|
||||
var _this$props2 = this.props,
|
||||
cx = _this$props2.cx,
|
||||
cy = _this$props2.cy,
|
||||
radius = _this$props2.radius,
|
||||
axisLine = _this$props2.axisLine,
|
||||
axisLineType = _this$props2.axisLineType;
|
||||
var props = _objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(this.props, false)), {}, {
|
||||
fill: 'none'
|
||||
}, (0, _ReactUtils.filterProps)(axisLine, false));
|
||||
if (axisLineType === 'circle') {
|
||||
return /*#__PURE__*/_react["default"].createElement(_Dot.Dot, _extends({
|
||||
className: "recharts-polar-angle-axis-line"
|
||||
}, props, {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
r: radius
|
||||
}));
|
||||
}
|
||||
var ticks = this.props.ticks;
|
||||
var points = ticks.map(function (entry) {
|
||||
return (0, _PolarUtils.polarToCartesian)(cx, cy, radius, entry.coordinate);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Polygon.Polygon, _extends({
|
||||
className: "recharts-polar-angle-axis-line"
|
||||
}, props, {
|
||||
points: points
|
||||
}));
|
||||
}
|
||||
}, {
|
||||
key: "renderTicks",
|
||||
value: function renderTicks() {
|
||||
var _this = this;
|
||||
var _this$props3 = this.props,
|
||||
ticks = _this$props3.ticks,
|
||||
tick = _this$props3.tick,
|
||||
tickLine = _this$props3.tickLine,
|
||||
tickFormatter = _this$props3.tickFormatter,
|
||||
stroke = _this$props3.stroke;
|
||||
var axisProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customTickProps = (0, _ReactUtils.filterProps)(tick, false);
|
||||
var tickLineProps = _objectSpread(_objectSpread({}, axisProps), {}, {
|
||||
fill: 'none'
|
||||
}, (0, _ReactUtils.filterProps)(tickLine, false));
|
||||
var items = ticks.map(function (entry, i) {
|
||||
var lineCoord = _this.getTickLineCoord(entry);
|
||||
var textAnchor = _this.getTickTextAnchor(entry);
|
||||
var tickProps = _objectSpread(_objectSpread(_objectSpread({
|
||||
textAnchor: textAnchor
|
||||
}, axisProps), {}, {
|
||||
stroke: 'none',
|
||||
fill: stroke
|
||||
}, customTickProps), {}, {
|
||||
index: i,
|
||||
payload: entry,
|
||||
x: lineCoord.x2,
|
||||
y: lineCoord.y2
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: (0, _clsx["default"])('recharts-polar-angle-axis-tick', (0, _PolarUtils.getTickClassName)(tick)),
|
||||
key: "tick-".concat(entry.coordinate)
|
||||
}, (0, _types.adaptEventsOfChild)(_this.props, entry, i)), tickLine && /*#__PURE__*/_react["default"].createElement("line", _extends({
|
||||
className: "recharts-polar-angle-axis-tick-line"
|
||||
}, tickLineProps, lineCoord)), tick && PolarAngleAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-polar-angle-axis-ticks"
|
||||
}, items);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props4 = this.props,
|
||||
ticks = _this$props4.ticks,
|
||||
radius = _this$props4.radius,
|
||||
axisLine = _this$props4.axisLine;
|
||||
if (radius <= 0 || !ticks || !ticks.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-polar-angle-axis', this.props.className)
|
||||
}, axisLine && this.renderAxisLine(), this.renderTicks());
|
||||
}
|
||||
}], [{
|
||||
key: "renderTickItem",
|
||||
value: function renderTickItem(option, props, value) {
|
||||
var tickItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
tickItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
tickItem = option(props);
|
||||
} else {
|
||||
tickItem = /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({}, props, {
|
||||
className: "recharts-polar-angle-axis-tick-value"
|
||||
}), value);
|
||||
}
|
||||
return tickItem;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(PolarAngleAxis, "displayName", 'PolarAngleAxis');
|
||||
_defineProperty(PolarAngleAxis, "axisType", 'angleAxis');
|
||||
_defineProperty(PolarAngleAxis, "defaultProps", {
|
||||
type: 'category',
|
||||
angleAxisId: 0,
|
||||
scale: 'auto',
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
orientation: 'outer',
|
||||
axisLine: true,
|
||||
tickLine: true,
|
||||
tickSize: 8,
|
||||
tick: true,
|
||||
hide: false,
|
||||
allowDuplicatedCategory: true
|
||||
});
|
||||
164
frontend/node_modules/recharts/lib/polar/PolarGrid.js
generated
vendored
Normal file
164
frontend/node_modules/recharts/lib/polar/PolarGrid.js
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PolarGrid = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["cx", "cy", "innerRadius", "outerRadius", "gridType", "radialLines"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Polar Grid
|
||||
*/
|
||||
var getPolygonPath = function getPolygonPath(radius, cx, cy, polarAngles) {
|
||||
var path = '';
|
||||
polarAngles.forEach(function (angle, i) {
|
||||
var point = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, angle);
|
||||
if (i) {
|
||||
path += "L ".concat(point.x, ",").concat(point.y);
|
||||
} else {
|
||||
path += "M ".concat(point.x, ",").concat(point.y);
|
||||
}
|
||||
});
|
||||
path += 'Z';
|
||||
return path;
|
||||
};
|
||||
|
||||
// Draw axis of radial line
|
||||
var PolarAngles = function PolarAngles(props) {
|
||||
var cx = props.cx,
|
||||
cy = props.cy,
|
||||
innerRadius = props.innerRadius,
|
||||
outerRadius = props.outerRadius,
|
||||
polarAngles = props.polarAngles,
|
||||
radialLines = props.radialLines;
|
||||
if (!polarAngles || !polarAngles.length || !radialLines) {
|
||||
return null;
|
||||
}
|
||||
var polarAnglesProps = _objectSpread({
|
||||
stroke: '#ccc'
|
||||
}, (0, _ReactUtils.filterProps)(props, false));
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-polar-grid-angle"
|
||||
}, polarAngles.map(function (entry) {
|
||||
var start = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, entry);
|
||||
var end = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, entry);
|
||||
return /*#__PURE__*/_react["default"].createElement("line", _extends({}, polarAnglesProps, {
|
||||
key: "line-".concat(entry),
|
||||
x1: start.x,
|
||||
y1: start.y,
|
||||
x2: end.x,
|
||||
y2: end.y
|
||||
}));
|
||||
}));
|
||||
};
|
||||
|
||||
// Draw concentric circles
|
||||
var ConcentricCircle = function ConcentricCircle(props) {
|
||||
var cx = props.cx,
|
||||
cy = props.cy,
|
||||
radius = props.radius,
|
||||
index = props.index;
|
||||
var concentricCircleProps = _objectSpread(_objectSpread({
|
||||
stroke: '#ccc'
|
||||
}, (0, _ReactUtils.filterProps)(props, false)), {}, {
|
||||
fill: 'none'
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("circle", _extends({}, concentricCircleProps, {
|
||||
className: (0, _clsx["default"])('recharts-polar-grid-concentric-circle', props.className),
|
||||
key: "circle-".concat(index),
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
r: radius
|
||||
}));
|
||||
};
|
||||
|
||||
// Draw concentric polygons
|
||||
var ConcentricPolygon = function ConcentricPolygon(props) {
|
||||
var radius = props.radius,
|
||||
index = props.index;
|
||||
var concentricPolygonProps = _objectSpread(_objectSpread({
|
||||
stroke: '#ccc'
|
||||
}, (0, _ReactUtils.filterProps)(props, false)), {}, {
|
||||
fill: 'none'
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, concentricPolygonProps, {
|
||||
className: (0, _clsx["default"])('recharts-polar-grid-concentric-polygon', props.className),
|
||||
key: "path-".concat(index),
|
||||
d: getPolygonPath(radius, props.cx, props.cy, props.polarAngles)
|
||||
}));
|
||||
};
|
||||
|
||||
// Draw concentric axis
|
||||
// TODO Optimize the name
|
||||
var ConcentricPath = function ConcentricPath(props) {
|
||||
var polarRadius = props.polarRadius,
|
||||
gridType = props.gridType;
|
||||
if (!polarRadius || !polarRadius.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-polar-grid-concentric"
|
||||
}, polarRadius.map(function (entry, i) {
|
||||
var key = i;
|
||||
if (gridType === 'circle') return /*#__PURE__*/_react["default"].createElement(ConcentricCircle, _extends({
|
||||
key: key
|
||||
}, props, {
|
||||
radius: entry,
|
||||
index: i
|
||||
}));
|
||||
return /*#__PURE__*/_react["default"].createElement(ConcentricPolygon, _extends({
|
||||
key: key
|
||||
}, props, {
|
||||
radius: entry,
|
||||
index: i
|
||||
}));
|
||||
}));
|
||||
};
|
||||
var PolarGrid = exports.PolarGrid = function PolarGrid(_ref) {
|
||||
var _ref$cx = _ref.cx,
|
||||
cx = _ref$cx === void 0 ? 0 : _ref$cx,
|
||||
_ref$cy = _ref.cy,
|
||||
cy = _ref$cy === void 0 ? 0 : _ref$cy,
|
||||
_ref$innerRadius = _ref.innerRadius,
|
||||
innerRadius = _ref$innerRadius === void 0 ? 0 : _ref$innerRadius,
|
||||
_ref$outerRadius = _ref.outerRadius,
|
||||
outerRadius = _ref$outerRadius === void 0 ? 0 : _ref$outerRadius,
|
||||
_ref$gridType = _ref.gridType,
|
||||
gridType = _ref$gridType === void 0 ? 'polygon' : _ref$gridType,
|
||||
_ref$radialLines = _ref.radialLines,
|
||||
radialLines = _ref$radialLines === void 0 ? true : _ref$radialLines,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
if (outerRadius <= 0) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: "recharts-polar-grid"
|
||||
}, /*#__PURE__*/_react["default"].createElement(PolarAngles, _extends({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
gridType: gridType,
|
||||
radialLines: radialLines
|
||||
}, props)), /*#__PURE__*/_react["default"].createElement(ConcentricPath, _extends({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
gridType: gridType,
|
||||
radialLines: radialLines
|
||||
}, props)));
|
||||
};
|
||||
PolarGrid.displayName = 'PolarGrid';
|
||||
217
frontend/node_modules/recharts/lib/polar/PolarRadiusAxis.js
generated
vendored
Normal file
217
frontend/node_modules/recharts/lib/polar/PolarRadiusAxis.js
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PolarRadiusAxis = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _maxBy = _interopRequireDefault(require("lodash/maxBy"));
|
||||
var _minBy = _interopRequireDefault(require("lodash/minBy"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _Text = require("../component/Text");
|
||||
var _Label = require("../component/Label");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _types = require("../util/types");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["cx", "cy", "angle", "ticks", "axisLine"],
|
||||
_excluded2 = ["ticks", "tick", "angle", "tickFormatter", "stroke"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview The axis of polar coordinate system
|
||||
*/
|
||||
var PolarRadiusAxis = exports.PolarRadiusAxis = /*#__PURE__*/function (_PureComponent) {
|
||||
function PolarRadiusAxis() {
|
||||
_classCallCheck(this, PolarRadiusAxis);
|
||||
return _callSuper(this, PolarRadiusAxis, arguments);
|
||||
}
|
||||
_inherits(PolarRadiusAxis, _PureComponent);
|
||||
return _createClass(PolarRadiusAxis, [{
|
||||
key: "getTickValueCoord",
|
||||
value:
|
||||
/**
|
||||
* Calculate the coordinate of tick
|
||||
* @param {Number} coordinate The radius of tick
|
||||
* @return {Object} (x, y)
|
||||
*/
|
||||
function getTickValueCoord(_ref) {
|
||||
var coordinate = _ref.coordinate;
|
||||
var _this$props = this.props,
|
||||
angle = _this$props.angle,
|
||||
cx = _this$props.cx,
|
||||
cy = _this$props.cy;
|
||||
return (0, _PolarUtils.polarToCartesian)(cx, cy, coordinate, angle);
|
||||
}
|
||||
}, {
|
||||
key: "getTickTextAnchor",
|
||||
value: function getTickTextAnchor() {
|
||||
var orientation = this.props.orientation;
|
||||
var textAnchor;
|
||||
switch (orientation) {
|
||||
case 'left':
|
||||
textAnchor = 'end';
|
||||
break;
|
||||
case 'right':
|
||||
textAnchor = 'start';
|
||||
break;
|
||||
default:
|
||||
textAnchor = 'middle';
|
||||
break;
|
||||
}
|
||||
return textAnchor;
|
||||
}
|
||||
}, {
|
||||
key: "getViewBox",
|
||||
value: function getViewBox() {
|
||||
var _this$props2 = this.props,
|
||||
cx = _this$props2.cx,
|
||||
cy = _this$props2.cy,
|
||||
angle = _this$props2.angle,
|
||||
ticks = _this$props2.ticks;
|
||||
var maxRadiusTick = (0, _maxBy["default"])(ticks, function (entry) {
|
||||
return entry.coordinate || 0;
|
||||
});
|
||||
var minRadiusTick = (0, _minBy["default"])(ticks, function (entry) {
|
||||
return entry.coordinate || 0;
|
||||
});
|
||||
return {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
startAngle: angle,
|
||||
endAngle: angle,
|
||||
innerRadius: minRadiusTick.coordinate || 0,
|
||||
outerRadius: maxRadiusTick.coordinate || 0
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "renderAxisLine",
|
||||
value: function renderAxisLine() {
|
||||
var _this$props3 = this.props,
|
||||
cx = _this$props3.cx,
|
||||
cy = _this$props3.cy,
|
||||
angle = _this$props3.angle,
|
||||
ticks = _this$props3.ticks,
|
||||
axisLine = _this$props3.axisLine,
|
||||
others = _objectWithoutProperties(_this$props3, _excluded);
|
||||
var extent = ticks.reduce(function (result, entry) {
|
||||
return [Math.min(result[0], entry.coordinate), Math.max(result[1], entry.coordinate)];
|
||||
}, [Infinity, -Infinity]);
|
||||
var point0 = (0, _PolarUtils.polarToCartesian)(cx, cy, extent[0], angle);
|
||||
var point1 = (0, _PolarUtils.polarToCartesian)(cx, cy, extent[1], angle);
|
||||
var props = _objectSpread(_objectSpread(_objectSpread({}, (0, _ReactUtils.filterProps)(others, false)), {}, {
|
||||
fill: 'none'
|
||||
}, (0, _ReactUtils.filterProps)(axisLine, false)), {}, {
|
||||
x1: point0.x,
|
||||
y1: point0.y,
|
||||
x2: point1.x,
|
||||
y2: point1.y
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement("line", _extends({
|
||||
className: "recharts-polar-radius-axis-line"
|
||||
}, props));
|
||||
}
|
||||
}, {
|
||||
key: "renderTicks",
|
||||
value: function renderTicks() {
|
||||
var _this = this;
|
||||
var _this$props4 = this.props,
|
||||
ticks = _this$props4.ticks,
|
||||
tick = _this$props4.tick,
|
||||
angle = _this$props4.angle,
|
||||
tickFormatter = _this$props4.tickFormatter,
|
||||
stroke = _this$props4.stroke,
|
||||
others = _objectWithoutProperties(_this$props4, _excluded2);
|
||||
var textAnchor = this.getTickTextAnchor();
|
||||
var axisProps = (0, _ReactUtils.filterProps)(others, false);
|
||||
var customTickProps = (0, _ReactUtils.filterProps)(tick, false);
|
||||
var items = ticks.map(function (entry, i) {
|
||||
var coord = _this.getTickValueCoord(entry);
|
||||
var tickProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
||||
textAnchor: textAnchor,
|
||||
transform: "rotate(".concat(90 - angle, ", ").concat(coord.x, ", ").concat(coord.y, ")")
|
||||
}, axisProps), {}, {
|
||||
stroke: 'none',
|
||||
fill: stroke
|
||||
}, customTickProps), {}, {
|
||||
index: i
|
||||
}, coord), {}, {
|
||||
payload: entry
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, _extends({
|
||||
className: (0, _clsx["default"])('recharts-polar-radius-axis-tick', (0, _PolarUtils.getTickClassName)(tick)),
|
||||
key: "tick-".concat(entry.coordinate)
|
||||
}, (0, _types.adaptEventsOfChild)(_this.props, entry, i)), PolarRadiusAxis.renderTickItem(tick, tickProps, tickFormatter ? tickFormatter(entry.value, i) : entry.value));
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-polar-radius-axis-ticks"
|
||||
}, items);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props5 = this.props,
|
||||
ticks = _this$props5.ticks,
|
||||
axisLine = _this$props5.axisLine,
|
||||
tick = _this$props5.tick;
|
||||
if (!ticks || !ticks.length) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: (0, _clsx["default"])('recharts-polar-radius-axis', this.props.className)
|
||||
}, axisLine && this.renderAxisLine(), tick && this.renderTicks(), _Label.Label.renderCallByParent(this.props, this.getViewBox()));
|
||||
}
|
||||
}], [{
|
||||
key: "renderTickItem",
|
||||
value: function renderTickItem(option, props, value) {
|
||||
var tickItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
tickItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
tickItem = option(props);
|
||||
} else {
|
||||
tickItem = /*#__PURE__*/_react["default"].createElement(_Text.Text, _extends({}, props, {
|
||||
className: "recharts-polar-radius-axis-tick-value"
|
||||
}), value);
|
||||
}
|
||||
return tickItem;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(PolarRadiusAxis, "displayName", 'PolarRadiusAxis');
|
||||
_defineProperty(PolarRadiusAxis, "axisType", 'radiusAxis');
|
||||
_defineProperty(PolarRadiusAxis, "defaultProps", {
|
||||
type: 'number',
|
||||
radiusAxisId: 0,
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
angle: 0,
|
||||
orientation: 'right',
|
||||
stroke: '#ccc',
|
||||
axisLine: true,
|
||||
tick: true,
|
||||
tickCount: 5,
|
||||
allowDataOverflow: false,
|
||||
scale: 'auto',
|
||||
allowDuplicatedCategory: true
|
||||
});
|
||||
327
frontend/node_modules/recharts/lib/polar/Radar.js
generated
vendored
Normal file
327
frontend/node_modules/recharts/lib/polar/Radar.js
generated
vendored
Normal file
@ -0,0 +1,327 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Radar = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _last = _interopRequireDefault(require("lodash/last"));
|
||||
var _first = _interopRequireDefault(require("lodash/first"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _Polygon = require("../shape/Polygon");
|
||||
var _Dot = require("../shape/Dot");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["key"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Radar
|
||||
*/
|
||||
var Radar = exports.Radar = /*#__PURE__*/function (_PureComponent) {
|
||||
function Radar() {
|
||||
var _this;
|
||||
_classCallCheck(this, Radar);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, Radar, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: false
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleMouseEnter", function (e) {
|
||||
var onMouseEnter = _this.props.onMouseEnter;
|
||||
if (onMouseEnter) {
|
||||
onMouseEnter(_this.props, e);
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleMouseLeave", function (e) {
|
||||
var onMouseLeave = _this.props.onMouseLeave;
|
||||
if (onMouseLeave) {
|
||||
onMouseLeave(_this.props, e);
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(Radar, _PureComponent);
|
||||
return _createClass(Radar, [{
|
||||
key: "renderDots",
|
||||
value: function renderDots(points) {
|
||||
var _this$props = this.props,
|
||||
dot = _this$props.dot,
|
||||
dataKey = _this$props.dataKey;
|
||||
var baseProps = (0, _ReactUtils.filterProps)(this.props, false);
|
||||
var customDotProps = (0, _ReactUtils.filterProps)(dot, true);
|
||||
var dots = points.map(function (entry, i) {
|
||||
var dotProps = _objectSpread(_objectSpread(_objectSpread({
|
||||
key: "dot-".concat(i),
|
||||
r: 3
|
||||
}, baseProps), customDotProps), {}, {
|
||||
dataKey: dataKey,
|
||||
cx: entry.x,
|
||||
cy: entry.y,
|
||||
index: i,
|
||||
payload: entry
|
||||
});
|
||||
return Radar.renderDotItem(dot, dotProps);
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-radar-dots"
|
||||
}, dots);
|
||||
}
|
||||
}, {
|
||||
key: "renderPolygonStatically",
|
||||
value: function renderPolygonStatically(points) {
|
||||
var _this$props2 = this.props,
|
||||
shape = _this$props2.shape,
|
||||
dot = _this$props2.dot,
|
||||
isRange = _this$props2.isRange,
|
||||
baseLinePoints = _this$props2.baseLinePoints,
|
||||
connectNulls = _this$props2.connectNulls;
|
||||
var radar;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(shape)) {
|
||||
radar = /*#__PURE__*/_react["default"].cloneElement(shape, _objectSpread(_objectSpread({}, this.props), {}, {
|
||||
points: points
|
||||
}));
|
||||
} else if ((0, _isFunction["default"])(shape)) {
|
||||
radar = shape(_objectSpread(_objectSpread({}, this.props), {}, {
|
||||
points: points
|
||||
}));
|
||||
} else {
|
||||
radar = /*#__PURE__*/_react["default"].createElement(_Polygon.Polygon, _extends({}, (0, _ReactUtils.filterProps)(this.props, true), {
|
||||
onMouseEnter: this.handleMouseEnter,
|
||||
onMouseLeave: this.handleMouseLeave,
|
||||
points: points,
|
||||
baseLinePoints: isRange ? baseLinePoints : null,
|
||||
connectNulls: connectNulls
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-radar-polygon"
|
||||
}, radar, dot ? this.renderDots(points) : null);
|
||||
}
|
||||
}, {
|
||||
key: "renderPolygonWithAnimation",
|
||||
value: function renderPolygonWithAnimation() {
|
||||
var _this2 = this;
|
||||
var _this$props3 = this.props,
|
||||
points = _this$props3.points,
|
||||
isAnimationActive = _this$props3.isAnimationActive,
|
||||
animationBegin = _this$props3.animationBegin,
|
||||
animationDuration = _this$props3.animationDuration,
|
||||
animationEasing = _this$props3.animationEasing,
|
||||
animationId = _this$props3.animationId;
|
||||
var prevPoints = this.state.prevPoints;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "radar-".concat(animationId),
|
||||
onAnimationEnd: this.handleAnimationEnd,
|
||||
onAnimationStart: this.handleAnimationStart
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
var prevPointsDiffFactor = prevPoints && prevPoints.length / points.length;
|
||||
var stepData = points.map(function (entry, index) {
|
||||
var prev = prevPoints && prevPoints[Math.floor(index * prevPointsDiffFactor)];
|
||||
if (prev) {
|
||||
var _interpolatorX = (0, _DataUtils.interpolateNumber)(prev.x, entry.x);
|
||||
var _interpolatorY = (0, _DataUtils.interpolateNumber)(prev.y, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: _interpolatorX(t),
|
||||
y: _interpolatorY(t)
|
||||
});
|
||||
}
|
||||
var interpolatorX = (0, _DataUtils.interpolateNumber)(entry.cx, entry.x);
|
||||
var interpolatorY = (0, _DataUtils.interpolateNumber)(entry.cy, entry.y);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
x: interpolatorX(t),
|
||||
y: interpolatorY(t)
|
||||
});
|
||||
});
|
||||
return _this2.renderPolygonStatically(stepData);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderPolygon",
|
||||
value: function renderPolygon() {
|
||||
var _this$props4 = this.props,
|
||||
points = _this$props4.points,
|
||||
isAnimationActive = _this$props4.isAnimationActive,
|
||||
isRange = _this$props4.isRange;
|
||||
var prevPoints = this.state.prevPoints;
|
||||
if (isAnimationActive && points && points.length && !isRange && (!prevPoints || !(0, _isEqual["default"])(prevPoints, points))) {
|
||||
return this.renderPolygonWithAnimation();
|
||||
}
|
||||
return this.renderPolygonStatically(points);
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props5 = this.props,
|
||||
hide = _this$props5.hide,
|
||||
className = _this$props5.className,
|
||||
points = _this$props5.points,
|
||||
isAnimationActive = _this$props5.isAnimationActive;
|
||||
if (hide || !points || !points.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var layerClass = (0, _clsx["default"])('recharts-radar', className);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, this.renderPolygon(), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(this.props, points));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curPoints: nextProps.points,
|
||||
prevPoints: prevState.curPoints
|
||||
};
|
||||
}
|
||||
if (nextProps.points !== prevState.curPoints) {
|
||||
return {
|
||||
curPoints: nextProps.points
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "renderDotItem",
|
||||
value: function renderDotItem(option, props) {
|
||||
var dotItem;
|
||||
if ( /*#__PURE__*/_react["default"].isValidElement(option)) {
|
||||
dotItem = /*#__PURE__*/_react["default"].cloneElement(option, props);
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
dotItem = option(props);
|
||||
} else {
|
||||
var key = props.key,
|
||||
dotProps = _objectWithoutProperties(props, _excluded);
|
||||
dotItem = /*#__PURE__*/_react["default"].createElement(_Dot.Dot, _extends({}, dotProps, {
|
||||
key: key,
|
||||
className: (0, _clsx["default"])('recharts-radar-dot', typeof option !== 'boolean' ? option.className : '')
|
||||
}));
|
||||
}
|
||||
return dotItem;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(Radar, "displayName", 'Radar');
|
||||
_defineProperty(Radar, "defaultProps", {
|
||||
angleAxisId: 0,
|
||||
radiusAxisId: 0,
|
||||
hide: false,
|
||||
activeDot: true,
|
||||
dot: false,
|
||||
legendType: 'rect',
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease'
|
||||
});
|
||||
_defineProperty(Radar, "getComposedData", function (_ref2) {
|
||||
var radiusAxis = _ref2.radiusAxis,
|
||||
angleAxis = _ref2.angleAxis,
|
||||
displayedData = _ref2.displayedData,
|
||||
dataKey = _ref2.dataKey,
|
||||
bandSize = _ref2.bandSize;
|
||||
var cx = angleAxis.cx,
|
||||
cy = angleAxis.cy;
|
||||
var isRange = false;
|
||||
var points = [];
|
||||
var angleBandSize = angleAxis.type !== 'number' ? bandSize !== null && bandSize !== void 0 ? bandSize : 0 : 0;
|
||||
displayedData.forEach(function (entry, i) {
|
||||
var name = (0, _ChartUtils.getValueByDataKey)(entry, angleAxis.dataKey, i);
|
||||
var value = (0, _ChartUtils.getValueByDataKey)(entry, dataKey);
|
||||
var angle = angleAxis.scale(name) + angleBandSize;
|
||||
var pointValue = Array.isArray(value) ? (0, _last["default"])(value) : value;
|
||||
var radius = (0, _isNil["default"])(pointValue) ? undefined : radiusAxis.scale(pointValue);
|
||||
if (Array.isArray(value) && value.length >= 2) {
|
||||
isRange = true;
|
||||
}
|
||||
points.push(_objectSpread(_objectSpread({}, (0, _PolarUtils.polarToCartesian)(cx, cy, radius, angle)), {}, {
|
||||
name: name,
|
||||
value: value,
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: radius,
|
||||
angle: angle,
|
||||
payload: entry
|
||||
}));
|
||||
});
|
||||
var baseLinePoints = [];
|
||||
if (isRange) {
|
||||
points.forEach(function (point) {
|
||||
if (Array.isArray(point.value)) {
|
||||
var baseValue = (0, _first["default"])(point.value);
|
||||
var radius = (0, _isNil["default"])(baseValue) ? undefined : radiusAxis.scale(baseValue);
|
||||
baseLinePoints.push(_objectSpread(_objectSpread({}, point), {}, {
|
||||
radius: radius
|
||||
}, (0, _PolarUtils.polarToCartesian)(cx, cy, radius, point.angle)));
|
||||
} else {
|
||||
baseLinePoints.push(point);
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
points: points,
|
||||
isRange: isRange,
|
||||
baseLinePoints: baseLinePoints
|
||||
};
|
||||
});
|
||||
365
frontend/node_modules/recharts/lib/polar/RadialBar.js
generated
vendored
Normal file
365
frontend/node_modules/recharts/lib/polar/RadialBar.js
generated
vendored
Normal file
@ -0,0 +1,365 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RadialBar = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _RadialBarUtils = require("../util/RadialBarUtils");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _Global = require("../util/Global");
|
||||
var _LabelList = require("../component/LabelList");
|
||||
var _Cell = require("../component/Cell");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ChartUtils = require("../util/ChartUtils");
|
||||
var _types = require("../util/types");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _excluded = ["shape", "activeShape", "activeIndex", "cornerRadius"],
|
||||
_excluded2 = ["value", "background"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Render a group of radial bar
|
||||
*/
|
||||
// TODO: Cause of circular dependency. Needs refactoring of functions that need them.
|
||||
// import { AngleAxisProps, RadiusAxisProps } from './types';
|
||||
var RadialBar = exports.RadialBar = /*#__PURE__*/function (_PureComponent) {
|
||||
function RadialBar() {
|
||||
var _this;
|
||||
_classCallCheck(this, RadialBar);
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
_this = _callSuper(this, RadialBar, [].concat(args));
|
||||
_defineProperty(_this, "state", {
|
||||
isAnimationFinished: false
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationEnd", function () {
|
||||
var onAnimationEnd = _this.props.onAnimationEnd;
|
||||
_this.setState({
|
||||
isAnimationFinished: true
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationEnd)) {
|
||||
onAnimationEnd();
|
||||
}
|
||||
});
|
||||
_defineProperty(_this, "handleAnimationStart", function () {
|
||||
var onAnimationStart = _this.props.onAnimationStart;
|
||||
_this.setState({
|
||||
isAnimationFinished: false
|
||||
});
|
||||
if ((0, _isFunction["default"])(onAnimationStart)) {
|
||||
onAnimationStart();
|
||||
}
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
_inherits(RadialBar, _PureComponent);
|
||||
return _createClass(RadialBar, [{
|
||||
key: "getDeltaAngle",
|
||||
value: function getDeltaAngle() {
|
||||
var _this$props = this.props,
|
||||
startAngle = _this$props.startAngle,
|
||||
endAngle = _this$props.endAngle;
|
||||
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
|
||||
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 360);
|
||||
return sign * deltaAngle;
|
||||
}
|
||||
}, {
|
||||
key: "renderSectorsStatically",
|
||||
value: function renderSectorsStatically(sectors) {
|
||||
var _this2 = this;
|
||||
var _this$props2 = this.props,
|
||||
shape = _this$props2.shape,
|
||||
activeShape = _this$props2.activeShape,
|
||||
activeIndex = _this$props2.activeIndex,
|
||||
cornerRadius = _this$props2.cornerRadius,
|
||||
others = _objectWithoutProperties(_this$props2, _excluded);
|
||||
var baseProps = (0, _ReactUtils.filterProps)(others, false);
|
||||
return sectors.map(function (entry, i) {
|
||||
var isActive = i === activeIndex;
|
||||
var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, baseProps), {}, {
|
||||
cornerRadius: (0, _RadialBarUtils.parseCornerRadius)(cornerRadius)
|
||||
}, entry), (0, _types.adaptEventsOfChild)(_this2.props, entry, i)), {}, {
|
||||
className: "recharts-radial-bar-sector ".concat(entry.className),
|
||||
forceCornerRadius: others.forceCornerRadius,
|
||||
cornerIsExternal: others.cornerIsExternal,
|
||||
isActive: isActive,
|
||||
option: isActive ? activeShape : shape
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_RadialBarUtils.RadialBarSector, _extends({}, props, {
|
||||
key: "sector-".concat(i)
|
||||
}));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderSectorsWithAnimation",
|
||||
value: function renderSectorsWithAnimation() {
|
||||
var _this3 = this;
|
||||
var _this$props3 = this.props,
|
||||
data = _this$props3.data,
|
||||
isAnimationActive = _this$props3.isAnimationActive,
|
||||
animationBegin = _this$props3.animationBegin,
|
||||
animationDuration = _this$props3.animationDuration,
|
||||
animationEasing = _this$props3.animationEasing,
|
||||
animationId = _this$props3.animationId;
|
||||
var prevData = this.state.prevData;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing,
|
||||
from: {
|
||||
t: 0
|
||||
},
|
||||
to: {
|
||||
t: 1
|
||||
},
|
||||
key: "radialBar-".concat(animationId),
|
||||
onAnimationStart: this.handleAnimationStart,
|
||||
onAnimationEnd: this.handleAnimationEnd
|
||||
}, function (_ref) {
|
||||
var t = _ref.t;
|
||||
var stepData = data.map(function (entry, index) {
|
||||
var prev = prevData && prevData[index];
|
||||
if (prev) {
|
||||
var interpolatorStartAngle = (0, _DataUtils.interpolateNumber)(prev.startAngle, entry.startAngle);
|
||||
var interpolatorEndAngle = (0, _DataUtils.interpolateNumber)(prev.endAngle, entry.endAngle);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
startAngle: interpolatorStartAngle(t),
|
||||
endAngle: interpolatorEndAngle(t)
|
||||
});
|
||||
}
|
||||
var endAngle = entry.endAngle,
|
||||
startAngle = entry.startAngle;
|
||||
var interpolator = (0, _DataUtils.interpolateNumber)(startAngle, endAngle);
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
endAngle: interpolator(t)
|
||||
});
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, null, _this3.renderSectorsStatically(stepData));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "renderSectors",
|
||||
value: function renderSectors() {
|
||||
var _this$props4 = this.props,
|
||||
data = _this$props4.data,
|
||||
isAnimationActive = _this$props4.isAnimationActive;
|
||||
var prevData = this.state.prevData;
|
||||
if (isAnimationActive && data && data.length && (!prevData || !(0, _isEqual["default"])(prevData, data))) {
|
||||
return this.renderSectorsWithAnimation();
|
||||
}
|
||||
return this.renderSectorsStatically(data);
|
||||
}
|
||||
}, {
|
||||
key: "renderBackground",
|
||||
value: function renderBackground(sectors) {
|
||||
var _this4 = this;
|
||||
var cornerRadius = this.props.cornerRadius;
|
||||
var backgroundProps = (0, _ReactUtils.filterProps)(this.props.background, false);
|
||||
return sectors.map(function (entry, i) {
|
||||
var value = entry.value,
|
||||
background = entry.background,
|
||||
rest = _objectWithoutProperties(entry, _excluded2);
|
||||
if (!background) {
|
||||
return null;
|
||||
}
|
||||
var props = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
||||
cornerRadius: (0, _RadialBarUtils.parseCornerRadius)(cornerRadius)
|
||||
}, rest), {}, {
|
||||
fill: '#eee'
|
||||
}, background), backgroundProps), (0, _types.adaptEventsOfChild)(_this4.props, entry, i)), {}, {
|
||||
index: i,
|
||||
className: (0, _clsx["default"])('recharts-radial-bar-background-sector', backgroundProps === null || backgroundProps === void 0 ? void 0 : backgroundProps.className),
|
||||
option: background,
|
||||
isActive: false
|
||||
});
|
||||
return /*#__PURE__*/_react["default"].createElement(_RadialBarUtils.RadialBarSector, _extends({}, props, {
|
||||
key: "sector-".concat(i)
|
||||
}));
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
var _this$props5 = this.props,
|
||||
hide = _this$props5.hide,
|
||||
data = _this$props5.data,
|
||||
className = _this$props5.className,
|
||||
background = _this$props5.background,
|
||||
isAnimationActive = _this$props5.isAnimationActive;
|
||||
if (hide || !data || !data.length) {
|
||||
return null;
|
||||
}
|
||||
var isAnimationFinished = this.state.isAnimationFinished;
|
||||
var layerClass = (0, _clsx["default"])('recharts-area', className);
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: layerClass
|
||||
}, background && /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-radial-bar-background"
|
||||
}, this.renderBackground(data)), /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: "recharts-radial-bar-sectors"
|
||||
}, this.renderSectors()), (!isAnimationActive || isAnimationFinished) && _LabelList.LabelList.renderCallByParent(_objectSpread({}, this.props), data));
|
||||
}
|
||||
}], [{
|
||||
key: "getDerivedStateFromProps",
|
||||
value: function getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.animationId !== prevState.prevAnimationId) {
|
||||
return {
|
||||
prevAnimationId: nextProps.animationId,
|
||||
curData: nextProps.data,
|
||||
prevData: prevState.curData
|
||||
};
|
||||
}
|
||||
if (nextProps.data !== prevState.curData) {
|
||||
return {
|
||||
curData: nextProps.data
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}]);
|
||||
}(_react.PureComponent);
|
||||
_defineProperty(RadialBar, "displayName", 'RadialBar');
|
||||
_defineProperty(RadialBar, "defaultProps", {
|
||||
angleAxisId: 0,
|
||||
radiusAxisId: 0,
|
||||
minPointSize: 0,
|
||||
hide: false,
|
||||
legendType: 'rect',
|
||||
data: [],
|
||||
isAnimationActive: !_Global.Global.isSsr,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease',
|
||||
forceCornerRadius: false,
|
||||
cornerIsExternal: false
|
||||
});
|
||||
_defineProperty(RadialBar, "getComposedData", function (_ref2) {
|
||||
var item = _ref2.item,
|
||||
props = _ref2.props,
|
||||
radiusAxis = _ref2.radiusAxis,
|
||||
radiusAxisTicks = _ref2.radiusAxisTicks,
|
||||
angleAxis = _ref2.angleAxis,
|
||||
angleAxisTicks = _ref2.angleAxisTicks,
|
||||
displayedData = _ref2.displayedData,
|
||||
dataKey = _ref2.dataKey,
|
||||
stackedData = _ref2.stackedData,
|
||||
barPosition = _ref2.barPosition,
|
||||
bandSize = _ref2.bandSize,
|
||||
dataStartIndex = _ref2.dataStartIndex;
|
||||
var pos = (0, _ChartUtils.findPositionOfBar)(barPosition, item);
|
||||
if (!pos) {
|
||||
return null;
|
||||
}
|
||||
var cx = angleAxis.cx,
|
||||
cy = angleAxis.cy;
|
||||
var layout = props.layout;
|
||||
var _item$props = item.props,
|
||||
children = _item$props.children,
|
||||
minPointSize = _item$props.minPointSize;
|
||||
var numericAxis = layout === 'radial' ? angleAxis : radiusAxis;
|
||||
var stackedDomain = stackedData ? numericAxis.scale.domain() : null;
|
||||
var baseValue = (0, _ChartUtils.getBaseValueOfBar)({
|
||||
numericAxis: numericAxis
|
||||
});
|
||||
var cells = (0, _ReactUtils.findAllByType)(children, _Cell.Cell);
|
||||
var sectors = displayedData.map(function (entry, index) {
|
||||
var value, innerRadius, outerRadius, startAngle, endAngle, backgroundSector;
|
||||
if (stackedData) {
|
||||
value = (0, _ChartUtils.truncateByDomain)(stackedData[dataStartIndex + index], stackedDomain);
|
||||
} else {
|
||||
value = (0, _ChartUtils.getValueByDataKey)(entry, dataKey);
|
||||
if (!Array.isArray(value)) {
|
||||
value = [baseValue, value];
|
||||
}
|
||||
}
|
||||
if (layout === 'radial') {
|
||||
innerRadius = (0, _ChartUtils.getCateCoordinateOfBar)({
|
||||
axis: radiusAxis,
|
||||
ticks: radiusAxisTicks,
|
||||
bandSize: bandSize,
|
||||
offset: pos.offset,
|
||||
entry: entry,
|
||||
index: index
|
||||
});
|
||||
endAngle = angleAxis.scale(value[1]);
|
||||
startAngle = angleAxis.scale(value[0]);
|
||||
outerRadius = innerRadius + pos.size;
|
||||
var deltaAngle = endAngle - startAngle;
|
||||
if (Math.abs(minPointSize) > 0 && Math.abs(deltaAngle) < Math.abs(minPointSize)) {
|
||||
var delta = (0, _DataUtils.mathSign)(deltaAngle || minPointSize) * (Math.abs(minPointSize) - Math.abs(deltaAngle));
|
||||
endAngle += delta;
|
||||
}
|
||||
backgroundSector = {
|
||||
background: {
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
startAngle: props.startAngle,
|
||||
endAngle: props.endAngle
|
||||
}
|
||||
};
|
||||
} else {
|
||||
innerRadius = radiusAxis.scale(value[0]);
|
||||
outerRadius = radiusAxis.scale(value[1]);
|
||||
startAngle = (0, _ChartUtils.getCateCoordinateOfBar)({
|
||||
axis: angleAxis,
|
||||
ticks: angleAxisTicks,
|
||||
bandSize: bandSize,
|
||||
offset: pos.offset,
|
||||
entry: entry,
|
||||
index: index
|
||||
});
|
||||
endAngle = startAngle + pos.size;
|
||||
var deltaRadius = outerRadius - innerRadius;
|
||||
if (Math.abs(minPointSize) > 0 && Math.abs(deltaRadius) < Math.abs(minPointSize)) {
|
||||
var _delta = (0, _DataUtils.mathSign)(deltaRadius || minPointSize) * (Math.abs(minPointSize) - Math.abs(deltaRadius));
|
||||
outerRadius += _delta;
|
||||
}
|
||||
}
|
||||
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, entry), backgroundSector), {}, {
|
||||
payload: entry,
|
||||
value: stackedData ? value : value[1],
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
}, cells && cells[index] && cells[index].props), {}, {
|
||||
tooltipPayload: [(0, _ChartUtils.getTooltipItem)(item, entry)],
|
||||
tooltipPosition: (0, _PolarUtils.polarToCartesian)(cx, cy, (innerRadius + outerRadius) / 2, (startAngle + endAngle) / 2)
|
||||
});
|
||||
});
|
||||
return {
|
||||
data: sectors,
|
||||
layout: layout
|
||||
};
|
||||
});
|
||||
1
frontend/node_modules/recharts/lib/polar/types.js
generated
vendored
Normal file
1
frontend/node_modules/recharts/lib/polar/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";
|
||||
58
frontend/node_modules/recharts/lib/shape/Cross.js
generated
vendored
Normal file
58
frontend/node_modules/recharts/lib/shape/Cross.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Cross = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["x", "y", "top", "left", "width", "height", "className"];
|
||||
/**
|
||||
* @fileOverview Cross
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
var getPath = function getPath(x, y, width, height, top, left) {
|
||||
return "M".concat(x, ",").concat(top, "v").concat(height, "M").concat(left, ",").concat(y, "h").concat(width);
|
||||
};
|
||||
var Cross = exports.Cross = function Cross(_ref) {
|
||||
var _ref$x = _ref.x,
|
||||
x = _ref$x === void 0 ? 0 : _ref$x,
|
||||
_ref$y = _ref.y,
|
||||
y = _ref$y === void 0 ? 0 : _ref$y,
|
||||
_ref$top = _ref.top,
|
||||
top = _ref$top === void 0 ? 0 : _ref$top,
|
||||
_ref$left = _ref.left,
|
||||
left = _ref$left === void 0 ? 0 : _ref$left,
|
||||
_ref$width = _ref.width,
|
||||
width = _ref$width === void 0 ? 0 : _ref$width,
|
||||
_ref$height = _ref.height,
|
||||
height = _ref$height === void 0 ? 0 : _ref$height,
|
||||
className = _ref.className,
|
||||
rest = _objectWithoutProperties(_ref, _excluded);
|
||||
var props = _objectSpread({
|
||||
x: x,
|
||||
y: y,
|
||||
top: top,
|
||||
left: left,
|
||||
width: width,
|
||||
height: height
|
||||
}, rest);
|
||||
if (!(0, _DataUtils.isNumber)(x) || !(0, _DataUtils.isNumber)(y) || !(0, _DataUtils.isNumber)(width) || !(0, _DataUtils.isNumber)(height) || !(0, _DataUtils.isNumber)(top) || !(0, _DataUtils.isNumber)(left)) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
|
||||
className: (0, _clsx["default"])('recharts-cross', className),
|
||||
d: getPath(x, y, width, height, top, left)
|
||||
}));
|
||||
};
|
||||
124
frontend/node_modules/recharts/lib/shape/Curve.js
generated
vendored
Normal file
124
frontend/node_modules/recharts/lib/shape/Curve.js
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPath = exports.Curve = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _d3Shape = require("victory-vendor/d3-shape");
|
||||
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _types = require("../util/types");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Curve
|
||||
*/
|
||||
var CURVE_FACTORIES = {
|
||||
curveBasisClosed: _d3Shape.curveBasisClosed,
|
||||
curveBasisOpen: _d3Shape.curveBasisOpen,
|
||||
curveBasis: _d3Shape.curveBasis,
|
||||
curveBumpX: _d3Shape.curveBumpX,
|
||||
curveBumpY: _d3Shape.curveBumpY,
|
||||
curveLinearClosed: _d3Shape.curveLinearClosed,
|
||||
curveLinear: _d3Shape.curveLinear,
|
||||
curveMonotoneX: _d3Shape.curveMonotoneX,
|
||||
curveMonotoneY: _d3Shape.curveMonotoneY,
|
||||
curveNatural: _d3Shape.curveNatural,
|
||||
curveStep: _d3Shape.curveStep,
|
||||
curveStepAfter: _d3Shape.curveStepAfter,
|
||||
curveStepBefore: _d3Shape.curveStepBefore
|
||||
};
|
||||
var defined = function defined(p) {
|
||||
return p.x === +p.x && p.y === +p.y;
|
||||
};
|
||||
var getX = function getX(p) {
|
||||
return p.x;
|
||||
};
|
||||
var getY = function getY(p) {
|
||||
return p.y;
|
||||
};
|
||||
var getCurveFactory = function getCurveFactory(type, layout) {
|
||||
if ((0, _isFunction["default"])(type)) {
|
||||
return type;
|
||||
}
|
||||
var name = "curve".concat((0, _upperFirst["default"])(type));
|
||||
if ((name === 'curveMonotone' || name === 'curveBump') && layout) {
|
||||
return CURVE_FACTORIES["".concat(name).concat(layout === 'vertical' ? 'Y' : 'X')];
|
||||
}
|
||||
return CURVE_FACTORIES[name] || _d3Shape.curveLinear;
|
||||
};
|
||||
/**
|
||||
* Calculate the path of curve. Returns null if points is an empty array.
|
||||
* @return path or null
|
||||
*/
|
||||
var getPath = exports.getPath = function getPath(_ref) {
|
||||
var _ref$type = _ref.type,
|
||||
type = _ref$type === void 0 ? 'linear' : _ref$type,
|
||||
_ref$points = _ref.points,
|
||||
points = _ref$points === void 0 ? [] : _ref$points,
|
||||
baseLine = _ref.baseLine,
|
||||
layout = _ref.layout,
|
||||
_ref$connectNulls = _ref.connectNulls,
|
||||
connectNulls = _ref$connectNulls === void 0 ? false : _ref$connectNulls;
|
||||
var curveFactory = getCurveFactory(type, layout);
|
||||
var formatPoints = connectNulls ? points.filter(function (entry) {
|
||||
return defined(entry);
|
||||
}) : points;
|
||||
var lineFunction;
|
||||
if (Array.isArray(baseLine)) {
|
||||
var formatBaseLine = connectNulls ? baseLine.filter(function (base) {
|
||||
return defined(base);
|
||||
}) : baseLine;
|
||||
var areaPoints = formatPoints.map(function (entry, index) {
|
||||
return _objectSpread(_objectSpread({}, entry), {}, {
|
||||
base: formatBaseLine[index]
|
||||
});
|
||||
});
|
||||
if (layout === 'vertical') {
|
||||
lineFunction = (0, _d3Shape.area)().y(getY).x1(getX).x0(function (d) {
|
||||
return d.base.x;
|
||||
});
|
||||
} else {
|
||||
lineFunction = (0, _d3Shape.area)().x(getX).y1(getY).y0(function (d) {
|
||||
return d.base.y;
|
||||
});
|
||||
}
|
||||
lineFunction.defined(defined).curve(curveFactory);
|
||||
return lineFunction(areaPoints);
|
||||
}
|
||||
if (layout === 'vertical' && (0, _DataUtils.isNumber)(baseLine)) {
|
||||
lineFunction = (0, _d3Shape.area)().y(getY).x1(getX).x0(baseLine);
|
||||
} else if ((0, _DataUtils.isNumber)(baseLine)) {
|
||||
lineFunction = (0, _d3Shape.area)().x(getX).y1(getY).y0(baseLine);
|
||||
} else {
|
||||
lineFunction = (0, _d3Shape.line)().x(getX).y(getY);
|
||||
}
|
||||
lineFunction.defined(defined).curve(curveFactory);
|
||||
return lineFunction(formatPoints);
|
||||
};
|
||||
var Curve = exports.Curve = function Curve(props) {
|
||||
var className = props.className,
|
||||
points = props.points,
|
||||
path = props.path,
|
||||
pathRef = props.pathRef;
|
||||
if ((!points || !points.length) && !path) {
|
||||
return null;
|
||||
}
|
||||
var realPath = points && points.length ? getPath(props) : path;
|
||||
return /*#__PURE__*/React.createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, false), (0, _types.adaptEventHandlers)(props), {
|
||||
className: (0, _clsx["default"])('recharts-curve', className),
|
||||
d: realPath,
|
||||
ref: pathRef
|
||||
}));
|
||||
};
|
||||
33
frontend/node_modules/recharts/lib/shape/Dot.js
generated
vendored
Normal file
33
frontend/node_modules/recharts/lib/shape/Dot.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Dot = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _types = require("../util/types");
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /**
|
||||
* @fileOverview Dot
|
||||
*/
|
||||
var Dot = exports.Dot = function Dot(props) {
|
||||
var cx = props.cx,
|
||||
cy = props.cy,
|
||||
r = props.r,
|
||||
className = props.className;
|
||||
var layerClass = (0, _clsx["default"])('recharts-dot', className);
|
||||
if (cx === +cx && cy === +cy && r === +r) {
|
||||
return /*#__PURE__*/React.createElement("circle", _extends({}, (0, _ReactUtils.filterProps)(props, false), (0, _types.adaptEventHandlers)(props), {
|
||||
className: layerClass,
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
r: r
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
96
frontend/node_modules/recharts/lib/shape/Polygon.js
generated
vendored
Normal file
96
frontend/node_modules/recharts/lib/shape/Polygon.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Polygon = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["points", "className", "baseLinePoints", "connectNulls"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /**
|
||||
* @fileOverview Polygon
|
||||
*/
|
||||
var isValidatePoint = function isValidatePoint(point) {
|
||||
return point && point.x === +point.x && point.y === +point.y;
|
||||
};
|
||||
var getParsedPoints = function getParsedPoints() {
|
||||
var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
var segmentPoints = [[]];
|
||||
points.forEach(function (entry) {
|
||||
if (isValidatePoint(entry)) {
|
||||
segmentPoints[segmentPoints.length - 1].push(entry);
|
||||
} else if (segmentPoints[segmentPoints.length - 1].length > 0) {
|
||||
// add another path
|
||||
segmentPoints.push([]);
|
||||
}
|
||||
});
|
||||
if (isValidatePoint(points[0])) {
|
||||
segmentPoints[segmentPoints.length - 1].push(points[0]);
|
||||
}
|
||||
if (segmentPoints[segmentPoints.length - 1].length <= 0) {
|
||||
segmentPoints = segmentPoints.slice(0, -1);
|
||||
}
|
||||
return segmentPoints;
|
||||
};
|
||||
var getSinglePolygonPath = function getSinglePolygonPath(points, connectNulls) {
|
||||
var segmentPoints = getParsedPoints(points);
|
||||
if (connectNulls) {
|
||||
segmentPoints = [segmentPoints.reduce(function (res, segPoints) {
|
||||
return [].concat(_toConsumableArray(res), _toConsumableArray(segPoints));
|
||||
}, [])];
|
||||
}
|
||||
var polygonPath = segmentPoints.map(function (segPoints) {
|
||||
return segPoints.reduce(function (path, point, index) {
|
||||
return "".concat(path).concat(index === 0 ? 'M' : 'L').concat(point.x, ",").concat(point.y);
|
||||
}, '');
|
||||
}).join('');
|
||||
return segmentPoints.length === 1 ? "".concat(polygonPath, "Z") : polygonPath;
|
||||
};
|
||||
var getRanglePath = function getRanglePath(points, baseLinePoints, connectNulls) {
|
||||
var outerPath = getSinglePolygonPath(points, connectNulls);
|
||||
return "".concat(outerPath.slice(-1) === 'Z' ? outerPath.slice(0, -1) : outerPath, "L").concat(getSinglePolygonPath(baseLinePoints.reverse(), connectNulls).slice(1));
|
||||
};
|
||||
var Polygon = exports.Polygon = function Polygon(props) {
|
||||
var points = props.points,
|
||||
className = props.className,
|
||||
baseLinePoints = props.baseLinePoints,
|
||||
connectNulls = props.connectNulls,
|
||||
others = _objectWithoutProperties(props, _excluded);
|
||||
if (!points || !points.length) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-polygon', className);
|
||||
if (baseLinePoints && baseLinePoints.length) {
|
||||
var hasStroke = others.stroke && others.stroke !== 'none';
|
||||
var rangePath = getRanglePath(points, baseLinePoints, connectNulls);
|
||||
return /*#__PURE__*/_react["default"].createElement("g", {
|
||||
className: layerClass
|
||||
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
fill: rangePath.slice(-1) === 'Z' ? others.fill : 'none',
|
||||
stroke: "none",
|
||||
d: rangePath
|
||||
})), hasStroke ? /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
fill: "none",
|
||||
d: getSinglePolygonPath(points, connectNulls)
|
||||
})) : null, hasStroke ? /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
fill: "none",
|
||||
d: getSinglePolygonPath(baseLinePoints, connectNulls)
|
||||
})) : null);
|
||||
}
|
||||
var singlePath = getSinglePolygonPath(points, connectNulls);
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(others, true), {
|
||||
fill: singlePath.slice(-1) === 'Z' ? others.fill : 'none',
|
||||
className: layerClass,
|
||||
d: singlePath
|
||||
}));
|
||||
};
|
||||
176
frontend/node_modules/recharts/lib/shape/Rectangle.js
generated
vendored
Normal file
176
frontend/node_modules/recharts/lib/shape/Rectangle.js
generated
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isInRectangle = exports.Rectangle = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Rectangle
|
||||
*/
|
||||
var getRectanglePath = function getRectanglePath(x, y, width, height, radius) {
|
||||
var maxRadius = Math.min(Math.abs(width) / 2, Math.abs(height) / 2);
|
||||
var ySign = height >= 0 ? 1 : -1;
|
||||
var xSign = width >= 0 ? 1 : -1;
|
||||
var clockWise = height >= 0 && width >= 0 || height < 0 && width < 0 ? 1 : 0;
|
||||
var path;
|
||||
if (maxRadius > 0 && radius instanceof Array) {
|
||||
var newRadius = [0, 0, 0, 0];
|
||||
for (var i = 0, len = 4; i < len; i++) {
|
||||
newRadius[i] = radius[i] > maxRadius ? maxRadius : radius[i];
|
||||
}
|
||||
path = "M".concat(x, ",").concat(y + ySign * newRadius[0]);
|
||||
if (newRadius[0] > 0) {
|
||||
path += "A ".concat(newRadius[0], ",").concat(newRadius[0], ",0,0,").concat(clockWise, ",").concat(x + xSign * newRadius[0], ",").concat(y);
|
||||
}
|
||||
path += "L ".concat(x + width - xSign * newRadius[1], ",").concat(y);
|
||||
if (newRadius[1] > 0) {
|
||||
path += "A ".concat(newRadius[1], ",").concat(newRadius[1], ",0,0,").concat(clockWise, ",\n ").concat(x + width, ",").concat(y + ySign * newRadius[1]);
|
||||
}
|
||||
path += "L ".concat(x + width, ",").concat(y + height - ySign * newRadius[2]);
|
||||
if (newRadius[2] > 0) {
|
||||
path += "A ".concat(newRadius[2], ",").concat(newRadius[2], ",0,0,").concat(clockWise, ",\n ").concat(x + width - xSign * newRadius[2], ",").concat(y + height);
|
||||
}
|
||||
path += "L ".concat(x + xSign * newRadius[3], ",").concat(y + height);
|
||||
if (newRadius[3] > 0) {
|
||||
path += "A ".concat(newRadius[3], ",").concat(newRadius[3], ",0,0,").concat(clockWise, ",\n ").concat(x, ",").concat(y + height - ySign * newRadius[3]);
|
||||
}
|
||||
path += 'Z';
|
||||
} else if (maxRadius > 0 && radius === +radius && radius > 0) {
|
||||
var _newRadius = Math.min(maxRadius, radius);
|
||||
path = "M ".concat(x, ",").concat(y + ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + xSign * _newRadius, ",").concat(y, "\n L ").concat(x + width - xSign * _newRadius, ",").concat(y, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width, ",").concat(y + ySign * _newRadius, "\n L ").concat(x + width, ",").concat(y + height - ySign * _newRadius, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x + width - xSign * _newRadius, ",").concat(y + height, "\n L ").concat(x + xSign * _newRadius, ",").concat(y + height, "\n A ").concat(_newRadius, ",").concat(_newRadius, ",0,0,").concat(clockWise, ",").concat(x, ",").concat(y + height - ySign * _newRadius, " Z");
|
||||
} else {
|
||||
path = "M ".concat(x, ",").concat(y, " h ").concat(width, " v ").concat(height, " h ").concat(-width, " Z");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
var isInRectangle = exports.isInRectangle = function isInRectangle(point, rect) {
|
||||
if (!point || !rect) {
|
||||
return false;
|
||||
}
|
||||
var px = point.x,
|
||||
py = point.y;
|
||||
var x = rect.x,
|
||||
y = rect.y,
|
||||
width = rect.width,
|
||||
height = rect.height;
|
||||
if (Math.abs(width) > 0 && Math.abs(height) > 0) {
|
||||
var minX = Math.min(x, x + width);
|
||||
var maxX = Math.max(x, x + width);
|
||||
var minY = Math.min(y, y + height);
|
||||
var maxY = Math.max(y, y + height);
|
||||
return px >= minX && px <= maxX && py >= minY && py <= maxY;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var defaultProps = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
// The radius of border
|
||||
// The radius of four corners when radius is a number
|
||||
// The radius of left-top, right-top, right-bottom, left-bottom when radius is an array
|
||||
radius: 0,
|
||||
isAnimationActive: false,
|
||||
isUpdateAnimationActive: false,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease'
|
||||
};
|
||||
var Rectangle = exports.Rectangle = function Rectangle(rectangleProps) {
|
||||
var props = _objectSpread(_objectSpread({}, defaultProps), rectangleProps);
|
||||
var pathRef = (0, _react.useRef)();
|
||||
var _useState = (0, _react.useState)(-1),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
totalLength = _useState2[0],
|
||||
setTotalLength = _useState2[1];
|
||||
(0, _react.useEffect)(function () {
|
||||
if (pathRef.current && pathRef.current.getTotalLength) {
|
||||
try {
|
||||
var pathTotalLength = pathRef.current.getTotalLength();
|
||||
if (pathTotalLength) {
|
||||
setTotalLength(pathTotalLength);
|
||||
}
|
||||
} catch (err) {
|
||||
// calculate total length error
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
var x = props.x,
|
||||
y = props.y,
|
||||
width = props.width,
|
||||
height = props.height,
|
||||
radius = props.radius,
|
||||
className = props.className;
|
||||
var animationEasing = props.animationEasing,
|
||||
animationDuration = props.animationDuration,
|
||||
animationBegin = props.animationBegin,
|
||||
isAnimationActive = props.isAnimationActive,
|
||||
isUpdateAnimationActive = props.isUpdateAnimationActive;
|
||||
if (x !== +x || y !== +y || width !== +width || height !== +height || width === 0 || height === 0) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-rectangle', className);
|
||||
if (!isUpdateAnimationActive) {
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
|
||||
className: layerClass,
|
||||
d: getRectanglePath(x, y, width, height, radius)
|
||||
}));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
canBegin: totalLength > 0,
|
||||
from: {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
to: {
|
||||
width: width,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
duration: animationDuration,
|
||||
animationEasing: animationEasing,
|
||||
isActive: isUpdateAnimationActive
|
||||
}, function (_ref) {
|
||||
var currWidth = _ref.width,
|
||||
currHeight = _ref.height,
|
||||
currX = _ref.x,
|
||||
currY = _ref.y;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
canBegin: totalLength > 0,
|
||||
from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"),
|
||||
to: "".concat(totalLength, "px 0px"),
|
||||
attributeName: "strokeDasharray",
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
isActive: isAnimationActive,
|
||||
easing: animationEasing
|
||||
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
|
||||
className: layerClass,
|
||||
d: getRectanglePath(currX, currY, currWidth, currHeight, radius),
|
||||
ref: pathRef
|
||||
})));
|
||||
});
|
||||
};
|
||||
219
frontend/node_modules/recharts/lib/shape/Sector.js
generated
vendored
Normal file
219
frontend/node_modules/recharts/lib/shape/Sector.js
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Sector = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _PolarUtils = require("../util/PolarUtils");
|
||||
var _DataUtils = require("../util/DataUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Sector
|
||||
*/
|
||||
var getDeltaAngle = function getDeltaAngle(startAngle, endAngle) {
|
||||
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
|
||||
var deltaAngle = Math.min(Math.abs(endAngle - startAngle), 359.999);
|
||||
return sign * deltaAngle;
|
||||
};
|
||||
var getTangentCircle = function getTangentCircle(_ref) {
|
||||
var cx = _ref.cx,
|
||||
cy = _ref.cy,
|
||||
radius = _ref.radius,
|
||||
angle = _ref.angle,
|
||||
sign = _ref.sign,
|
||||
isExternal = _ref.isExternal,
|
||||
cornerRadius = _ref.cornerRadius,
|
||||
cornerIsExternal = _ref.cornerIsExternal;
|
||||
var centerRadius = cornerRadius * (isExternal ? 1 : -1) + radius;
|
||||
var theta = Math.asin(cornerRadius / centerRadius) / _PolarUtils.RADIAN;
|
||||
var centerAngle = cornerIsExternal ? angle : angle + sign * theta;
|
||||
var center = (0, _PolarUtils.polarToCartesian)(cx, cy, centerRadius, centerAngle);
|
||||
// The coordinate of point which is tangent to the circle
|
||||
var circleTangency = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, centerAngle);
|
||||
// The coordinate of point which is tangent to the radius line
|
||||
var lineTangencyAngle = cornerIsExternal ? angle - sign * theta : angle;
|
||||
var lineTangency = (0, _PolarUtils.polarToCartesian)(cx, cy, centerRadius * Math.cos(theta * _PolarUtils.RADIAN), lineTangencyAngle);
|
||||
return {
|
||||
center: center,
|
||||
circleTangency: circleTangency,
|
||||
lineTangency: lineTangency,
|
||||
theta: theta
|
||||
};
|
||||
};
|
||||
var getSectorPath = function getSectorPath(_ref2) {
|
||||
var cx = _ref2.cx,
|
||||
cy = _ref2.cy,
|
||||
innerRadius = _ref2.innerRadius,
|
||||
outerRadius = _ref2.outerRadius,
|
||||
startAngle = _ref2.startAngle,
|
||||
endAngle = _ref2.endAngle;
|
||||
var angle = getDeltaAngle(startAngle, endAngle);
|
||||
|
||||
// When the angle of sector equals to 360, star point and end point coincide
|
||||
var tempEndAngle = startAngle + angle;
|
||||
var outerStartPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, startAngle);
|
||||
var outerEndPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, tempEndAngle);
|
||||
var path = "M ".concat(outerStartPoint.x, ",").concat(outerStartPoint.y, "\n A ").concat(outerRadius, ",").concat(outerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle > tempEndAngle), ",\n ").concat(outerEndPoint.x, ",").concat(outerEndPoint.y, "\n ");
|
||||
if (innerRadius > 0) {
|
||||
var innerStartPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, startAngle);
|
||||
var innerEndPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, tempEndAngle);
|
||||
path += "L ".concat(innerEndPoint.x, ",").concat(innerEndPoint.y, "\n A ").concat(innerRadius, ",").concat(innerRadius, ",0,\n ").concat(+(Math.abs(angle) > 180), ",").concat(+(startAngle <= tempEndAngle), ",\n ").concat(innerStartPoint.x, ",").concat(innerStartPoint.y, " Z");
|
||||
} else {
|
||||
path += "L ".concat(cx, ",").concat(cy, " Z");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
var getSectorWithCorner = function getSectorWithCorner(_ref3) {
|
||||
var cx = _ref3.cx,
|
||||
cy = _ref3.cy,
|
||||
innerRadius = _ref3.innerRadius,
|
||||
outerRadius = _ref3.outerRadius,
|
||||
cornerRadius = _ref3.cornerRadius,
|
||||
forceCornerRadius = _ref3.forceCornerRadius,
|
||||
cornerIsExternal = _ref3.cornerIsExternal,
|
||||
startAngle = _ref3.startAngle,
|
||||
endAngle = _ref3.endAngle;
|
||||
var sign = (0, _DataUtils.mathSign)(endAngle - startAngle);
|
||||
var _getTangentCircle = getTangentCircle({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: outerRadius,
|
||||
angle: startAngle,
|
||||
sign: sign,
|
||||
cornerRadius: cornerRadius,
|
||||
cornerIsExternal: cornerIsExternal
|
||||
}),
|
||||
soct = _getTangentCircle.circleTangency,
|
||||
solt = _getTangentCircle.lineTangency,
|
||||
sot = _getTangentCircle.theta;
|
||||
var _getTangentCircle2 = getTangentCircle({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: outerRadius,
|
||||
angle: endAngle,
|
||||
sign: -sign,
|
||||
cornerRadius: cornerRadius,
|
||||
cornerIsExternal: cornerIsExternal
|
||||
}),
|
||||
eoct = _getTangentCircle2.circleTangency,
|
||||
eolt = _getTangentCircle2.lineTangency,
|
||||
eot = _getTangentCircle2.theta;
|
||||
var outerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sot - eot;
|
||||
if (outerArcAngle < 0) {
|
||||
if (forceCornerRadius) {
|
||||
return "M ".concat(solt.x, ",").concat(solt.y, "\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(cornerRadius * 2, ",0\n a").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,1,").concat(-cornerRadius * 2, ",0\n ");
|
||||
}
|
||||
return getSectorPath({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
});
|
||||
}
|
||||
var path = "M ".concat(solt.x, ",").concat(solt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(soct.x, ",").concat(soct.y, "\n A").concat(outerRadius, ",").concat(outerRadius, ",0,").concat(+(outerArcAngle > 180), ",").concat(+(sign < 0), ",").concat(eoct.x, ",").concat(eoct.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eolt.x, ",").concat(eolt.y, "\n ");
|
||||
if (innerRadius > 0) {
|
||||
var _getTangentCircle3 = getTangentCircle({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: innerRadius,
|
||||
angle: startAngle,
|
||||
sign: sign,
|
||||
isExternal: true,
|
||||
cornerRadius: cornerRadius,
|
||||
cornerIsExternal: cornerIsExternal
|
||||
}),
|
||||
sict = _getTangentCircle3.circleTangency,
|
||||
silt = _getTangentCircle3.lineTangency,
|
||||
sit = _getTangentCircle3.theta;
|
||||
var _getTangentCircle4 = getTangentCircle({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: innerRadius,
|
||||
angle: endAngle,
|
||||
sign: -sign,
|
||||
isExternal: true,
|
||||
cornerRadius: cornerRadius,
|
||||
cornerIsExternal: cornerIsExternal
|
||||
}),
|
||||
eict = _getTangentCircle4.circleTangency,
|
||||
eilt = _getTangentCircle4.lineTangency,
|
||||
eit = _getTangentCircle4.theta;
|
||||
var innerArcAngle = cornerIsExternal ? Math.abs(startAngle - endAngle) : Math.abs(startAngle - endAngle) - sit - eit;
|
||||
if (innerArcAngle < 0 && cornerRadius === 0) {
|
||||
return "".concat(path, "L").concat(cx, ",").concat(cy, "Z");
|
||||
}
|
||||
path += "L".concat(eilt.x, ",").concat(eilt.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(eict.x, ",").concat(eict.y, "\n A").concat(innerRadius, ",").concat(innerRadius, ",0,").concat(+(innerArcAngle > 180), ",").concat(+(sign > 0), ",").concat(sict.x, ",").concat(sict.y, "\n A").concat(cornerRadius, ",").concat(cornerRadius, ",0,0,").concat(+(sign < 0), ",").concat(silt.x, ",").concat(silt.y, "Z");
|
||||
} else {
|
||||
path += "L".concat(cx, ",").concat(cy, "Z");
|
||||
}
|
||||
return path;
|
||||
};
|
||||
var defaultProps = {
|
||||
cx: 0,
|
||||
cy: 0,
|
||||
innerRadius: 0,
|
||||
outerRadius: 0,
|
||||
startAngle: 0,
|
||||
endAngle: 0,
|
||||
cornerRadius: 0,
|
||||
forceCornerRadius: false,
|
||||
cornerIsExternal: false
|
||||
};
|
||||
var Sector = exports.Sector = function Sector(sectorProps) {
|
||||
var props = _objectSpread(_objectSpread({}, defaultProps), sectorProps);
|
||||
var cx = props.cx,
|
||||
cy = props.cy,
|
||||
innerRadius = props.innerRadius,
|
||||
outerRadius = props.outerRadius,
|
||||
cornerRadius = props.cornerRadius,
|
||||
forceCornerRadius = props.forceCornerRadius,
|
||||
cornerIsExternal = props.cornerIsExternal,
|
||||
startAngle = props.startAngle,
|
||||
endAngle = props.endAngle,
|
||||
className = props.className;
|
||||
if (outerRadius < innerRadius || startAngle === endAngle) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-sector', className);
|
||||
var deltaRadius = outerRadius - innerRadius;
|
||||
var cr = (0, _DataUtils.getPercentValue)(cornerRadius, deltaRadius, 0, true);
|
||||
var path;
|
||||
if (cr > 0 && Math.abs(startAngle - endAngle) < 360) {
|
||||
path = getSectorWithCorner({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
cornerRadius: Math.min(cr, deltaRadius / 2),
|
||||
forceCornerRadius: forceCornerRadius,
|
||||
cornerIsExternal: cornerIsExternal,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
});
|
||||
} else {
|
||||
path = getSectorPath({
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
});
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(props, true), {
|
||||
className: layerClass,
|
||||
d: path,
|
||||
role: "img"
|
||||
}));
|
||||
};
|
||||
103
frontend/node_modules/recharts/lib/shape/Symbols.js
generated
vendored
Normal file
103
frontend/node_modules/recharts/lib/shape/Symbols.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Symbols = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _upperFirst = _interopRequireDefault(require("lodash/upperFirst"));
|
||||
var _d3Shape = require("victory-vendor/d3-shape");
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
var _excluded = ["type", "size", "sizeType"];
|
||||
/**
|
||||
* @fileOverview Curve
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
var symbolFactories = {
|
||||
symbolCircle: _d3Shape.symbolCircle,
|
||||
symbolCross: _d3Shape.symbolCross,
|
||||
symbolDiamond: _d3Shape.symbolDiamond,
|
||||
symbolSquare: _d3Shape.symbolSquare,
|
||||
symbolStar: _d3Shape.symbolStar,
|
||||
symbolTriangle: _d3Shape.symbolTriangle,
|
||||
symbolWye: _d3Shape.symbolWye
|
||||
};
|
||||
var RADIAN = Math.PI / 180;
|
||||
var getSymbolFactory = function getSymbolFactory(type) {
|
||||
var name = "symbol".concat((0, _upperFirst["default"])(type));
|
||||
return symbolFactories[name] || _d3Shape.symbolCircle;
|
||||
};
|
||||
var calculateAreaSize = function calculateAreaSize(size, sizeType, type) {
|
||||
if (sizeType === 'area') {
|
||||
return size;
|
||||
}
|
||||
switch (type) {
|
||||
case 'cross':
|
||||
return 5 * size * size / 9;
|
||||
case 'diamond':
|
||||
return 0.5 * size * size / Math.sqrt(3);
|
||||
case 'square':
|
||||
return size * size;
|
||||
case 'star':
|
||||
{
|
||||
var angle = 18 * RADIAN;
|
||||
return 1.25 * size * size * (Math.tan(angle) - Math.tan(angle * 2) * Math.pow(Math.tan(angle), 2));
|
||||
}
|
||||
case 'triangle':
|
||||
return Math.sqrt(3) * size * size / 4;
|
||||
case 'wye':
|
||||
return (21 - 10 * Math.sqrt(3)) * size * size / 8;
|
||||
default:
|
||||
return Math.PI * size * size / 4;
|
||||
}
|
||||
};
|
||||
var registerSymbol = function registerSymbol(key, factory) {
|
||||
symbolFactories["symbol".concat((0, _upperFirst["default"])(key))] = factory;
|
||||
};
|
||||
var Symbols = exports.Symbols = function Symbols(_ref) {
|
||||
var _ref$type = _ref.type,
|
||||
type = _ref$type === void 0 ? 'circle' : _ref$type,
|
||||
_ref$size = _ref.size,
|
||||
size = _ref$size === void 0 ? 64 : _ref$size,
|
||||
_ref$sizeType = _ref.sizeType,
|
||||
sizeType = _ref$sizeType === void 0 ? 'area' : _ref$sizeType,
|
||||
rest = _objectWithoutProperties(_ref, _excluded);
|
||||
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
||||
type: type,
|
||||
size: size,
|
||||
sizeType: sizeType
|
||||
});
|
||||
|
||||
/**
|
||||
* Calculate the path of curve
|
||||
* @return {String} path
|
||||
*/
|
||||
var getPath = function getPath() {
|
||||
var symbolFactory = getSymbolFactory(type);
|
||||
var symbol = (0, _d3Shape.symbol)().type(symbolFactory).size(calculateAreaSize(size, sizeType, type));
|
||||
return symbol();
|
||||
};
|
||||
var className = props.className,
|
||||
cx = props.cx,
|
||||
cy = props.cy;
|
||||
var filteredProps = (0, _ReactUtils.filterProps)(props, true);
|
||||
if (cx === +cx && cy === +cy && size === +size) {
|
||||
return /*#__PURE__*/_react["default"].createElement("path", _extends({}, filteredProps, {
|
||||
className: (0, _clsx["default"])('recharts-symbols', className),
|
||||
transform: "translate(".concat(cx, ", ").concat(cy, ")"),
|
||||
d: getPath()
|
||||
}));
|
||||
}
|
||||
return null;
|
||||
};
|
||||
Symbols.registerSymbol = registerSymbol;
|
||||
128
frontend/node_modules/recharts/lib/shape/Trapezoid.js
generated
vendored
Normal file
128
frontend/node_modules/recharts/lib/shape/Trapezoid.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Trapezoid = void 0;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _clsx = _interopRequireDefault(require("clsx"));
|
||||
var _reactSmooth = _interopRequireDefault(require("react-smooth"));
|
||||
var _ReactUtils = require("../util/ReactUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
||||
* @fileOverview Rectangle
|
||||
*/
|
||||
var getTrapezoidPath = function getTrapezoidPath(x, y, upperWidth, lowerWidth, height) {
|
||||
var widthGap = upperWidth - lowerWidth;
|
||||
var path;
|
||||
path = "M ".concat(x, ",").concat(y);
|
||||
path += "L ".concat(x + upperWidth, ",").concat(y);
|
||||
path += "L ".concat(x + upperWidth - widthGap / 2, ",").concat(y + height);
|
||||
path += "L ".concat(x + upperWidth - widthGap / 2 - lowerWidth, ",").concat(y + height);
|
||||
path += "L ".concat(x, ",").concat(y, " Z");
|
||||
return path;
|
||||
};
|
||||
var defaultProps = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
upperWidth: 0,
|
||||
lowerWidth: 0,
|
||||
height: 0,
|
||||
isUpdateAnimationActive: false,
|
||||
animationBegin: 0,
|
||||
animationDuration: 1500,
|
||||
animationEasing: 'ease'
|
||||
};
|
||||
var Trapezoid = exports.Trapezoid = function Trapezoid(props) {
|
||||
var trapezoidProps = _objectSpread(_objectSpread({}, defaultProps), props);
|
||||
var pathRef = (0, _react.useRef)();
|
||||
var _useState = (0, _react.useState)(-1),
|
||||
_useState2 = _slicedToArray(_useState, 2),
|
||||
totalLength = _useState2[0],
|
||||
setTotalLength = _useState2[1];
|
||||
(0, _react.useEffect)(function () {
|
||||
if (pathRef.current && pathRef.current.getTotalLength) {
|
||||
try {
|
||||
var pathTotalLength = pathRef.current.getTotalLength();
|
||||
if (pathTotalLength) {
|
||||
setTotalLength(pathTotalLength);
|
||||
}
|
||||
} catch (err) {
|
||||
// calculate total length error
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
var x = trapezoidProps.x,
|
||||
y = trapezoidProps.y,
|
||||
upperWidth = trapezoidProps.upperWidth,
|
||||
lowerWidth = trapezoidProps.lowerWidth,
|
||||
height = trapezoidProps.height,
|
||||
className = trapezoidProps.className;
|
||||
var animationEasing = trapezoidProps.animationEasing,
|
||||
animationDuration = trapezoidProps.animationDuration,
|
||||
animationBegin = trapezoidProps.animationBegin,
|
||||
isUpdateAnimationActive = trapezoidProps.isUpdateAnimationActive;
|
||||
if (x !== +x || y !== +y || upperWidth !== +upperWidth || lowerWidth !== +lowerWidth || height !== +height || upperWidth === 0 && lowerWidth === 0 || height === 0) {
|
||||
return null;
|
||||
}
|
||||
var layerClass = (0, _clsx["default"])('recharts-trapezoid', className);
|
||||
if (!isUpdateAnimationActive) {
|
||||
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(trapezoidProps, true), {
|
||||
className: layerClass,
|
||||
d: getTrapezoidPath(x, y, upperWidth, lowerWidth, height)
|
||||
})));
|
||||
}
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
canBegin: totalLength > 0,
|
||||
from: {
|
||||
upperWidth: 0,
|
||||
lowerWidth: 0,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
to: {
|
||||
upperWidth: upperWidth,
|
||||
lowerWidth: lowerWidth,
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
duration: animationDuration,
|
||||
animationEasing: animationEasing,
|
||||
isActive: isUpdateAnimationActive
|
||||
}, function (_ref) {
|
||||
var currUpperWidth = _ref.upperWidth,
|
||||
currLowerWidth = _ref.lowerWidth,
|
||||
currHeight = _ref.height,
|
||||
currX = _ref.x,
|
||||
currY = _ref.y;
|
||||
return /*#__PURE__*/_react["default"].createElement(_reactSmooth["default"], {
|
||||
canBegin: totalLength > 0,
|
||||
from: "0px ".concat(totalLength === -1 ? 1 : totalLength, "px"),
|
||||
to: "".concat(totalLength, "px 0px"),
|
||||
attributeName: "strokeDasharray",
|
||||
begin: animationBegin,
|
||||
duration: animationDuration,
|
||||
easing: animationEasing
|
||||
}, /*#__PURE__*/_react["default"].createElement("path", _extends({}, (0, _ReactUtils.filterProps)(trapezoidProps, true), {
|
||||
className: layerClass,
|
||||
d: getTrapezoidPath(currX, currY, currUpperWidth, currLowerWidth, currHeight),
|
||||
ref: pathRef
|
||||
})));
|
||||
});
|
||||
};
|
||||
215
frontend/node_modules/recharts/lib/util/ActiveShapeUtils.js
generated
vendored
Normal file
215
frontend/node_modules/recharts/lib/util/ActiveShapeUtils.js
generated
vendored
Normal file
@ -0,0 +1,215 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Shape = Shape;
|
||||
exports.compareFunnel = compareFunnel;
|
||||
exports.comparePie = comparePie;
|
||||
exports.compareScatter = compareScatter;
|
||||
exports.getActiveShapeIndexForTooltip = getActiveShapeIndexForTooltip;
|
||||
exports.getPropsFromShapeOption = getPropsFromShapeOption;
|
||||
exports.isFunnel = isFunnel;
|
||||
exports.isPie = isPie;
|
||||
exports.isScatter = isScatter;
|
||||
var _react = _interopRequireWildcard(require("react"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
|
||||
var _isBoolean = _interopRequireDefault(require("lodash/isBoolean"));
|
||||
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
||||
var _Rectangle = require("../shape/Rectangle");
|
||||
var _Trapezoid = require("../shape/Trapezoid");
|
||||
var _Sector = require("../shape/Sector");
|
||||
var _Layer = require("../container/Layer");
|
||||
var _Symbols = require("../shape/Symbols");
|
||||
var _excluded = ["option", "shapeType", "propTransformer", "activeClassName", "isActive"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
/**
|
||||
* This is an abstraction for rendering a user defined prop for a customized shape in several forms.
|
||||
*
|
||||
* <Shape /> is the root and will handle taking in:
|
||||
* - an object of svg properties
|
||||
* - a boolean
|
||||
* - a render prop(inline function that returns jsx)
|
||||
* - a react element
|
||||
*
|
||||
* <ShapeSelector /> is a subcomponent of <Shape /> and used to match a component
|
||||
* to the value of props.shapeType that is passed to the root.
|
||||
*
|
||||
*/
|
||||
|
||||
function defaultPropTransformer(option, props) {
|
||||
return _objectSpread(_objectSpread({}, props), option);
|
||||
}
|
||||
function isSymbolsProps(shapeType, _elementProps) {
|
||||
return shapeType === 'symbols';
|
||||
}
|
||||
function ShapeSelector(_ref) {
|
||||
var shapeType = _ref.shapeType,
|
||||
elementProps = _ref.elementProps;
|
||||
switch (shapeType) {
|
||||
case 'rectangle':
|
||||
return /*#__PURE__*/_react["default"].createElement(_Rectangle.Rectangle, elementProps);
|
||||
case 'trapezoid':
|
||||
return /*#__PURE__*/_react["default"].createElement(_Trapezoid.Trapezoid, elementProps);
|
||||
case 'sector':
|
||||
return /*#__PURE__*/_react["default"].createElement(_Sector.Sector, elementProps);
|
||||
case 'symbols':
|
||||
if (isSymbolsProps(shapeType, elementProps)) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_Symbols.Symbols, elementProps);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function getPropsFromShapeOption(option) {
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(option)) {
|
||||
return option.props;
|
||||
}
|
||||
return option;
|
||||
}
|
||||
function Shape(_ref2) {
|
||||
var option = _ref2.option,
|
||||
shapeType = _ref2.shapeType,
|
||||
_ref2$propTransformer = _ref2.propTransformer,
|
||||
propTransformer = _ref2$propTransformer === void 0 ? defaultPropTransformer : _ref2$propTransformer,
|
||||
_ref2$activeClassName = _ref2.activeClassName,
|
||||
activeClassName = _ref2$activeClassName === void 0 ? 'recharts-active-shape' : _ref2$activeClassName,
|
||||
isActive = _ref2.isActive,
|
||||
props = _objectWithoutProperties(_ref2, _excluded);
|
||||
var shape;
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(option)) {
|
||||
shape = /*#__PURE__*/(0, _react.cloneElement)(option, _objectSpread(_objectSpread({}, props), getPropsFromShapeOption(option)));
|
||||
} else if ((0, _isFunction["default"])(option)) {
|
||||
shape = option(props);
|
||||
} else if ((0, _isPlainObject["default"])(option) && !(0, _isBoolean["default"])(option)) {
|
||||
var nextProps = propTransformer(option, props);
|
||||
shape = /*#__PURE__*/_react["default"].createElement(ShapeSelector, {
|
||||
shapeType: shapeType,
|
||||
elementProps: nextProps
|
||||
});
|
||||
} else {
|
||||
var elementProps = props;
|
||||
shape = /*#__PURE__*/_react["default"].createElement(ShapeSelector, {
|
||||
shapeType: shapeType,
|
||||
elementProps: elementProps
|
||||
});
|
||||
}
|
||||
if (isActive) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_Layer.Layer, {
|
||||
className: activeClassName
|
||||
}, shape);
|
||||
}
|
||||
return shape;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is an abstraction to handle identifying the active index from a tooltip mouse interaction
|
||||
*/
|
||||
|
||||
function isFunnel(graphicalItem, _item) {
|
||||
return _item != null && 'trapezoids' in graphicalItem.props;
|
||||
}
|
||||
function isPie(graphicalItem, _item) {
|
||||
return _item != null && 'sectors' in graphicalItem.props;
|
||||
}
|
||||
function isScatter(graphicalItem, _item) {
|
||||
return _item != null && 'points' in graphicalItem.props;
|
||||
}
|
||||
function compareFunnel(shapeData, activeTooltipItem) {
|
||||
var _activeTooltipItem$la, _activeTooltipItem$la2;
|
||||
var xMatches = shapeData.x === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la === void 0 ? void 0 : _activeTooltipItem$la.x) || shapeData.x === activeTooltipItem.x;
|
||||
var yMatches = shapeData.y === (activeTooltipItem === null || activeTooltipItem === void 0 || (_activeTooltipItem$la2 = activeTooltipItem.labelViewBox) === null || _activeTooltipItem$la2 === void 0 ? void 0 : _activeTooltipItem$la2.y) || shapeData.y === activeTooltipItem.y;
|
||||
return xMatches && yMatches;
|
||||
}
|
||||
function comparePie(shapeData, activeTooltipItem) {
|
||||
var startAngleMatches = shapeData.endAngle === activeTooltipItem.endAngle;
|
||||
var endAngleMatches = shapeData.startAngle === activeTooltipItem.startAngle;
|
||||
return startAngleMatches && endAngleMatches;
|
||||
}
|
||||
function compareScatter(shapeData, activeTooltipItem) {
|
||||
var xMatches = shapeData.x === activeTooltipItem.x;
|
||||
var yMatches = shapeData.y === activeTooltipItem.y;
|
||||
var zMatches = shapeData.z === activeTooltipItem.z;
|
||||
return xMatches && yMatches && zMatches;
|
||||
}
|
||||
function getComparisonFn(graphicalItem, activeItem) {
|
||||
var comparison;
|
||||
if (isFunnel(graphicalItem, activeItem)) {
|
||||
comparison = compareFunnel;
|
||||
} else if (isPie(graphicalItem, activeItem)) {
|
||||
comparison = comparePie;
|
||||
} else if (isScatter(graphicalItem, activeItem)) {
|
||||
comparison = compareScatter;
|
||||
}
|
||||
return comparison;
|
||||
}
|
||||
function getShapeDataKey(graphicalItem, activeItem) {
|
||||
var shapeKey;
|
||||
if (isFunnel(graphicalItem, activeItem)) {
|
||||
shapeKey = 'trapezoids';
|
||||
} else if (isPie(graphicalItem, activeItem)) {
|
||||
shapeKey = 'sectors';
|
||||
} else if (isScatter(graphicalItem, activeItem)) {
|
||||
shapeKey = 'points';
|
||||
}
|
||||
return shapeKey;
|
||||
}
|
||||
function getActiveShapeTooltipPayload(graphicalItem, activeItem) {
|
||||
if (isFunnel(graphicalItem, activeItem)) {
|
||||
var _activeItem$tooltipPa;
|
||||
return (_activeItem$tooltipPa = activeItem.tooltipPayload) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa[0]) === null || _activeItem$tooltipPa === void 0 || (_activeItem$tooltipPa = _activeItem$tooltipPa.payload) === null || _activeItem$tooltipPa === void 0 ? void 0 : _activeItem$tooltipPa.payload;
|
||||
}
|
||||
if (isPie(graphicalItem, activeItem)) {
|
||||
var _activeItem$tooltipPa2;
|
||||
return (_activeItem$tooltipPa2 = activeItem.tooltipPayload) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2[0]) === null || _activeItem$tooltipPa2 === void 0 || (_activeItem$tooltipPa2 = _activeItem$tooltipPa2.payload) === null || _activeItem$tooltipPa2 === void 0 ? void 0 : _activeItem$tooltipPa2.payload;
|
||||
}
|
||||
if (isScatter(graphicalItem, activeItem)) {
|
||||
return activeItem.payload;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {GetActiveShapeIndexForTooltip} arg an object of incoming attributes from Tooltip
|
||||
* @returns {number}
|
||||
*
|
||||
* To handle possible duplicates in the data set,
|
||||
* match both the data value of the active item to a data value on a graph item,
|
||||
* and match the mouse coordinates of the active item to the coordinates of in a particular components shape data.
|
||||
* This assumes equal lengths of shape objects to data items.
|
||||
*/
|
||||
function getActiveShapeIndexForTooltip(_ref3) {
|
||||
var activeTooltipItem = _ref3.activeTooltipItem,
|
||||
graphicalItem = _ref3.graphicalItem,
|
||||
itemData = _ref3.itemData;
|
||||
var shapeKey = getShapeDataKey(graphicalItem, activeTooltipItem);
|
||||
var tooltipPayload = getActiveShapeTooltipPayload(graphicalItem, activeTooltipItem);
|
||||
var activeItemMatches = itemData.filter(function (datum, dataIndex) {
|
||||
var valuesMatch = (0, _isEqual["default"])(tooltipPayload, datum);
|
||||
var mouseCoordinateMatches = graphicalItem.props[shapeKey].filter(function (shapeData) {
|
||||
var comparison = getComparisonFn(graphicalItem, activeTooltipItem);
|
||||
return comparison(shapeData, activeTooltipItem);
|
||||
});
|
||||
|
||||
// get the last index in case of multiple matches
|
||||
var indexOfMouseCoordinates = graphicalItem.props[shapeKey].indexOf(mouseCoordinateMatches[mouseCoordinateMatches.length - 1]);
|
||||
var coordinatesMatch = dataIndex === indexOfMouseCoordinates;
|
||||
return valuesMatch && coordinatesMatch;
|
||||
});
|
||||
|
||||
// get the last index in case of multiple matches
|
||||
var activeIndex = itemData.indexOf(activeItemMatches[activeItemMatches.length - 1]);
|
||||
return activeIndex;
|
||||
}
|
||||
75
frontend/node_modules/recharts/lib/util/BarUtils.js
generated
vendored
Normal file
75
frontend/node_modules/recharts/lib/util/BarUtils.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BarRectangle = BarRectangle;
|
||||
exports.minPointSizeCallback = void 0;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
||||
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
||||
var _DataUtils = require("./DataUtils");
|
||||
var _excluded = ["x", "y"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
// Rectangle props is expecting x, y, height, width as numbers, name as a string, and radius as a custom type
|
||||
// When props are being spread in from a user defined component in Bar,
|
||||
// the prop types of an SVGElement have these typed as something else.
|
||||
// This function will return the passed in props
|
||||
// along with x, y, height as numbers, name as a string, and radius as number | [number, number, number, number]
|
||||
function typeguardBarRectangleProps(_ref, props) {
|
||||
var xProp = _ref.x,
|
||||
yProp = _ref.y,
|
||||
option = _objectWithoutProperties(_ref, _excluded);
|
||||
var xValue = "".concat(xProp);
|
||||
var x = parseInt(xValue, 10);
|
||||
var yValue = "".concat(yProp);
|
||||
var y = parseInt(yValue, 10);
|
||||
var heightValue = "".concat(props.height || option.height);
|
||||
var height = parseInt(heightValue, 10);
|
||||
var widthValue = "".concat(props.width || option.width);
|
||||
var width = parseInt(widthValue, 10);
|
||||
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props), option), x ? {
|
||||
x: x
|
||||
} : {}), y ? {
|
||||
y: y
|
||||
} : {}), {}, {
|
||||
height: height,
|
||||
width: width,
|
||||
name: props.name,
|
||||
radius: props.radius
|
||||
});
|
||||
}
|
||||
function BarRectangle(props) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
shapeType: "rectangle",
|
||||
propTransformer: typeguardBarRectangleProps,
|
||||
activeClassName: "recharts-active-bar"
|
||||
}, props));
|
||||
}
|
||||
/**
|
||||
* Safely gets minPointSize from from the minPointSize prop if it is a function
|
||||
* @param minPointSize minPointSize as passed to the Bar component
|
||||
* @param defaultValue default minPointSize
|
||||
* @returns minPointSize
|
||||
*/
|
||||
var minPointSizeCallback = exports.minPointSizeCallback = function minPointSizeCallback(minPointSize) {
|
||||
var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
return function (value, index) {
|
||||
if (typeof minPointSize === 'number') return minPointSize;
|
||||
var isValueNumberOrNil = (0, _DataUtils.isNumber)(value) || (0, _DataUtils.isNullish)(value);
|
||||
if (isValueNumberOrNil) {
|
||||
return minPointSize(value, index);
|
||||
}
|
||||
!isValueNumberOrNil ? process.env.NODE_ENV !== "production" ? (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;
|
||||
return defaultValue;
|
||||
};
|
||||
};
|
||||
290
frontend/node_modules/recharts/lib/util/CartesianUtils.js
generated
vendored
Normal file
290
frontend/node_modules/recharts/lib/util/CartesianUtils.js
generated
vendored
Normal file
@ -0,0 +1,290 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getAngledRectangleWidth = exports.formatAxisMap = exports.createLabeledScales = exports.ScaleHelper = void 0;
|
||||
exports.normalizeAngle = normalizeAngle;
|
||||
exports.rectWithPoints = exports.rectWithCoords = void 0;
|
||||
var _mapValues = _interopRequireDefault(require("lodash/mapValues"));
|
||||
var _every = _interopRequireDefault(require("lodash/every"));
|
||||
var _ChartUtils = require("./ChartUtils");
|
||||
var _ReactUtils = require("./ReactUtils");
|
||||
var _DataUtils = require("./DataUtils");
|
||||
var _Bar = require("../cartesian/Bar");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
/**
|
||||
* Calculate the scale function, position, width, height of axes
|
||||
* @param {Object} props Latest props
|
||||
* @param {Object} axisMap The configuration of axes
|
||||
* @param {Object} offset The offset of main part in the svg element
|
||||
* @param {String} axisType The type of axes, x-axis or y-axis
|
||||
* @param {String} chartName The name of chart
|
||||
* @return {Object} Configuration
|
||||
*/
|
||||
var formatAxisMap = exports.formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {
|
||||
var width = props.width,
|
||||
height = props.height,
|
||||
layout = props.layout,
|
||||
children = props.children;
|
||||
var ids = Object.keys(axisMap);
|
||||
var steps = {
|
||||
left: offset.left,
|
||||
leftMirror: offset.left,
|
||||
right: width - offset.right,
|
||||
rightMirror: width - offset.right,
|
||||
top: offset.top,
|
||||
topMirror: offset.top,
|
||||
bottom: height - offset.bottom,
|
||||
bottomMirror: height - offset.bottom
|
||||
};
|
||||
var hasBar = !!(0, _ReactUtils.findChildByType)(children, _Bar.Bar);
|
||||
return ids.reduce(function (result, id) {
|
||||
var axis = axisMap[id];
|
||||
var orientation = axis.orientation,
|
||||
domain = axis.domain,
|
||||
_axis$padding = axis.padding,
|
||||
padding = _axis$padding === void 0 ? {} : _axis$padding,
|
||||
mirror = axis.mirror,
|
||||
reversed = axis.reversed;
|
||||
var offsetKey = "".concat(orientation).concat(mirror ? 'Mirror' : '');
|
||||
var calculatedPadding, range, x, y, needSpace;
|
||||
if (axis.type === 'number' && (axis.padding === 'gap' || axis.padding === 'no-gap')) {
|
||||
var diff = domain[1] - domain[0];
|
||||
var smallestDistanceBetweenValues = Infinity;
|
||||
var sortedValues = axis.categoricalDomain.sort(_DataUtils.compareValues);
|
||||
sortedValues.forEach(function (value, index) {
|
||||
if (index > 0) {
|
||||
smallestDistanceBetweenValues = Math.min((value || 0) - (sortedValues[index - 1] || 0), smallestDistanceBetweenValues);
|
||||
}
|
||||
});
|
||||
if (Number.isFinite(smallestDistanceBetweenValues)) {
|
||||
var smallestDistanceInPercent = smallestDistanceBetweenValues / diff;
|
||||
var rangeWidth = axis.layout === 'vertical' ? offset.height : offset.width;
|
||||
if (axis.padding === 'gap') {
|
||||
calculatedPadding = smallestDistanceInPercent * rangeWidth / 2;
|
||||
}
|
||||
if (axis.padding === 'no-gap') {
|
||||
var gap = (0, _DataUtils.getPercentValue)(props.barCategoryGap, smallestDistanceInPercent * rangeWidth);
|
||||
var halfBand = smallestDistanceInPercent * rangeWidth / 2;
|
||||
calculatedPadding = halfBand - gap - (halfBand - gap) / rangeWidth * gap;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (axisType === 'xAxis') {
|
||||
range = [offset.left + (padding.left || 0) + (calculatedPadding || 0), offset.left + offset.width - (padding.right || 0) - (calculatedPadding || 0)];
|
||||
} else if (axisType === 'yAxis') {
|
||||
range = layout === 'horizontal' ? [offset.top + offset.height - (padding.bottom || 0), offset.top + (padding.top || 0)] : [offset.top + (padding.top || 0) + (calculatedPadding || 0), offset.top + offset.height - (padding.bottom || 0) - (calculatedPadding || 0)];
|
||||
} else {
|
||||
range = axis.range;
|
||||
}
|
||||
if (reversed) {
|
||||
range = [range[1], range[0]];
|
||||
}
|
||||
var _parseScale = (0, _ChartUtils.parseScale)(axis, chartName, hasBar),
|
||||
scale = _parseScale.scale,
|
||||
realScaleType = _parseScale.realScaleType;
|
||||
scale.domain(domain).range(range);
|
||||
(0, _ChartUtils.checkDomainOfScale)(scale);
|
||||
var ticks = (0, _ChartUtils.getTicksOfScale)(scale, _objectSpread(_objectSpread({}, axis), {}, {
|
||||
realScaleType: realScaleType
|
||||
}));
|
||||
if (axisType === 'xAxis') {
|
||||
needSpace = orientation === 'top' && !mirror || orientation === 'bottom' && mirror;
|
||||
x = offset.left;
|
||||
y = steps[offsetKey] - needSpace * axis.height;
|
||||
} else if (axisType === 'yAxis') {
|
||||
needSpace = orientation === 'left' && !mirror || orientation === 'right' && mirror;
|
||||
x = steps[offsetKey] - needSpace * axis.width;
|
||||
y = offset.top;
|
||||
}
|
||||
var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {
|
||||
realScaleType: realScaleType,
|
||||
x: x,
|
||||
y: y,
|
||||
scale: scale,
|
||||
width: axisType === 'xAxis' ? offset.width : axis.width,
|
||||
height: axisType === 'yAxis' ? offset.height : axis.height
|
||||
});
|
||||
finalAxis.bandSize = (0, _ChartUtils.getBandSizeOfAxis)(finalAxis, ticks);
|
||||
if (!axis.hide && axisType === 'xAxis') {
|
||||
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.height;
|
||||
} else if (!axis.hide) {
|
||||
steps[offsetKey] += (needSpace ? -1 : 1) * finalAxis.width;
|
||||
}
|
||||
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));
|
||||
}, {});
|
||||
};
|
||||
var rectWithPoints = exports.rectWithPoints = function rectWithPoints(_ref, _ref2) {
|
||||
var x1 = _ref.x,
|
||||
y1 = _ref.y;
|
||||
var x2 = _ref2.x,
|
||||
y2 = _ref2.y;
|
||||
return {
|
||||
x: Math.min(x1, x2),
|
||||
y: Math.min(y1, y2),
|
||||
width: Math.abs(x2 - x1),
|
||||
height: Math.abs(y2 - y1)
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute the x, y, width, and height of a box from two reference points.
|
||||
* @param {Object} coords x1, x2, y1, and y2
|
||||
* @return {Object} object
|
||||
*/
|
||||
var rectWithCoords = exports.rectWithCoords = function rectWithCoords(_ref3) {
|
||||
var x1 = _ref3.x1,
|
||||
y1 = _ref3.y1,
|
||||
x2 = _ref3.x2,
|
||||
y2 = _ref3.y2;
|
||||
return rectWithPoints({
|
||||
x: x1,
|
||||
y: y1
|
||||
}, {
|
||||
x: x2,
|
||||
y: y2
|
||||
});
|
||||
};
|
||||
var ScaleHelper = exports.ScaleHelper = /*#__PURE__*/function () {
|
||||
function ScaleHelper(scale) {
|
||||
_classCallCheck(this, ScaleHelper);
|
||||
this.scale = scale;
|
||||
}
|
||||
return _createClass(ScaleHelper, [{
|
||||
key: "domain",
|
||||
get: function get() {
|
||||
return this.scale.domain;
|
||||
}
|
||||
}, {
|
||||
key: "range",
|
||||
get: function get() {
|
||||
return this.scale.range;
|
||||
}
|
||||
}, {
|
||||
key: "rangeMin",
|
||||
get: function get() {
|
||||
return this.range()[0];
|
||||
}
|
||||
}, {
|
||||
key: "rangeMax",
|
||||
get: function get() {
|
||||
return this.range()[1];
|
||||
}
|
||||
}, {
|
||||
key: "bandwidth",
|
||||
get: function get() {
|
||||
return this.scale.bandwidth;
|
||||
}
|
||||
}, {
|
||||
key: "apply",
|
||||
value: function apply(value) {
|
||||
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
bandAware = _ref4.bandAware,
|
||||
position = _ref4.position;
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (position) {
|
||||
switch (position) {
|
||||
case 'start':
|
||||
{
|
||||
return this.scale(value);
|
||||
}
|
||||
case 'middle':
|
||||
{
|
||||
var offset = this.bandwidth ? this.bandwidth() / 2 : 0;
|
||||
return this.scale(value) + offset;
|
||||
}
|
||||
case 'end':
|
||||
{
|
||||
var _offset = this.bandwidth ? this.bandwidth() : 0;
|
||||
return this.scale(value) + _offset;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return this.scale(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bandAware) {
|
||||
var _offset2 = this.bandwidth ? this.bandwidth() / 2 : 0;
|
||||
return this.scale(value) + _offset2;
|
||||
}
|
||||
return this.scale(value);
|
||||
}
|
||||
}, {
|
||||
key: "isInRange",
|
||||
value: function isInRange(value) {
|
||||
var range = this.range();
|
||||
var first = range[0];
|
||||
var last = range[range.length - 1];
|
||||
return first <= last ? value >= first && value <= last : value >= last && value <= first;
|
||||
}
|
||||
}], [{
|
||||
key: "create",
|
||||
value: function create(obj) {
|
||||
return new ScaleHelper(obj);
|
||||
}
|
||||
}]);
|
||||
}();
|
||||
_defineProperty(ScaleHelper, "EPS", 1e-4);
|
||||
var createLabeledScales = exports.createLabeledScales = function createLabeledScales(options) {
|
||||
var scales = Object.keys(options).reduce(function (res, key) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, key, ScaleHelper.create(options[key])));
|
||||
}, {});
|
||||
return _objectSpread(_objectSpread({}, scales), {}, {
|
||||
apply: function apply(coord) {
|
||||
var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
bandAware = _ref5.bandAware,
|
||||
position = _ref5.position;
|
||||
return (0, _mapValues["default"])(coord, function (value, label) {
|
||||
return scales[label].apply(value, {
|
||||
bandAware: bandAware,
|
||||
position: position
|
||||
});
|
||||
});
|
||||
},
|
||||
isInRange: function isInRange(coord) {
|
||||
return (0, _every["default"])(coord, function (value, label) {
|
||||
return scales[label].isInRange(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** Normalizes the angle so that 0 <= angle < 180.
|
||||
* @param {number} angle Angle in degrees.
|
||||
* @return {number} the normalized angle with a value of at least 0 and never greater or equal to 180. */
|
||||
function normalizeAngle(angle) {
|
||||
return (angle % 180 + 180) % 180;
|
||||
}
|
||||
|
||||
/** Calculates the width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
||||
* @param {Object} size Width and height of the text in a horizontal position.
|
||||
* @param {number} angle Angle in degrees in which the text is displayed.
|
||||
* @return {number} The width of the largest horizontal line that fits inside a rectangle that is displayed at an angle.
|
||||
*/
|
||||
var getAngledRectangleWidth = exports.getAngledRectangleWidth = function getAngledRectangleWidth(_ref6) {
|
||||
var width = _ref6.width,
|
||||
height = _ref6.height;
|
||||
var angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
// Ensure angle is >= 0 && < 180
|
||||
var normalizedAngle = normalizeAngle(angle);
|
||||
var angleRadians = normalizedAngle * Math.PI / 180;
|
||||
|
||||
/* Depending on the height and width of the rectangle, we may need to use different formulas to calculate the angled
|
||||
* width. This threshold defines when each formula should kick in. */
|
||||
var angleThreshold = Math.atan(height / width);
|
||||
var angledWidth = angleRadians > angleThreshold && angleRadians < Math.PI - angleThreshold ? height / Math.sin(angleRadians) : width / Math.cos(angleRadians);
|
||||
return Math.abs(angledWidth);
|
||||
};
|
||||
1079
frontend/node_modules/recharts/lib/util/ChartUtils.js
generated
vendored
Normal file
1079
frontend/node_modules/recharts/lib/util/ChartUtils.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7
frontend/node_modules/recharts/lib/util/Constants.js
generated
vendored
Normal file
7
frontend/node_modules/recharts/lib/util/Constants.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.COLOR_PANEL = void 0;
|
||||
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'];
|
||||
26
frontend/node_modules/recharts/lib/util/CssPrefixUtils.js
generated
vendored
Normal file
26
frontend/node_modules/recharts/lib/util/CssPrefixUtils.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.generatePrefixStyle = void 0;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var PREFIX_LIST = ['Webkit', 'Moz', 'O', 'ms'];
|
||||
var generatePrefixStyle = exports.generatePrefixStyle = function generatePrefixStyle(name, value) {
|
||||
if (!name) {
|
||||
return null;
|
||||
}
|
||||
var camelName = name.replace(/(\w)/, function (v) {
|
||||
return v.toUpperCase();
|
||||
});
|
||||
var result = PREFIX_LIST.reduce(function (res, entry) {
|
||||
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, entry + camelName, value));
|
||||
}, {});
|
||||
result[name] = value;
|
||||
return result;
|
||||
};
|
||||
118
frontend/node_modules/recharts/lib/util/DOMUtils.js
generated
vendored
Normal file
118
frontend/node_modules/recharts/lib/util/DOMUtils.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getStyleString = exports.getStringSize = exports.getOffset = void 0;
|
||||
var _Global = require("./Global");
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
var stringCache = {
|
||||
widthCache: {},
|
||||
cacheCount: 0
|
||||
};
|
||||
var MAX_CACHE_NUM = 2000;
|
||||
var SPAN_STYLE = {
|
||||
position: 'absolute',
|
||||
top: '-20000px',
|
||||
left: 0,
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
border: 'none',
|
||||
whiteSpace: 'pre'
|
||||
};
|
||||
var STYLE_LIST = ['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'lineHeight', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom'];
|
||||
var MEASUREMENT_SPAN_ID = 'recharts_measurement_span';
|
||||
function autoCompleteStyle(name, value) {
|
||||
if (STYLE_LIST.indexOf(name) >= 0 && value === +value) {
|
||||
return "".concat(value, "px");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function camelToMiddleLine(text) {
|
||||
var strs = text.split('');
|
||||
var formatStrs = strs.reduce(function (result, entry) {
|
||||
if (entry === entry.toUpperCase()) {
|
||||
return [].concat(_toConsumableArray(result), ['-', entry.toLowerCase()]);
|
||||
}
|
||||
return [].concat(_toConsumableArray(result), [entry]);
|
||||
}, []);
|
||||
return formatStrs.join('');
|
||||
}
|
||||
var getStyleString = exports.getStyleString = function getStyleString(style) {
|
||||
return Object.keys(style).reduce(function (result, s) {
|
||||
return "".concat(result).concat(camelToMiddleLine(s), ":").concat(autoCompleteStyle(s, style[s]), ";");
|
||||
}, '');
|
||||
};
|
||||
function removeInvalidKeys(obj) {
|
||||
var copyObj = _objectSpread({}, obj);
|
||||
Object.keys(copyObj).forEach(function (key) {
|
||||
if (!copyObj[key]) {
|
||||
delete copyObj[key];
|
||||
}
|
||||
});
|
||||
return copyObj;
|
||||
}
|
||||
var getStringSize = exports.getStringSize = function getStringSize(text) {
|
||||
var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
if (text === undefined || text === null || _Global.Global.isSsr) {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
var copyStyle = removeInvalidKeys(style);
|
||||
var cacheKey = JSON.stringify({
|
||||
text: text,
|
||||
copyStyle: copyStyle
|
||||
});
|
||||
if (stringCache.widthCache[cacheKey]) {
|
||||
return stringCache.widthCache[cacheKey];
|
||||
}
|
||||
try {
|
||||
var measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
||||
if (!measurementSpan) {
|
||||
measurementSpan = document.createElement('span');
|
||||
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
||||
measurementSpan.setAttribute('aria-hidden', 'true');
|
||||
document.body.appendChild(measurementSpan);
|
||||
}
|
||||
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
|
||||
// https://en.wikipedia.org/wiki/Content_Security_Policy
|
||||
var measurementSpanStyle = _objectSpread(_objectSpread({}, SPAN_STYLE), copyStyle);
|
||||
Object.assign(measurementSpan.style, measurementSpanStyle);
|
||||
measurementSpan.textContent = "".concat(text);
|
||||
var rect = measurementSpan.getBoundingClientRect();
|
||||
var result = {
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
};
|
||||
stringCache.widthCache[cacheKey] = result;
|
||||
if (++stringCache.cacheCount > MAX_CACHE_NUM) {
|
||||
stringCache.cacheCount = 0;
|
||||
stringCache.widthCache = {};
|
||||
}
|
||||
return result;
|
||||
} catch (e) {
|
||||
return {
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
}
|
||||
};
|
||||
var getOffset = exports.getOffset = function getOffset(rect) {
|
||||
return {
|
||||
top: rect.top + window.scrollY - document.documentElement.clientTop,
|
||||
left: rect.left + window.scrollX - document.documentElement.clientLeft
|
||||
};
|
||||
};
|
||||
179
frontend/node_modules/recharts/lib/util/DataUtils.js
generated
vendored
Normal file
179
frontend/node_modules/recharts/lib/util/DataUtils.js
generated
vendored
Normal file
@ -0,0 +1,179 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.compareValues = void 0;
|
||||
exports.findEntryInArray = findEntryInArray;
|
||||
exports.uniqueId = exports.mathSign = exports.isPercent = exports.isNumber = exports.isNumOrStr = exports.isNullish = exports.interpolateNumber = exports.hasDuplicate = exports.getPercentValue = exports.getLinearRegression = exports.getAnyElementOfObject = void 0;
|
||||
var _isString = _interopRequireDefault(require("lodash/isString"));
|
||||
var _isNaN = _interopRequireDefault(require("lodash/isNaN"));
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var mathSign = exports.mathSign = function mathSign(value) {
|
||||
if (value === 0) {
|
||||
return 0;
|
||||
}
|
||||
if (value > 0) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
var isPercent = exports.isPercent = function isPercent(value) {
|
||||
return (0, _isString["default"])(value) && value.indexOf('%') === value.length - 1;
|
||||
};
|
||||
var isNumber = exports.isNumber = function isNumber(value) {
|
||||
return (0, _isNumber["default"])(value) && !(0, _isNaN["default"])(value);
|
||||
};
|
||||
var isNullish = exports.isNullish = function isNullish(value) {
|
||||
return (0, _isNil["default"])(value);
|
||||
};
|
||||
var isNumOrStr = exports.isNumOrStr = function isNumOrStr(value) {
|
||||
return isNumber(value) || (0, _isString["default"])(value);
|
||||
};
|
||||
var idCounter = 0;
|
||||
var uniqueId = exports.uniqueId = function uniqueId(prefix) {
|
||||
var id = ++idCounter;
|
||||
return "".concat(prefix || '').concat(id);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get percent value of a total value
|
||||
* @param {number|string} percent A percent
|
||||
* @param {number} totalValue Total value
|
||||
* @param {number} defaultValue The value returned when percent is undefined or invalid
|
||||
* @param {boolean} validate If set to be true, the result will be validated
|
||||
* @return {number} value
|
||||
*/
|
||||
var getPercentValue = exports.getPercentValue = function getPercentValue(percent, totalValue) {
|
||||
var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
var validate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
if (!isNumber(percent) && !(0, _isString["default"])(percent)) {
|
||||
return defaultValue;
|
||||
}
|
||||
var value;
|
||||
if (isPercent(percent)) {
|
||||
var index = percent.indexOf('%');
|
||||
value = totalValue * parseFloat(percent.slice(0, index)) / 100;
|
||||
} else {
|
||||
value = +percent;
|
||||
}
|
||||
if ((0, _isNaN["default"])(value)) {
|
||||
value = defaultValue;
|
||||
}
|
||||
if (validate && value > totalValue) {
|
||||
value = totalValue;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
var getAnyElementOfObject = exports.getAnyElementOfObject = function getAnyElementOfObject(obj) {
|
||||
if (!obj) {
|
||||
return null;
|
||||
}
|
||||
var keys = Object.keys(obj);
|
||||
if (keys && keys.length) {
|
||||
return obj[keys[0]];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var hasDuplicate = exports.hasDuplicate = function hasDuplicate(ary) {
|
||||
if (!Array.isArray(ary)) {
|
||||
return false;
|
||||
}
|
||||
var len = ary.length;
|
||||
var cache = {};
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!cache[ary[i]]) {
|
||||
cache[ary[i]] = true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/* @todo consider to rename this function into `getInterpolator` */
|
||||
var interpolateNumber = exports.interpolateNumber = function interpolateNumber(numberA, numberB) {
|
||||
if (isNumber(numberA) && isNumber(numberB)) {
|
||||
return function (t) {
|
||||
return numberA + t * (numberB - numberA);
|
||||
};
|
||||
}
|
||||
return function () {
|
||||
return numberB;
|
||||
};
|
||||
};
|
||||
function findEntryInArray(ary, specifiedKey, specifiedValue) {
|
||||
if (!ary || !ary.length) {
|
||||
return null;
|
||||
}
|
||||
return ary.find(function (entry) {
|
||||
return entry && (typeof specifiedKey === 'function' ? specifiedKey(entry) : (0, _get["default"])(entry, specifiedKey)) === specifiedValue;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The least square linear regression
|
||||
* @param {Array} data The array of points
|
||||
* @returns {Object} The domain of x, and the parameter of linear function
|
||||
*/
|
||||
var getLinearRegression = exports.getLinearRegression = function getLinearRegression(data) {
|
||||
if (!data || !data.length) {
|
||||
return null;
|
||||
}
|
||||
var len = data.length;
|
||||
var xsum = 0;
|
||||
var ysum = 0;
|
||||
var xysum = 0;
|
||||
var xxsum = 0;
|
||||
var xmin = Infinity;
|
||||
var xmax = -Infinity;
|
||||
var xcurrent = 0;
|
||||
var ycurrent = 0;
|
||||
for (var i = 0; i < len; i++) {
|
||||
xcurrent = data[i].cx || 0;
|
||||
ycurrent = data[i].cy || 0;
|
||||
xsum += xcurrent;
|
||||
ysum += ycurrent;
|
||||
xysum += xcurrent * ycurrent;
|
||||
xxsum += xcurrent * xcurrent;
|
||||
xmin = Math.min(xmin, xcurrent);
|
||||
xmax = Math.max(xmax, xcurrent);
|
||||
}
|
||||
var a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
|
||||
return {
|
||||
xmin: xmin,
|
||||
xmax: xmax,
|
||||
a: a,
|
||||
b: (ysum - a * xsum) / len
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Compare values.
|
||||
*
|
||||
* This function is intended to be passed to `Array.prototype.sort()`. It properly compares generic homogeneous arrays that are either `string[]`,
|
||||
* `number[]`, or `Date[]`. When comparing heterogeneous arrays or homogeneous arrays of other types, it will attempt to compare items properly but
|
||||
* will fall back to string comparison for mismatched or unsupported types.
|
||||
*
|
||||
* For some background, `Array.prototype.sort()`'s default comparator coerces each of the array's items into a string and compares the strings. This
|
||||
* often leads to undesirable behavior, especially with numerical items.
|
||||
*
|
||||
* @param {unknown} a The first item to compare
|
||||
* @param {unknown} b The second item to compare
|
||||
* @return {number} A negative number if a < b, a positive number if a > b, 0 if equal
|
||||
*/
|
||||
var compareValues = exports.compareValues = function compareValues(a, b) {
|
||||
if (isNumber(a) && isNumber(b)) {
|
||||
return a - b;
|
||||
}
|
||||
if ((0, _isString["default"])(a) && (0, _isString["default"])(b)) {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
if (a instanceof Date && b instanceof Date) {
|
||||
return a.getTime() - b.getTime();
|
||||
}
|
||||
return String(a).localeCompare(String(b));
|
||||
};
|
||||
57
frontend/node_modules/recharts/lib/util/DetectReferenceElementsDomain.js
generated
vendored
Normal file
57
frontend/node_modules/recharts/lib/util/DetectReferenceElementsDomain.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.detectReferenceElementsDomain = void 0;
|
||||
var _ReferenceDot = require("../cartesian/ReferenceDot");
|
||||
var _ReferenceLine = require("../cartesian/ReferenceLine");
|
||||
var _ReferenceArea = require("../cartesian/ReferenceArea");
|
||||
var _IfOverflowMatches = require("./IfOverflowMatches");
|
||||
var _ReactUtils = require("./ReactUtils");
|
||||
var _DataUtils = require("./DataUtils");
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
var detectReferenceElementsDomain = exports.detectReferenceElementsDomain = function detectReferenceElementsDomain(children, domain, axisId, axisType, specifiedTicks) {
|
||||
var lines = (0, _ReactUtils.findAllByType)(children, _ReferenceLine.ReferenceLine);
|
||||
var dots = (0, _ReactUtils.findAllByType)(children, _ReferenceDot.ReferenceDot);
|
||||
var elements = [].concat(_toConsumableArray(lines), _toConsumableArray(dots));
|
||||
var areas = (0, _ReactUtils.findAllByType)(children, _ReferenceArea.ReferenceArea);
|
||||
var idKey = "".concat(axisType, "Id");
|
||||
var valueKey = axisType[0];
|
||||
var finalDomain = domain;
|
||||
if (elements.length) {
|
||||
finalDomain = elements.reduce(function (result, el) {
|
||||
if (el.props[idKey] === axisId && (0, _IfOverflowMatches.ifOverflowMatches)(el.props, 'extendDomain') && (0, _DataUtils.isNumber)(el.props[valueKey])) {
|
||||
var value = el.props[valueKey];
|
||||
return [Math.min(result[0], value), Math.max(result[1], value)];
|
||||
}
|
||||
return result;
|
||||
}, finalDomain);
|
||||
}
|
||||
if (areas.length) {
|
||||
var key1 = "".concat(valueKey, "1");
|
||||
var key2 = "".concat(valueKey, "2");
|
||||
finalDomain = areas.reduce(function (result, el) {
|
||||
if (el.props[idKey] === axisId && (0, _IfOverflowMatches.ifOverflowMatches)(el.props, 'extendDomain') && (0, _DataUtils.isNumber)(el.props[key1]) && (0, _DataUtils.isNumber)(el.props[key2])) {
|
||||
var value1 = el.props[key1];
|
||||
var value2 = el.props[key2];
|
||||
return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];
|
||||
}
|
||||
return result;
|
||||
}, finalDomain);
|
||||
}
|
||||
if (specifiedTicks && specifiedTicks.length) {
|
||||
finalDomain = specifiedTicks.reduce(function (result, tick) {
|
||||
if ((0, _DataUtils.isNumber)(tick)) {
|
||||
return [Math.min(result[0], tick), Math.max(result[1], tick)];
|
||||
}
|
||||
return result;
|
||||
}, finalDomain);
|
||||
}
|
||||
return finalDomain;
|
||||
};
|
||||
10
frontend/node_modules/recharts/lib/util/Events.js
generated
vendored
Normal file
10
frontend/node_modules/recharts/lib/util/Events.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.eventCenter = exports.SYNC_EVENT = void 0;
|
||||
var _eventemitter = _interopRequireDefault(require("eventemitter3"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
var eventCenter = exports.eventCenter = new _eventemitter["default"]();
|
||||
var SYNC_EVENT = exports.SYNC_EVENT = 'recharts.syncMouseEvents';
|
||||
40
frontend/node_modules/recharts/lib/util/FunnelUtils.js
generated
vendored
Normal file
40
frontend/node_modules/recharts/lib/util/FunnelUtils.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FunnelTrapezoid = FunnelTrapezoid;
|
||||
exports.typeGuardTrapezoidProps = typeGuardTrapezoidProps;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
// Trapezoid props is expecting x, y, height as numbers.
|
||||
// When props are being spread in from a user defined component in Funnel,
|
||||
// the prop types of an SVGElement have these typed as string | number.
|
||||
// This function will return the passed in props along with x, y, height as numbers.
|
||||
function typeGuardTrapezoidProps(option, props) {
|
||||
var xValue = "".concat(props.x || option.x);
|
||||
var x = parseInt(xValue, 10);
|
||||
var yValue = "".concat(props.y || option.y);
|
||||
var y = parseInt(yValue, 10);
|
||||
var heightValue = "".concat((props === null || props === void 0 ? void 0 : props.height) || (option === null || option === void 0 ? void 0 : option.height));
|
||||
var height = parseInt(heightValue, 10);
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, props), (0, _ActiveShapeUtils.getPropsFromShapeOption)(option)), {}, {
|
||||
height: height,
|
||||
x: x,
|
||||
y: y
|
||||
});
|
||||
}
|
||||
function FunnelTrapezoid(props) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
shapeType: "trapezoid",
|
||||
propTransformer: typeGuardTrapezoidProps
|
||||
}, props));
|
||||
}
|
||||
27
frontend/node_modules/recharts/lib/util/Global.js
generated
vendored
Normal file
27
frontend/node_modules/recharts/lib/util/Global.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Global = void 0;
|
||||
var parseIsSsrByDefault = function parseIsSsrByDefault() {
|
||||
return !(typeof window !== 'undefined' && window.document && window.document.createElement && window.setTimeout);
|
||||
};
|
||||
var Global = exports.Global = {
|
||||
isSsr: parseIsSsrByDefault(),
|
||||
get: function get(key) {
|
||||
return Global[key];
|
||||
},
|
||||
set: function set(key, value) {
|
||||
if (typeof key === 'string') {
|
||||
Global[key] = value;
|
||||
} else {
|
||||
var keys = Object.keys(key);
|
||||
if (keys && keys.length) {
|
||||
keys.forEach(function (k) {
|
||||
Global[k] = key[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
14
frontend/node_modules/recharts/lib/util/IfOverflowMatches.js
generated
vendored
Normal file
14
frontend/node_modules/recharts/lib/util/IfOverflowMatches.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ifOverflowMatches = void 0;
|
||||
var ifOverflowMatches = exports.ifOverflowMatches = function ifOverflowMatches(props, value) {
|
||||
var alwaysShow = props.alwaysShow;
|
||||
var ifOverflow = props.ifOverflow;
|
||||
if (alwaysShow) {
|
||||
ifOverflow = 'extendDomain';
|
||||
}
|
||||
return ifOverflow === value;
|
||||
};
|
||||
28
frontend/node_modules/recharts/lib/util/LogUtils.js
generated
vendored
Normal file
28
frontend/node_modules/recharts/lib/util/LogUtils.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.warn = void 0;
|
||||
/* eslint no-console: 0 */
|
||||
var isDev = process.env.NODE_ENV !== 'production';
|
||||
var warn = exports.warn = function warn(condition, format) {
|
||||
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
||||
args[_key - 2] = arguments[_key];
|
||||
}
|
||||
if (isDev && typeof console !== 'undefined' && console.warn) {
|
||||
if (format === undefined) {
|
||||
console.warn('LogUtils requires an error message argument');
|
||||
}
|
||||
if (!condition) {
|
||||
if (format === undefined) {
|
||||
console.warn('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
||||
} else {
|
||||
var argIndex = 0;
|
||||
console.warn(format.replace(/%s/g, function () {
|
||||
return args[argIndex++];
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
215
frontend/node_modules/recharts/lib/util/PolarUtils.js
generated
vendored
Normal file
215
frontend/node_modules/recharts/lib/util/PolarUtils.js
generated
vendored
Normal file
@ -0,0 +1,215 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.radianToDegree = exports.polarToCartesian = exports.inRangeOfSector = exports.getTickClassName = exports.getMaxRadius = exports.getAngleOfPoint = exports.formatAxisMap = exports.formatAngleOfSector = exports.distanceBetweenPoints = exports.degreeToRadian = exports.RADIAN = void 0;
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _react = require("react");
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _DataUtils = require("./DataUtils");
|
||||
var _ChartUtils = require("./ChartUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
var RADIAN = exports.RADIAN = Math.PI / 180;
|
||||
var degreeToRadian = exports.degreeToRadian = function degreeToRadian(angle) {
|
||||
return angle * Math.PI / 180;
|
||||
};
|
||||
var radianToDegree = exports.radianToDegree = function radianToDegree(angleInRadian) {
|
||||
return angleInRadian * 180 / Math.PI;
|
||||
};
|
||||
var polarToCartesian = exports.polarToCartesian = function polarToCartesian(cx, cy, radius, angle) {
|
||||
return {
|
||||
x: cx + Math.cos(-RADIAN * angle) * radius,
|
||||
y: cy + Math.sin(-RADIAN * angle) * radius
|
||||
};
|
||||
};
|
||||
var getMaxRadius = exports.getMaxRadius = function getMaxRadius(width, height) {
|
||||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
||||
top: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
left: 0
|
||||
};
|
||||
return Math.min(Math.abs(width - (offset.left || 0) - (offset.right || 0)), Math.abs(height - (offset.top || 0) - (offset.bottom || 0))) / 2;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the scale function, position, width, height of axes
|
||||
* @param {Object} props Latest props
|
||||
* @param {Object} axisMap The configuration of axes
|
||||
* @param {Object} offset The offset of main part in the svg element
|
||||
* @param {Object} axisType The type of axes, radius-axis or angle-axis
|
||||
* @param {String} chartName The name of chart
|
||||
* @return {Object} Configuration
|
||||
*/
|
||||
var formatAxisMap = exports.formatAxisMap = function formatAxisMap(props, axisMap, offset, axisType, chartName) {
|
||||
var width = props.width,
|
||||
height = props.height;
|
||||
var startAngle = props.startAngle,
|
||||
endAngle = props.endAngle;
|
||||
var cx = (0, _DataUtils.getPercentValue)(props.cx, width, width / 2);
|
||||
var cy = (0, _DataUtils.getPercentValue)(props.cy, height, height / 2);
|
||||
var maxRadius = getMaxRadius(width, height, offset);
|
||||
var innerRadius = (0, _DataUtils.getPercentValue)(props.innerRadius, maxRadius, 0);
|
||||
var outerRadius = (0, _DataUtils.getPercentValue)(props.outerRadius, maxRadius, maxRadius * 0.8);
|
||||
var ids = Object.keys(axisMap);
|
||||
return ids.reduce(function (result, id) {
|
||||
var axis = axisMap[id];
|
||||
var domain = axis.domain,
|
||||
reversed = axis.reversed;
|
||||
var range;
|
||||
if ((0, _isNil["default"])(axis.range)) {
|
||||
if (axisType === 'angleAxis') {
|
||||
range = [startAngle, endAngle];
|
||||
} else if (axisType === 'radiusAxis') {
|
||||
range = [innerRadius, outerRadius];
|
||||
}
|
||||
if (reversed) {
|
||||
range = [range[1], range[0]];
|
||||
}
|
||||
} else {
|
||||
range = axis.range;
|
||||
var _range = range;
|
||||
var _range2 = _slicedToArray(_range, 2);
|
||||
startAngle = _range2[0];
|
||||
endAngle = _range2[1];
|
||||
}
|
||||
var _parseScale = (0, _ChartUtils.parseScale)(axis, chartName),
|
||||
realScaleType = _parseScale.realScaleType,
|
||||
scale = _parseScale.scale;
|
||||
scale.domain(domain).range(range);
|
||||
(0, _ChartUtils.checkDomainOfScale)(scale);
|
||||
var ticks = (0, _ChartUtils.getTicksOfScale)(scale, _objectSpread(_objectSpread({}, axis), {}, {
|
||||
realScaleType: realScaleType
|
||||
}));
|
||||
var finalAxis = _objectSpread(_objectSpread(_objectSpread({}, axis), ticks), {}, {
|
||||
range: range,
|
||||
radius: outerRadius,
|
||||
realScaleType: realScaleType,
|
||||
scale: scale,
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
innerRadius: innerRadius,
|
||||
outerRadius: outerRadius,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
});
|
||||
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, id, finalAxis));
|
||||
}, {});
|
||||
};
|
||||
var distanceBetweenPoints = exports.distanceBetweenPoints = function distanceBetweenPoints(point, anotherPoint) {
|
||||
var x1 = point.x,
|
||||
y1 = point.y;
|
||||
var x2 = anotherPoint.x,
|
||||
y2 = anotherPoint.y;
|
||||
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
||||
};
|
||||
var getAngleOfPoint = exports.getAngleOfPoint = function getAngleOfPoint(_ref, _ref2) {
|
||||
var x = _ref.x,
|
||||
y = _ref.y;
|
||||
var cx = _ref2.cx,
|
||||
cy = _ref2.cy;
|
||||
var radius = distanceBetweenPoints({
|
||||
x: x,
|
||||
y: y
|
||||
}, {
|
||||
x: cx,
|
||||
y: cy
|
||||
});
|
||||
if (radius <= 0) {
|
||||
return {
|
||||
radius: radius
|
||||
};
|
||||
}
|
||||
var cos = (x - cx) / radius;
|
||||
var angleInRadian = Math.acos(cos);
|
||||
if (y > cy) {
|
||||
angleInRadian = 2 * Math.PI - angleInRadian;
|
||||
}
|
||||
return {
|
||||
radius: radius,
|
||||
angle: radianToDegree(angleInRadian),
|
||||
angleInRadian: angleInRadian
|
||||
};
|
||||
};
|
||||
var formatAngleOfSector = exports.formatAngleOfSector = function formatAngleOfSector(_ref3) {
|
||||
var startAngle = _ref3.startAngle,
|
||||
endAngle = _ref3.endAngle;
|
||||
var startCnt = Math.floor(startAngle / 360);
|
||||
var endCnt = Math.floor(endAngle / 360);
|
||||
var min = Math.min(startCnt, endCnt);
|
||||
return {
|
||||
startAngle: startAngle - min * 360,
|
||||
endAngle: endAngle - min * 360
|
||||
};
|
||||
};
|
||||
var reverseFormatAngleOfSetor = function reverseFormatAngleOfSetor(angle, _ref4) {
|
||||
var startAngle = _ref4.startAngle,
|
||||
endAngle = _ref4.endAngle;
|
||||
var startCnt = Math.floor(startAngle / 360);
|
||||
var endCnt = Math.floor(endAngle / 360);
|
||||
var min = Math.min(startCnt, endCnt);
|
||||
return angle + min * 360;
|
||||
};
|
||||
var inRangeOfSector = exports.inRangeOfSector = function inRangeOfSector(_ref5, sector) {
|
||||
var x = _ref5.x,
|
||||
y = _ref5.y;
|
||||
var _getAngleOfPoint = getAngleOfPoint({
|
||||
x: x,
|
||||
y: y
|
||||
}, sector),
|
||||
radius = _getAngleOfPoint.radius,
|
||||
angle = _getAngleOfPoint.angle;
|
||||
var innerRadius = sector.innerRadius,
|
||||
outerRadius = sector.outerRadius;
|
||||
if (radius < innerRadius || radius > outerRadius) {
|
||||
return false;
|
||||
}
|
||||
if (radius === 0) {
|
||||
return true;
|
||||
}
|
||||
var _formatAngleOfSector = formatAngleOfSector(sector),
|
||||
startAngle = _formatAngleOfSector.startAngle,
|
||||
endAngle = _formatAngleOfSector.endAngle;
|
||||
var formatAngle = angle;
|
||||
var inRange;
|
||||
if (startAngle <= endAngle) {
|
||||
while (formatAngle > endAngle) {
|
||||
formatAngle -= 360;
|
||||
}
|
||||
while (formatAngle < startAngle) {
|
||||
formatAngle += 360;
|
||||
}
|
||||
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
|
||||
} else {
|
||||
while (formatAngle > startAngle) {
|
||||
formatAngle -= 360;
|
||||
}
|
||||
while (formatAngle < endAngle) {
|
||||
formatAngle += 360;
|
||||
}
|
||||
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
|
||||
}
|
||||
if (inRange) {
|
||||
return _objectSpread(_objectSpread({}, sector), {}, {
|
||||
radius: radius,
|
||||
angle: reverseFormatAngleOfSetor(formatAngle, sector)
|
||||
});
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var getTickClassName = exports.getTickClassName = function getTickClassName(tick) {
|
||||
return ! /*#__PURE__*/(0, _react.isValidElement)(tick) && !(0, _isFunction["default"])(tick) && typeof tick !== 'boolean' ? tick.className : '';
|
||||
};
|
||||
45
frontend/node_modules/recharts/lib/util/RadialBarUtils.js
generated
vendored
Normal file
45
frontend/node_modules/recharts/lib/util/RadialBarUtils.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RadialBarSector = RadialBarSector;
|
||||
exports.parseCornerRadius = parseCornerRadius;
|
||||
exports.typeGuardSectorProps = typeGuardSectorProps;
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function parseCornerRadius(cornerRadius) {
|
||||
if (typeof cornerRadius === 'string') {
|
||||
return parseInt(cornerRadius, 10);
|
||||
}
|
||||
return cornerRadius;
|
||||
}
|
||||
|
||||
// Sector props is expecting cx, cy as numbers.
|
||||
// When props are being spread in from a user defined component in RadialBar,
|
||||
// the prop types of an SVGElement have these typed as string | number.
|
||||
// This function will return the passed in props along with cx, cy as numbers.
|
||||
function typeGuardSectorProps(option, props) {
|
||||
var cxValue = "".concat(props.cx || option.cx);
|
||||
var cx = Number(cxValue);
|
||||
var cyValue = "".concat(props.cy || option.cy);
|
||||
var cy = Number(cyValue);
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, props), option), {}, {
|
||||
cx: cx,
|
||||
cy: cy
|
||||
});
|
||||
}
|
||||
function RadialBarSector(props) {
|
||||
return /*#__PURE__*/_react["default"].createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
shapeType: "sector",
|
||||
propTransformer: typeGuardSectorProps
|
||||
}, props));
|
||||
}
|
||||
311
frontend/node_modules/recharts/lib/util/ReactUtils.js
generated
vendored
Normal file
311
frontend/node_modules/recharts/lib/util/ReactUtils.js
generated
vendored
Normal file
@ -0,0 +1,311 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.filterSvgElements = exports.filterProps = exports.TOOLTIP_TYPES = exports.SCALE_TYPES = exports.LEGEND_TYPES = void 0;
|
||||
exports.findAllByType = findAllByType;
|
||||
exports.findChildByType = findChildByType;
|
||||
exports.withoutType = exports.validateWidthHeight = exports.toArray = exports.renderByOrder = exports.parseChildIndex = exports.isValidSpreadableProp = exports.isSingleChildEqual = exports.isChildrenEqual = exports.hasClipDot = exports.getReactEventByType = exports.getDisplayName = void 0;
|
||||
var _get = _interopRequireDefault(require("lodash/get"));
|
||||
var _isNil = _interopRequireDefault(require("lodash/isNil"));
|
||||
var _isString = _interopRequireDefault(require("lodash/isString"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
||||
var _react = require("react");
|
||||
var _reactIs = require("react-is");
|
||||
var _DataUtils = require("./DataUtils");
|
||||
var _ShallowEqual = require("./ShallowEqual");
|
||||
var _types = require("./types");
|
||||
var _excluded = ["children"],
|
||||
_excluded2 = ["children"];
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
var REACT_BROWSER_EVENT_MAP = {
|
||||
click: 'onClick',
|
||||
mousedown: 'onMouseDown',
|
||||
mouseup: 'onMouseUp',
|
||||
mouseover: 'onMouseOver',
|
||||
mousemove: 'onMouseMove',
|
||||
mouseout: 'onMouseOut',
|
||||
mouseenter: 'onMouseEnter',
|
||||
mouseleave: 'onMouseLeave',
|
||||
touchcancel: 'onTouchCancel',
|
||||
touchend: 'onTouchEnd',
|
||||
touchmove: 'onTouchMove',
|
||||
touchstart: 'onTouchStart',
|
||||
contextmenu: 'onContextMenu',
|
||||
dblclick: 'onDoubleClick'
|
||||
};
|
||||
var SCALE_TYPES = exports.SCALE_TYPES = ['auto', 'linear', 'pow', 'sqrt', 'log', 'identity', 'time', 'band', 'point', 'ordinal', 'quantile', 'quantize', 'utc', 'sequential', 'threshold'];
|
||||
var LEGEND_TYPES = exports.LEGEND_TYPES = ['plainline', 'line', 'square', 'rect', 'circle', 'cross', 'diamond', 'star', 'triangle', 'wye', 'none'];
|
||||
var TOOLTIP_TYPES = exports.TOOLTIP_TYPES = ['none'];
|
||||
|
||||
/**
|
||||
* Get the display name of a component
|
||||
* @param {Object} Comp Specified Component
|
||||
* @return {String} Display name of Component
|
||||
*/
|
||||
var getDisplayName = exports.getDisplayName = function getDisplayName(Comp) {
|
||||
if (typeof Comp === 'string') {
|
||||
return Comp;
|
||||
}
|
||||
if (!Comp) {
|
||||
return '';
|
||||
}
|
||||
return Comp.displayName || Comp.name || 'Component';
|
||||
};
|
||||
|
||||
// `toArray` gets called multiple times during the render
|
||||
// so we can memoize last invocation (since reference to `children` is the same)
|
||||
var lastChildren = null;
|
||||
var lastResult = null;
|
||||
var toArray = exports.toArray = function toArray(children) {
|
||||
if (children === lastChildren && Array.isArray(lastResult)) {
|
||||
return lastResult;
|
||||
}
|
||||
var result = [];
|
||||
_react.Children.forEach(children, function (child) {
|
||||
if ((0, _isNil["default"])(child)) return;
|
||||
if ((0, _reactIs.isFragment)(child)) {
|
||||
result = result.concat(toArray(child.props.children));
|
||||
} else {
|
||||
// @ts-expect-error this could still be Iterable<ReactNode> and TS does not like that
|
||||
result.push(child);
|
||||
}
|
||||
});
|
||||
lastResult = result;
|
||||
lastChildren = children;
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
* Find and return all matched children by type.
|
||||
* `type` must be a React.ComponentType
|
||||
*/
|
||||
function findAllByType(children, type) {
|
||||
var result = [];
|
||||
var types = [];
|
||||
if (Array.isArray(type)) {
|
||||
types = type.map(function (t) {
|
||||
return getDisplayName(t);
|
||||
});
|
||||
} else {
|
||||
types = [getDisplayName(type)];
|
||||
}
|
||||
toArray(children).forEach(function (child) {
|
||||
var childType = (0, _get["default"])(child, 'type.displayName') || (0, _get["default"])(child, 'type.name');
|
||||
if (types.indexOf(childType) !== -1) {
|
||||
result.push(child);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the first matched child by type, return null otherwise.
|
||||
* `type` must be a React.ComponentType
|
||||
*/
|
||||
function findChildByType(children, type) {
|
||||
var result = findAllByType(children, type);
|
||||
return result && result[0];
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new array of children excluding the ones matched the type
|
||||
*/
|
||||
var withoutType = exports.withoutType = function withoutType(children, type) {
|
||||
var newChildren = [];
|
||||
var types;
|
||||
if (Array.isArray(type)) {
|
||||
types = type.map(function (t) {
|
||||
return getDisplayName(t);
|
||||
});
|
||||
} else {
|
||||
types = [getDisplayName(type)];
|
||||
}
|
||||
toArray(children).forEach(function (child) {
|
||||
var displayName = (0, _get["default"])(child, 'type.displayName');
|
||||
if (displayName && types.indexOf(displayName) !== -1) {
|
||||
return;
|
||||
}
|
||||
newChildren.push(child);
|
||||
});
|
||||
return newChildren;
|
||||
};
|
||||
|
||||
/**
|
||||
* validate the width and height props of a chart element
|
||||
* @param {Object} el A chart element
|
||||
* @return {Boolean} true If the props width and height are number, and greater than 0
|
||||
*/
|
||||
var validateWidthHeight = exports.validateWidthHeight = function validateWidthHeight(el) {
|
||||
if (!el || !el.props) {
|
||||
return false;
|
||||
}
|
||||
var _el$props = el.props,
|
||||
width = _el$props.width,
|
||||
height = _el$props.height;
|
||||
if (!(0, _DataUtils.isNumber)(width) || width <= 0 || !(0, _DataUtils.isNumber)(height) || height <= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var SVG_TAGS = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColormatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-url', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'lineGradient', 'marker', 'mask', 'metadata', 'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern'];
|
||||
var isSvgElement = function isSvgElement(child) {
|
||||
return child && child.type && (0, _isString["default"])(child.type) && SVG_TAGS.indexOf(child.type) >= 0;
|
||||
};
|
||||
var hasClipDot = exports.hasClipDot = function hasClipDot(dot) {
|
||||
return dot && _typeof(dot) === 'object' && 'clipDot' in dot;
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the property is valid to spread onto an SVG element or onto a specific component
|
||||
* @param {unknown} property property value currently being compared
|
||||
* @param {string} key property key currently being compared
|
||||
* @param {boolean} includeEvents if events are included in spreadable props
|
||||
* @param {boolean} svgElementType checks against map of SVG element types to attributes
|
||||
* @returns {boolean} is prop valid
|
||||
*/
|
||||
var isValidSpreadableProp = exports.isValidSpreadableProp = function isValidSpreadableProp(property, key, includeEvents, svgElementType) {
|
||||
var _FilteredElementKeyMa;
|
||||
/**
|
||||
* If the svg element type is explicitly included, check against the filtered element key map
|
||||
* to determine if there are attributes that should only exist on that element type.
|
||||
* @todo Add an internal cjs version of https://github.com/wooorm/svg-element-attributes for full coverage.
|
||||
*/
|
||||
var matchingElementTypeKeys = (_FilteredElementKeyMa = _types.FilteredElementKeyMap === null || _types.FilteredElementKeyMap === void 0 ? void 0 : _types.FilteredElementKeyMap[svgElementType]) !== null && _FilteredElementKeyMa !== void 0 ? _FilteredElementKeyMa : [];
|
||||
return key.startsWith('data-') || !(0, _isFunction["default"])(property) && (svgElementType && matchingElementTypeKeys.includes(key) || _types.SVGElementPropKeys.includes(key)) || includeEvents && _types.EventKeys.includes(key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter all the svg elements of children
|
||||
* @param {Array} children The children of a react element
|
||||
* @return {Array} All the svg elements
|
||||
*/
|
||||
var filterSvgElements = exports.filterSvgElements = function filterSvgElements(children) {
|
||||
var svgElements = [];
|
||||
toArray(children).forEach(function (entry) {
|
||||
if (isSvgElement(entry)) {
|
||||
svgElements.push(entry);
|
||||
}
|
||||
});
|
||||
return svgElements;
|
||||
};
|
||||
var filterProps = exports.filterProps = function filterProps(props, includeEvents, svgElementType) {
|
||||
if (!props || typeof props === 'function' || typeof props === 'boolean') {
|
||||
return null;
|
||||
}
|
||||
var inputProps = props;
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(props)) {
|
||||
inputProps = props.props;
|
||||
}
|
||||
if (!(0, _isObject["default"])(inputProps)) {
|
||||
return null;
|
||||
}
|
||||
var out = {};
|
||||
|
||||
/**
|
||||
* Props are blindly spread onto SVG elements. This loop filters out properties that we don't want to spread.
|
||||
* Items filtered out are as follows:
|
||||
* - functions in properties that are SVG attributes (functions are included when includeEvents is true)
|
||||
* - props that are SVG attributes but don't matched the passed svgElementType
|
||||
* - any prop that is not in SVGElementPropKeys (or in EventKeys if includeEvents is true)
|
||||
*/
|
||||
Object.keys(inputProps).forEach(function (key) {
|
||||
var _inputProps;
|
||||
if (isValidSpreadableProp((_inputProps = inputProps) === null || _inputProps === void 0 ? void 0 : _inputProps[key], key, includeEvents, svgElementType)) {
|
||||
out[key] = inputProps[key];
|
||||
}
|
||||
});
|
||||
return out;
|
||||
};
|
||||
|
||||
/**
|
||||
* Wether props of children changed
|
||||
* @param {Object} nextChildren The latest children
|
||||
* @param {Object} prevChildren The prev children
|
||||
* @return {Boolean} equal or not
|
||||
*/
|
||||
var isChildrenEqual = exports.isChildrenEqual = function isChildrenEqual(nextChildren, prevChildren) {
|
||||
if (nextChildren === prevChildren) {
|
||||
return true;
|
||||
}
|
||||
var count = _react.Children.count(nextChildren);
|
||||
if (count !== _react.Children.count(prevChildren)) {
|
||||
return false;
|
||||
}
|
||||
if (count === 0) {
|
||||
return true;
|
||||
}
|
||||
if (count === 1) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
return isSingleChildEqual(Array.isArray(nextChildren) ? nextChildren[0] : nextChildren, Array.isArray(prevChildren) ? prevChildren[0] : prevChildren);
|
||||
}
|
||||
for (var i = 0; i < count; i++) {
|
||||
var nextChild = nextChildren[i];
|
||||
var prevChild = prevChildren[i];
|
||||
if (Array.isArray(nextChild) || Array.isArray(prevChild)) {
|
||||
if (!isChildrenEqual(nextChild, prevChild)) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
} else if (!isSingleChildEqual(nextChild, prevChild)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var isSingleChildEqual = exports.isSingleChildEqual = function isSingleChildEqual(nextChild, prevChild) {
|
||||
if ((0, _isNil["default"])(nextChild) && (0, _isNil["default"])(prevChild)) {
|
||||
return true;
|
||||
}
|
||||
if (!(0, _isNil["default"])(nextChild) && !(0, _isNil["default"])(prevChild)) {
|
||||
var _ref = nextChild.props || {},
|
||||
nextChildren = _ref.children,
|
||||
nextProps = _objectWithoutProperties(_ref, _excluded);
|
||||
var _ref2 = prevChild.props || {},
|
||||
prevChildren = _ref2.children,
|
||||
prevProps = _objectWithoutProperties(_ref2, _excluded2);
|
||||
if (nextChildren && prevChildren) {
|
||||
return (0, _ShallowEqual.shallowEqual)(nextProps, prevProps) && isChildrenEqual(nextChildren, prevChildren);
|
||||
}
|
||||
if (!nextChildren && !prevChildren) {
|
||||
return (0, _ShallowEqual.shallowEqual)(nextProps, prevProps);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
var renderByOrder = exports.renderByOrder = function renderByOrder(children, renderMap) {
|
||||
var elements = [];
|
||||
var record = {};
|
||||
toArray(children).forEach(function (child, index) {
|
||||
if (isSvgElement(child)) {
|
||||
elements.push(child);
|
||||
} else if (child) {
|
||||
var displayName = getDisplayName(child.type);
|
||||
var _ref3 = renderMap[displayName] || {},
|
||||
handler = _ref3.handler,
|
||||
once = _ref3.once;
|
||||
if (handler && (!once || !record[displayName])) {
|
||||
var results = handler(child, displayName, index);
|
||||
elements.push(results);
|
||||
record[displayName] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
return elements;
|
||||
};
|
||||
var getReactEventByType = exports.getReactEventByType = function getReactEventByType(e) {
|
||||
var type = e && e.type;
|
||||
if (type && REACT_BROWSER_EVENT_MAP[type]) {
|
||||
return REACT_BROWSER_EVENT_MAP[type];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var parseChildIndex = exports.parseChildIndex = function parseChildIndex(child, children) {
|
||||
return toArray(children).indexOf(child);
|
||||
};
|
||||
180
frontend/node_modules/recharts/lib/util/ReduceCSSCalc.js
generated
vendored
Normal file
180
frontend/node_modules/recharts/lib/util/ReduceCSSCalc.js
generated
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.reduceCSSCalc = reduceCSSCalc;
|
||||
exports.safeEvaluateExpression = safeEvaluateExpression;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
||||
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var MULTIPLY_OR_DIVIDE_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
||||
var ADD_OR_SUBTRACT_REGEX = /(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/;
|
||||
var CSS_LENGTH_UNIT_REGEX = /^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/;
|
||||
var NUM_SPLIT_REGEX = /(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/;
|
||||
var CONVERSION_RATES = {
|
||||
cm: 96 / 2.54,
|
||||
mm: 96 / 25.4,
|
||||
pt: 96 / 72,
|
||||
pc: 96 / 6,
|
||||
"in": 96,
|
||||
Q: 96 / (2.54 * 40),
|
||||
px: 1
|
||||
};
|
||||
var FIXED_CSS_LENGTH_UNITS = Object.keys(CONVERSION_RATES);
|
||||
var STR_NAN = 'NaN';
|
||||
function convertToPx(value, unit) {
|
||||
return value * CONVERSION_RATES[unit];
|
||||
}
|
||||
var DecimalCSS = /*#__PURE__*/function () {
|
||||
function DecimalCSS(num, unit) {
|
||||
_classCallCheck(this, DecimalCSS);
|
||||
this.num = num;
|
||||
this.unit = unit;
|
||||
this.num = num;
|
||||
this.unit = unit;
|
||||
if (Number.isNaN(num)) {
|
||||
this.unit = '';
|
||||
}
|
||||
if (unit !== '' && !CSS_LENGTH_UNIT_REGEX.test(unit)) {
|
||||
this.num = NaN;
|
||||
this.unit = '';
|
||||
}
|
||||
if (FIXED_CSS_LENGTH_UNITS.includes(unit)) {
|
||||
this.num = convertToPx(num, unit);
|
||||
this.unit = 'px';
|
||||
}
|
||||
}
|
||||
return _createClass(DecimalCSS, [{
|
||||
key: "add",
|
||||
value: function add(other) {
|
||||
if (this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num + other.num, this.unit);
|
||||
}
|
||||
}, {
|
||||
key: "subtract",
|
||||
value: function subtract(other) {
|
||||
if (this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num - other.num, this.unit);
|
||||
}
|
||||
}, {
|
||||
key: "multiply",
|
||||
value: function multiply(other) {
|
||||
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num * other.num, this.unit || other.unit);
|
||||
}
|
||||
}, {
|
||||
key: "divide",
|
||||
value: function divide(other) {
|
||||
if (this.unit !== '' && other.unit !== '' && this.unit !== other.unit) {
|
||||
return new DecimalCSS(NaN, '');
|
||||
}
|
||||
return new DecimalCSS(this.num / other.num, this.unit || other.unit);
|
||||
}
|
||||
}, {
|
||||
key: "toString",
|
||||
value: function toString() {
|
||||
return "".concat(this.num).concat(this.unit);
|
||||
}
|
||||
}, {
|
||||
key: "isNaN",
|
||||
value: function isNaN() {
|
||||
return Number.isNaN(this.num);
|
||||
}
|
||||
}], [{
|
||||
key: "parse",
|
||||
value: function parse(str) {
|
||||
var _NUM_SPLIT_REGEX$exec;
|
||||
var _ref = (_NUM_SPLIT_REGEX$exec = NUM_SPLIT_REGEX.exec(str)) !== null && _NUM_SPLIT_REGEX$exec !== void 0 ? _NUM_SPLIT_REGEX$exec : [],
|
||||
_ref2 = _slicedToArray(_ref, 3),
|
||||
numStr = _ref2[1],
|
||||
unit = _ref2[2];
|
||||
return new DecimalCSS(parseFloat(numStr), unit !== null && unit !== void 0 ? unit : '');
|
||||
}
|
||||
}]);
|
||||
}();
|
||||
function calculateArithmetic(expr) {
|
||||
if (expr.includes(STR_NAN)) {
|
||||
return STR_NAN;
|
||||
}
|
||||
var newExpr = expr;
|
||||
while (newExpr.includes('*') || newExpr.includes('/')) {
|
||||
var _MULTIPLY_OR_DIVIDE_R;
|
||||
var _ref3 = (_MULTIPLY_OR_DIVIDE_R = MULTIPLY_OR_DIVIDE_REGEX.exec(newExpr)) !== null && _MULTIPLY_OR_DIVIDE_R !== void 0 ? _MULTIPLY_OR_DIVIDE_R : [],
|
||||
_ref4 = _slicedToArray(_ref3, 4),
|
||||
leftOperand = _ref4[1],
|
||||
operator = _ref4[2],
|
||||
rightOperand = _ref4[3];
|
||||
var lTs = DecimalCSS.parse(leftOperand !== null && leftOperand !== void 0 ? leftOperand : '');
|
||||
var rTs = DecimalCSS.parse(rightOperand !== null && rightOperand !== void 0 ? rightOperand : '');
|
||||
var result = operator === '*' ? lTs.multiply(rTs) : lTs.divide(rTs);
|
||||
if (result.isNaN()) {
|
||||
return STR_NAN;
|
||||
}
|
||||
newExpr = newExpr.replace(MULTIPLY_OR_DIVIDE_REGEX, result.toString());
|
||||
}
|
||||
while (newExpr.includes('+') || /.-\d+(?:\.\d+)?/.test(newExpr)) {
|
||||
var _ADD_OR_SUBTRACT_REGE;
|
||||
var _ref5 = (_ADD_OR_SUBTRACT_REGE = ADD_OR_SUBTRACT_REGEX.exec(newExpr)) !== null && _ADD_OR_SUBTRACT_REGE !== void 0 ? _ADD_OR_SUBTRACT_REGE : [],
|
||||
_ref6 = _slicedToArray(_ref5, 4),
|
||||
_leftOperand = _ref6[1],
|
||||
_operator = _ref6[2],
|
||||
_rightOperand = _ref6[3];
|
||||
var _lTs = DecimalCSS.parse(_leftOperand !== null && _leftOperand !== void 0 ? _leftOperand : '');
|
||||
var _rTs = DecimalCSS.parse(_rightOperand !== null && _rightOperand !== void 0 ? _rightOperand : '');
|
||||
var _result = _operator === '+' ? _lTs.add(_rTs) : _lTs.subtract(_rTs);
|
||||
if (_result.isNaN()) {
|
||||
return STR_NAN;
|
||||
}
|
||||
newExpr = newExpr.replace(ADD_OR_SUBTRACT_REGEX, _result.toString());
|
||||
}
|
||||
return newExpr;
|
||||
}
|
||||
var PARENTHESES_REGEX = /\(([^()]*)\)/;
|
||||
function calculateParentheses(expr) {
|
||||
var newExpr = expr;
|
||||
while (newExpr.includes('(')) {
|
||||
var _PARENTHESES_REGEX$ex = PARENTHESES_REGEX.exec(newExpr),
|
||||
_PARENTHESES_REGEX$ex2 = _slicedToArray(_PARENTHESES_REGEX$ex, 2),
|
||||
parentheticalExpression = _PARENTHESES_REGEX$ex2[1];
|
||||
newExpr = newExpr.replace(PARENTHESES_REGEX, calculateArithmetic(parentheticalExpression));
|
||||
}
|
||||
return newExpr;
|
||||
}
|
||||
function evaluateExpression(expression) {
|
||||
var newExpr = expression.replace(/\s+/g, '');
|
||||
newExpr = calculateParentheses(newExpr);
|
||||
newExpr = calculateArithmetic(newExpr);
|
||||
return newExpr;
|
||||
}
|
||||
function safeEvaluateExpression(expression) {
|
||||
try {
|
||||
return evaluateExpression(expression);
|
||||
} catch (e) {
|
||||
/* istanbul ignore next */
|
||||
return STR_NAN;
|
||||
}
|
||||
}
|
||||
function reduceCSSCalc(expression) {
|
||||
var result = safeEvaluateExpression(expression.slice(5, -1));
|
||||
if (result === STR_NAN) {
|
||||
// notify the user
|
||||
return '';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
35
frontend/node_modules/recharts/lib/util/ScatterUtils.js
generated
vendored
Normal file
35
frontend/node_modules/recharts/lib/util/ScatterUtils.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ScatterSymbol = ScatterSymbol;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _Symbols = require("../shape/Symbols");
|
||||
var _ActiveShapeUtils = require("./ActiveShapeUtils");
|
||||
var _excluded = ["option", "isActive"];
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
||||
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
||||
function ScatterSymbol(_ref) {
|
||||
var option = _ref.option,
|
||||
isActive = _ref.isActive,
|
||||
props = _objectWithoutProperties(_ref, _excluded);
|
||||
if (typeof option === 'string') {
|
||||
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
option: /*#__PURE__*/React.createElement(_Symbols.Symbols, _extends({
|
||||
type: option
|
||||
}, props)),
|
||||
isActive: isActive,
|
||||
shapeType: "symbols"
|
||||
}, props));
|
||||
}
|
||||
return /*#__PURE__*/React.createElement(_ActiveShapeUtils.Shape, _extends({
|
||||
option: option,
|
||||
isActive: isActive,
|
||||
shapeType: "symbols"
|
||||
}, props));
|
||||
}
|
||||
20
frontend/node_modules/recharts/lib/util/ShallowEqual.js
generated
vendored
Normal file
20
frontend/node_modules/recharts/lib/util/ShallowEqual.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.shallowEqual = shallowEqual;
|
||||
function shallowEqual(a, b) {
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
for (var key in a) {
|
||||
if ({}.hasOwnProperty.call(a, key) && (!{}.hasOwnProperty.call(b, key) || a[key] !== b[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (var _key in b) {
|
||||
if ({}.hasOwnProperty.call(b, _key) && !{}.hasOwnProperty.call(a, _key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
47
frontend/node_modules/recharts/lib/util/TickUtils.js
generated
vendored
Normal file
47
frontend/node_modules/recharts/lib/util/TickUtils.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getAngledTickWidth = getAngledTickWidth;
|
||||
exports.getNumberIntervalTicks = getNumberIntervalTicks;
|
||||
exports.getTickBoundaries = getTickBoundaries;
|
||||
exports.isVisible = isVisible;
|
||||
var _CartesianUtils = require("./CartesianUtils");
|
||||
var _getEveryNthWithCondition = require("./getEveryNthWithCondition");
|
||||
function getAngledTickWidth(contentSize, unitSize, angle) {
|
||||
var size = {
|
||||
width: contentSize.width + unitSize.width,
|
||||
height: contentSize.height + unitSize.height
|
||||
};
|
||||
return (0, _CartesianUtils.getAngledRectangleWidth)(size, angle);
|
||||
}
|
||||
function getTickBoundaries(viewBox, sign, sizeKey) {
|
||||
var isWidth = sizeKey === 'width';
|
||||
var x = viewBox.x,
|
||||
y = viewBox.y,
|
||||
width = viewBox.width,
|
||||
height = viewBox.height;
|
||||
if (sign === 1) {
|
||||
return {
|
||||
start: isWidth ? x : y,
|
||||
end: isWidth ? x + width : y + height
|
||||
};
|
||||
}
|
||||
return {
|
||||
start: isWidth ? x + width : y + height,
|
||||
end: isWidth ? x : y
|
||||
};
|
||||
}
|
||||
function isVisible(sign, tickPosition, getSize, start, end) {
|
||||
/* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating
|
||||
* the tick's size. */
|
||||
if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {
|
||||
return false;
|
||||
}
|
||||
var size = getSize();
|
||||
return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
|
||||
}
|
||||
function getNumberIntervalTicks(ticks, interval) {
|
||||
return (0, _getEveryNthWithCondition.getEveryNthWithCondition)(ticks, interval + 1);
|
||||
}
|
||||
25
frontend/node_modules/recharts/lib/util/calculateViewBox.js
generated
vendored
Normal file
25
frontend/node_modules/recharts/lib/util/calculateViewBox.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.calculateViewBox = void 0;
|
||||
var _memoize = _interopRequireDefault(require("lodash/memoize"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
/**
|
||||
* This is memoized because the viewBox is unlikely to change often
|
||||
* - but because it is computed from offset, any change to it would re-render all children.
|
||||
*
|
||||
* And because we have many readers of the viewBox, and update it only rarely,
|
||||
* then let's optimize with memoization.
|
||||
*/
|
||||
var calculateViewBox = exports.calculateViewBox = (0, _memoize["default"])(function (offset) {
|
||||
return {
|
||||
x: offset.left,
|
||||
y: offset.top,
|
||||
width: offset.width,
|
||||
height: offset.height
|
||||
};
|
||||
}, function (offset) {
|
||||
return ['l', offset.left, 't', offset.top, 'w', offset.width, 'h', offset.height].join('');
|
||||
});
|
||||
45
frontend/node_modules/recharts/lib/util/cursor/getCursorPoints.js
generated
vendored
Normal file
45
frontend/node_modules/recharts/lib/util/cursor/getCursorPoints.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getCursorPoints = getCursorPoints;
|
||||
var _PolarUtils = require("../PolarUtils");
|
||||
var _getRadialCursorPoints = require("./getRadialCursorPoints");
|
||||
function getCursorPoints(layout, activeCoordinate, offset) {
|
||||
var x1, y1, x2, y2;
|
||||
if (layout === 'horizontal') {
|
||||
x1 = activeCoordinate.x;
|
||||
x2 = x1;
|
||||
y1 = offset.top;
|
||||
y2 = offset.top + offset.height;
|
||||
} else if (layout === 'vertical') {
|
||||
y1 = activeCoordinate.y;
|
||||
y2 = y1;
|
||||
x1 = offset.left;
|
||||
x2 = offset.left + offset.width;
|
||||
} else if (activeCoordinate.cx != null && activeCoordinate.cy != null) {
|
||||
if (layout === 'centric') {
|
||||
var cx = activeCoordinate.cx,
|
||||
cy = activeCoordinate.cy,
|
||||
innerRadius = activeCoordinate.innerRadius,
|
||||
outerRadius = activeCoordinate.outerRadius,
|
||||
angle = activeCoordinate.angle;
|
||||
var innerPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, innerRadius, angle);
|
||||
var outerPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, outerRadius, angle);
|
||||
x1 = innerPoint.x;
|
||||
y1 = innerPoint.y;
|
||||
x2 = outerPoint.x;
|
||||
y2 = outerPoint.y;
|
||||
} else {
|
||||
return (0, _getRadialCursorPoints.getRadialCursorPoints)(activeCoordinate);
|
||||
}
|
||||
}
|
||||
return [{
|
||||
x: x1,
|
||||
y: y1
|
||||
}, {
|
||||
x: x2,
|
||||
y: y2
|
||||
}];
|
||||
}
|
||||
17
frontend/node_modules/recharts/lib/util/cursor/getCursorRectangle.js
generated
vendored
Normal file
17
frontend/node_modules/recharts/lib/util/cursor/getCursorRectangle.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getCursorRectangle = getCursorRectangle;
|
||||
function getCursorRectangle(layout, activeCoordinate, offset, tooltipAxisBandSize) {
|
||||
var halfSize = tooltipAxisBandSize / 2;
|
||||
return {
|
||||
stroke: 'none',
|
||||
fill: '#ccc',
|
||||
x: layout === 'horizontal' ? activeCoordinate.x - halfSize : offset.left + 0.5,
|
||||
y: layout === 'horizontal' ? offset.top + 0.5 : activeCoordinate.y - halfSize,
|
||||
width: layout === 'horizontal' ? tooltipAxisBandSize : offset.width - 1,
|
||||
height: layout === 'horizontal' ? offset.height - 1 : tooltipAxisBandSize
|
||||
};
|
||||
}
|
||||
29
frontend/node_modules/recharts/lib/util/cursor/getRadialCursorPoints.js
generated
vendored
Normal file
29
frontend/node_modules/recharts/lib/util/cursor/getRadialCursorPoints.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getRadialCursorPoints = getRadialCursorPoints;
|
||||
var _PolarUtils = require("../PolarUtils");
|
||||
/**
|
||||
* Only applicable for radial layouts
|
||||
* @param {Object} activeCoordinate ChartCoordinate
|
||||
* @returns {Object} RadialCursorPoints
|
||||
*/
|
||||
function getRadialCursorPoints(activeCoordinate) {
|
||||
var cx = activeCoordinate.cx,
|
||||
cy = activeCoordinate.cy,
|
||||
radius = activeCoordinate.radius,
|
||||
startAngle = activeCoordinate.startAngle,
|
||||
endAngle = activeCoordinate.endAngle;
|
||||
var startPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, startAngle);
|
||||
var endPoint = (0, _PolarUtils.polarToCartesian)(cx, cy, radius, endAngle);
|
||||
return {
|
||||
points: [startPoint, endPoint],
|
||||
cx: cx,
|
||||
cy: cy,
|
||||
radius: radius,
|
||||
startAngle: startAngle,
|
||||
endAngle: endAngle
|
||||
};
|
||||
}
|
||||
32
frontend/node_modules/recharts/lib/util/getEveryNthWithCondition.js
generated
vendored
Normal file
32
frontend/node_modules/recharts/lib/util/getEveryNthWithCondition.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getEveryNthWithCondition = getEveryNthWithCondition;
|
||||
/**
|
||||
* Given an array and a number N, return a new array which contains every nTh
|
||||
* element of the input array. For n below 1, an empty array is returned.
|
||||
* If isValid is provided, all candidates must suffice the condition, else undefined is returned.
|
||||
* @param {T[]} array An input array.
|
||||
* @param {integer} n A number
|
||||
* @param {Function} isValid A function to evaluate a candidate form the array
|
||||
* @returns {T[]} The result array of the same type as the input array.
|
||||
*/
|
||||
function getEveryNthWithCondition(array, n, isValid) {
|
||||
if (n < 1) {
|
||||
return [];
|
||||
}
|
||||
if (n === 1 && isValid === undefined) {
|
||||
return array;
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < array.length; i += n) {
|
||||
if (isValid === undefined || isValid(array[i]) === true) {
|
||||
result.push(array[i]);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
68
frontend/node_modules/recharts/lib/util/getLegendProps.js
generated
vendored
Normal file
68
frontend/node_modules/recharts/lib/util/getLegendProps.js
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getLegendProps = void 0;
|
||||
var _Legend = require("../component/Legend");
|
||||
var _ChartUtils = require("./ChartUtils");
|
||||
var _ReactUtils = require("./ReactUtils");
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
||||
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var getLegendProps = exports.getLegendProps = function getLegendProps(_ref) {
|
||||
var children = _ref.children,
|
||||
formattedGraphicalItems = _ref.formattedGraphicalItems,
|
||||
legendWidth = _ref.legendWidth,
|
||||
legendContent = _ref.legendContent;
|
||||
var legendItem = (0, _ReactUtils.findChildByType)(children, _Legend.Legend);
|
||||
if (!legendItem) {
|
||||
return null;
|
||||
}
|
||||
var legendDefaultProps = _Legend.Legend.defaultProps;
|
||||
var legendProps = legendDefaultProps !== undefined ? _objectSpread(_objectSpread({}, legendDefaultProps), legendItem.props) : {};
|
||||
var legendData;
|
||||
if (legendItem.props && legendItem.props.payload) {
|
||||
legendData = legendItem.props && legendItem.props.payload;
|
||||
} else if (legendContent === 'children') {
|
||||
legendData = (formattedGraphicalItems || []).reduce(function (result, _ref2) {
|
||||
var item = _ref2.item,
|
||||
props = _ref2.props;
|
||||
var data = props.sectors || props.data || [];
|
||||
return result.concat(data.map(function (entry) {
|
||||
return {
|
||||
type: legendItem.props.iconType || item.props.legendType,
|
||||
value: entry.name,
|
||||
color: entry.fill,
|
||||
payload: entry
|
||||
};
|
||||
}));
|
||||
}, []);
|
||||
} else {
|
||||
legendData = (formattedGraphicalItems || []).map(function (_ref3) {
|
||||
var item = _ref3.item;
|
||||
var itemDefaultProps = item.type.defaultProps;
|
||||
var itemProps = itemDefaultProps !== undefined ? _objectSpread(_objectSpread({}, itemDefaultProps), item.props) : {};
|
||||
var dataKey = itemProps.dataKey,
|
||||
name = itemProps.name,
|
||||
legendType = itemProps.legendType,
|
||||
hide = itemProps.hide;
|
||||
return {
|
||||
inactive: hide,
|
||||
dataKey: dataKey,
|
||||
type: legendProps.iconType || legendType || 'square',
|
||||
color: (0, _ChartUtils.getMainColorOfGraphicItem)(item),
|
||||
value: name || dataKey,
|
||||
// @ts-expect-error property strokeDasharray is required in Payload but optional in props
|
||||
payload: itemProps
|
||||
};
|
||||
});
|
||||
}
|
||||
return _objectSpread(_objectSpread(_objectSpread({}, legendProps), _Legend.Legend.getWithHeight(legendItem, legendWidth)), {}, {
|
||||
payload: legendData,
|
||||
item: legendItem
|
||||
});
|
||||
};
|
||||
29
frontend/node_modules/recharts/lib/util/isDomainSpecifiedByUser.js
generated
vendored
Normal file
29
frontend/node_modules/recharts/lib/util/isDomainSpecifiedByUser.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isDomainSpecifiedByUser = isDomainSpecifiedByUser;
|
||||
var _DataUtils = require("./DataUtils");
|
||||
/**
|
||||
* Takes a domain and user props to determine whether he provided the domain via props or if we need to calculate it.
|
||||
* @param {AxisDomain} domain The potential domain from props
|
||||
* @param {Boolean} allowDataOverflow from props
|
||||
* @param {String} axisType from props
|
||||
* @returns {Boolean} `true` if domain is specified by user
|
||||
*/
|
||||
function isDomainSpecifiedByUser(domain, allowDataOverflow, axisType) {
|
||||
if (axisType === 'number' && allowDataOverflow === true && Array.isArray(domain)) {
|
||||
var domainStart = domain === null || domain === void 0 ? void 0 : domain[0];
|
||||
var domainEnd = domain === null || domain === void 0 ? void 0 : domain[1];
|
||||
|
||||
/*
|
||||
* The `isNumber` check is needed because the user could also provide strings like "dataMin" via the domain props.
|
||||
* In such case, we have to compute the domain from the data.
|
||||
*/
|
||||
if (!!domainStart && !!domainEnd && (0, _DataUtils.isNumber)(domainStart) && (0, _DataUtils.isNumber)(domainEnd)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
26
frontend/node_modules/recharts/lib/util/payload/getUniqPayload.js
generated
vendored
Normal file
26
frontend/node_modules/recharts/lib/util/payload/getUniqPayload.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getUniqPayload = getUniqPayload;
|
||||
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
||||
var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
/**
|
||||
* This is configuration option that decides how to filter for unique values only:
|
||||
*
|
||||
* - `false` means "no filter"
|
||||
* - `true` means "use recharts default filter"
|
||||
* - function means "use return of this function as the default key"
|
||||
*/
|
||||
|
||||
function getUniqPayload(payload, option, defaultUniqBy) {
|
||||
if (option === true) {
|
||||
return (0, _uniqBy["default"])(payload, defaultUniqBy);
|
||||
}
|
||||
if ((0, _isFunction["default"])(option)) {
|
||||
return (0, _uniqBy["default"])(payload, option);
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
117
frontend/node_modules/recharts/lib/util/tooltip/translate.js
generated
vendored
Normal file
117
frontend/node_modules/recharts/lib/util/tooltip/translate.js
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getTooltipCSSClassName = getTooltipCSSClassName;
|
||||
exports.getTooltipTranslate = getTooltipTranslate;
|
||||
exports.getTooltipTranslateXY = getTooltipTranslateXY;
|
||||
exports.getTransformStyle = getTransformStyle;
|
||||
var _clsx2 = _interopRequireDefault(require("clsx"));
|
||||
var _DataUtils = require("../DataUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
||||
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
var CSS_CLASS_PREFIX = 'recharts-tooltip-wrapper';
|
||||
var TOOLTIP_HIDDEN = {
|
||||
visibility: 'hidden'
|
||||
};
|
||||
function getTooltipCSSClassName(_ref) {
|
||||
var coordinate = _ref.coordinate,
|
||||
translateX = _ref.translateX,
|
||||
translateY = _ref.translateY;
|
||||
return (0, _clsx2["default"])(CSS_CLASS_PREFIX, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(CSS_CLASS_PREFIX, "-right"), (0, _DataUtils.isNumber)(translateX) && coordinate && (0, _DataUtils.isNumber)(coordinate.x) && translateX >= coordinate.x), "".concat(CSS_CLASS_PREFIX, "-left"), (0, _DataUtils.isNumber)(translateX) && coordinate && (0, _DataUtils.isNumber)(coordinate.x) && translateX < coordinate.x), "".concat(CSS_CLASS_PREFIX, "-bottom"), (0, _DataUtils.isNumber)(translateY) && coordinate && (0, _DataUtils.isNumber)(coordinate.y) && translateY >= coordinate.y), "".concat(CSS_CLASS_PREFIX, "-top"), (0, _DataUtils.isNumber)(translateY) && coordinate && (0, _DataUtils.isNumber)(coordinate.y) && translateY < coordinate.y));
|
||||
}
|
||||
function getTooltipTranslateXY(_ref2) {
|
||||
var allowEscapeViewBox = _ref2.allowEscapeViewBox,
|
||||
coordinate = _ref2.coordinate,
|
||||
key = _ref2.key,
|
||||
offsetTopLeft = _ref2.offsetTopLeft,
|
||||
position = _ref2.position,
|
||||
reverseDirection = _ref2.reverseDirection,
|
||||
tooltipDimension = _ref2.tooltipDimension,
|
||||
viewBox = _ref2.viewBox,
|
||||
viewBoxDimension = _ref2.viewBoxDimension;
|
||||
if (position && (0, _DataUtils.isNumber)(position[key])) {
|
||||
return position[key];
|
||||
}
|
||||
var negative = coordinate[key] - tooltipDimension - offsetTopLeft;
|
||||
var positive = coordinate[key] + offsetTopLeft;
|
||||
if (allowEscapeViewBox[key]) {
|
||||
return reverseDirection[key] ? negative : positive;
|
||||
}
|
||||
if (reverseDirection[key]) {
|
||||
var _tooltipBoundary = negative;
|
||||
var _viewBoxBoundary = viewBox[key];
|
||||
if (_tooltipBoundary < _viewBoxBoundary) {
|
||||
return Math.max(positive, viewBox[key]);
|
||||
}
|
||||
return Math.max(negative, viewBox[key]);
|
||||
}
|
||||
var tooltipBoundary = positive + tooltipDimension;
|
||||
var viewBoxBoundary = viewBox[key] + viewBoxDimension;
|
||||
if (tooltipBoundary > viewBoxBoundary) {
|
||||
return Math.max(negative, viewBox[key]);
|
||||
}
|
||||
return Math.max(positive, viewBox[key]);
|
||||
}
|
||||
function getTransformStyle(_ref3) {
|
||||
var translateX = _ref3.translateX,
|
||||
translateY = _ref3.translateY,
|
||||
useTranslate3d = _ref3.useTranslate3d;
|
||||
return {
|
||||
transform: useTranslate3d ? "translate3d(".concat(translateX, "px, ").concat(translateY, "px, 0)") : "translate(".concat(translateX, "px, ").concat(translateY, "px)")
|
||||
};
|
||||
}
|
||||
function getTooltipTranslate(_ref4) {
|
||||
var allowEscapeViewBox = _ref4.allowEscapeViewBox,
|
||||
coordinate = _ref4.coordinate,
|
||||
offsetTopLeft = _ref4.offsetTopLeft,
|
||||
position = _ref4.position,
|
||||
reverseDirection = _ref4.reverseDirection,
|
||||
tooltipBox = _ref4.tooltipBox,
|
||||
useTranslate3d = _ref4.useTranslate3d,
|
||||
viewBox = _ref4.viewBox;
|
||||
var cssProperties, translateX, translateY;
|
||||
if (tooltipBox.height > 0 && tooltipBox.width > 0 && coordinate) {
|
||||
translateX = getTooltipTranslateXY({
|
||||
allowEscapeViewBox: allowEscapeViewBox,
|
||||
coordinate: coordinate,
|
||||
key: 'x',
|
||||
offsetTopLeft: offsetTopLeft,
|
||||
position: position,
|
||||
reverseDirection: reverseDirection,
|
||||
tooltipDimension: tooltipBox.width,
|
||||
viewBox: viewBox,
|
||||
viewBoxDimension: viewBox.width
|
||||
});
|
||||
translateY = getTooltipTranslateXY({
|
||||
allowEscapeViewBox: allowEscapeViewBox,
|
||||
coordinate: coordinate,
|
||||
key: 'y',
|
||||
offsetTopLeft: offsetTopLeft,
|
||||
position: position,
|
||||
reverseDirection: reverseDirection,
|
||||
tooltipDimension: tooltipBox.height,
|
||||
viewBox: viewBox,
|
||||
viewBoxDimension: viewBox.height
|
||||
});
|
||||
cssProperties = getTransformStyle({
|
||||
translateX: translateX,
|
||||
translateY: translateY,
|
||||
useTranslate3d: useTranslate3d
|
||||
});
|
||||
} else {
|
||||
cssProperties = TOOLTIP_HIDDEN;
|
||||
}
|
||||
return {
|
||||
cssProperties: cssProperties,
|
||||
cssClasses: getTooltipCSSClassName({
|
||||
translateX: translateX,
|
||||
translateY: translateY,
|
||||
coordinate: coordinate
|
||||
})
|
||||
};
|
||||
}
|
||||
132
frontend/node_modules/recharts/lib/util/types.js
generated
vendored
Normal file
132
frontend/node_modules/recharts/lib/util/types.js
generated
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.adaptEventsOfChild = exports.adaptEventHandlers = exports.SVGElementPropKeys = exports.FilteredElementKeyMap = exports.EventKeys = void 0;
|
||||
var _react = require("react");
|
||||
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
/**
|
||||
* Determines how values are stacked:
|
||||
*
|
||||
* - `none` is the default, it adds values on top of each other. No smarts. Negative values will overlap.
|
||||
* - `expand` make it so that the values always add up to 1 - so the chart will look like a rectangle.
|
||||
* - `wiggle` and `silhouette` tries to keep the chart centered.
|
||||
* - `sign` stacks positive values above zero and negative values below zero. Similar to `none` but handles negatives.
|
||||
* - `positive` ignores all negative values, and then behaves like \`none\`.
|
||||
*
|
||||
* Also see https://d3js.org/d3-shape/stack#stack-offsets
|
||||
* (note that the `diverging` offset in d3 is named `sign` in recharts)
|
||||
*/
|
||||
|
||||
//
|
||||
// Event Handler Types -- Copied from @types/react/index.d.ts and adapted for Props.
|
||||
//
|
||||
|
||||
var SVGContainerPropKeys = ['viewBox', 'children'];
|
||||
var SVGElementPropKeys = exports.SVGElementPropKeys = ['aria-activedescendant', 'aria-atomic', 'aria-autocomplete', 'aria-busy', 'aria-checked', 'aria-colcount', 'aria-colindex', 'aria-colspan', 'aria-controls', 'aria-current', 'aria-describedby', 'aria-details', 'aria-disabled', 'aria-errormessage', 'aria-expanded', 'aria-flowto', 'aria-haspopup', 'aria-hidden', 'aria-invalid', 'aria-keyshortcuts', 'aria-label', 'aria-labelledby', 'aria-level', 'aria-live', 'aria-modal', 'aria-multiline', 'aria-multiselectable', 'aria-orientation', 'aria-owns', 'aria-placeholder', 'aria-posinset', 'aria-pressed', 'aria-readonly', 'aria-relevant', 'aria-required', 'aria-roledescription', 'aria-rowcount', 'aria-rowindex', 'aria-rowspan', 'aria-selected', 'aria-setsize', 'aria-sort', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'className', 'color', 'height', 'id', 'lang', 'max', 'media', 'method', 'min', 'name', 'style',
|
||||
/*
|
||||
* removed 'type' SVGElementPropKey because we do not currently use any SVG elements
|
||||
* that can use it and it conflicts with the recharts prop 'type'
|
||||
* https://github.com/recharts/recharts/pull/3327
|
||||
* https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/type
|
||||
*/
|
||||
// 'type',
|
||||
'target', 'width', 'role', 'tabIndex', 'accentHeight', 'accumulate', 'additive', 'alignmentBaseline', 'allowReorder', 'alphabetic', 'amplitude', 'arabicForm', 'ascent', 'attributeName', 'attributeType', 'autoReverse', 'azimuth', 'baseFrequency', 'baselineShift', 'baseProfile', 'bbox', 'begin', 'bias', 'by', 'calcMode', 'capHeight', 'clip', 'clipPath', 'clipPathUnits', 'clipRule', 'colorInterpolation', 'colorInterpolationFilters', 'colorProfile', 'colorRendering', 'contentScriptType', 'contentStyleType', 'cursor', 'cx', 'cy', 'd', 'decelerate', 'descent', 'diffuseConstant', 'direction', 'display', 'divisor', 'dominantBaseline', 'dur', 'dx', 'dy', 'edgeMode', 'elevation', 'enableBackground', 'end', 'exponent', 'externalResourcesRequired', 'fill', 'fillOpacity', 'fillRule', 'filter', 'filterRes', 'filterUnits', 'floodColor', 'floodOpacity', 'focusable', 'fontFamily', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontWeight', 'format', 'from', 'fx', 'fy', 'g1', 'g2', 'glyphName', 'glyphOrientationHorizontal', 'glyphOrientationVertical', 'glyphRef', 'gradientTransform', 'gradientUnits', 'hanging', 'horizAdvX', 'horizOriginX', 'href', 'ideographic', 'imageRendering', 'in2', 'in', 'intercept', 'k1', 'k2', 'k3', 'k4', 'k', 'kernelMatrix', 'kernelUnitLength', 'kerning', 'keyPoints', 'keySplines', 'keyTimes', 'lengthAdjust', 'letterSpacing', 'lightingColor', 'limitingConeAngle', 'local', 'markerEnd', 'markerHeight', 'markerMid', 'markerStart', 'markerUnits', 'markerWidth', 'mask', 'maskContentUnits', 'maskUnits', 'mathematical', 'mode', 'numOctaves', 'offset', 'opacity', 'operator', 'order', 'orient', 'orientation', 'origin', 'overflow', 'overlinePosition', 'overlineThickness', 'paintOrder', 'panose1', 'pathLength', 'patternContentUnits', 'patternTransform', 'patternUnits', 'pointerEvents', 'pointsAtX', 'pointsAtY', 'pointsAtZ', 'preserveAlpha', 'preserveAspectRatio', 'primitiveUnits', 'r', 'radius', 'refX', 'refY', 'renderingIntent', 'repeatCount', 'repeatDur', 'requiredExtensions', 'requiredFeatures', 'restart', 'result', 'rotate', 'rx', 'ry', 'seed', 'shapeRendering', 'slope', 'spacing', 'specularConstant', 'specularExponent', 'speed', 'spreadMethod', 'startOffset', 'stdDeviation', 'stemh', 'stemv', 'stitchTiles', 'stopColor', 'stopOpacity', 'strikethroughPosition', 'strikethroughThickness', 'string', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'surfaceScale', 'systemLanguage', 'tableValues', 'targetX', 'targetY', 'textAnchor', 'textDecoration', 'textLength', 'textRendering', 'to', 'transform', 'u1', 'u2', 'underlinePosition', 'underlineThickness', 'unicode', 'unicodeBidi', 'unicodeRange', 'unitsPerEm', 'vAlphabetic', 'values', 'vectorEffect', 'version', 'vertAdvY', 'vertOriginX', 'vertOriginY', 'vHanging', 'vIdeographic', 'viewTarget', 'visibility', 'vMathematical', 'widths', 'wordSpacing', 'writingMode', 'x1', 'x2', 'x', 'xChannelSelector', 'xHeight', 'xlinkActuate', 'xlinkArcrole', 'xlinkHref', 'xlinkRole', 'xlinkShow', 'xlinkTitle', 'xlinkType', 'xmlBase', 'xmlLang', 'xmlns', 'xmlnsXlink', 'xmlSpace', 'y1', 'y2', 'y', 'yChannelSelector', 'z', 'zoomAndPan', 'ref', 'key', 'angle'];
|
||||
var PolyElementKeys = ['points', 'pathLength'];
|
||||
|
||||
/** svg element types that have specific attribute filtration requirements */
|
||||
|
||||
/** map of svg element types to unique svg attributes that belong to that element */
|
||||
var FilteredElementKeyMap = exports.FilteredElementKeyMap = {
|
||||
svg: SVGContainerPropKeys,
|
||||
polygon: PolyElementKeys,
|
||||
polyline: PolyElementKeys
|
||||
};
|
||||
var EventKeys = exports.EventKeys = ['dangerouslySetInnerHTML', 'onCopy', 'onCopyCapture', 'onCut', 'onCutCapture', 'onPaste', 'onPasteCapture', 'onCompositionEnd', 'onCompositionEndCapture', 'onCompositionStart', 'onCompositionStartCapture', 'onCompositionUpdate', 'onCompositionUpdateCapture', 'onFocus', 'onFocusCapture', 'onBlur', 'onBlurCapture', 'onChange', 'onChangeCapture', 'onBeforeInput', 'onBeforeInputCapture', 'onInput', 'onInputCapture', 'onReset', 'onResetCapture', 'onSubmit', 'onSubmitCapture', 'onInvalid', 'onInvalidCapture', 'onLoad', 'onLoadCapture', 'onError', 'onErrorCapture', 'onKeyDown', 'onKeyDownCapture', 'onKeyPress', 'onKeyPressCapture', 'onKeyUp', 'onKeyUpCapture', 'onAbort', 'onAbortCapture', 'onCanPlay', 'onCanPlayCapture', 'onCanPlayThrough', 'onCanPlayThroughCapture', 'onDurationChange', 'onDurationChangeCapture', 'onEmptied', 'onEmptiedCapture', 'onEncrypted', 'onEncryptedCapture', 'onEnded', 'onEndedCapture', 'onLoadedData', 'onLoadedDataCapture', 'onLoadedMetadata', 'onLoadedMetadataCapture', 'onLoadStart', 'onLoadStartCapture', 'onPause', 'onPauseCapture', 'onPlay', 'onPlayCapture', 'onPlaying', 'onPlayingCapture', 'onProgress', 'onProgressCapture', 'onRateChange', 'onRateChangeCapture', 'onSeeked', 'onSeekedCapture', 'onSeeking', 'onSeekingCapture', 'onStalled', 'onStalledCapture', 'onSuspend', 'onSuspendCapture', 'onTimeUpdate', 'onTimeUpdateCapture', 'onVolumeChange', 'onVolumeChangeCapture', 'onWaiting', 'onWaitingCapture', 'onAuxClick', 'onAuxClickCapture', 'onClick', 'onClickCapture', 'onContextMenu', 'onContextMenuCapture', 'onDoubleClick', 'onDoubleClickCapture', 'onDrag', 'onDragCapture', 'onDragEnd', 'onDragEndCapture', 'onDragEnter', 'onDragEnterCapture', 'onDragExit', 'onDragExitCapture', 'onDragLeave', 'onDragLeaveCapture', 'onDragOver', 'onDragOverCapture', 'onDragStart', 'onDragStartCapture', 'onDrop', 'onDropCapture', 'onMouseDown', 'onMouseDownCapture', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseMoveCapture', 'onMouseOut', 'onMouseOutCapture', 'onMouseOver', 'onMouseOverCapture', 'onMouseUp', 'onMouseUpCapture', 'onSelect', 'onSelectCapture', 'onTouchCancel', 'onTouchCancelCapture', 'onTouchEnd', 'onTouchEndCapture', 'onTouchMove', 'onTouchMoveCapture', 'onTouchStart', 'onTouchStartCapture', 'onPointerDown', 'onPointerDownCapture', 'onPointerMove', 'onPointerMoveCapture', 'onPointerUp', 'onPointerUpCapture', 'onPointerCancel', 'onPointerCancelCapture', 'onPointerEnter', 'onPointerEnterCapture', 'onPointerLeave', 'onPointerLeaveCapture', 'onPointerOver', 'onPointerOverCapture', 'onPointerOut', 'onPointerOutCapture', 'onGotPointerCapture', 'onGotPointerCaptureCapture', 'onLostPointerCapture', 'onLostPointerCaptureCapture', 'onScroll', 'onScrollCapture', 'onWheel', 'onWheelCapture', 'onAnimationStart', 'onAnimationStartCapture', 'onAnimationEnd', 'onAnimationEndCapture', 'onAnimationIteration', 'onAnimationIterationCapture', 'onTransitionEnd', 'onTransitionEndCapture'];
|
||||
|
||||
/** The type of easing function to use for animations */
|
||||
|
||||
/** Specifies the duration of animation, the unit of this option is ms. */
|
||||
|
||||
/** the offset of a chart, which define the blank space all around */
|
||||
|
||||
/**
|
||||
* The domain of axis.
|
||||
* This is the definition
|
||||
*
|
||||
* Numeric domain is always defined by an array of exactly two values, for the min and the max of the axis.
|
||||
* Categorical domain is defined as array of all possible values.
|
||||
*
|
||||
* Can be specified in many ways:
|
||||
* - array of numbers
|
||||
* - with special strings like 'dataMin' and 'dataMax'
|
||||
* - with special string math like 'dataMin - 100'
|
||||
* - with keyword 'auto'
|
||||
* - or a function
|
||||
* - array of functions
|
||||
* - or a combination of the above
|
||||
*/
|
||||
|
||||
/**
|
||||
* NumberDomain is an evaluated {@link AxisDomain}.
|
||||
* Unlike {@link AxisDomain}, it has no variety - it's a tuple of two number.
|
||||
* This is after all the keywords and functions were evaluated and what is left is [min, max].
|
||||
*
|
||||
* Know that the min, max values are not guaranteed to be nice numbers - values like -Infinity or NaN are possible.
|
||||
*
|
||||
* There are also `category` axes that have different things than numbers in their domain.
|
||||
*/
|
||||
|
||||
/** The props definition of base axis */
|
||||
|
||||
/** Defines how ticks are placed and whether / how tick collisions are handled.
|
||||
* 'preserveStart' keeps the left tick on collision and ensures that the first tick is always shown.
|
||||
* 'preserveEnd' keeps the right tick on collision and ensures that the last tick is always shown.
|
||||
* 'preserveStartEnd' keeps the left tick on collision and ensures that the first and last ticks are always shown.
|
||||
* 'equidistantPreserveStart' selects a number N such that every nTh tick will be shown without collision.
|
||||
*/
|
||||
|
||||
var adaptEventHandlers = exports.adaptEventHandlers = function adaptEventHandlers(props, newHandler) {
|
||||
if (!props || typeof props === 'function' || typeof props === 'boolean') {
|
||||
return null;
|
||||
}
|
||||
var inputProps = props;
|
||||
if ( /*#__PURE__*/(0, _react.isValidElement)(props)) {
|
||||
inputProps = props.props;
|
||||
}
|
||||
if (!(0, _isObject["default"])(inputProps)) {
|
||||
return null;
|
||||
}
|
||||
var out = {};
|
||||
Object.keys(inputProps).forEach(function (key) {
|
||||
if (EventKeys.includes(key)) {
|
||||
out[key] = newHandler || function (e) {
|
||||
return inputProps[key](inputProps, e);
|
||||
};
|
||||
}
|
||||
});
|
||||
return out;
|
||||
};
|
||||
var getEventHandlerOfChild = function getEventHandlerOfChild(originalHandler, data, index) {
|
||||
return function (e) {
|
||||
originalHandler(data, index, e);
|
||||
return null;
|
||||
};
|
||||
};
|
||||
var adaptEventsOfChild = exports.adaptEventsOfChild = function adaptEventsOfChild(props, data, index) {
|
||||
if (!(0, _isObject["default"])(props) || _typeof(props) !== 'object') {
|
||||
return null;
|
||||
}
|
||||
var out = null;
|
||||
Object.keys(props).forEach(function (key) {
|
||||
var item = props[key];
|
||||
if (EventKeys.includes(key) && typeof item === 'function') {
|
||||
if (!out) out = {};
|
||||
out[key] = getEventHandlerOfChild(item, data, index);
|
||||
}
|
||||
});
|
||||
return out;
|
||||
};
|
||||
Reference in New Issue
Block a user