@semcore/d3-chart 3.60.0 → 3.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/lib/cjs/Area.js +14 -12
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +17 -15
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +19 -17
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +15 -13
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +19 -17
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +12 -10
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +11 -9
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +19 -17
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +6 -4
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +12 -10
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +6 -4
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +22 -20
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +15 -13
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/Reference.js +15 -13
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +12 -10
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/Tooltip.js +12 -10
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +12 -10
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +5 -3
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +5 -3
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/es6/Area.js +14 -12
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +17 -15
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +19 -17
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +15 -13
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +19 -17
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +12 -10
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +11 -9
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/HorizontalBar.js +19 -17
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +6 -4
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +12 -10
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +6 -4
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +22 -20
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +15 -13
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/Reference.js +15 -13
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ScatterPlot.js +12 -10
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/Tooltip.js +12 -10
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +12 -10
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +5 -3
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +5 -3
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +7 -5
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +20 -18
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +9 -7
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +54 -0
- package/lib/esm/Area.mjs +189 -0
- package/lib/esm/Axis.mjs +406 -0
- package/lib/esm/Bar.mjs +201 -0
- package/lib/esm/Bubble.mjs +216 -0
- package/lib/esm/CompactHorizontalBar.mjs +518 -0
- package/lib/esm/Donut.mjs +415 -0
- package/lib/esm/Dots.mjs +120 -0
- package/lib/esm/GroupBar.mjs +94 -0
- package/lib/esm/HorizontalBar.mjs +181 -0
- package/lib/esm/Hover.mjs +217 -0
- package/lib/esm/Line.mjs +199 -0
- package/lib/esm/Pattern.mjs +520 -0
- package/lib/esm/Plot.mjs +137 -0
- package/lib/esm/Radar.mjs +706 -0
- package/lib/esm/RadialTree.mjs +565 -0
- package/lib/esm/Reference.mjs +243 -0
- package/lib/esm/ResponsiveContainer.mjs +99 -0
- package/lib/esm/ScatterPlot.mjs +194 -0
- package/lib/esm/StackBar.mjs +177 -0
- package/lib/esm/StackedArea.mjs +84 -0
- package/lib/esm/Tooltip.mjs +255 -0
- package/lib/esm/Venn.mjs +234 -0
- package/lib/esm/a11y/DataAccessibilityTable.mjs +100 -0
- package/lib/esm/a11y/PlotA11yModule.mjs +117 -0
- package/lib/esm/a11y/PlotA11yView.mjs +146 -0
- package/lib/esm/a11y/bezier.mjs +32 -0
- package/lib/esm/a11y/focus.mjs +44 -0
- package/lib/esm/a11y/hints.mjs +122 -0
- package/lib/esm/a11y/insights.mjs +700 -0
- package/lib/esm/a11y/intl.mjs +17 -0
- package/lib/esm/a11y/locale.mjs +39 -0
- package/lib/esm/a11y/serialize.mjs +363 -0
- package/lib/esm/a11y/summarize.mjs +14 -0
- package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/module/de.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/en.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/es.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/fr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/it.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ja.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/ko.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/nl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pl.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/pt.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/sv.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/tr.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/vi.json.mjs +14 -0
- package/lib/esm/a11y/translations/module/zh.json.mjs +14 -0
- package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +33 -0
- package/lib/esm/a11y/translations/view/de.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/en.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/es.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/fr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/it.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ja.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/ko.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/nl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pl.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/pt.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/sv.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/tr.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/vi.json.mjs +48 -0
- package/lib/esm/a11y/translations/view/zh.json.mjs +48 -0
- package/lib/esm/color.mjs +127 -0
- package/lib/esm/component/Chart/AbstractChart.mjs +408 -0
- package/lib/esm/component/Chart/AreaChart.mjs +145 -0
- package/lib/esm/component/Chart/BarChart.mjs +240 -0
- package/lib/esm/component/Chart/BubbleChart.mjs +135 -0
- package/lib/esm/component/Chart/CigaretteChart.mjs +294 -0
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +113 -0
- package/lib/esm/component/Chart/DonutChart.mjs +113 -0
- package/lib/esm/component/Chart/HistogramChart.mjs +166 -0
- package/lib/esm/component/Chart/LineChart.mjs +131 -0
- package/lib/esm/component/Chart/RadarChart.mjs +115 -0
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +144 -0
- package/lib/esm/component/Chart/VennChart.mjs +141 -0
- package/lib/esm/component/Chart/index.mjs +27 -0
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +91 -0
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +86 -0
- package/lib/esm/component/ChartLegend/LegendFlex/legend-flex.shadow.css +12 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +240 -0
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +4 -0
- package/lib/esm/component/ChartLegend/LegendItem/legend-item.shadow.css +129 -0
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +90 -0
- package/lib/esm/component/ChartLegend/LegendTable/legend-table.shadow.css +19 -0
- package/lib/esm/component/ChartLegend/index.mjs +5 -0
- package/lib/esm/component/Cigarette/Cigarette.mjs +139 -0
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +141 -0
- package/lib/esm/createElement.mjs +104 -0
- package/lib/esm/index.mjs +70 -0
- package/lib/esm/style/area.shadow.css +50 -0
- package/lib/esm/style/axis.shadow.css +88 -0
- package/lib/esm/style/bar.shadow.css +66 -0
- package/lib/esm/style/bubble.shadow.css +64 -0
- package/lib/esm/style/donut.shadow.css +36 -0
- package/lib/esm/style/dot.shadow.css +27 -0
- package/lib/esm/style/hover.shadow.css +9 -0
- package/lib/esm/style/line.shadow.css +43 -0
- package/lib/esm/style/plot.shadow.css +19 -0
- package/lib/esm/style/plotA11yModule.shadow.css +12 -0
- package/lib/esm/style/plotA11yView.shadow.css +39 -0
- package/lib/esm/style/radar.shadow.css +80 -0
- package/lib/esm/style/radial-tree.shadow.css +54 -0
- package/lib/esm/style/reference.shadow.css +43 -0
- package/lib/esm/style/scatterplot.shadow.css +41 -0
- package/lib/esm/style/tooltip.shadow.css +42 -0
- package/lib/esm/style/venn.shadow.css +48 -0
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +31 -0
- package/lib/esm/translations/en.json.mjs +12 -0
- package/lib/esm/translations/es.json.mjs +11 -0
- package/lib/esm/translations/fr.json.mjs +11 -0
- package/lib/esm/translations/it.json.mjs +11 -0
- package/lib/esm/translations/ja.json.mjs +11 -0
- package/lib/esm/translations/ko.json.mjs +11 -0
- package/lib/esm/translations/nl.json.mjs +11 -0
- package/lib/esm/translations/pl.json.mjs +11 -0
- package/lib/esm/translations/pt.json.mjs +11 -0
- package/lib/esm/translations/sv.json.mjs +11 -0
- package/lib/esm/translations/tr.json.mjs +11 -0
- package/lib/esm/translations/vi.json.mjs +11 -0
- package/lib/esm/translations/zh.json.mjs +11 -0
- package/lib/esm/utils.mjs +266 -0
- package/package.json +11 -11
- package/vite.config.ts +2 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
8
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
9
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
10
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
11
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { transition } from "d3-transition";
|
|
14
|
+
import { sstyled as sstyled$1, Component } from "@semcore/core";
|
|
15
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
16
|
+
import assignProps from "@semcore/utils/lib/assignProps";
|
|
17
|
+
import getOriginChildren from "@semcore/utils/lib/getOriginChildren";
|
|
18
|
+
import canUseDOM from "@semcore/utils/lib/canUseDOM";
|
|
19
|
+
import createElement from "./createElement.mjs";
|
|
20
|
+
import { measureText, getChartDefaultColorName } from "./utils.mjs";
|
|
21
|
+
import { getPatternSymbolSize, PatternSymbol } from "./Pattern.mjs";
|
|
22
|
+
var _excluded = ["data"];
|
|
23
|
+
/*!__reshadow-styles__:"./style/radial-tree.shadow.css"*/
|
|
24
|
+
var style = (
|
|
25
|
+
/*__reshadow_css_start__*/
|
|
26
|
+
(sstyled.insert(
|
|
27
|
+
/*__inner_css_start__*/
|
|
28
|
+
".___SRadian_o1tue_gg_{cursor:pointer;fill:var(--intergalactic-text-large-info, #008ff8)}.___SLine_o1tue_gg_{stroke:var(--intergalactic-text-large-info, #008ff8)}.___SLine_o1tue_gg_.__stroke_o1tue_gg_{stroke:var(--stroke_o1tue)}.___SLine_o1tue_gg_.__transparent_o1tue_gg_{opacity:.3}.___SCap_o1tue_gg_{transition:r .1s}.___SCap_o1tue_gg_.__pattern_o1tue_gg_{stroke:var(--intergalactic-chart-grid-border, #ffffff);stroke-width:1px}.___SCap_o1tue_gg_.__transparent_o1tue_gg_,.___SIcon_o1tue_gg_.__transparent_o1tue_gg_,.___SLabel_o1tue_gg_.__transparent_o1tue_gg_{opacity:.3}.___SLabel_o1tue_gg_{fill:var(--color_o1tue)}@media (hover:hover){.___SRadian_o1tue_gg_:hover .___SLabel_o1tue_gg_{cursor:pointer;filter:brightness(.6)}}@media (prefers-reduced-motion){.___SLineCap_o1tue_gg_{transition:none}}",
|
|
29
|
+
/*__inner_css_end__*/
|
|
30
|
+
"o1tue_gg_"
|
|
31
|
+
), /*__reshadow_css_end__*/
|
|
32
|
+
{
|
|
33
|
+
"__SRadian": "___SRadian_o1tue_gg_",
|
|
34
|
+
"__SLine": "___SLine_o1tue_gg_",
|
|
35
|
+
"_stroke": "__stroke_o1tue_gg_",
|
|
36
|
+
"--stroke": "--stroke_o1tue",
|
|
37
|
+
"_transparent": "__transparent_o1tue_gg_",
|
|
38
|
+
"__SCap": "___SCap_o1tue_gg_",
|
|
39
|
+
"_pattern": "__pattern_o1tue_gg_",
|
|
40
|
+
"__SIcon": "___SIcon_o1tue_gg_",
|
|
41
|
+
"__SLabel": "___SLabel_o1tue_gg_",
|
|
42
|
+
"--color": "--color_o1tue",
|
|
43
|
+
"__SLineCap": "___SLineCap_o1tue_gg_"
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
var baseAngle = -Math.PI / 2;
|
|
47
|
+
var RadialTreeBase = /* @__PURE__ */ function(_Component) {
|
|
48
|
+
_inherits(RadialTreeBase2, _Component);
|
|
49
|
+
var _super = _createSuper(RadialTreeBase2);
|
|
50
|
+
function RadialTreeBase2(props) {
|
|
51
|
+
var _this;
|
|
52
|
+
_classCallCheck(this, RadialTreeBase2);
|
|
53
|
+
_this = _super.call(this, props);
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "Element", void 0);
|
|
55
|
+
_this.handleRadianClick = _this.handleRadianClick.bind(_assertThisInitialized(_this));
|
|
56
|
+
return _this;
|
|
57
|
+
}
|
|
58
|
+
_createClass(RadialTreeBase2, [{
|
|
59
|
+
key: "uncontrolledProps",
|
|
60
|
+
value: function uncontrolledProps() {
|
|
61
|
+
return {
|
|
62
|
+
activeKey: null
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "runAppearAnimation",
|
|
67
|
+
value: function runAppearAnimation() {
|
|
68
|
+
var _window$matchMedia;
|
|
69
|
+
var _this$asProps = this.asProps, duration = _this$asProps.duration, uid = _this$asProps.uid;
|
|
70
|
+
if (!canUseDOM()) return;
|
|
71
|
+
var preferReduceMotion = (_window$matchMedia = window.matchMedia("(prefers-reduced-motion: reduce)")) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.matches;
|
|
72
|
+
if (!(duration > 0)) return;
|
|
73
|
+
if (preferReduceMotion) return;
|
|
74
|
+
var circlesAnimation = transition().selection().selectAll("[data-radial-animation=".concat(uid, "-cap-circle]")).interrupt();
|
|
75
|
+
var iconsAnimation = transition().selection().selectAll("[data-radial-animation=".concat(uid, "-cap-icon]")).interrupt();
|
|
76
|
+
var linesAnimation = transition().selection().selectAll("[data-radial-animation=".concat(uid, "-line]")).interrupt();
|
|
77
|
+
var labelsAnimation = transition().selection().selectAll("[data-radial-animation=".concat(uid, "-label]")).interrupt();
|
|
78
|
+
var circlesNodes = circlesAnimation.nodes();
|
|
79
|
+
var iconsNodes = iconsAnimation.nodes();
|
|
80
|
+
var linesNodes = linesAnimation.nodes();
|
|
81
|
+
var labelsNodes = linesAnimation.nodes();
|
|
82
|
+
if (circlesNodes.length > 0) {
|
|
83
|
+
var attrs = circlesNodes.map(function(node) {
|
|
84
|
+
var _lineNode$x, _lineNode$x$baseVal, _lineNode$y, _lineNode$y$baseVal;
|
|
85
|
+
var radianIndex = parseInt(node.dataset.radianIndex, 10);
|
|
86
|
+
var lineNode = linesNodes[radianIndex];
|
|
87
|
+
return {
|
|
88
|
+
from: {
|
|
89
|
+
cx: (_lineNode$x = lineNode.x1) === null || _lineNode$x === void 0 ? void 0 : (_lineNode$x$baseVal = _lineNode$x.baseVal) === null || _lineNode$x$baseVal === void 0 ? void 0 : _lineNode$x$baseVal.value,
|
|
90
|
+
cy: (_lineNode$y = lineNode.y1) === null || _lineNode$y === void 0 ? void 0 : (_lineNode$y$baseVal = _lineNode$y.baseVal) === null || _lineNode$y$baseVal === void 0 ? void 0 : _lineNode$y$baseVal.value
|
|
91
|
+
},
|
|
92
|
+
to: {
|
|
93
|
+
cx: node.dataset["cx"],
|
|
94
|
+
cy: node.dataset["cy"]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
circlesAnimation.attr("opacity", 0).attr("cx", function(_, index) {
|
|
99
|
+
var _attrs$index$from;
|
|
100
|
+
return (_attrs$index$from = attrs[index].from) === null || _attrs$index$from === void 0 ? void 0 : _attrs$index$from.cx;
|
|
101
|
+
}).attr("cy", function(_, index) {
|
|
102
|
+
var _attrs$index$from2;
|
|
103
|
+
return (_attrs$index$from2 = attrs[index].from) === null || _attrs$index$from2 === void 0 ? void 0 : _attrs$index$from2.cy;
|
|
104
|
+
}).transition().duration(duration).attr("opacity", 1).attr("cx", function(_, index) {
|
|
105
|
+
var _attrs$index$to;
|
|
106
|
+
return (_attrs$index$to = attrs[index].to) === null || _attrs$index$to === void 0 ? void 0 : _attrs$index$to.cx;
|
|
107
|
+
}).attr("cy", function(_, index) {
|
|
108
|
+
var _attrs$index$to2;
|
|
109
|
+
return (_attrs$index$to2 = attrs[index].to) === null || _attrs$index$to2 === void 0 ? void 0 : _attrs$index$to2.cy;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (iconsNodes.length > 0) {
|
|
113
|
+
var _attrs = iconsNodes.map(function(node) {
|
|
114
|
+
var _node$width, _node$width$baseVal, _node$height, _node$height$baseVal, _lineNode$x2, _lineNode$x2$baseVal, _lineNode$y2, _lineNode$y2$baseVal;
|
|
115
|
+
var width = (_node$width = node.width) === null || _node$width === void 0 ? void 0 : (_node$width$baseVal = _node$width.baseVal) === null || _node$width$baseVal === void 0 ? void 0 : _node$width$baseVal.value;
|
|
116
|
+
var height = (_node$height = node.height) === null || _node$height === void 0 ? void 0 : (_node$height$baseVal = _node$height.baseVal) === null || _node$height$baseVal === void 0 ? void 0 : _node$height$baseVal.value;
|
|
117
|
+
var radianIndex = parseInt(node.dataset.radianIndex, 10);
|
|
118
|
+
var lineNode = linesNodes[radianIndex];
|
|
119
|
+
return {
|
|
120
|
+
from: {
|
|
121
|
+
x: ((_lineNode$x2 = lineNode.x1) === null || _lineNode$x2 === void 0 ? void 0 : (_lineNode$x2$baseVal = _lineNode$x2.baseVal) === null || _lineNode$x2$baseVal === void 0 ? void 0 : _lineNode$x2$baseVal.value) - width / 2,
|
|
122
|
+
y: ((_lineNode$y2 = lineNode.y1) === null || _lineNode$y2 === void 0 ? void 0 : (_lineNode$y2$baseVal = _lineNode$y2.baseVal) === null || _lineNode$y2$baseVal === void 0 ? void 0 : _lineNode$y2$baseVal.value) - height / 2
|
|
123
|
+
},
|
|
124
|
+
to: {
|
|
125
|
+
x: node.dataset["x"],
|
|
126
|
+
y: node.dataset["y"]
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
iconsAnimation.attr("opacity", 0).attr("x", function(_, index) {
|
|
131
|
+
var _attrs$index$from3;
|
|
132
|
+
return (_attrs$index$from3 = _attrs[index].from) === null || _attrs$index$from3 === void 0 ? void 0 : _attrs$index$from3.x;
|
|
133
|
+
}).attr("y", function(_, index) {
|
|
134
|
+
var _attrs$index$from4;
|
|
135
|
+
return (_attrs$index$from4 = _attrs[index].from) === null || _attrs$index$from4 === void 0 ? void 0 : _attrs$index$from4.y;
|
|
136
|
+
}).transition().duration(duration).attr("opacity", 1).attr("x", function(_, index) {
|
|
137
|
+
var _attrs$index$to3;
|
|
138
|
+
return (_attrs$index$to3 = _attrs[index].to) === null || _attrs$index$to3 === void 0 ? void 0 : _attrs$index$to3.x;
|
|
139
|
+
}).attr("y", function(_, index) {
|
|
140
|
+
var _attrs$index$to4;
|
|
141
|
+
return (_attrs$index$to4 = _attrs[index].to) === null || _attrs$index$to4 === void 0 ? void 0 : _attrs$index$to4.y;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (linesNodes.length > 0) {
|
|
145
|
+
var _attrs2 = linesNodes.map(function(node) {
|
|
146
|
+
var _node$x, _node$x$baseVal, _node$y, _node$y$baseVal;
|
|
147
|
+
return {
|
|
148
|
+
from: {
|
|
149
|
+
x2: (_node$x = node.x1) === null || _node$x === void 0 ? void 0 : (_node$x$baseVal = _node$x.baseVal) === null || _node$x$baseVal === void 0 ? void 0 : _node$x$baseVal.value,
|
|
150
|
+
y2: (_node$y = node.y1) === null || _node$y === void 0 ? void 0 : (_node$y$baseVal = _node$y.baseVal) === null || _node$y$baseVal === void 0 ? void 0 : _node$y$baseVal.value
|
|
151
|
+
},
|
|
152
|
+
to: {
|
|
153
|
+
x2: node.dataset["x2"],
|
|
154
|
+
y2: node.dataset["y2"]
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
linesAnimation.attr("opacity", 0).attr("x2", function(_, index) {
|
|
159
|
+
var _attrs2$index$from;
|
|
160
|
+
return (_attrs2$index$from = _attrs2[index].from) === null || _attrs2$index$from === void 0 ? void 0 : _attrs2$index$from.x2;
|
|
161
|
+
}).attr("y2", function(_, index) {
|
|
162
|
+
var _attrs2$index$from2;
|
|
163
|
+
return (_attrs2$index$from2 = _attrs2[index].from) === null || _attrs2$index$from2 === void 0 ? void 0 : _attrs2$index$from2.y2;
|
|
164
|
+
}).transition().duration(duration).attr("opacity", 1).attr("x2", function(_, index) {
|
|
165
|
+
var _attrs2$index$to;
|
|
166
|
+
return (_attrs2$index$to = _attrs2[index].to) === null || _attrs2$index$to === void 0 ? void 0 : _attrs2$index$to.x2;
|
|
167
|
+
}).attr("y2", function(_, index) {
|
|
168
|
+
var _attrs2$index$to2;
|
|
169
|
+
return (_attrs2$index$to2 = _attrs2[index].to) === null || _attrs2$index$to2 === void 0 ? void 0 : _attrs2$index$to2.y2;
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (labelsNodes.length > 0) {
|
|
173
|
+
labelsAnimation.attr("opacity", 0);
|
|
174
|
+
labelsAnimation.transition().duration(duration).attr("opacity", 1);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
178
|
+
key: "componentDidUpdate",
|
|
179
|
+
value: function componentDidUpdate(prevProps) {
|
|
180
|
+
if (prevProps.$rootProps.data !== this.asProps.data) {
|
|
181
|
+
this.runAppearAnimation();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "componentDidMount",
|
|
186
|
+
value: function componentDidMount() {
|
|
187
|
+
this.runAppearAnimation();
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
key: "handleRadianClick",
|
|
191
|
+
value: function handleRadianClick(key) {
|
|
192
|
+
var _this2 = this;
|
|
193
|
+
return function(event) {
|
|
194
|
+
var newKey = key !== _this2.asProps.activeKey ? key : null;
|
|
195
|
+
_this2.handlers.activeKey(newKey, event);
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}, {
|
|
199
|
+
key: "computeTextWidth",
|
|
200
|
+
value: function computeTextWidth() {
|
|
201
|
+
var _this$asProps2 = this.asProps, data = _this$asProps2.data, textSize = _this$asProps2.textSize;
|
|
202
|
+
var widths = data.map(function(_ref10) {
|
|
203
|
+
var label = _ref10.label;
|
|
204
|
+
return measureText(label, textSize);
|
|
205
|
+
});
|
|
206
|
+
return Math.max.apply(Math, _toConsumableArray(widths));
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "getTitleProps",
|
|
210
|
+
value: function getTitleProps() {
|
|
211
|
+
var _this$asProps3 = this.asProps, uid = _this$asProps3.uid, size = _this$asProps3.size, textSize = _this$asProps3.textSize;
|
|
212
|
+
var _size = _slicedToArray(size, 2), width = _size[0], height = _size[1];
|
|
213
|
+
var center = [width / 2, height / 2];
|
|
214
|
+
var x = center[0], y = center[1];
|
|
215
|
+
return _defineProperty({
|
|
216
|
+
x,
|
|
217
|
+
y,
|
|
218
|
+
textSize: textSize * 1.5
|
|
219
|
+
}, "data-radial-animation", "".concat(uid, "-label"));
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "getRadianProps",
|
|
223
|
+
value: function getRadianProps() {
|
|
224
|
+
var _this$asProps4 = this.asProps, data = _this$asProps4.data, restRootProps = _objectWithoutProperties(_this$asProps4, _excluded);
|
|
225
|
+
var textWidth = this.computeTextWidth();
|
|
226
|
+
return _objectSpread(_objectSpread({}, restRootProps), {}, {
|
|
227
|
+
radiansCount: data.length,
|
|
228
|
+
data,
|
|
229
|
+
textWidth,
|
|
230
|
+
onRadianClick: this.handleRadianClick
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}, {
|
|
234
|
+
key: "render",
|
|
235
|
+
value: function render() {
|
|
236
|
+
var _ref;
|
|
237
|
+
var SRadialTree = this.Element;
|
|
238
|
+
var Children = this.asProps.Children;
|
|
239
|
+
this.asProps.dataHintsHandler.establishDataType("values-set");
|
|
240
|
+
return _ref = sstyled$1(this.asProps.styles), /* @__PURE__ */ React.createElement(SRadialTree, _ref.cn("SRadialTree", {
|
|
241
|
+
"render": "g"
|
|
242
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref.cn("Children", {})));
|
|
243
|
+
}
|
|
244
|
+
}]);
|
|
245
|
+
return RadialTreeBase2;
|
|
246
|
+
}(Component);
|
|
247
|
+
_defineProperty(RadialTreeBase, "displayName", "RadialTree");
|
|
248
|
+
_defineProperty(RadialTreeBase, "style", style);
|
|
249
|
+
_defineProperty(RadialTreeBase, "enhance", [uniqueIDEnhancement()]);
|
|
250
|
+
_defineProperty(RadialTreeBase, "defaultProps", {
|
|
251
|
+
angleOffset: 0,
|
|
252
|
+
duration: 300,
|
|
253
|
+
centralMargin: 50,
|
|
254
|
+
labelMargin: 5,
|
|
255
|
+
iconColor: "#fff",
|
|
256
|
+
capSize: 8,
|
|
257
|
+
iconSize: 8,
|
|
258
|
+
textSize: 14,
|
|
259
|
+
defaultActiveKey: null
|
|
260
|
+
});
|
|
261
|
+
var RadialTreeRadian = /* @__PURE__ */ function(_Component2) {
|
|
262
|
+
_inherits(RadialTreeRadian2, _Component2);
|
|
263
|
+
var _super2 = _createSuper(RadialTreeRadian2);
|
|
264
|
+
function RadialTreeRadian2(props) {
|
|
265
|
+
var _this3;
|
|
266
|
+
_classCallCheck(this, RadialTreeRadian2);
|
|
267
|
+
_this3 = _super2.call(this, props);
|
|
268
|
+
_defineProperty(_assertThisInitialized(_this3), "Element", void 0);
|
|
269
|
+
_this3.renderRadian = _this3.renderRadian.bind(_assertThisInitialized(_this3));
|
|
270
|
+
return _this3;
|
|
271
|
+
}
|
|
272
|
+
_createClass(RadialTreeRadian2, [{
|
|
273
|
+
key: "getInteractiveAreaProps",
|
|
274
|
+
value: function getInteractiveAreaProps(_ref12, index) {
|
|
275
|
+
var _$rootProps$data;
|
|
276
|
+
var $rootProps = _ref12.$rootProps;
|
|
277
|
+
var data = (_$rootProps$data = $rootProps.data) === null || _$rootProps$data === void 0 ? void 0 : _$rootProps$data[index];
|
|
278
|
+
var _this$computeRadianPo = this.computeRadianPosition(data, index), xStart = _this$computeRadianPo.xStart, yStart = _this$computeRadianPo.yStart, xLabelCenter = _this$computeRadianPo.xLabelCenter, yLabelCenter = _this$computeRadianPo.yLabelCenter, capSize = _this$computeRadianPo.capSize;
|
|
279
|
+
return {
|
|
280
|
+
x1: xStart,
|
|
281
|
+
y1: yStart,
|
|
282
|
+
x2: xLabelCenter,
|
|
283
|
+
y2: yLabelCenter,
|
|
284
|
+
strokeWidth: capSize * 3
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
key: "getLineProps",
|
|
289
|
+
value: function getLineProps(_ref13, index) {
|
|
290
|
+
var _$rootProps$data2, _color, _ref14;
|
|
291
|
+
var $rootProps = _ref13.$rootProps;
|
|
292
|
+
var data = (_$rootProps$data2 = $rootProps.data) === null || _$rootProps$data2 === void 0 ? void 0 : _$rootProps$data2[index];
|
|
293
|
+
var _this$computeRadianPo2 = this.computeRadianPosition(data, index), xStart = _this$computeRadianPo2.xStart, yStart = _this$computeRadianPo2.yStart, xEnd = _this$computeRadianPo2.xEnd, yEnd = _this$computeRadianPo2.yEnd;
|
|
294
|
+
var _this$asProps5 = this.asProps, uid = _this$asProps5.uid, transparent = _this$asProps5.transparent, resolveColor = _this$asProps5.resolveColor;
|
|
295
|
+
var color = (_color = data.color) !== null && _color !== void 0 ? _color : this.asProps.color;
|
|
296
|
+
return _ref14 = {
|
|
297
|
+
x1: xStart,
|
|
298
|
+
y1: yStart,
|
|
299
|
+
x2: xEnd,
|
|
300
|
+
y2: yEnd,
|
|
301
|
+
stroke: color,
|
|
302
|
+
resolveColor,
|
|
303
|
+
transparent
|
|
304
|
+
}, _defineProperty(_ref14, "data-x1", xStart), _defineProperty(_ref14, "data-y1", yStart), _defineProperty(_ref14, "data-x2", xEnd), _defineProperty(_ref14, "data-y2", yEnd), _defineProperty(_ref14, "data-radial-animation", "".concat(uid, "-line")), _defineProperty(_ref14, "data-radian-index", index), _ref14;
|
|
305
|
+
}
|
|
306
|
+
}, {
|
|
307
|
+
key: "getCapProps",
|
|
308
|
+
value: function getCapProps(_ref15, index) {
|
|
309
|
+
var _$rootProps$data3, _color2, _ref16;
|
|
310
|
+
var $rootProps = _ref15.$rootProps;
|
|
311
|
+
var data = (_$rootProps$data3 = $rootProps.data) === null || _$rootProps$data3 === void 0 ? void 0 : _$rootProps$data3[index];
|
|
312
|
+
var _this$computeRadianPo3 = this.computeRadianPosition(data, index), xEnd = _this$computeRadianPo3.xEnd, yEnd = _this$computeRadianPo3.yEnd, capSize = _this$computeRadianPo3.capSize;
|
|
313
|
+
var _this$asProps6 = this.asProps, uid = _this$asProps6.uid, transparent = _this$asProps6.transparent, resolveColor = _this$asProps6.resolveColor, patterns = _this$asProps6.patterns;
|
|
314
|
+
var color = (_color2 = data.color) !== null && _color2 !== void 0 ? _color2 : this.asProps.color;
|
|
315
|
+
return _ref16 = {
|
|
316
|
+
x: xEnd,
|
|
317
|
+
y: yEnd
|
|
318
|
+
}, _defineProperty(_ref16, "data-cx", xEnd), _defineProperty(_ref16, "data-cy", yEnd), _defineProperty(_ref16, "radius", capSize), _defineProperty(_ref16, "color", color), _defineProperty(_ref16, "resolveColor", resolveColor), _defineProperty(_ref16, "transparent", transparent), _defineProperty(_ref16, "patterns", patterns), _defineProperty(_ref16, "uid", "".concat(uid, "-cap-").concat(index)), _defineProperty(_ref16, "data-radial-animation", "".concat(uid, "-cap-circle")), _defineProperty(_ref16, "data-radian-index", index), _ref16;
|
|
319
|
+
}
|
|
320
|
+
}, {
|
|
321
|
+
key: "getIconProps",
|
|
322
|
+
value: function getIconProps(_ref17, index) {
|
|
323
|
+
var _$rootProps$data4, _iconColor, _iconSize, _icon, _ref18;
|
|
324
|
+
var $rootProps = _ref17.$rootProps;
|
|
325
|
+
var data = (_$rootProps$data4 = $rootProps.data) === null || _$rootProps$data4 === void 0 ? void 0 : _$rootProps$data4[index];
|
|
326
|
+
var _this$computeRadianPo4 = this.computeRadianPosition(data, index), xEnd = _this$computeRadianPo4.xEnd, yEnd = _this$computeRadianPo4.yEnd, isActive = _this$computeRadianPo4.isActive;
|
|
327
|
+
var _this$asProps7 = this.asProps, uid = _this$asProps7.uid, resolveColor = _this$asProps7.resolveColor;
|
|
328
|
+
var iconColor = (_iconColor = data.iconColor) !== null && _iconColor !== void 0 ? _iconColor : this.asProps.iconColor;
|
|
329
|
+
var iconSize = (_iconSize = data.iconSize) !== null && _iconSize !== void 0 ? _iconSize : this.asProps.iconSize;
|
|
330
|
+
var icon = (_icon = data.icon) !== null && _icon !== void 0 ? _icon : this.asProps.icon;
|
|
331
|
+
var x = xEnd - iconSize / 2;
|
|
332
|
+
var y = yEnd - iconSize / 2;
|
|
333
|
+
return _ref18 = {
|
|
334
|
+
x,
|
|
335
|
+
y
|
|
336
|
+
}, _defineProperty(_ref18, "data-x", x), _defineProperty(_ref18, "data-y", y), _defineProperty(_ref18, "iconSize", iconSize), _defineProperty(_ref18, "color", iconColor !== null && iconColor !== void 0 ? iconColor : "#fff"), _defineProperty(_ref18, "resolveColor", resolveColor), _defineProperty(_ref18, "data-radial-animation", "".concat(uid, "-cap-icon")), _defineProperty(_ref18, "data-radian-index", index), _defineProperty(_ref18, "icon", icon), _defineProperty(_ref18, "tag", icon), _defineProperty(_ref18, "isActive", isActive), _ref18;
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
key: "getLabelProps",
|
|
340
|
+
value: function getLabelProps(_ref19, index) {
|
|
341
|
+
var _$rootProps$data5, _color3, _ref21;
|
|
342
|
+
var $rootProps = _ref19.$rootProps;
|
|
343
|
+
var data = (_$rootProps$data5 = $rootProps.data) === null || _$rootProps$data5 === void 0 ? void 0 : _$rootProps$data5[index];
|
|
344
|
+
var _this$computeRadianPo5 = this.computeRadianPosition(data, index), xLabelCenter = _this$computeRadianPo5.xLabelCenter, yLabelCenter = _this$computeRadianPo5.yLabelCenter, labelAngle = _this$computeRadianPo5.labelAngle, isHorizontal = _this$computeRadianPo5.isHorizontal;
|
|
345
|
+
var _this$asProps8 = this.asProps, uid = _this$asProps8.uid, textSize = _this$asProps8.textSize, transparent = _this$asProps8.transparent, resolveColor = _this$asProps8.resolveColor;
|
|
346
|
+
var _ref20 = data, label = _ref20.label;
|
|
347
|
+
var color = (_color3 = data.color) !== null && _color3 !== void 0 ? _color3 : this.asProps.color;
|
|
348
|
+
return _ref21 = {
|
|
349
|
+
x: xLabelCenter,
|
|
350
|
+
y: yLabelCenter,
|
|
351
|
+
angle: labelAngle
|
|
352
|
+
}, _defineProperty(_ref21, "data-radial-animation", "".concat(uid, "-label")), _defineProperty(_ref21, "data-radian-index", index), _defineProperty(_ref21, "label", label), _defineProperty(_ref21, "color", color), _defineProperty(_ref21, "resolveColor", resolveColor), _defineProperty(_ref21, "isHorizontal", isHorizontal), _defineProperty(_ref21, "textSize", textSize), _defineProperty(_ref21, "transparent", transparent), _ref21;
|
|
353
|
+
}
|
|
354
|
+
}, {
|
|
355
|
+
key: "getRadianKey",
|
|
356
|
+
value: function getRadianKey(data, index) {
|
|
357
|
+
var _data$key;
|
|
358
|
+
return (_data$key = data.key) !== null && _data$key !== void 0 ? _data$key : "radian-".concat(index);
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "computeRadianPosition",
|
|
362
|
+
value: function computeRadianPosition(data, index) {
|
|
363
|
+
var _data$capSize;
|
|
364
|
+
var _this$asProps9 = this.asProps, centralMargin = _this$asProps9.centralMargin, labelMargin = _this$asProps9.labelMargin, angleOffset = _this$asProps9.angleOffset, activeKey = _this$asProps9.activeKey, size = _this$asProps9.size, radiansCount = _this$asProps9.radiansCount, textWidth = _this$asProps9.textWidth;
|
|
365
|
+
var _size2 = _slicedToArray(size, 2), width = _size2[0], height = _size2[1];
|
|
366
|
+
var key = this.getRadianKey(data, index);
|
|
367
|
+
var isActive = activeKey === key;
|
|
368
|
+
var baseCapSize = (_data$capSize = data.capSize) !== null && _data$capSize !== void 0 ? _data$capSize : this.asProps.capSize;
|
|
369
|
+
var capSize = baseCapSize * (isActive ? 1 : 0.5);
|
|
370
|
+
var minDemSize = Math.min(width, height) / 2;
|
|
371
|
+
var length = Math.max(minDemSize - textWidth - baseCapSize - centralMargin - labelMargin * 2, 10);
|
|
372
|
+
var angle = baseAngle + angleOffset + index / radiansCount * (Math.PI * 2);
|
|
373
|
+
var isHorizontal = angle - baseAngle > 1 / 6 * Math.PI && angle - baseAngle < 5 / 6 * Math.PI || angle - baseAngle > 7 / 6 * Math.PI && angle - baseAngle < 11 / 6 * Math.PI;
|
|
374
|
+
var topAngle = -Math.PI / 2;
|
|
375
|
+
var labelAngle = (angle - topAngle) % Math.PI + topAngle;
|
|
376
|
+
var center = [width / 2, height / 2];
|
|
377
|
+
var xCenter = center[0], yCenter = center[1];
|
|
378
|
+
var start = [xCenter + Math.cos(angle) * centralMargin, yCenter + Math.sin(angle) * centralMargin];
|
|
379
|
+
var end = [xCenter + Math.cos(angle) * (centralMargin + length), yCenter + Math.sin(angle) * (centralMargin + length)];
|
|
380
|
+
var xStart = start[0], yStart = start[1];
|
|
381
|
+
var xEnd = end[0], yEnd = end[1];
|
|
382
|
+
var labelCenter = [xCenter + Math.cos(angle) * (centralMargin + length + baseCapSize + textWidth / 2 + labelMargin), yCenter + Math.sin(angle) * (centralMargin + length + baseCapSize + textWidth / 2 + labelMargin)];
|
|
383
|
+
var xLabelCenter = labelCenter[0], yLabelCenter = labelCenter[1];
|
|
384
|
+
return {
|
|
385
|
+
xStart,
|
|
386
|
+
yStart,
|
|
387
|
+
xEnd,
|
|
388
|
+
yEnd,
|
|
389
|
+
xLabelCenter,
|
|
390
|
+
yLabelCenter,
|
|
391
|
+
labelAngle,
|
|
392
|
+
isHorizontal,
|
|
393
|
+
capSize,
|
|
394
|
+
isActive
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}, {
|
|
398
|
+
key: "renderRadian",
|
|
399
|
+
value: function renderRadian(data, index) {
|
|
400
|
+
var _ref2;
|
|
401
|
+
var _this$asProps10 = this.asProps, styles = _this$asProps10.styles, Children = _this$asProps10.Children, onRadianClick = _this$asProps10.onRadianClick;
|
|
402
|
+
var key = this.getRadianKey(data, index);
|
|
403
|
+
var SRadian = "g";
|
|
404
|
+
var children = getOriginChildren(Children);
|
|
405
|
+
if (typeof children === "function") {
|
|
406
|
+
var _child = this.asProps.children;
|
|
407
|
+
var mergedProps = assignProps(children(this.asProps), this.asProps);
|
|
408
|
+
children = mergedProps.children;
|
|
409
|
+
mergedProps.children = _child;
|
|
410
|
+
}
|
|
411
|
+
this.asProps.dataHintsHandler.describeValueEntity("".concat(index, ".").concat(data.label), data.label);
|
|
412
|
+
var InteractiveArea3 = RadialTree.Radian.InteractiveArea;
|
|
413
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SRadian, _ref2.cn("SRadian", {
|
|
414
|
+
"aria-hidden": true,
|
|
415
|
+
"key": key,
|
|
416
|
+
"onClick": onRadianClick(key)
|
|
417
|
+
}), /* @__PURE__ */ React.createElement(InteractiveArea3, _ref2.cn("InteractiveArea", {})), children);
|
|
418
|
+
}
|
|
419
|
+
}, {
|
|
420
|
+
key: "render",
|
|
421
|
+
value: function render() {
|
|
422
|
+
var _ref3, _this4 = this;
|
|
423
|
+
var data = this.asProps.data;
|
|
424
|
+
var SRadianList = "g";
|
|
425
|
+
return _ref3 = sstyled$1(this.asProps.styles), /* @__PURE__ */ React.createElement(SRadianList, _ref3.cn("SRadianList", {}), data.map(function(data2, index) {
|
|
426
|
+
return _this4.renderRadian(data2, index);
|
|
427
|
+
}));
|
|
428
|
+
}
|
|
429
|
+
}]);
|
|
430
|
+
return RadialTreeRadian2;
|
|
431
|
+
}(Component);
|
|
432
|
+
_defineProperty(RadialTreeRadian, "displayName", "RadialTreeRadian");
|
|
433
|
+
_defineProperty(RadialTreeRadian, "style", style);
|
|
434
|
+
_defineProperty(RadialTreeRadian, "defaultProps", {
|
|
435
|
+
centralMargin: 50,
|
|
436
|
+
labelMargin: 2,
|
|
437
|
+
iconColor: "#fff",
|
|
438
|
+
capSize: 16,
|
|
439
|
+
iconSize: 16,
|
|
440
|
+
textSize: 14
|
|
441
|
+
});
|
|
442
|
+
var InteractiveArea = function InteractiveArea2(_ref22) {
|
|
443
|
+
var _ref4;
|
|
444
|
+
var SInteractiveArea = _ref22.Element, styles = _ref22.styles;
|
|
445
|
+
return _ref4 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SInteractiveArea, _ref4.cn("SInteractiveArea", {
|
|
446
|
+
"stroke": "transparent",
|
|
447
|
+
"render": "line"
|
|
448
|
+
}));
|
|
449
|
+
};
|
|
450
|
+
var Line = function Line2(_ref23) {
|
|
451
|
+
var _ref5;
|
|
452
|
+
var SLine = _ref23.Element, styles = _ref23.styles, stroke = _ref23.stroke, resolveColor = _ref23.resolveColor, transparent = _ref23.transparent;
|
|
453
|
+
return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SLine, _ref5.cn("SLine", {
|
|
454
|
+
"render": "line",
|
|
455
|
+
"stroke": resolveColor(stroke),
|
|
456
|
+
"transparent": transparent
|
|
457
|
+
}));
|
|
458
|
+
};
|
|
459
|
+
var Cap = function Cap2(_ref24) {
|
|
460
|
+
var _ref7;
|
|
461
|
+
var SCap = _ref24.Element, styles = _ref24.styles, _ref24$x = _ref24.x, x = _ref24$x === void 0 ? 0 : _ref24$x, _ref24$y = _ref24.y, y = _ref24$y === void 0 ? 0 : _ref24$y, radius = _ref24.radius, color = _ref24.color, resolveColor = _ref24.resolveColor, transparent = _ref24.transparent, patterns = _ref24.patterns;
|
|
462
|
+
if (!patterns) {
|
|
463
|
+
var _ref6;
|
|
464
|
+
return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCap, _ref6.cn("SCap", {
|
|
465
|
+
"render": "circle",
|
|
466
|
+
"cx": x,
|
|
467
|
+
"cy": y,
|
|
468
|
+
"r": radius,
|
|
469
|
+
"fill": resolveColor(color),
|
|
470
|
+
"transparent": transparent
|
|
471
|
+
}));
|
|
472
|
+
}
|
|
473
|
+
var patternKey = color || getChartDefaultColorName(0);
|
|
474
|
+
var _getPatternSymbolSize = getPatternSymbolSize({
|
|
475
|
+
patternKey,
|
|
476
|
+
patterns
|
|
477
|
+
}), _getPatternSymbolSize2 = _slicedToArray(_getPatternSymbolSize, 2), width = _getPatternSymbolSize2[0], height = _getPatternSymbolSize2[1];
|
|
478
|
+
return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SCap, _ref7.cn("SCap", {
|
|
479
|
+
"render": PatternSymbol,
|
|
480
|
+
"patternKey": color,
|
|
481
|
+
"x": x - (width || 0) / 2,
|
|
482
|
+
"y": y - (height || 0) / 2,
|
|
483
|
+
"fill": resolveColor(color),
|
|
484
|
+
"transparent": transparent,
|
|
485
|
+
"pattern": true
|
|
486
|
+
}));
|
|
487
|
+
};
|
|
488
|
+
var Icon = function Icon2(_ref25) {
|
|
489
|
+
var _ref8;
|
|
490
|
+
var SIcon = _ref25.Element, styles = _ref25.styles, isActive = _ref25.isActive, tag = _ref25.tag, x = _ref25.x, y = _ref25.y, iconSize = _ref25.iconSize, transparent = _ref25.transparent;
|
|
491
|
+
if (!(isActive && tag)) return null;
|
|
492
|
+
var width = iconSize;
|
|
493
|
+
var height = iconSize;
|
|
494
|
+
return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SIcon, _ref8.cn("SIcon", {
|
|
495
|
+
"x": x,
|
|
496
|
+
"y": y,
|
|
497
|
+
"width": width,
|
|
498
|
+
"height": height,
|
|
499
|
+
"render": tag,
|
|
500
|
+
"transparent": transparent
|
|
501
|
+
}));
|
|
502
|
+
};
|
|
503
|
+
var Label = function Label2(_ref26) {
|
|
504
|
+
var SLabel = _ref26.Element, Children = _ref26.Children, styles = _ref26.styles, label = _ref26.label, color = _ref26.color, resolveColor = _ref26.resolveColor, isHorizontal = _ref26.isHorizontal, x = _ref26.x, y = _ref26.y, textSize = _ref26.textSize, angle = _ref26.angle, transparent = _ref26.transparent;
|
|
505
|
+
var lines = String(label).split("\n");
|
|
506
|
+
var linesCount = lines.length;
|
|
507
|
+
var SLabelLine = "tspan";
|
|
508
|
+
var angleDegs = (angle / Math.PI * 180).toFixed(2);
|
|
509
|
+
var transformOrigin = [x.toFixed(2), y.toFixed(2)];
|
|
510
|
+
var transform = "rotate(".concat([angleDegs].concat(transformOrigin).join(", "), ")");
|
|
511
|
+
var sstyles = sstyled$1(styles);
|
|
512
|
+
var sLabelStyles = sstyles.cn("SLabel", {
|
|
513
|
+
color: resolveColor(color),
|
|
514
|
+
"text-cursor": isHorizontal ? "text" : "vertical-text",
|
|
515
|
+
transparent
|
|
516
|
+
});
|
|
517
|
+
return /* @__PURE__ */ React.createElement(SLabel, {
|
|
518
|
+
"aria-hidden": true,
|
|
519
|
+
render: "text",
|
|
520
|
+
textAnchor: "middle",
|
|
521
|
+
dominantBaseline: "central",
|
|
522
|
+
className: sLabelStyles.className,
|
|
523
|
+
style: sLabelStyles.style,
|
|
524
|
+
x: x.toFixed(2),
|
|
525
|
+
y: y.toFixed(2),
|
|
526
|
+
transform
|
|
527
|
+
}, lines.map(function(lineText, lineIndex) {
|
|
528
|
+
return /* @__PURE__ */ React.createElement(SLabelLine, {
|
|
529
|
+
x,
|
|
530
|
+
y: y + (lineIndex - (linesCount - 1) / 2) * textSize,
|
|
531
|
+
key: "#".concat(lineIndex, "-").concat(lineText)
|
|
532
|
+
}, lineText);
|
|
533
|
+
}), /* @__PURE__ */ React.createElement(Children, null));
|
|
534
|
+
};
|
|
535
|
+
var Radian = createElement(RadialTreeRadian, {
|
|
536
|
+
InteractiveArea,
|
|
537
|
+
Line,
|
|
538
|
+
Cap,
|
|
539
|
+
Icon,
|
|
540
|
+
Label
|
|
541
|
+
});
|
|
542
|
+
var Title = function Title2(_ref27) {
|
|
543
|
+
var _ref9;
|
|
544
|
+
var STitle = _ref27.Element, Children = _ref27.Children, children = _ref27.children, styles = _ref27.styles, textSize = _ref27.textSize, color = _ref27.color, resolveColor = _ref27.resolveColor, x = _ref27.x, y = _ref27.y, dataHintsHandler = _ref27.dataHintsHandler;
|
|
545
|
+
if (typeof children === "string") {
|
|
546
|
+
dataHintsHandler.setTitle("vertical", children);
|
|
547
|
+
}
|
|
548
|
+
return _ref9 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STitle, _ref9.cn("STitle", {
|
|
549
|
+
"aria-hidden": true,
|
|
550
|
+
"render": "text",
|
|
551
|
+
"textAnchor": "middle",
|
|
552
|
+
"dominantBaseline": "central",
|
|
553
|
+
"fontSize": textSize,
|
|
554
|
+
"fill": resolveColor(color),
|
|
555
|
+
"x": x,
|
|
556
|
+
"y": y
|
|
557
|
+
}), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {})));
|
|
558
|
+
};
|
|
559
|
+
var RadialTree = createElement(RadialTreeBase, {
|
|
560
|
+
Title,
|
|
561
|
+
Radian
|
|
562
|
+
});
|
|
563
|
+
export {
|
|
564
|
+
RadialTree as default
|
|
565
|
+
};
|