@easyv/charts 1.1.8 → 1.2.0
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.
|
@@ -34,13 +34,13 @@ var _default = function _default(data, dataAnimation) {
|
|
|
34
34
|
(0, _react.useEffect)(function () {
|
|
35
35
|
var animateRef = null;
|
|
36
36
|
|
|
37
|
-
if (dataAnimation && data.length) {
|
|
37
|
+
if (dataAnimation && dataAnimation.show && dataAnimation.duration && data.length) {
|
|
38
38
|
animateRef = (0, _popmotion.animate)({
|
|
39
39
|
autoplay: true,
|
|
40
40
|
repeat: 0,
|
|
41
41
|
from: 0,
|
|
42
42
|
to: 1,
|
|
43
|
-
duration:
|
|
43
|
+
duration: dataAnimation.duration * 1000,
|
|
44
44
|
ease: _popmotion.linear,
|
|
45
45
|
onUpdate: function onUpdate(v) {
|
|
46
46
|
setAnimateData(function (oldData) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyv/charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"release": "standard-version",
|
|
8
7
|
"make": "babel src -d lib --extensions .ts,.tsx,.js && cp -r src/css lib",
|
|
9
8
|
"prepare": "husky install"
|
|
10
9
|
},
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"standard-version": "^9.3.2"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@easyv/utils": "^0.0.
|
|
34
|
+
"@easyv/utils": "^0.0.45",
|
|
36
35
|
"d3v7": "npm:d3@^7.0.0",
|
|
37
36
|
"popmotion": "^9.3.6",
|
|
38
37
|
"react": "^17.0.2",
|
|
@@ -12,7 +12,7 @@ export default (Component: ComponentType<any>) =>
|
|
|
12
12
|
...rest
|
|
13
13
|
}: {
|
|
14
14
|
data: DataType[];
|
|
15
|
-
config: { dataAnimation:
|
|
15
|
+
config: { dataAnimation: DataAnimation; [key: string]: any };
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}) => (
|
|
18
18
|
<Component
|
|
@@ -8,18 +8,23 @@ import { animate, linear } from 'popmotion';
|
|
|
8
8
|
* @returns 改变后的数据
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export default (data: DataType[], dataAnimation:
|
|
11
|
+
export default (data: DataType[], dataAnimation: DataAnimation) => {
|
|
12
12
|
const [animateData, setAnimateData] = useState<DataType[]>([]);
|
|
13
13
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
let animateRef: any = null;
|
|
16
|
-
if (
|
|
16
|
+
if (
|
|
17
|
+
dataAnimation &&
|
|
18
|
+
dataAnimation.show &&
|
|
19
|
+
dataAnimation.duration &&
|
|
20
|
+
data.length
|
|
21
|
+
) {
|
|
17
22
|
animateRef = animate({
|
|
18
23
|
autoplay: true,
|
|
19
24
|
repeat: 0,
|
|
20
25
|
from: 0,
|
|
21
26
|
to: 1,
|
|
22
|
-
duration:
|
|
27
|
+
duration: dataAnimation.duration * 1000,
|
|
23
28
|
ease: linear,
|
|
24
29
|
onUpdate: (v: number) => {
|
|
25
30
|
setAnimateData((oldData: DataType[]) => {
|