@easyv/charts 1.4.16 → 1.4.17

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.
Files changed (46) hide show
  1. package/lib/components/AnimateData.js +16 -8
  2. package/lib/components/Axis.js +128 -82
  3. package/lib/components/Background.js +24 -16
  4. package/lib/components/Band.js +89 -62
  5. package/lib/components/BaseLine.js +41 -29
  6. package/lib/components/Brush.js +46 -29
  7. package/lib/components/Carousel.js +40 -13
  8. package/lib/components/CartesianChart.js +98 -78
  9. package/lib/components/Chart.js +36 -23
  10. package/lib/components/ChartContainer.js +27 -18
  11. package/lib/components/ConicalGradient.js +68 -35
  12. package/lib/components/ExtentData.js +17 -9
  13. package/lib/components/FilterData.js +27 -16
  14. package/lib/components/Indicator.js +8 -6
  15. package/lib/components/Label.js +112 -82
  16. package/lib/components/Legend.js +66 -41
  17. package/lib/components/Lighter.js +48 -19
  18. package/lib/components/Line.js +59 -39
  19. package/lib/components/LinearGradient.js +20 -14
  20. package/lib/components/Mapping.js +34 -9
  21. package/lib/components/Marquee.js +30 -14
  22. package/lib/components/PieChart.js +400 -306
  23. package/lib/components/StackData.js +18 -8
  24. package/lib/components/StereoBar.js +105 -65
  25. package/lib/components/TextOverflow.js +25 -9
  26. package/lib/components/Tooltip.js +55 -41
  27. package/lib/components/index.js +27 -0
  28. package/lib/context/index.js +2 -0
  29. package/lib/element/ConicGradient.js +35 -29
  30. package/lib/element/Line.js +13 -9
  31. package/lib/element/index.js +2 -0
  32. package/lib/formatter/index.js +2 -0
  33. package/lib/formatter/legend.js +41 -30
  34. package/lib/hooks/index.js +8 -0
  35. package/lib/hooks/useAnimateData.js +16 -3
  36. package/lib/hooks/useAxes.js +115 -65
  37. package/lib/hooks/useCarouselAxisX.js +56 -26
  38. package/lib/hooks/useExtentData.js +46 -14
  39. package/lib/hooks/useFilterData.js +29 -8
  40. package/lib/hooks/useStackData.js +30 -7
  41. package/lib/hooks/useTooltip.js +43 -26
  42. package/lib/index.js +15 -0
  43. package/lib/utils/index.js +247 -95
  44. package/package.json +1 -1
  45. package/src/components/CartesianChart.js +6 -6
  46. package/src/components/TextOverflow.tsx +4 -1
@@ -1,73 +1,87 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = void 0;
9
+
8
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
10
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
11
16
  var _react = require("react");
17
+
12
18
  var _utils = require("../utils");
19
+
13
20
  var _context = require("../context");
21
+
14
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /**
16
- * 轴类图表标签
17
- */
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
+
18
26
  var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
19
27
  var _ref$config = _ref.config,
