@easyv/charts 1.4.15 → 1.4.16

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