@easyv/charts 1.10.19 → 1.10.20

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.
@@ -214,8 +214,10 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
214
214
  var isSideLegend = isPieAdaptive && isSidePlacement;
215
215
  var isTopBottomAdaptive = isPieAdaptive && isCenterTopOrBottom;
216
216
  var fullWidth = (_ref3 = componentWidth !== null && componentWidth !== void 0 ? componentWidth : chartWidth) !== null && _ref3 !== void 0 ? _ref3 : 0;
217
- var legendAreaWidth = Math.max(0, fullWidth - marginLeft - marginRight);
218
- var sideLegendMaxWidth = isSideLegend ? Math.max(0, position === "left" || _alignment === "left" ? marginLeft : marginRight) : 0;
217
+ // Adaptive+上下:组件总宽;Adaptive+左右:仅 maxWidth = 总宽 左右 chart.margin,宽度由内容撑开
218
+ var pieLegendFullWidth = Math.max(0, fullWidth);
219
+ var pieLegendInnerWidth = Math.max(0, fullWidth - marginLeft - marginRight);
220
+ var sideLegendMaxWidth = isSideLegend ? pieLegendInnerWidth : 0;
219
221
  var fixedColumnsPerRow = Math.min(Math.max(1, Number(gridTemplateColumns) || 1), length);
220
222
  var isPieTopBottomFixedMultiCol = isPieChart && isFixedWidth && isCenterTopOrBottom && fixedColumnsPerRow > 1;
221
223
  var formatterExtra = _objectSpread(_objectSpread(_objectSpread({}, config), {}, {
@@ -231,7 +233,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
231
233
  }, isSideLegend && sideLegendMaxWidth > 0 ? {
232
234
  adaptiveMaxWidth: sideLegendMaxWidth
233
235
  } : {}), isTopBottomAdaptive ? {
234
- chartWidth: legendAreaWidth
236
+ chartWidth: pieLegendFullWidth
235
237
  } : {});
236
238
  var renderPieSideItem = function renderPieSideItem(series, i) {
237
239
  var _series$config;
@@ -336,8 +338,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
336
338
  if (isTopBottomAdaptive) {
337
339
  var topBottomWrapperStyle = _objectSpread(_objectSpread({
338
340
  position: "absolute",
339
- width: legendAreaWidth || "100%",
340
- maxWidth: legendAreaWidth || "100%",
341
+ width: pieLegendFullWidth || "100%",
342
+ maxWidth: pieLegendFullWidth || "100%",
341
343
  boxSizing: "border-box"
342
344
  }, getPosition(position, _alignment, x, y)), {}, {
343
345
  height: loop.show ? height : "auto",
@@ -322,7 +322,6 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
322
322
  chartHeight = _useContext.height,
323
323
  triggerOnRelative = _useContext.triggerOnRelative,
324
324
  onEmit = _useContext.onEmit;
325
- // chart.margin 以用户配置为准;Adaptive 仅走 Legend 侧栏/顶底排版,不再 updateConfig 写预设边距
326
325
  var _useState = (0, _react.useState)(1),
327
326
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
328
327
  y = _useState2[0],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.10.19",
3
+ "version": "1.10.20",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -232,15 +232,10 @@ export default memo(
232
232
  const isSideLegend = isPieAdaptive && isSidePlacement;
233
233
  const isTopBottomAdaptive = isPieAdaptive && isCenterTopOrBottom;
234
234
  const fullWidth = componentWidth ?? chartWidth ?? 0;
235
- const legendAreaWidth = Math.max(0, fullWidth - marginLeft - marginRight);
236
- const sideLegendMaxWidth = isSideLegend
237
- ? Math.max(
238
- 0,
239
- position === "left" || _alignment === "left"
240
- ? marginLeft
241
- : marginRight,
242
- )
243
- : 0;
235
+ // Adaptive+上下:组件总宽;Adaptive+左右:仅 maxWidth = 总宽 左右 chart.margin,宽度由内容撑开
236
+ const pieLegendFullWidth = Math.max(0, fullWidth);
237
+ const pieLegendInnerWidth = Math.max(0, fullWidth - marginLeft - marginRight);
238
+ const sideLegendMaxWidth = isSideLegend ? pieLegendInnerWidth : 0;
244
239
  const fixedColumnsPerRow = Math.min(
245
240
  Math.max(1, Number(gridTemplateColumns) || 1),
246
241
  length,
@@ -265,7 +260,7 @@ export default memo(
265
260
  ...(isSideLegend && sideLegendMaxWidth > 0
266
261
  ? { adaptiveMaxWidth: sideLegendMaxWidth }
267
262
  : {}),
268
- ...(isTopBottomAdaptive ? { chartWidth: legendAreaWidth } : {}),
263
+ ...(isTopBottomAdaptive ? { chartWidth: pieLegendFullWidth } : {}),
269
264
  };
270
265
 
271
266
  const renderPieSideItem = (series, i) => {
@@ -403,8 +398,8 @@ export default memo(
403
398
  if (isTopBottomAdaptive) {
404
399
  const topBottomWrapperStyle = {
405
400
  position: "absolute",
406
- width: legendAreaWidth || "100%",
407
- maxWidth: legendAreaWidth || "100%",
401
+ width: pieLegendFullWidth || "100%",
402
+ maxWidth: pieLegendFullWidth || "100%",
408
403
  boxSizing: "border-box",
409
404
  ...getPosition(position, _alignment, x, y),
410
405
  height: loop.show ? height : "auto",
@@ -301,7 +301,6 @@ const Component = memo(
301
301
  triggerOnRelative,
302
302
  onEmit,
303
303
  } = useContext(chartContext);
304
- // chart.margin 以用户配置为准;Adaptive 仅走 Legend 侧栏/顶底排版,不再 updateConfig 写预设边距
305
304
  const [y, setY] = useState(1);
306
305
  const radius = (Math.min(chartWidth, chartHeight) / 2) * outerRadius;
307
306