20
- _ref$config$seriesInt = _ref$config.seriesIntervalWidth,
21
- paddingInner = _ref$config$seriesInt === void 0 ? 0 : _ref$config$seriesInt,
22
- _ref$config$paddingIn = _ref$config.paddingInner,
23
- paddingOuter = _ref$config$paddingIn === void 0 ? 0 : _ref$config$paddingIn,
24
- label = _ref$config.label,
25
- icon = _ref$config.icon,
26
- config = _ref.config,
27
- _ref$bandLength = _ref.bandLength,
28
- bandLength = _ref$bandLength === void 0 ? 0 : _ref$bandLength,
29
- data = _ref.data,
30
- _ref$xAxis = _ref.xAxis,
31
- xScaler = _ref$xAxis.scaler,
32
- step = _ref$xAxis.step,
33
- direction = _ref$xAxis.direction,
34
- _ref$yAxis = _ref.yAxis,
35
- yScaler = _ref$yAxis.scaler,
36
- isClipAxis = _ref$yAxis.isClipAxis,
37
- clipValue = _ref$yAxis.clipValue,
38
- triggerClick = _ref.triggerClick;
28
+ _ref$config$seriesInt = _ref$config.seriesIntervalWidth,
29
+ paddingInner = _ref$config$seriesInt === void 0 ? 0 : _ref$config$seriesInt,
30
+ _ref$config$paddingIn = _ref$config.paddingInner,
31
+ paddingOuter = _ref$config$paddingIn === void 0 ? 0 : _ref$config$paddingIn,
32
+ label = _ref$config.label,
33
+ icon = _ref$config.icon,
34
+ config = _ref.config,
35
+ _ref$bandLength = _ref.bandLength,
36
+ bandLength = _ref$bandLength === void 0 ? 0 : _ref$bandLength,
37
+ data = _ref.data,
38
+ _ref$xAxis = _ref.xAxis,
39
+ xScaler = _ref$xAxis.scaler,
40
+ step = _ref$xAxis.step,
41
+ direction = _ref$xAxis.direction,
42
+ _ref$yAxis = _ref.yAxis,
43
+ yScaler = _ref$yAxis.scaler,
44
+ isClipAxis = _ref$yAxis.isClipAxis,
45
+ clipValue = _ref$yAxis.clipValue,
46
+ triggerClick = _ref.triggerClick;
39
47
  var lineType = config.hasOwnProperty("line"); // 堆叠处理
48
+
40
49
  var showIcon = icon && icon.show;
41
50
  var showLabel = label && label.show;
42
51
  if (!(data.length && (showIcon || showLabel))) return null;
52
+
43
53
  var _useContext = (0, _react.useContext)(_context.chartContext),
44
- width = _useContext.width,
45
- height = _useContext.height;
54
+ width = _useContext.width,
55
+ height = _useContext.height;
56
+
46
57
  var _getSeriesInfo = (0, _utils.getSeriesInfo)({
47
- step: step,
48
- bandLength: bandLength,
49
- paddingInner: paddingInner,
50
- paddingOuter: paddingOuter
51
- }),
52
- seriesStep = _getSeriesInfo.seriesStep,
53
- seriesWidth = _getSeriesInfo.seriesWidth,
54
- seriesStart = _getSeriesInfo.seriesStart;
58
+ step: step,
59
+ bandLength: bandLength,
60
+ paddingInner: paddingInner,
61
+ paddingOuter: paddingOuter
62
+ }),
63
+ seriesStep = _getSeriesInfo.seriesStep,
64
+ seriesWidth = _getSeriesInfo.seriesWidth,
65
+ seriesStart = _getSeriesInfo.seriesStart;
66
+
55
67
  var isVertical = direction === "vertical";
56
68
  var _position = label.position;
57
69
  return /*#__PURE__*/React.createElement("g", {
58
70
  className: "__easyv-label"
59
71
  }, data.map(function (_ref2, i) {
60
72
  var index = _ref2.index,
61
- _ref2$bound = (0, _slicedToArray2["default"])(_ref2.bound, 2),
62
- start = _ref2$bound[0],
63
- end = _ref2$bound[1],
64
- data = _ref2.data,
65
- _ref2$data = _ref2.data,
66
- x = _ref2$data.x,
67
- y = _ref2$data.y,
68
- showY = _ref2$data.showY,
69
- s = _ref2$data.s;
73
+ _ref2$bound = (0, _slicedToArray2["default"])(_ref2.bound, 2),
74
+ start = _ref2$bound[0],
75
+ end = _ref2$bound[1],
76
+ data = _ref2.data,
77
+ _ref2$data = _ref2.data,
78
+ x = _ref2$data.x,
79
+ y = _ref2$data.y,
80
+ showY = _ref2$data.showY,
81
+ s = _ref2$data.s;
82
+
70
83
  var y1, y2;
84
+
71
85
  if (isClipAxis) {
72
86
  if (end > +clipValue) {
73
87
  y1 = yScaler[1](start);
@@ -77,12 +91,12 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
77
91
  y2 = yScaler[1](end);
78
92
  }
79
93
  } else {
80
- y1 = yScaler(isVertical ? end : start);
81
- // 处理z型折线图和堆叠柱图的逻辑冲突
94
+ y1 = yScaler(isVertical ? end : start); // 处理z型折线图和堆叠柱图的逻辑冲突
95
+
82
96
  y2 = lineType ? start ? yScaler(isVertical ? start : end - start) : yScaler(isVertical ? start : end) : yScaler(isVertical ? start : end);
83
- }
97
+ } // const y2 = yScaler(isVertical ? start : end);
98
+
84
99
 
85
- // const y2 = yScaler(isVertical ? start : end);
86
100
  var positionX = xScaler(x) - step / 2 + seriesStart + index * seriesStep;
87
101
  if (isNaN(positionX)) return null;
88
102
  var position = positionX + (config.line ? step : seriesWidth) / 2;
@@ -123,22 +137,24 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
123
137
  }, attr)));
