@semcore/mini-chart 16.1.1 → 17.0.0-prerelease.18
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/README.md +4 -4
- package/lib/cjs/component/score/Donut.js +84 -96
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +104 -108
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/score/Line.types.js.map +1 -1
- package/lib/cjs/component/score/index.js +3 -3
- package/lib/cjs/component/trend/Bar.js +83 -96
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +114 -135
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/cjs/component/trend/Trend.js +43 -65
- package/lib/cjs/component/trend/Trend.js.map +1 -1
- package/lib/cjs/component/trend/index.js +4 -4
- package/lib/cjs/index.js +3 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/ScoreDonutUtils.js +48 -75
- package/lib/cjs/utils/ScoreDonutUtils.js.map +1 -1
- package/lib/es6/component/score/Donut.js +80 -93
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +99 -103
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/score/Line.types.js.map +1 -1
- package/lib/es6/component/trend/Bar.js +78 -91
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +109 -130
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/es6/component/trend/Trend.js +41 -64
- package/lib/es6/component/trend/Trend.js.map +1 -1
- package/lib/es6/index.js +8 -8
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/utils/ScoreDonutUtils.js +43 -71
- package/lib/es6/utils/ScoreDonutUtils.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +80 -79
- package/lib/esm/component/score/Line.mjs +100 -91
- package/lib/esm/component/trend/Bar.mjs +79 -82
- package/lib/esm/component/trend/Line.mjs +110 -116
- package/lib/esm/component/trend/Trend.mjs +41 -61
- package/lib/esm/index.mjs +1 -1
- package/lib/esm/utils/ScoreDonutUtils.mjs +43 -71
- package/lib/types/component/score/Donut.d.ts +7 -12
- package/lib/types/component/score/Line.types.d.ts +8 -6
- package/lib/types/component/trend/Bar.d.ts +2 -8
- package/lib/types/component/trend/Line.d.ts +6 -10
- package/lib/types/component/trend/Trend.d.ts +3 -3
- package/package.json +4 -4
|
@@ -1,110 +1,107 @@
|
|
|
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 _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
2
|
import { createComponent, assignProps, sstyled } from "@semcore/core";
|
|
3
|
+
import { Box } from "@semcore/base-components";
|
|
9
4
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
10
5
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
|
-
import { Box } from "@semcore/flex-box";
|
|
12
6
|
import React from "react";
|
|
13
7
|
import { Trend } from "./Trend.mjs";
|
|
14
8
|
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
15
|
-
|
|
9
|
+
const style = (
|
|
16
10
|
/*__reshadow_css_start__*/
|
|
17
11
|
(sstyled.insert(
|
|
18
12
|
/*__inner_css_start__*/
|
|
19
|
-
"@keyframes
|
|
13
|
+
"@keyframes pulse_1ydx6{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1ydx6_gg_.__loading_1ydx6_gg_,.___SLineGauge_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendBar_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendLine_1ydx6_gg_.__loading_1ydx6_gg_{animation-name:pulse_1ydx6;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
|
|
20
14
|
/*__inner_css_end__*/
|
|
21
|
-
"
|
|
15
|
+
"1ydx6_gg_"
|
|
22
16
|
), /*__reshadow_css_end__*/
|
|
23
17
|
{
|
|
24
|
-
"__SLineGauge": "
|
|
25
|
-
"_loading": "
|
|
26
|
-
"__SDonutContainer": "
|
|
27
|
-
"__STrendLine": "
|
|
28
|
-
"__STrendBar": "
|
|
29
|
-
"@pulse": "
|
|
18
|
+
"__SLineGauge": "___SLineGauge_1ydx6_gg_",
|
|
19
|
+
"_loading": "__loading_1ydx6_gg_",
|
|
20
|
+
"__SDonutContainer": "___SDonutContainer_1ydx6_gg_",
|
|
21
|
+
"__STrendLine": "___STrendLine_1ydx6_gg_",
|
|
22
|
+
"__STrendBar": "___STrendBar_1ydx6_gg_",
|
|
23
|
+
"@pulse": "pulse_1ydx6"
|
|
30
24
|
})
|
|
31
25
|
);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
class TrendBarRoot extends Trend {
|
|
27
|
+
get defaultData() {
|
|
28
|
+
return [{
|
|
29
|
+
value: 20
|
|
30
|
+
}, {
|
|
31
|
+
value: 80
|
|
32
|
+
}, {
|
|
33
|
+
value: 45
|
|
34
|
+
}, {
|
|
35
|
+
value: 10
|
|
36
|
+
}];
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value: 80
|
|
45
|
-
}, {
|
|
46
|
-
value: 45
|
|
47
|
-
}, {
|
|
48
|
-
value: 10
|
|
49
|
-
}];
|
|
38
|
+
get data() {
|
|
39
|
+
const {
|
|
40
|
+
data,
|
|
41
|
+
loading
|
|
42
|
+
} = this.asProps;
|
|
43
|
+
if (loading) {
|
|
44
|
+
return this.defaultData;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
var _ref = this.asProps, _ref2;
|
|
50
|
+
const STrendBar = Box;
|
|
51
|
+
const {
|
|
52
|
+
styles,
|
|
53
|
+
resolveColor,
|
|
54
|
+
isHistogram,
|
|
55
|
+
animate,
|
|
56
|
+
loading
|
|
57
|
+
} = this.asProps;
|
|
58
|
+
const step = this.defaultWidth / this.data.length;
|
|
59
|
+
const {
|
|
60
|
+
__excludeProps,
|
|
61
|
+
extractedAriaProps
|
|
62
|
+
} = extractAriaProps(this.asProps);
|
|
63
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendBar, _ref2.cn("STrendBar", {
|
|
64
|
+
...assignProps({
|
|
69
65
|
"ref": this.containerRef,
|
|
70
|
-
"__excludeProps": ["data"]
|
|
71
|
-
}, _ref)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
66
|
+
"__excludeProps": ["data", ...__excludeProps]
|
|
67
|
+
}, _ref)
|
|
68
|
+
}), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", {
|
|
69
|
+
"width": "100%",
|
|
70
|
+
"height": "100%",
|
|
71
|
+
"viewBox": `0 0 ${this.svgWidth} ${this.svgHeight}`,
|
|
72
|
+
"role": "img",
|
|
73
|
+
...extractedAriaProps
|
|
74
|
+
}), this.data.map((barItem, index) => {
|
|
75
|
+
let color = resolveColor("chart-palette-order-other-data");
|
|
76
|
+
if (barItem.color) {
|
|
77
|
+
color = resolveColor(barItem.color);
|
|
78
|
+
}
|
|
79
|
+
return /* @__PURE__ */ React.createElement("rect", {
|
|
80
|
+
key: index,
|
|
81
|
+
x: step * index,
|
|
82
|
+
y: this.defaultHeight - barItem.value,
|
|
83
|
+
width: isHistogram ? step : step * 0.8,
|
|
84
|
+
height: barItem.value,
|
|
85
|
+
fill: color
|
|
86
|
+
}, animate && !loading && /* @__PURE__ */ React.createElement("animate", {
|
|
87
|
+
attributeName: "y",
|
|
88
|
+
values: `${this.defaultHeight};${this.defaultHeight - barItem.value}`,
|
|
89
|
+
dur: "500ms"
|
|
90
|
+
}));
|
|
91
|
+
})));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
97
94
|
_defineProperty(TrendBarRoot, "enhance", [resolveColorEnhance()]);
|
|
98
95
|
_defineProperty(TrendBarRoot, "style", style);
|
|
99
96
|
_defineProperty(TrendBarRoot, "defaultProps", {
|
|
100
97
|
animate: true
|
|
101
98
|
});
|
|
102
|
-
|
|
99
|
+
const TrendBar = createComponent(TrendBarRoot);
|
|
103
100
|
TrendBar.displayName = "MiniChart.TrendBar";
|
|
104
|
-
|
|
105
|
-
enhancements: [
|
|
101
|
+
const TrendHistogram = createComponent(TrendBarRoot, {}, {
|
|
102
|
+
enhancements: [() => {
|
|
106
103
|
return {
|
|
107
|
-
wrapperProps:
|
|
104
|
+
wrapperProps: (props) => {
|
|
108
105
|
return assignProps(props, {
|
|
109
106
|
isHistogram: true
|
|
110
107
|
});
|
|
@@ -1,147 +1,141 @@
|
|
|
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 _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
2
|
import { createComponent, assignProps, sstyled } from "@semcore/core";
|
|
3
|
+
import { Box } from "@semcore/base-components";
|
|
9
4
|
import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
|
|
10
5
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
11
6
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
12
|
-
import { Box } from "@semcore/flex-box";
|
|
13
7
|
import React from "react";
|
|
14
8
|
import { Trend } from "./Trend.mjs";
|
|
15
9
|
/*!__reshadow-styles__:"../skeleton/skeleton.shadow.css"*/
|
|
16
|
-
|
|
10
|
+
const style = (
|
|
17
11
|
/*__reshadow_css_start__*/
|
|
18
12
|
(sstyled.insert(
|
|
19
13
|
/*__inner_css_start__*/
|
|
20
|
-
"@keyframes
|
|
14
|
+
"@keyframes pulse_1ydx6{0%,to{opacity:1}50%{opacity:.4}}.___SDonutContainer_1ydx6_gg_.__loading_1ydx6_gg_,.___SLineGauge_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendBar_1ydx6_gg_.__loading_1ydx6_gg_,.___STrendLine_1ydx6_gg_.__loading_1ydx6_gg_{animation-name:pulse_1ydx6;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-duration:1.6s;will-change:opacity}",
|
|
21
15
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
16
|
+
"1ydx6_gg_"
|
|
23
17
|
), /*__reshadow_css_end__*/
|
|
24
18
|
{
|
|
25
|
-
"__SLineGauge": "
|
|
26
|
-
"_loading": "
|
|
27
|
-
"__SDonutContainer": "
|
|
28
|
-
"__STrendLine": "
|
|
29
|
-
"__STrendBar": "
|
|
30
|
-
"@pulse": "
|
|
19
|
+
"__SLineGauge": "___SLineGauge_1ydx6_gg_",
|
|
20
|
+
"_loading": "__loading_1ydx6_gg_",
|
|
21
|
+
"__SDonutContainer": "___SDonutContainer_1ydx6_gg_",
|
|
22
|
+
"__STrendLine": "___STrendLine_1ydx6_gg_",
|
|
23
|
+
"__STrendBar": "___STrendBar_1ydx6_gg_",
|
|
24
|
+
"@pulse": "pulse_1ydx6"
|
|
31
25
|
})
|
|
32
26
|
);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return _callSuper(this, TrendLineRoot2, arguments);
|
|
27
|
+
class TrendLineRoot extends Trend {
|
|
28
|
+
get defaultData() {
|
|
29
|
+
return [15, 70, 20, 85, 20];
|
|
37
30
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return (_this$asProps$lastPoi = this.asProps.lastPointRadius) !== null && _this$asProps$lastPoi !== void 0 ? _this$asProps$lastPoi : 6;
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "data",
|
|
52
|
-
get: function get() {
|
|
53
|
-
var _this$asProps = this.asProps, data = _this$asProps.data, loading = _this$asProps.loading;
|
|
54
|
-
if (loading) {
|
|
55
|
-
return this.defaultData;
|
|
56
|
-
}
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
}, {
|
|
60
|
-
key: "svgWidth",
|
|
61
|
-
get: function get() {
|
|
62
|
-
return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
|
|
31
|
+
get lastPointRadius() {
|
|
32
|
+
return this.asProps.lastPointRadius ?? 6;
|
|
33
|
+
}
|
|
34
|
+
get data() {
|
|
35
|
+
const {
|
|
36
|
+
data,
|
|
37
|
+
loading
|
|
38
|
+
} = this.asProps;
|
|
39
|
+
if (loading) {
|
|
40
|
+
return this.defaultData;
|
|
63
41
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
get svgWidth() {
|
|
45
|
+
return this.asProps.lastPointColor ? this.defaultWidth + this.lastPointRadius : this.defaultWidth;
|
|
46
|
+
}
|
|
47
|
+
get svgHeight() {
|
|
48
|
+
return this.asProps.lastPointColor ? this.defaultHeight + this.lastPointRadius : this.defaultHeight;
|
|
49
|
+
}
|
|
50
|
+
get color() {
|
|
51
|
+
const {
|
|
52
|
+
resolveColor,
|
|
53
|
+
color = "chart-palette-order-1",
|
|
54
|
+
loading
|
|
55
|
+
} = this.asProps;
|
|
56
|
+
if (loading) {
|
|
57
|
+
return resolveColor("skeleton-bg");
|
|
68
58
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
return resolveColor(color);
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
var _ref = this.asProps, _ref2;
|
|
63
|
+
const STrendLine = Box;
|
|
64
|
+
const {
|
|
65
|
+
uid,
|
|
66
|
+
withArea,
|
|
67
|
+
animate,
|
|
68
|
+
lastPointColor,
|
|
69
|
+
resolveColor,
|
|
70
|
+
loading,
|
|
71
|
+
styles
|
|
72
|
+
} = this.asProps;
|
|
73
|
+
const points = [];
|
|
74
|
+
const length = this.data.length;
|
|
75
|
+
const step = this.defaultWidth / (length - 1);
|
|
76
|
+
for (let i = 0; i < length; i++) {
|
|
77
|
+
points.push(`${step * i},${this.defaultHeight - this.data[i]}`);
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var points = [];
|
|
85
|
-
var length = this.data.length;
|
|
86
|
-
var step = this.defaultWidth / (length - 1);
|
|
87
|
-
for (var i = 0; i < length; i++) {
|
|
88
|
-
points.push("".concat(step * i, ",").concat(this.defaultHeight - this.data[i]));
|
|
89
|
-
}
|
|
90
|
-
var _extractAriaProps = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps.__excludeProps, extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
|
91
|
-
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", _objectSpread({}, assignProps({
|
|
79
|
+
const {
|
|
80
|
+
__excludeProps,
|
|
81
|
+
extractedAriaProps
|
|
82
|
+
} = extractAriaProps(this.asProps);
|
|
83
|
+
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(STrendLine, _ref2.cn("STrendLine", {
|
|
84
|
+
...assignProps({
|
|
92
85
|
"ref": this.containerRef,
|
|
93
|
-
"__excludeProps": ["data"]
|
|
94
|
-
}, _ref)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
86
|
+
"__excludeProps": ["data", ...__excludeProps]
|
|
87
|
+
}, _ref)
|
|
88
|
+
}), /* @__PURE__ */ React.createElement("svg", _ref2.cn("svg", {
|
|
89
|
+
"width": "100%",
|
|
90
|
+
"height": "100%",
|
|
91
|
+
"viewBox": `0 0 ${this.svgWidth} ${this.svgHeight}`,
|
|
92
|
+
"role": "img",
|
|
93
|
+
...extractedAriaProps
|
|
94
|
+
}), /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
|
|
95
|
+
"points": points.join(" "),
|
|
96
|
+
"stroke": this.color,
|
|
97
|
+
"strokeWidth": "4",
|
|
98
|
+
"fill": "none",
|
|
99
|
+
"clipPath": `url(#${uid})`
|
|
100
|
+
})), withArea && /* @__PURE__ */ React.createElement("polyline", _ref2.cn("polyline", {
|
|
101
|
+
"points": `0,${this.defaultHeight} ${points.join(" ")} ${this.defaultWidth},${this.defaultHeight}`,
|
|
102
|
+
"fill": this.color,
|
|
103
|
+
"fillOpacity": 0.2,
|
|
104
|
+
"clipPath": `url(#${uid})`
|
|
105
|
+
})), lastPointColor && !loading && /* @__PURE__ */ React.createElement("circle", _ref2.cn("circle", {
|
|
106
|
+
"cx": step * (length - 1),
|
|
107
|
+
"cy": this.defaultHeight - this.data[length - 1],
|
|
108
|
+
"r": this.lastPointRadius,
|
|
109
|
+
"fill": resolveColor(lastPointColor),
|
|
110
|
+
"stroke": resolveColor("chart-grid-border"),
|
|
111
|
+
"strokeWidth": 4,
|
|
112
|
+
"clipPath": `url(#${uid})`
|
|
113
|
+
})), animate && !loading && /* @__PURE__ */ React.createElement("clipPath", _ref2.cn("clipPath", {
|
|
114
|
+
"id": uid
|
|
115
|
+
}), /* @__PURE__ */ React.createElement("rect", _ref2.cn("rect", {
|
|
116
|
+
"x": "0",
|
|
117
|
+
"y": "0",
|
|
118
|
+
"width": "100%",
|
|
119
|
+
"height": "100%",
|
|
120
|
+
"fill": "black"
|
|
121
|
+
}), /* @__PURE__ */ React.createElement("animate", _ref2.cn("animate", {
|
|
122
|
+
"dur": "500ms",
|
|
123
|
+
"attributeName": "width",
|
|
124
|
+
"values": "0;100%"
|
|
125
|
+
}))))));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
134
128
|
_defineProperty(TrendLineRoot, "enhance", [resolveColorEnhance(), uniqueIDEnhancement()]);
|
|
135
129
|
_defineProperty(TrendLineRoot, "style", style);
|
|
136
130
|
_defineProperty(TrendLineRoot, "defaultProps", {
|
|
137
131
|
animate: true
|
|
138
132
|
});
|
|
139
|
-
|
|
133
|
+
const TrendLine = createComponent(TrendLineRoot);
|
|
140
134
|
TrendLine.displayName = "MiniChart.TrendLine";
|
|
141
|
-
|
|
142
|
-
enhancements: [
|
|
135
|
+
const TrendArea = createComponent(TrendLineRoot, {}, {
|
|
136
|
+
enhancements: [() => {
|
|
143
137
|
return {
|
|
144
|
-
wrapperProps:
|
|
138
|
+
wrapperProps: (props) => {
|
|
145
139
|
return assignProps(props, {
|
|
146
140
|
withArea: true
|
|
147
141
|
});
|
|
@@ -1,75 +1,55 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
2
|
import { Component } from "@semcore/core";
|
|
7
3
|
import React from "react";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
args[_key] = arguments[_key];
|
|
13
|
-
}
|
|
14
|
-
_classCallCheck(this, Trend2);
|
|
15
|
-
_this = _callSuper(this, Trend2, [].concat(args));
|
|
16
|
-
_defineProperty(_this, "state", {
|
|
4
|
+
class Trend extends Component {
|
|
5
|
+
constructor(...args) {
|
|
6
|
+
super(...args);
|
|
7
|
+
_defineProperty(this, "state", {
|
|
17
8
|
width: 200,
|
|
18
9
|
height: 100
|
|
19
10
|
});
|
|
20
|
-
_defineProperty(
|
|
21
|
-
|
|
11
|
+
_defineProperty(this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
12
|
+
}
|
|
13
|
+
componentDidMount() {
|
|
14
|
+
this.setSizes();
|
|
22
15
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
key: "componentDidMount",
|
|
26
|
-
value: function componentDidMount() {
|
|
16
|
+
componentDidUpdate(prevProps) {
|
|
17
|
+
if (prevProps.w !== this.props.w || prevProps.h !== this.props.h || prevProps.data !== this.props.data) {
|
|
27
18
|
this.setSizes();
|
|
28
19
|
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
key: "setSizes",
|
|
59
|
-
value: function setSizes() {
|
|
60
|
-
if (this.containerRef.current) {
|
|
61
|
-
var boundingClientRect = this.containerRef.current.getBoundingClientRect();
|
|
62
|
-
var width = boundingClientRect.width, height = boundingClientRect.height;
|
|
63
|
-
if (width > 0 && height > 0) {
|
|
64
|
-
this.setState({
|
|
65
|
-
width,
|
|
66
|
-
height
|
|
67
|
-
});
|
|
68
|
-
}
|
|
20
|
+
}
|
|
21
|
+
get defaultWidth() {
|
|
22
|
+
const {
|
|
23
|
+
width,
|
|
24
|
+
height
|
|
25
|
+
} = this.state;
|
|
26
|
+
return width / height * this.defaultHeight;
|
|
27
|
+
}
|
|
28
|
+
get defaultHeight() {
|
|
29
|
+
return 100;
|
|
30
|
+
}
|
|
31
|
+
get svgWidth() {
|
|
32
|
+
return this.defaultWidth;
|
|
33
|
+
}
|
|
34
|
+
get svgHeight() {
|
|
35
|
+
return this.defaultHeight;
|
|
36
|
+
}
|
|
37
|
+
setSizes() {
|
|
38
|
+
if (this.containerRef.current) {
|
|
39
|
+
const boundingClientRect = this.containerRef.current.getBoundingClientRect();
|
|
40
|
+
const {
|
|
41
|
+
width,
|
|
42
|
+
height
|
|
43
|
+
} = boundingClientRect;
|
|
44
|
+
if (width > 0 && height > 0) {
|
|
45
|
+
this.setState({
|
|
46
|
+
width,
|
|
47
|
+
height
|
|
48
|
+
});
|
|
69
49
|
}
|
|
70
50
|
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
73
53
|
export {
|
|
74
54
|
Trend
|
|
75
55
|
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { ScoreDonut, ScoreSemiDonut } from "./component/score/Donut.mjs";
|
|
|
2
2
|
import { ScoreLine } from "./component/score/Line.mjs";
|
|
3
3
|
import { TrendHistogram, TrendBar } from "./component/trend/Bar.mjs";
|
|
4
4
|
import { TrendArea, TrendLine } from "./component/trend/Line.mjs";
|
|
5
|
-
|
|
5
|
+
const miniCharts = {
|
|
6
6
|
TrendLine,
|
|
7
7
|
TrendArea,
|
|
8
8
|
TrendBar,
|