UNPKG

2.03 kBJavaScriptView Raw
1import { __assign } from "tslib";
2import { deepMix, isNil } from '@antv/util';
3import { jsx } from '@antv/f-engine';
4export default (function (props) {
5 var records = props.records,
6 animation = props.animation,
7 clip = props.clip;
8 return jsx("group", {
9 attrs: {
10 clip: clip
11 }
12 }, records.map(function (record) {
13 var key = record.key,
14 children = record.children;
15 return jsx("group", {
16 key: key
17 }, children.map(function (item) {
18 var x = item.x,
19 y = item.y,
20 size = item.size,
21 color = item.color,
22 shapeName = item.shapeName,
23 shape = item.shape;
24 if (isNaN(x) || isNaN(y)) {
25 return null;
26 }
27 if (shapeName === 'rect') {
28 var rectSize = isNil(size) ? shape.size : size;
29 return jsx("rect", {
30 key: key,
31 attrs: __assign(__assign({
32 x: x - rectSize,
33 y: y - rectSize,
34 fill: color,
35 stroke: color
36 }, shape), {
37 width: rectSize * 2,
38 height: rectSize * 2
39 }),
40 animation: deepMix({
41 appear: {
42 easing: 'linear',
43 duration: 450
44 },
45 update: {
46 easing: 'linear',
47 duration: 450,
48 property: ['x', 'y', 'width', 'height', 'fill']
49 }
50 }, animation)
51 });
52 }
53 return jsx("circle", {
54 key: key,
55 style: __assign(__assign({
56 cx: x,
57 cy: y,
58 fill: shapeName === 'circle' ? color : null,
59 stroke: shapeName === 'hollowCircle' ? color : null
60 }, shape), {
61 r: isNil(size) ? shape.size : size
62 }),
63 animation: deepMix({
64 appear: {
65 easing: 'linear',
66 duration: 450
67 },
68 update: {
69 easing: 'linear',
70 duration: 450,
71 property: ['cx', 'cy', 'r', 'fill']
72 }
73 }, animation)
74 });
75 }));
76 }));
77});
\No newline at end of file