main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

111
node_modules/recharts/es6/chart/AccessibilityManager.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
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 : String(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); }
export var AccessibilityManager = /*#__PURE__*/function () {
function AccessibilityManager() {
_classCallCheck(this, AccessibilityManager);
_defineProperty(this, "activeIndex", 0);
_defineProperty(this, "coordinateList", []);
_defineProperty(this, "layout", 'horizontal');
}
_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
});
}
}]);
return AccessibilityManager;
}();

20
node_modules/recharts/es6/chart/AreaChart.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @fileOverview Area Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Area } from '../cartesian/Area';
import { XAxis } from '../cartesian/XAxis';
import { YAxis } from '../cartesian/YAxis';
import { formatAxisMap } from '../util/CartesianUtils';
export var AreaChart = generateCategoricalChart({
chartName: 'AreaChart',
GraphicalChild: Area,
axisComponents: [{
axisType: 'xAxis',
AxisComp: XAxis
}, {
axisType: 'yAxis',
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap
});

22
node_modules/recharts/es6/chart/BarChart.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
/**
* @fileOverview Bar Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Bar } from '../cartesian/Bar';
import { XAxis } from '../cartesian/XAxis';
import { YAxis } from '../cartesian/YAxis';
import { formatAxisMap } from '../util/CartesianUtils';
export var BarChart = generateCategoricalChart({
chartName: 'BarChart',
GraphicalChild: Bar,
defaultTooltipEventType: 'axis',
validateTooltipEventTypes: ['axis', 'item'],
axisComponents: [{
axisType: 'xAxis',
AxisComp: XAxis
}, {
axisType: 'yAxis',
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap
});

27
node_modules/recharts/es6/chart/ComposedChart.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
/**
* @fileOverview Composed Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Area } from '../cartesian/Area';
import { Bar } from '../cartesian/Bar';
import { Line } from '../cartesian/Line';
import { Scatter } from '../cartesian/Scatter';
import { XAxis } from '../cartesian/XAxis';
import { YAxis } from '../cartesian/YAxis';
import { ZAxis } from '../cartesian/ZAxis';
import { formatAxisMap } from '../util/CartesianUtils';
export var ComposedChart = generateCategoricalChart({
chartName: 'ComposedChart',
GraphicalChild: [Line, Area, Bar, Scatter],
axisComponents: [{
axisType: 'xAxis',
AxisComp: XAxis
}, {
axisType: 'yAxis',
AxisComp: YAxis
}, {
axisType: 'zAxis',
AxisComp: ZAxis
}],
formatAxisMap: formatAxisMap
});

15
node_modules/recharts/es6/chart/FunnelChart.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
/**
* @fileOverview Funnel Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Funnel } from '../numberAxis/Funnel';
export var FunnelChart = generateCategoricalChart({
chartName: 'FunnelChart',
GraphicalChild: Funnel,
validateTooltipEventTypes: ['item'],
defaultTooltipEventType: 'item',
axisComponents: [],
defaultProps: {
layout: 'centric'
}
});

20
node_modules/recharts/es6/chart/LineChart.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/**
* @fileOverview Line Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Line } from '../cartesian/Line';
import { XAxis } from '../cartesian/XAxis';
import { YAxis } from '../cartesian/YAxis';
import { formatAxisMap } from '../util/CartesianUtils';
export var LineChart = generateCategoricalChart({
chartName: 'LineChart',
GraphicalChild: Line,
axisComponents: [{
axisType: 'xAxis',
AxisComp: XAxis
}, {
axisType: 'yAxis',
AxisComp: YAxis
}],
formatAxisMap: formatAxisMap
});

32
node_modules/recharts/es6/chart/PieChart.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* @fileOverview Pie Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { PolarAngleAxis } from '../polar/PolarAngleAxis';
import { PolarRadiusAxis } from '../polar/PolarRadiusAxis';
import { formatAxisMap } from '../util/PolarUtils';
import { Pie } from '../polar/Pie';
export var PieChart = generateCategoricalChart({
chartName: 'PieChart',
GraphicalChild: Pie,
validateTooltipEventTypes: ['item'],
defaultTooltipEventType: 'item',
legendContent: 'children',
axisComponents: [{
axisType: 'angleAxis',
AxisComp: PolarAngleAxis
}, {
axisType: 'radiusAxis',
AxisComp: PolarRadiusAxis
}],
formatAxisMap: formatAxisMap,
defaultProps: {
layout: 'centric',
startAngle: 0,
endAngle: 360,
cx: '50%',
cy: '50%',
innerRadius: 0,
outerRadius: '80%'
}
});

29
node_modules/recharts/es6/chart/RadarChart.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/**
* @fileOverview Radar Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Radar } from '../polar/Radar';
import { PolarAngleAxis } from '../polar/PolarAngleAxis';
import { PolarRadiusAxis } from '../polar/PolarRadiusAxis';
import { formatAxisMap } from '../util/PolarUtils';
export var RadarChart = generateCategoricalChart({
chartName: 'RadarChart',
GraphicalChild: Radar,
axisComponents: [{
axisType: 'angleAxis',
AxisComp: PolarAngleAxis
}, {
axisType: 'radiusAxis',
AxisComp: PolarRadiusAxis
}],
formatAxisMap: formatAxisMap,
defaultProps: {
layout: 'centric',
startAngle: 90,
endAngle: -270,
cx: '50%',
cy: '50%',
innerRadius: 0,
outerRadius: '80%'
}
});

32
node_modules/recharts/es6/chart/RadialBarChart.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* @fileOverview Radar Bar Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { PolarAngleAxis } from '../polar/PolarAngleAxis';
import { PolarRadiusAxis } from '../polar/PolarRadiusAxis';
import { formatAxisMap } from '../util/PolarUtils';
import { RadialBar } from '../polar/RadialBar';
export var RadialBarChart = generateCategoricalChart({
chartName: 'RadialBarChart',
GraphicalChild: RadialBar,
legendContent: 'children',
defaultTooltipEventType: 'axis',
validateTooltipEventTypes: ['axis', 'item'],
axisComponents: [{
axisType: 'angleAxis',
AxisComp: PolarAngleAxis
}, {
axisType: 'radiusAxis',
AxisComp: PolarRadiusAxis
}],
formatAxisMap: formatAxisMap,
defaultProps: {
layout: 'radial',
startAngle: 0,
endAngle: 360,
cx: '50%',
cy: '50%',
innerRadius: 0,
outerRadius: '80%'
}
});

669
node_modules/recharts/es6/chart/Sankey.js generated vendored Normal file
View File

@@ -0,0 +1,669 @@
var _excluded = ["width", "height", "className", "style", "children"],
_excluded2 = ["sourceX", "sourceY", "sourceControlX", "targetX", "targetY", "targetControlX", "linkWidth"];
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 = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; 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 _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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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 : String(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
*/
import React, { PureComponent } from 'react';
import maxBy from 'lodash/maxBy';
import min from 'lodash/min';
import get from 'lodash/get';
import sumBy from 'lodash/sumBy';
import isFunction from 'lodash/isFunction';
import clsx from 'clsx';
import { Surface } from '../container/Surface';
import { Layer } from '../container/Layer';
import { Tooltip } from '../component/Tooltip';
import { Rectangle } from '../shape/Rectangle';
import { shallowEqual } from '../util/ShallowEqual';
import { filterSvgElements, validateWidthHeight, findChildByType, filterProps } from '../util/ReactUtils';
import { getValueByDataKey } from '../util/ChartUtils';
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 = maxBy(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 = min(depthTree.map(function (nodes) {
return (height - (nodes.length - 1) * nodePadding) / sumBy(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: getValueByDataKey(payload, nameKey, ''),
value: getValueByDataKey(payload, 'value')
}];
}
if (payload.source && payload.target) {
var sourceName = getValueByDataKey(payload.source, nameKey, '');
var targetName = getValueByDataKey(payload.target, nameKey, '');
return [{
payload: el,
name: "".concat(sourceName, " - ").concat(targetName),
value: getValueByDataKey(payload, 'value')
}];
}
return [];
};
export var Sankey = /*#__PURE__*/function (_PureComponent) {
_inherits(Sankey, _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(_assertThisInitialized(_this), "state", {
activeElement: null,
activeElementType: null,
isTooltipActive: false,
nodes: [],
links: []
});
return _this;
}
_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 = findChildByType(children, 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 = findChildByType(children, 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 = findChildByType(children, 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 = get(margin, 'top') || 0;
var left = get(margin, 'left') || 0;
return /*#__PURE__*/React.createElement(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
})
}, 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.createElement(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 = get(margin, 'top') || 0;
var left = get(margin, 'left') || 0;
return /*#__PURE__*/React.createElement(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({}, 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.createElement(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 = findChildByType(children, 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.cloneElement(tooltipItem, {
viewBox: viewBox,
active: isTooltipActive,
coordinate: coordinate,
label: '',
payload: payload
});
}
}, {
key: "render",
value: function render() {
if (!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 = filterProps(others, false);
return /*#__PURE__*/React.createElement("div", {
className: clsx('recharts-wrapper', className),
style: _objectSpread(_objectSpread({}, style), {}, {
position: 'relative',
cursor: 'default',
width: width,
height: height
}),
role: "region"
}, /*#__PURE__*/React.createElement(Surface, _extends({}, attrs, {
width: width,
height: height
}), 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 || !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.isValidElement(option)) {
return /*#__PURE__*/React.cloneElement(option, props);
}
if (isFunction(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.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"
}, filterProps(others, false)));
}
}, {
key: "renderNodeItem",
value: function renderNodeItem(option, props) {
if ( /*#__PURE__*/React.isValidElement(option)) {
return /*#__PURE__*/React.cloneElement(option, props);
}
if (isFunction(option)) {
return option(props);
}
return /*#__PURE__*/React.createElement(Rectangle, _extends({
className: "recharts-sankey-node",
fill: "#0088fe",
fillOpacity: "0.8"
}, filterProps(props, false), {
role: "img"
}));
}
}]);
return Sankey;
}(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
});

26
node_modules/recharts/es6/chart/ScatterChart.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
/**
* @fileOverview Scatter Chart
*/
import { generateCategoricalChart } from './generateCategoricalChart';
import { Scatter } from '../cartesian/Scatter';
import { XAxis } from '../cartesian/XAxis';
import { YAxis } from '../cartesian/YAxis';
import { ZAxis } from '../cartesian/ZAxis';
import { formatAxisMap } from '../util/CartesianUtils';
export var ScatterChart = generateCategoricalChart({
chartName: 'ScatterChart',
GraphicalChild: Scatter,
defaultTooltipEventType: 'item',
validateTooltipEventTypes: ['item'],
axisComponents: [{
axisType: 'xAxis',
AxisComp: XAxis
}, {
axisType: 'yAxis',
AxisComp: YAxis
}, {
axisType: 'zAxis',
AxisComp: ZAxis
}],
formatAxisMap: formatAxisMap
});

199
node_modules/recharts/es6/chart/SunburstChart.js generated vendored Normal file
View File

@@ -0,0 +1,199 @@
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; }
import React, { useState } from 'react';
import { scaleLinear } from 'victory-vendor/d3-scale';
import clsx from 'clsx';
import { findChildByType } from '../util/ReactUtils';
import { Surface } from '../container/Surface';
import { Layer } from '../container/Layer';
import { Sector } from '../shape/Sector';
import { Text } from '../component/Text';
import { polarToCartesian } from '../util/PolarUtils';
import { Tooltip } from '../component/Tooltip';
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));
}
export var 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 = useState(false),
_useState2 = _slicedToArray(_useState, 2),
isTooltipActive = _useState2[0],
setIsTooltipActive = _useState2[1];
var _useState3 = useState(null),
_useState4 = _slicedToArray(_useState3, 2),
activeNode = _useState4[0],
setActiveNode = _useState4[1];
var rScale = 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 = polarToCartesian(0, 0, innerR + radius / 2, -(start + arcLength - arcLength / 2)),
textX = _polarToCartesian.x,
textY = _polarToCartesian.y;
currentAngle += arcLength;
sectors.push( /*#__PURE__*/React.createElement("g", {
"aria-label": d.name,
tabIndex: 0
}, /*#__PURE__*/React.createElement(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.createElement(Text, _extends({}, textOptions, {
alignmentBaseline: "middle",
textAnchor: "middle",
x: textX + cx,
y: cy - textY
}), d[dataKey])));
var _polarToCartesian2 = 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 = clsx('recharts-sunburst', className);
function renderTooltip() {
var tooltipComponent = findChildByType([children], Tooltip);
if (!tooltipComponent || !activeNode) return null;
var viewBox = {
x: 0,
y: 0,
width: width,
height: height
};
return /*#__PURE__*/React.cloneElement(tooltipComponent, {
viewBox: viewBox,
coordinate: positions.get(activeNode.name),
payload: [activeNode],
active: isTooltipActive
});
}
return /*#__PURE__*/React.createElement("div", {
className: clsx('recharts-wrapper', className),
style: {
position: 'relative',
width: width,
height: height
},
role: "region"
}, /*#__PURE__*/React.createElement(Surface, {
width: width,
height: height
}, children, /*#__PURE__*/React.createElement(Layer, {
className: layerClass
}, sectors)), renderTooltip());
};

675
node_modules/recharts/es6/chart/Treemap.js generated vendored Normal file
View File

@@ -0,0 +1,675 @@
var _excluded = ["width", "height", "className", "style", "children", "type"];
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 = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; 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 _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 _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
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 : String(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); }
import isNan from 'lodash/isNaN';
import isFunction from 'lodash/isFunction';
import omit from 'lodash/omit';
import get from 'lodash/get';
import clsx from 'clsx';
/**
* @fileOverview TreemapChart
*/
import React, { PureComponent } from 'react';
import Smooth from 'react-smooth';
import { Tooltip } from '../component/Tooltip';
import { Layer } from '../container/Layer';
import { Surface } from '../container/Surface';
import { Polygon } from '../shape/Polygon';
import { Rectangle } from '../shape/Rectangle';
import { getValueByDataKey } from '../util/ChartUtils';
import { COLOR_PANEL } from '../util/Constants';
import { uniqueId } from '../util/DataUtils';
import { getStringSize } from '../util/DOMUtils';
import { Global } from '../util/Global';
import { filterSvgElements, findChildByType, validateWidthHeight, filterProps } from '../util/ReactUtils';
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 = isNan(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: isNan(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 _i2 = 0, len = row.length; _i2 < len; _i2++) {
child = row[_i2];
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: []
};
export var Treemap = /*#__PURE__*/function (_PureComponent) {
_inherits(Treemap, _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(_assertThisInitialized(_this), "state", _objectSpread({}, defaultState));
_defineProperty(_assertThisInitialized(_this), "handleAnimationEnd", function () {
var onAnimationEnd = _this.props.onAnimationEnd;
_this.setState({
isAnimationFinished: true
});
if (isFunction(onAnimationEnd)) {
onAnimationEnd();
}
});
_defineProperty(_assertThisInitialized(_this), "handleAnimationStart", function () {
var onAnimationStart = _this.props.onAnimationStart;
_this.setState({
isAnimationFinished: false
});
if (isFunction(onAnimationStart)) {
onAnimationStart();
}
});
return _this;
}
_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 = findChildByType(children, 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 = findChildByType(children, 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.createElement(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.createElement(Smooth, {
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.createElement(Smooth, {
from: "translate(".concat(translateX, "px, ").concat(translateX, "px)"),
to: "translate(0, 0)",
attributeName: "transform",
begin: animationBegin,
easing: animationEasing,
isActive: isAnimationActive,
duration: animationDuration
}, /*#__PURE__*/React.createElement(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({}, 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.createElement(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 = findChildByType(children, 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: getValueByDataKey(activeNode, nameKey, ''),
value: getValueByDataKey(activeNode, NODE_VALUE_KEY)
}] : [];
return /*#__PURE__*/React.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.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 = get(item, nameKey, 'root');
var content = null;
if ( /*#__PURE__*/React.isValidElement(nestIndexContent)) {
content = /*#__PURE__*/React.cloneElement(nestIndexContent, item, i);
}
if (isFunction(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.createElement("div", {
onClick: _this4.handleNestIndex.bind(_this4, item, i),
key: "nest-index-".concat(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 (!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 = filterProps(others, false);
return /*#__PURE__*/React.createElement("div", {
className: clsx('recharts-wrapper', className),
style: _objectSpread(_objectSpread({}, style), {}, {
position: 'relative',
cursor: 'default',
width: width,
height: height
}),
role: "region"
}, /*#__PURE__*/React.createElement(Surface, _extends({}, attrs, {
width: width,
height: type === 'nest' ? height - 30 : height
}), this.renderAllNodes(), 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.isValidElement(content)) {
return /*#__PURE__*/React.cloneElement(content, nodeProps);
}
if (isFunction(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.createElement(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 = getStringSize(nodeProps.name);
if (width > 20 && height > 20 && nameSize.width < width && nameSize.height < height) {
text = /*#__PURE__*/React.createElement("text", {
x: x + 8,
y: y + height / 2 + 7,
fontSize: 14
}, nodeProps.name);
}
var colors = colorPanel || COLOR_PANEL;
return /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement(Rectangle, _extends({
fill: nodeProps.depth < 2 ? colors[index % colors.length] : 'rgba(255,255,255,0)',
stroke: "#fff"
}, omit(nodeProps, 'children'), {
role: "img"
})), arrow, text);
}
}]);
return Treemap;
}(PureComponent);
_defineProperty(Treemap, "displayName", 'Treemap');
_defineProperty(Treemap, "defaultProps", {
aspectRatio: 0.5 * (1 + Math.sqrt(5)),
dataKey: 'value',
type: 'flat',
isAnimationActive: !Global.isSsr,
isUpdateAnimationActive: !Global.isSsr,
animationBegin: 0,
animationDuration: 1500,
animationEasing: 'linear'
});

File diff suppressed because it is too large Load Diff

1
node_modules/recharts/es6/chart/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};