@semcore/mini-chart 0.29.2 → 0.29.3
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/component/score/Donut.js +12 -10
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +21 -19
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/trend/Bar.js +10 -8
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +10 -8
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/es6/component/score/Donut.js +12 -10
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +21 -19
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +10 -8
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +10 -8
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +106 -86
- package/lib/esm/component/score/Line.mjs +107 -84
- package/lib/esm/component/score/donut.shadow.css +17 -0
- package/lib/esm/component/score/line.shadow.css +62 -0
- package/lib/esm/component/skeleton/skeleton.shadow.css +24 -0
- package/lib/esm/component/trend/Bar.mjs +87 -71
- package/lib/esm/component/trend/Line.mjs +121 -102
- package/lib/esm/component/trend/Trend.mjs +47 -35
- package/lib/esm/index.mjs +13 -13
- package/package.json +3 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@import '../skeleton/skeleton.shadow.css';
|
|
2
|
+
|
|
3
|
+
SLineGauge {
|
|
4
|
+
height: 8px;
|
|
5
|
+
background-color: var(--base-bg-color, var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9));
|
|
6
|
+
border-radius: var(--intergalactic-chart-rounded, 2px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
SLineValue {
|
|
12
|
+
height: 8px;
|
|
13
|
+
border-radius: var(--intergalactic-chart-rounded, 2px) 0 0 var(--intergalactic-chart-rounded, 2px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SLineValue[percent] {
|
|
17
|
+
width: var(--percent);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
SLineValue[color], SLineSegmentItem[color] {
|
|
21
|
+
background-color: var(--color, var(--intergalactic-chart-palette-order-1, #2bb3ff));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
SLineGauge[segments] {
|
|
25
|
+
border-radius: var(--intergalactic-progress-bar-rounded, 6px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
SLineGaugeSegment, SAnimationLine {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
SLineSegmentItem:last-child {
|
|
37
|
+
margin-right: 0;
|
|
38
|
+
border-right: none;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
SLineSegmentItem {
|
|
42
|
+
height: 8px;
|
|
43
|
+
background: transparent;
|
|
44
|
+
border-right-color: var(--intergalactic-chart-grid-border, #ffffff);
|
|
45
|
+
border-right-style: solid;
|
|
46
|
+
border-right-width: 1px;
|
|
47
|
+
box-sizing: content-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SAnimationLine {
|
|
51
|
+
background-color: var(--intergalactic-chart-grid-bar-chart-base-bg, #e0e1e9);
|
|
52
|
+
transition: all var(--intergalactic-duration-extra-slow, 500) ease-in-out;
|
|
53
|
+
animation-name: move-line;
|
|
54
|
+
animation-duration: 0.5s;
|
|
55
|
+
animation-timing-function: ease-in-out;
|
|
56
|
+
animation-fill-mode: forwards;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@keyframes move-line {
|
|
60
|
+
0% {transform: translateX(0);}
|
|
61
|
+
100% {transform: translateX(100%);}
|
|
62
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
SLineGauge[loading],
|
|
2
|
+
SDonutContainer[loading],
|
|
3
|
+
STrendLine[loading],
|
|
4
|
+
STrendBar[loading] {
|
|
5
|
+
animation-name: pulse;
|
|
6
|
+
animation-iteration-count: infinite;
|
|
7
|
+
animation-timing-function: ease-in-out;
|
|
8
|
+
animation-duration: 1.6s;
|
|
9
|
+
will-change: opacity;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@keyframes pulse {
|
|
13
|
+
0% {
|
|
14
|
+
opacity: 1;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
50% {
|
|
18
|
+
opacity: 0.4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
100% {
|
|
22
|
+
opacity: 1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Trend
|
|
13
|
-
import { Box
|
|
14
|
-
import { extractAriaProps
|
|
15
|
-
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { assignProps, sstyled as sstyled$1 } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
12
|
+
import { Trend } from "./Trend.mjs";
|
|
13
|
+
import { Box } from "@semcore/flex-box";
|
|
14
|
+
import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
|
|
15
|
+
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
16
|
+
var style = (
|
|
16
17
|
/*__reshadow_css_start__*/
|
|
17
|
-
(
|
|
18
|
+
(sstyled.insert(
|
|
18
19
|
/*__inner_css_start__*/
|
|
19
|
-
"@keyframes
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
20
|
+
"@keyframes pulse_wwiiw{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_wwiiw_gg_.__loading_wwiiw_gg_,.___SLineGauge_wwiiw_gg_.__loading_wwiiw_gg_,.___STrendBar_wwiiw_gg_.__loading_wwiiw_gg_,.___STrendLine_wwiiw_gg_.__loading_wwiiw_gg_{animation-name:pulse_wwiiw;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
|
|
21
|
+
/*__inner_css_end__*/
|
|
22
|
+
"wwiiw_gg_"
|
|
23
|
+
), /*__reshadow_css_end__*/
|
|
24
|
+
{
|
|
25
|
+
"__SLineGauge": "___SLineGauge_wwiiw_gg_",
|
|
26
|
+
"_loading": "__loading_wwiiw_gg_",
|
|
27
|
+
"__SDonutContainer": "___SDonutContainer_wwiiw_gg_",
|
|
28
|
+
"__STrendLine": "___STrendLine_wwiiw_gg_",
|
|
29
|
+
"__STrendBar": "___STrendBar_wwiiw_gg_",
|
|
30
|
+
"@pulse": "pulse_wwiiw"
|
|
28
31
|
})
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
);
|
|
33
|
+
var TrendBarRoot = /* @__PURE__ */ function(_Trend) {
|
|
34
|
+
_inherits(TrendBarRoot2, _Trend);
|
|
35
|
+
var _super = _createSuper(TrendBarRoot2);
|
|
36
|
+
function TrendBarRoot2() {
|
|
37
|
+
_classCallCheck(this, TrendBarRoot2);
|
|
38
|
+
return _super.apply(this, arguments);
|
|
34
39
|
}
|
|
35
|
-
|
|
40
|
+
_createClass(TrendBarRoot2, [{
|
|
36
41
|
key: "defaultData",
|
|
37
|
-
get: function() {
|
|
42
|
+
get: function get() {
|
|
38
43
|
return [{
|
|
39
44
|
value: 20
|
|
40
45
|
}, {
|
|
@@ -47,60 +52,71 @@ var j = (
|
|
|
47
52
|
}
|
|
48
53
|
}, {
|
|
49
54
|
key: "data",
|
|
50
|
-
get: function() {
|
|
51
|
-
var
|
|
52
|
-
|
|
55
|
+
get: function get() {
|
|
56
|
+
var _this$asProps = this.asProps, data = _this$asProps.data, loading = _this$asProps.loading;
|
|
57
|
+
if (loading) {
|
|
58
|
+
return this.defaultData;
|
|
59
|
+
}
|
|
60
|
+
return data;
|
|
53
61
|
}
|
|
54
62
|
}, {
|
|
55
63
|
key: "render",
|
|
56
|
-
value: function() {
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
value: function render() {
|
|
65
|
+
var _ref = this.asProps, _ref2, _this = this;
|
|
66
|
+
var STrendBar = Box;
|
|
67
|
+
var _this$asProps2 = this.asProps, styles = _this$asProps2.styles, resolveColor = _this$asProps2.resolveColor, isHistogram = _this$asProps2.isHistogram, animate = _this$asProps2.animate, loading = _this$asProps2.loading;
|
|
68
|
+
var step = this.defaultWidth / this.data.length;
|
|
69
|
+
var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
|
70
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", _objectSpread({}, assignProps({
|
|
71
|
+
"ref": this.containerRef,
|
|
72
|
+
"__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
|
|
73
|
+
}, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
|
|
74
|
+
"width": "100%",
|
|
75
|
+
"height": "100%",
|
|
76
|
+
"viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
|
|
77
|
+
"role": "img"
|
|
78
|
+
}, extractedAriaProps)), this.data.map(function(barItem, index) {
|
|
79
|
+
var color = resolveColor("chart-palette-order-other-data");
|
|
80
|
+
if (barItem.color) {
|
|
81
|
+
color = resolveColor(barItem.color);
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ React.createElement("rect", {
|
|
84
|
+
key: index,
|
|
85
|
+
x: step * index,
|
|
86
|
+
y: _this.defaultHeight - barItem.value,
|
|
87
|
+
width: isHistogram ? step : step * 0.8,
|
|
88
|
+
height: barItem.value,
|
|
89
|
+
fill: color
|
|
90
|
+
}, animate && !loading && /* @__PURE__ */ React.createElement("animate", {
|
|
76
91
|
attributeName: "y",
|
|
77
|
-
values: "".concat(
|
|
92
|
+
values: "".concat(_this.defaultHeight, ";").concat(_this.defaultHeight - barItem.value),
|
|
78
93
|
dur: "500ms"
|
|
79
94
|
}));
|
|
80
95
|
})));
|
|
81
96
|
}
|
|
82
|
-
}])
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
}]);
|
|
98
|
+
return TrendBarRoot2;
|
|
99
|
+
}(Trend);
|
|
100
|
+
_defineProperty(TrendBarRoot, "enhance", [resolveColorEnhance()]);
|
|
101
|
+
_defineProperty(TrendBarRoot, "style", style);
|
|
102
|
+
_defineProperty(TrendBarRoot, "defaultProps", {
|
|
103
|
+
animate: true
|
|
88
104
|
});
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
var
|
|
105
|
+
var TrendBar = createComponent(TrendBarRoot);
|
|
106
|
+
TrendBar.displayName = "MiniChart.TrendBar";
|
|
107
|
+
var TrendHistogram = createComponent(TrendBarRoot, {}, {
|
|
92
108
|
enhancements: [function() {
|
|
93
109
|
return {
|
|
94
|
-
wrapperProps: function(
|
|
95
|
-
return
|
|
96
|
-
isHistogram:
|
|
110
|
+
wrapperProps: function wrapperProps(props) {
|
|
111
|
+
return assignProps(props, {
|
|
112
|
+
isHistogram: true
|
|
97
113
|
});
|
|
98
114
|
}
|
|
99
115
|
};
|
|
100
116
|
}]
|
|
101
117
|
});
|
|
102
|
-
|
|
118
|
+
TrendBar.displayName = "MiniChart.TrendHistogram";
|
|
103
119
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
120
|
+
TrendBar,
|
|
121
|
+
TrendHistogram
|
|
106
122
|
};
|
|
@@ -1,140 +1,159 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { sstyled
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { Trend
|
|
14
|
-
import { Box
|
|
15
|
-
import { extractAriaProps
|
|
16
|
-
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { assignProps, sstyled as sstyled$1 } from "@semcore/core";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import resolveColorEnhance from "@semcore/utils/lib/enhances/resolveColorEnhance";
|
|
12
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
13
|
+
import { Trend } from "./Trend.mjs";
|
|
14
|
+
import { Box } from "@semcore/flex-box";
|
|
15
|
+
import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
|
|
16
|
+
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
17
|
+
var style = (
|
|
17
18
|
/*__reshadow_css_start__*/
|
|
18
|
-
(
|
|
19
|
+
(sstyled.insert(
|
|
19
20
|
/*__inner_css_start__*/
|
|
20
|
-
"@keyframes
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
21
|
+
"@keyframes pulse_wwiiw{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_wwiiw_gg_.__loading_wwiiw_gg_,.___SLineGauge_wwiiw_gg_.__loading_wwiiw_gg_,.___STrendBar_wwiiw_gg_.__loading_wwiiw_gg_,.___STrendLine_wwiiw_gg_.__loading_wwiiw_gg_{animation-name:pulse_wwiiw;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
|
|
22
|
+
/*__inner_css_end__*/
|
|
23
|
+
"wwiiw_gg_"
|
|
24
|
+
), /*__reshadow_css_end__*/
|
|
25
|
+
{
|
|
26
|
+
"__SLineGauge": "___SLineGauge_wwiiw_gg_",
|
|
27
|
+
"_loading": "__loading_wwiiw_gg_",
|
|
28
|
+
"__SDonutContainer": "___SDonutContainer_wwiiw_gg_",
|
|
29
|
+
"__STrendLine": "___STrendLine_wwiiw_gg_",
|
|
30
|
+
"__STrendBar": "___STrendBar_wwiiw_gg_",
|
|
31
|
+
"@pulse": "pulse_wwiiw"
|
|
29
32
|
})
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
);
|
|
34
|
+
var TrendLineRoot = /* @__PURE__ */ function(_Trend) {
|
|
35
|
+
_inherits(TrendLineRoot2, _Trend);
|
|
36
|
+
var _super = _createSuper(TrendLineRoot2);
|
|
37
|
+
function TrendLineRoot2() {
|
|
38
|
+
_classCallCheck(this, TrendLineRoot2);
|
|
39
|
+
return _super.apply(this, arguments);
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
_createClass(TrendLineRoot2, [{
|
|
37
42
|
key: "defaultData",
|
|
38
|
-
get: function() {
|
|
43
|
+
get: function get() {
|
|
39
44
|
return [15, 70, 20, 85, 20];
|
|
40
45
|
}
|
|
41
46
|
}, {
|
|
42
47
|
key: "lastPointRadius",
|
|
43
|
-
get: function() {
|
|
44
|
-
var
|
|
45
|
-
return (
|
|
48
|
+
get: function get() {
|
|
49
|
+
var _this$asProps$lastPoi;
|
|
50
|
+
return (_this$asProps$lastPoi = this.asProps.lastPointRadius) !== null && _this$asProps$lastPoi !== void 0 ? _this$asProps$lastPoi : 6;
|
|
46
51
|
}
|
|
47
52
|
}, {
|
|
48
53
|
key: "data",
|
|
49
|
-
get: function() {
|
|
50
|
-
var
|
|
51
|
-
|
|
54
|
+
get: function get() {
|
|
55
|
+
var _this$asProps = this.asProps, data = _this$asProps.data, loading = _this$asProps.loading;
|
|
56
|
+
if (loading) {
|
|
57
|
+
return this.defaultData;
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
52
60
|
}
|
|
53
61
|
}, {
|
|
54
62
|
key: "svgWidth",
|
|
55
|
-
get: function() {
|
|
63
|
+
get: function get() {
|
|
56
64
|
return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
|
|
57
65
|
}
|
|
58
66
|
}, {
|
|
59
67
|
key: "svgHeight",
|
|
60
|
-
get: function() {
|
|
68
|
+
get: function get() {
|
|
61
69
|
return this.asProps.lastPointColor ? this.defaultHeight + this.lastPointRadius : this.defaultHeight;
|
|
62
70
|
}
|
|
63
71
|
}, {
|
|
64
72
|
key: "color",
|
|
65
|
-
get: function() {
|
|
66
|
-
var
|
|
67
|
-
|
|
73
|
+
get: function get() {
|
|
74
|
+
var _this$asProps2 = this.asProps, resolveColor = _this$asProps2.resolveColor, _this$asProps2$color = _this$asProps2.color, color = _this$asProps2$color === void 0 ? "chart-palette-order-1" : _this$asProps2$color, loading = _this$asProps2.loading;
|
|
75
|
+
if (loading) {
|
|
76
|
+
return resolveColor("skeleton-bg");
|
|
77
|
+
}
|
|
78
|
+
return resolveColor(color);
|
|
68
79
|
}
|
|
69
80
|
}, {
|
|
70
81
|
key: "render",
|
|
71
|
-
value: function() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
fill:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
82
|
+
value: function render() {
|
|
83
|
+
var _ref = this.asProps, _ref2;
|
|
84
|
+
var STrendLine = Box;
|
|
85
|
+
var _this$asProps3 = this.asProps, uid = _this$asProps3.uid, withArea = _this$asProps3.withArea, animate = _this$asProps3.animate, lastPointColor = _this$asProps3.lastPointColor, resolveColor = _this$asProps3.resolveColor, loading = _this$asProps3.loading, styles = _this$asProps3.styles;
|
|
86
|
+
var points = [];
|
|
87
|
+
var length = this.data.length;
|
|
88
|
+
var step = this.defaultWidth / (length - 1);
|
|
89
|
+
for (var i = 0; i < length; i++) {
|
|
90
|
+
points.push("".concat(step * i, ",").concat(this.defaultHeight - this.data[i]));
|
|
91
|
+
}
|
|
92
|
+
var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
|
93
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", _objectSpread({}, assignProps({
|
|
94
|
+
"ref": this.containerRef,
|
|
95
|
+
"__excludeProps": ["data"].concat(_toConsumableArray(__excludeProps))
|
|
96
|
+
}, _ref))), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", _objectSpread({
|
|
97
|
+
"width": "100%",
|
|
98
|
+
"height": "100%",
|
|
99
|
+
"viewBox": "0 0 ".concat(this.svgWidth, " ").concat(this.svgHeight),
|
|
100
|
+
"role": "img"
|
|
101
|
+
}, extractedAriaProps)), /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
|
|
102
|
+
"points": points.join(" "),
|
|
103
|
+
"stroke": this.color,
|
|
104
|
+
"strokeWidth": "4",
|
|
105
|
+
"fill": "none",
|
|
106
|
+
"clipPath": "url(#".concat(uid, ")")
|
|
107
|
+
})), withArea && /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
|
|
108
|
+
"points": "0,".concat(this.defaultHeight, " ").concat(points.join(" "), " ").concat(this.defaultWidth, ",").concat(this.defaultHeight),
|
|
109
|
+
"fill": this.color,
|
|
110
|
+
"fillOpacity": 0.2,
|
|
111
|
+
"clipPath": "url(#".concat(uid, ")")
|
|
112
|
+
})), lastPointColor && !loading && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
113
|
+
"cx": step * (length - 1),
|
|
114
|
+
"cy": this.defaultHeight - this.data[length - 1],
|
|
115
|
+
"r": this.lastPointRadius,
|
|
116
|
+
"fill": resolveColor(lastPointColor),
|
|
117
|
+
"stroke": resolveColor("chart-grid-border"),
|
|
118
|
+
"strokeWidth": 4,
|
|
119
|
+
"clipPath": "url(#".concat(uid, ")")
|
|
120
|
+
})), animate && !loading && /* @__PURE__ */ React.createElement("clipPath", _ref2.cn("clipPath", {
|
|
121
|
+
"id": uid
|
|
122
|
+
}), /* @__PURE__ */ React.createElement("rect", _ref2.cn("rect", {
|
|
123
|
+
"x": "0",
|
|
124
|
+
"y": "0",
|
|
125
|
+
"width": "100%",
|
|
126
|
+
"height": "100%",
|
|
127
|
+
"fill": "black"
|
|
128
|
+
}), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
|
|
129
|
+
"dur": "500ms",
|
|
130
|
+
"attributeName": "width",
|
|
131
|
+
"values": "0;100%"
|
|
114
132
|
}))))));
|
|
115
133
|
}
|
|
116
|
-
}])
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
}]);
|
|
135
|
+
return TrendLineRoot2;
|
|
136
|
+
}(Trend);
|
|
137
|
+
_defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
|
|
138
|
+
_defineProperty(TrendLineRoot, "style", style);
|
|
139
|
+
_defineProperty(TrendLineRoot, "defaultProps", {
|
|
140
|
+
animate: true
|
|
122
141
|
});
|
|
123
|
-
var
|
|
124
|
-
|
|
125
|
-
var
|
|
142
|
+
var TrendLine = createComponent(TrendLineRoot);
|
|
143
|
+
TrendLine.displayName = "MiniChart.TrendLine";
|
|
144
|
+
var TrendArea = createComponent(TrendLineRoot, {}, {
|
|
126
145
|
enhancements: [function() {
|
|
127
146
|
return {
|
|
128
|
-
wrapperProps: function(
|
|
129
|
-
return
|
|
130
|
-
withArea:
|
|
147
|
+
wrapperProps: function wrapperProps(props) {
|
|
148
|
+
return assignProps(props, {
|
|
149
|
+
withArea: true
|
|
131
150
|
});
|
|
132
151
|
}
|
|
133
152
|
};
|
|
134
153
|
}]
|
|
135
154
|
});
|
|
136
|
-
|
|
155
|
+
TrendArea.displayName = "MiniChart.TrendArea";
|
|
137
156
|
export {
|
|
138
|
-
|
|
139
|
-
|
|
157
|
+
TrendArea,
|
|
158
|
+
TrendLine
|
|
140
159
|
};
|