@easyv/charts 1.6.8 → 1.6.10
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/lib/components/AnimateData.js +13 -22
- package/lib/components/Axis.js +106 -153
- package/lib/components/Background.js +18 -27
- package/lib/components/Band.js +79 -105
- package/lib/components/BaseLine.js +38 -52
- package/lib/components/Brush.js +31 -49
- package/lib/components/Carousel.js +20 -48
- package/lib/components/CartesianChart.js +136 -195
- package/lib/components/Chart.js +37 -59
- package/lib/components/ChartContainer.js +23 -33
- package/lib/components/ConicalGradient.js +38 -72
- package/lib/components/Control.js +61 -101
- package/lib/components/ExtentData.js +13 -22
- package/lib/components/FilterData.js +20 -32
- package/lib/components/Indicator.js +18 -26
- package/lib/components/Label.js +90 -121
- package/lib/components/Legend.js +48 -74
- package/lib/components/Lighter.js +22 -52
- package/lib/components/Line.js +41 -62
- package/lib/components/LinearGradient.js +16 -23
- package/lib/components/Mapping.js +15 -41
- package/lib/components/Marquee.js +23 -40
- package/lib/components/PieChart.js +352 -456
- package/lib/components/StackData.js +12 -23
- package/lib/components/StereoBar.js +69 -110
- package/lib/components/TextOverflow.js +17 -31
- package/lib/components/Tooltip.js +50 -65
- package/lib/components/index.js +1 -31
- package/lib/components/pieTooltip.js +46 -74
- package/lib/context/index.js +1 -4
- package/lib/css/index.module.css +1 -1
- package/lib/element/ConicGradient.js +31 -37
- package/lib/element/Line.js +11 -16
- package/lib/element/index.js +0 -2
- package/lib/formatter/index.js +0 -2
- package/lib/formatter/legend.js +48 -48
- package/lib/hooks/index.js +0 -9
- package/lib/hooks/useAiData.js +16 -27
- package/lib/hooks/useAnimateData.js +7 -21
- package/lib/hooks/useAxes.js +89 -151
- package/lib/hooks/useCarouselAxisX.js +30 -64
- package/lib/hooks/useExtentData.js +24 -65
- package/lib/hooks/useFilterData.js +16 -42
- package/lib/hooks/useStackData.js +11 -35
- package/lib/hooks/useTooltip.js +29 -47
- package/lib/index.js +2 -17
- package/lib/utils/index.js +138 -325
- package/package.json +1 -1
- package/src/components/Band.tsx +1 -1
- package/src/components/CartesianChart.js +2 -2
- package/src/css/index.module.css +1 -1
- package/src/formatter/legend.js +13 -1
|
@@ -1,76 +1,62 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
14
|
+
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; }
|
|
15
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
16
|
+
/**
|
|
17
|
+
* 文字跑马灯组件
|
|
18
|
+
* eg: <Marquee value={文本内容} speed={跑马灯速度} style={额外样式}></Marquee>
|
|
19
|
+
*/
|
|
20
|
+
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
27
21
|
var value = props.value,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
style = props.style,
|
|
23
|
+
_props$speed = props.speed,
|
|
24
|
+
speed = _props$speed === void 0 ? 5 : _props$speed;
|
|
31
25
|
var rootRef = ref || (0, _react.useRef)();
|
|
32
26
|
var target = (0, _react.useRef)(null);
|
|
33
27
|
var observe = (0, _react.useRef)(null);
|
|
34
28
|
var speed_ = (0, _react.useRef)(0); //这里必须用一个ref绑定speed,否则animation中获取不到最新的speed
|
|
35
|
-
|
|
36
29
|
var timer = (0, _react.useRef)();
|
|
37
|
-
|
|
38
30
|
var _useState = (0, _react.useState)(false),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
32
|
+
overflow = _useState2[0],
|
|
33
|
+
setOverflow = _useState2[1];
|
|
43
34
|
speed_.current = speed;
|
|
44
|
-
|
|
45
35
|
var startAnimation = function startAnimation(lineWidth) {
|
|
46
|
-
var
|
|
36
|
+
var _animation = function animation(timestamp) {
|
|
47
37
|
var frame = Math.round(timestamp * speed_.current % (lineWidth * 100) / 100);
|
|
48
38
|
target.current.style.transform = "translate(-".concat(frame, "px,0px)");
|
|
49
39
|
target.current.nextSibling.style.transform = "translate(-".concat(frame, "px,0px)");
|
|
50
|
-
timer.current = requestAnimationFrame(
|
|
40
|
+
timer.current = requestAnimationFrame(_animation);
|
|
51
41
|
};
|
|
52
|
-
|
|
53
|
-
timer.current = requestAnimationFrame(animation);
|
|
42
|
+
timer.current = requestAnimationFrame(_animation);
|
|
54
43
|
};
|
|
55
|
-
|
|
56
44
|
(0, _react.useEffect)(function () {
|
|
57
45
|
//初始化观察器,利用观察器来监视组件可视区域变化
|
|
58
46
|
observe.current = new IntersectionObserver(function (entries) {
|
|
59
47
|
var entrie = entries[0];
|
|
60
|
-
|
|
61
48
|
if (entrie.boundingClientRect.width <= entrie.rootBounds.width) {
|
|
62
49
|
//表示文字全部可视
|
|
63
50
|
cancelAnimationFrame(timer.current || 0);
|
|
64
51
|
target.current.style.transform = "translate(0px,0px)"; //重置偏移
|
|
65
|
-
|
|
66
52
|
setOverflow(false);
|
|
67
53
|
return;
|
|
68
54
|
} else {
|
|
69
55
|
//否则文本溢出
|
|
70
56
|
if (!overflow) {
|
|
71
57
|
cancelAnimationFrame(timer.current || 0);
|
|
72
|
-
startAnimation(entrie.target.offsetWidth);
|
|
73
|
-
|
|
58
|
+
startAnimation(entrie.target.offsetWidth);
|
|
59
|
+
//startAnimation(entrie.boundingClientRect.width);
|
|
74
60
|
setOverflow(true);
|
|
75
61
|
}
|
|
76
62
|
}
|
|
@@ -80,9 +66,8 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
80
66
|
threshold: new Array(101).fill(0).map(function (d, i) {
|
|
81
67
|
return i / 100;
|
|
82
68
|
}) //这里设置了[0-1]之间所有的阈值,保证每一帧的变化都能被观察到
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
69
|
+
});
|
|
70
|
+
// start observing
|
|
86
71
|
observe.current.observe(target.current);
|
|
87
72
|
return function () {
|
|
88
73
|
cancelAnimationFrame(timer.current || 0);
|
|
@@ -113,6 +98,4 @@ var _default = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
113
98
|
}
|
|
114
99
|
});
|
|
115
100
|
}));
|
|
116
|
-
}));
|
|
117
|
-
|
|
118
|
-
exports["default"] = _default;
|
|
101
|
+
}));
|