124
138
  }));
125
139
  });
140
+
126
141
  exports["default"] = _default;
142
+
127
143
  var Label = function Label(_ref3) {
128
144
  var x = _ref3.x,
129
- y = _ref3.y,
130
- value = _ref3.value,
131
- _ref3$config = _ref3.config,
132
- font = _ref3$config.font,
133
- _ref3$config$translat = _ref3$config.translate,
134
- _ref3$config$translat2 = _ref3$config$translat.x,
135
- translateX = _ref3$config$translat2 === void 0 ? 0 : _ref3$config$translat2,
136
- _ref3$config$translat3 = _ref3$config$translat.y,
137
- translateY = _ref3$config$translat3 === void 0 ? 0 : _ref3$config$translat3,
138
- _ref3$textAnchor = _ref3.textAnchor,
139
- textAnchor = _ref3$textAnchor === void 0 ? "middle" : _ref3$textAnchor,
140
- _ref3$dominantBaselin = _ref3.dominantBaseline,
141
- dominantBaseline = _ref3$dominantBaselin === void 0 ? "middle" : _ref3$dominantBaselin;
145
+ y = _ref3.y,
146
+ value = _ref3.value,
147
+ _ref3$config = _ref3.config,
148
+ font = _ref3$config.font,
149
+ _ref3$config$translat = _ref3$config.translate,
150
+ _ref3$config$translat2 = _ref3$config$translat.x,
151
+ translateX = _ref3$config$translat2 === void 0 ? 0 : _ref3$config$translat2,
152
+ _ref3$config$translat3 = _ref3$config$translat.y,
153
+ translateY = _ref3$config$translat3 === void 0 ? 0 : _ref3$config$translat3,
154
+ _ref3$textAnchor = _ref3.textAnchor,
155
+ textAnchor = _ref3$textAnchor === void 0 ? "middle" : _ref3$textAnchor,
156
+ _ref3$dominantBaselin = _ref3.dominantBaseline,
157
+ dominantBaseline = _ref3$dominantBaselin === void 0 ? "middle" : _ref3$dominantBaselin;
142
158
  return /*#__PURE__*/React.createElement("text", (0, _extends2["default"])({
143
159
  x: x,
144
160
  y: y,
@@ -150,19 +166,20 @@ var Label = function Label(_ref3) {
150
166
  dominantBaseline: dominantBaseline
151
167
  }, font), value);
152
168
  };
169
+
153
170
  var Icon = function Icon(_ref4) {
154
171
  var cx = _ref4.cx,
155
- cy = _ref4.cy,
156
- _ref4$config = _ref4.config,
157
- mode = _ref4$config.mode,
158
- inner = _ref4$config.inner,
159
- outer = _ref4$config.outer,
160
- color = _ref4$config.color,
161
- radius = _ref4$config.radius,
162
- image = _ref4$config.image,
163
- _ref4$config$size = _ref4$config.size,
164
- width = _ref4$config$size.width,
165
- height = _ref4$config$size.height;
172
+ cy = _ref4.cy,
173
+ _ref4$config = _ref4.config,
174
+ mode = _ref4$config.mode,
175
+ inner = _ref4$config.inner,
176
+ outer = _ref4$config.outer,
177
+ color = _ref4$config.color,
178
+ radius = _ref4$config.radius,
179
+ image = _ref4$config.image,
180
+ _ref4$config$size = _ref4$config.size,
181
+ width = _ref4$config$size.width,
182
+ height = _ref4$config$size.height;
166
183
  return mode == "single" ? /*#__PURE__*/React.createElement(Circle, {
167
184
  cx: cx,
168
185
  cy: cy,
@@ -182,11 +199,12 @@ var Icon = function Icon(_ref4) {
182
199
  xlinkHref: window.appConfig.ASSETS_URL + image
183
200
  }));
184
201
  };
202
+
185
203
  var Circle = function Circle(_ref5) {
186
204
  var cx = _ref5.cx,
187
- cy = _ref5.cy,
188
- color = _ref5.color,
189
- radius = _ref5.radius;
205
+ cy = _ref5.cy,
206
+ color = _ref5.color,
207
+ radius = _ref5.radius;
190
208
  return /*#__PURE__*/React.createElement("circle", {
191
209
  cx: cx,
192
210
  cy: cy,
@@ -195,34 +213,40 @@ var Circle = function Circle(_ref5) {
195
213
  stroke: "none"
196
214
  });
197
215
  };
216
+
198
217
  var getVerticalLabel = function getVerticalLabel(_ref6) {
199
218
  var _ref6$position = _ref6.position,
200
- position = _ref6$position === void 0 ? "outerStart" : _ref6$position,
201
- width = _ref6.width,
202
- y = _ref6.y,
203
- y1 = _ref6.y1,
204
- y2 = _ref6.y2;
219
+ position = _ref6$position === void 0 ? "outerStart" : _ref6$position,
220
+ width = _ref6.width,
221
+ y = _ref6.y,
222
+ y1 = _ref6.y1,
223
+ y2 = _ref6.y2;
224
+
205
225
  switch (position) {
206
226
  case "start":
207
227
  return {
208
228
  x: y > 0 ? y2 : y1,
209
229
  textAnchor: "start"
210
230
  };
231
+
211
232
  case "middle":
212
233
  return {
213
234
  x: (y1 + y2) / 2,
214
235
  textAnchor: "middle"
215
236
  };
237
+
216
238
  case "end":
217
239
  return {
218
240
  x: y > 0 ? y1 : y2,
219
241
  textAnchor: "end"
220
242
  };
243
+
221
244
  case "outerStart":
222
245
  return {
223
246
  x: y1,
224
247
  textAnchor: y > 0 ? "start" : "end"
225
248
  };
249
+
226
250
  case "chartStart":
227
251
  return {
228
252
  x: y > 0 ? width : 0,
@@ -230,34 +254,40 @@ var getVerticalLabel = function getVerticalLabel(_ref6) {
230
254
  };
231
255
  }
232
256
  };
257
+
233
258
  var getHorizontalLabel = function getHorizontalLabel(_ref7) {
234
259
  var _ref7$position = _ref7.position,
235
- position = _ref7$position === void 0 ? "outerStart" : _ref7$position,
236
- height = _ref7.height,
237
- y = _ref7.y,
238
- y1 = _ref7.y1,
239
- y2 = _ref7.y2;
260
+ position = _ref7$position === void 0 ? "outerStart" : _ref7$position,
261
+ height = _ref7.height,
262
+ y = _ref7.y,
263
+ y1 = _ref7.y1,
264
+ y2 = _ref7.y2;
265
+
240
266
  switch (position) {
241
267
  case "start":
242
268
  return {
243
269
  y: y > 0 ? y1 : y2,
244
270
  dominantBaseline: "text-after-edge"
245
271
  };
272
+
246
273
  case "middle":
247
274
  return {
248
275
  y: (y1 + y2) / 2,
249
276
  dominantBaseline: "middle"
250
277
  };
278
+
251
279
  case "end":
252
280
  return {
253
281
  y: y > 0 ? y2 : y1,
254
282
  dominantBaseline: "text-before-edge"
255
283
  };
284
+
256
285
  case "outerStart":
257
286
  return {
258
287
  y: y2,
259
288
  dominantBaseline: y >= 0 ? "text-after-edge" : "text-before-edge"
260
289
  };
290
+
261
291
  case "chartStart":
262
292
  return {
263
293
  y: y > 0 ? 0 : height,
@@ -1,79 +1,96 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
6
+
5
7
  Object.defineProperty(exports, "__esModule", {
6
8
  value: true
7
9
  });
8
10
  exports["default"] = void 0;
11
+
9
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
10
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
11
16
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
+
12
18
  var _react = _interopRequireWildcard(require("react"));
19
+
13
20
  var _utils = require("../utils");
21
+
14
22
  var _TextOverflow = _interopRequireDefault(require("./TextOverflow"));
23
+
15
24
  var _excluded = ["italic", "bold"];
16
- /**
17
- * 图例
18
- */
25
+
19
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
+
20
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
+
21
30
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
+
22
32
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
+
23
34
  var defaultFont = {
24
35
  fontStyle: 'normal',
25
36
  fontWeight: 'normal'
26
37
  };
38
+
27
39
  var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
28
40
  var series = _ref.series,
29
- config = _ref.config,
30
- _ref$config = _ref.config,
31
- show = _ref$config.show,
32
- _ref$config$order = _ref$config.order,
33
- order = _ref$config$order === void 0 ? '' : _ref$config$order,
34
- interactive = _ref$config.interactive,
35
- maxWidth = _ref$config.maxWidth,
36
- textOverflow = _ref$config.textOverflow,
37
- speed = _ref$config.speed,
38
- _ref$config$layout = _ref$config.layout,
39
- _ref$config$layout$al = _ref$config$layout.alignment,
40
- alignment = _ref$config$layout$al === void 0 ? 'right center' : _ref$config$layout$al,
41
- gridTemplateColumns = _ref$config$layout.gridTemplateColumns,
42
- _ref$config$layout$gr = _ref$config$layout.gridGap,
43
- gridColumnGap = _ref$config$layout$gr.gridColumnGap,
44
- gridRowGap = _ref$config$layout$gr.gridRowGap,
45
- _ref$config$layout$tr = _ref$config$layout.translate,
46
- x = _ref$config$layout$tr.x,
47
- y = _ref$config$layout$tr.y,
48
- _ref$config$font = _ref$config.font,
49
- _ref$config$font2 = _ref$config$font === void 0 ? defaultFont : _ref$config$font,
50
- italic = _ref$config$font2.italic,
51
- bold = _ref$config$font2.bold,
52
- font = (0, _objectWithoutProperties2["default"])(_ref$config$font2, _excluded),
53
- _ref$config$unselect = _ref$config.unselect,
54
- _ref$config$unselect2 = _ref$config$unselect === void 0 ? {} : _ref$config$unselect,
55
- _ref$config$unselect3 = _ref$config$unselect2.opacity,
56
- opacity = _ref$config$unselect3 === void 0 ? 1 : _ref$config$unselect3,
57
- filterData = _ref.filterData,
58
- formatter = _ref.formatter,
59
- judge = _ref.judge;
41
+ config = _ref.config,
42
+ _ref$config = _ref.config,
43
+ show = _ref$config.show,
44
+ _ref$config$order = _ref$config.order,
45
+ order = _ref$config$order === void 0 ? '' : _ref$config$order,
46
+ interactive = _ref$config.interactive,
47
+ maxWidth = _ref$config.maxWidth,
48
+ textOverflow = _ref$config.textOverflow,
49
+ speed = _ref$config.speed,
50
+ _ref$config$layout = _ref$config.layout,
51
+ _ref$config$layout$al = _ref$config$layout.alignment,
52
+ alignment = _ref$config$layout$al === void 0 ? 'right center' : _ref$config$layout$al,
53
+ gridTemplateColumns = _ref$config$layout.gridTemplateColumns,
54
+ _ref$config$layout$gr = _ref$config$layout.gridGap,
55
+ gridColumnGap = _ref$config$layout$gr.gridColumnGap,
56
+ gridRowGap = _ref$config$layout$gr.gridRowGap,
57
+ _ref$config$layout$tr = _ref$config$layout.translate,
58
+ x = _ref$config$layout$tr.x,
59
+ y = _ref$config$layout$tr.y,
60
+ _ref$config$font = _ref$config.font;
61
+ _ref$config$font = _ref$config$font === void 0 ? defaultFont : _ref$config$font;
62
+ var italic = _ref$config$font.italic,
63
+ bold = _ref$config$font.bold,
64
+ font = (0, _objectWithoutProperties2["default"])(_ref$config$font, _excluded),
65
+ _ref$config$unselect = _ref$config.unselect;
66
+ _ref$config$unselect = _ref$config$unselect === void 0 ? {} : _ref$config$unselect;
67
+ var _ref$config$unselect$ = _ref$config$unselect.opacity,
68
+ opacity = _ref$config$unselect$ === void 0 ? 1 : _ref$config$unselect$,
69
+ filterData = _ref.filterData,
70
+ formatter = _ref.formatter,
71
+ judge = _ref.judge;
60
72
  if (!show) return null;
73
+
61
74
  var _series = (0, _utils.sortPie)(series, order);
75
+
62
76
  var _alignment$split = alignment.split(' '),
63
- _alignment$split2 = (0, _slicedToArray2["default"])(_alignment$split, 2),
64
- _alignment = _alignment$split2[0],
65
- position = _alignment$split2[1];
77
+ _alignment$split2 = (0, _slicedToArray2["default"])(_alignment$split, 2),
78
+ _alignment = _alignment$split2[0],
79
+ position = _alignment$split2[1];
80
+
66
81
  var length = _series.length;
67
82
  var onClick = (0, _react.useCallback)(function (e) {
68
83
  var dataset = e.currentTarget.dataset;
69
84
  var name = dataset.name;
70
85
  filterData && interactive && filterData(name);
71
86
  }, [interactive, filterData]);
87
+
72
88
  if (judge == 0) {
73
89
  _series.forEach(function (d) {
74
90
  d.percent = 0;
75
91
  });
76
92
  }
93
+
77
94
  return /*#__PURE__*/_react["default"].createElement("div", {
78
95
  className: "__easyv-legend-wrapper",
79
96
  style: _objectSpread({
@@ -90,12 +107,15 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
90
107
  }
91
108
  }, _series.map(function (series, index) {
92
109
  var _series$config, _series$config$line;
110
+
93
111
  var type = series.type,
94
- name = series.name,
95
- displayName = series.displayName,
96
- icon = series.icon,
97
- selected = series.selected;
112
+ name = series.name,
113
+ displayName = series.displayName,
114
+ icon = series.icon,
115
+ selected = series.selected;
116
+
98
117
  var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 ? void 0 : (_series$config = series.config) === null || _series$config === void 0 ? void 0 : (_series$config$line = _series$config.line) === null || _series$config$line === void 0 ? void 0 : _series$config$line.type);
118
+
99
119
  return /*#__PURE__*/_react["default"].createElement("li", {
100
120
  key: index,
101
121
  onClick: onClick,
@@ -120,7 +140,9 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
120
140
  })));
121
141
  })));
122
142
  });
143
+
123
144
  exports["default"] = _default;
145
+
124
146
  var getPosition = function getPosition(position, alignment) {
125
147
  switch (position) {
126
148
  case 'top':
@@ -130,6 +152,7 @@ var getPosition = function getPosition(position, alignment) {
130
152
  top: 5,
131
153
  justifyContent: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
132
154
  };
155
+
133
156
  case 'right':
134
157
  return {
135
158
  top: 0,
@@ -137,6 +160,7 @@ var getPosition = function getPosition(position, alignment) {
137
160
  right: 10,
138
161
  alignItems: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
139
162
  };
163
+
140
164
  case 'left':
141
165
  return {
142
166
  top: 0,
@@ -144,6 +168,7 @@ var getPosition = function getPosition(position, alignment) {
144
168
  left: 10,
145
169
  alignItems: alignment === 'center' ? 'center' : alignment === 'left' ? 'flex-start' : 'flex-end'
146
170
  };
171
+
147
172
  default:
148
173
  return {
149
174
  left: 0,