1 | import { __assign } from "tslib";
|
2 | import { createRef, jsx } from '@antv/f-engine';
|
3 | import { deepMix } from '@antv/util';
|
4 | function concatPoints(children) {
|
5 | var result = [];
|
6 | for (var i = 0; i < children.length; i++) {
|
7 | var child = children[i];
|
8 | result = result.concat(child.points);
|
9 | }
|
10 | return result;
|
11 | }
|
12 | export default (function (props) {
|
13 | var records = props.records,
|
14 | coord = props.coord,
|
15 | animation = props.animation,
|
16 | EndView = props.endView,
|
17 | clip = props.clip;
|
18 | var _a = coord,
|
19 | left = _a.left,
|
20 | top = _a.top,
|
21 | width = _a.width,
|
22 | height = _a.height,
|
23 | center = _a.center,
|
24 | startAngle = _a.startAngle,
|
25 | endAngle = _a.endAngle,
|
26 | radius = _a.radius;
|
27 | var appear = coord.isPolar ? {
|
28 | easing: 'quadraticOut',
|
29 | duration: 450,
|
30 | clip: {
|
31 | type: 'sector',
|
32 | property: ['endAngle'],
|
33 | style: {
|
34 | cx: center.x,
|
35 | cy: center.y,
|
36 | startAngle: "".concat(startAngle, "rad"),
|
37 | r: radius
|
38 | },
|
39 | start: {
|
40 | endAngle: "".concat(startAngle, "rad")
|
41 | },
|
42 | end: {
|
43 | endAngle: "".concat(endAngle, "rad")
|
44 | }
|
45 | }
|
46 | } : {
|
47 | easing: 'quadraticOut',
|
48 | duration: 450,
|
49 | clip: {
|
50 | type: 'rect',
|
51 | property: ['width'],
|
52 | style: {
|
53 | x: left,
|
54 | y: top,
|
55 | height: height
|
56 | },
|
57 | start: {
|
58 | width: 0
|
59 | },
|
60 | end: {
|
61 | width: width
|
62 | }
|
63 | }
|
64 | };
|
65 | return jsx("group", {
|
66 | style: {
|
67 | clip: clip
|
68 | }
|
69 | }, records.map(function (record) {
|
70 | var _a;
|
71 | var key = record.key,
|
72 | children = record.children;
|
73 | var points = concatPoints(children);
|
74 | var ref = createRef();
|
75 | return jsx("group", {
|
76 | key: key
|
77 | }, children.map(function (child) {
|
78 | var points = child.points,
|
79 | color = child.color,
|
80 | size = child.size,
|
81 | shape = child.shape;
|
82 | var fliterPoints = points.filter(function (point) {
|
83 | return !isNaN(point.x) && !isNaN(point.y);
|
84 | });
|
85 | if (fliterPoints.length === 0) return;
|
86 | return jsx("polyline", {
|
87 | key: key,
|
88 | ref: ref,
|
89 | style: __assign(__assign({
|
90 | points: fliterPoints.map(function (point) {
|
91 | return [point.x, point.y];
|
92 | }),
|
93 | stroke: color
|
94 | }, shape), {
|
95 | lineWidth: size || shape.lineWidth
|
96 | }),
|
97 | animation: deepMix({
|
98 | update: {
|
99 | easing: 'linear',
|
100 | duration: 450,
|
101 | property: ['points']
|
102 | },
|
103 | appear: appear
|
104 | }, animation)
|
105 | });
|
106 | }), EndView ? jsx("group", {
|
107 | style: {
|
108 | offset: ref
|
109 | },
|
110 | animation: deepMix({
|
111 | appear: {
|
112 | easing: 'quadraticOut',
|
113 | duration: 450,
|
114 | property: ['offsetDistance'],
|
115 | start: {
|
116 | offsetDistance: 0
|
117 | },
|
118 | end: {
|
119 | offsetDistance: 1
|
120 | }
|
121 | }
|
122 | }, animation)
|
123 | }, jsx(EndView, {
|
124 | origin: (_a = points[0]) === null || _a === void 0 ? void 0 : _a.origin
|
125 | })) : null);
|
126 | }));
|
127 | }); |
\ | No newline at end of file |