onesight-charts 1.4.5 → 1.4.7

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 (30) hide show
  1. package/dist/onesight-charts.min.js +1 -1
  2. package/es/components/common-bar/index.js +1 -1
  3. package/es/components/custom-line/index.js +16 -13
  4. package/es/components/custom-line/tooltipConfig.js +8 -3
  5. package/es/components/line/index.js +15 -12
  6. package/es/components/line/tooltipConfig.js +8 -3
  7. package/es/components/one-table/index.js +1 -1
  8. package/es/components/pie/legend/index.js +2 -2
  9. package/es/components/stacked-bar/index.js +4 -4
  10. package/es/components/standard-custom-line/index.js +15 -5
  11. package/es/components/standard-custom-line/tooltipConfig.js +8 -3
  12. package/es/components/standard-line/index.js +16 -13
  13. package/es/components/standard-line/tooltipConfig.js +8 -3
  14. package/es/components/vertical-stacked-bar/index.js +2 -2
  15. package/es/utils/chartUtils.js +79 -1
  16. package/lib/components/common-bar/index.js +6 -1
  17. package/lib/components/custom-line/index.js +16 -13
  18. package/lib/components/custom-line/tooltipConfig.js +11 -2
  19. package/lib/components/line/index.js +15 -12
  20. package/lib/components/line/tooltipConfig.js +11 -2
  21. package/lib/components/one-table/index.js +1 -1
  22. package/lib/components/pie/legend/index.js +2 -2
  23. package/lib/components/stacked-bar/index.js +4 -4
  24. package/lib/components/standard-custom-line/index.js +19 -5
  25. package/lib/components/standard-custom-line/tooltipConfig.js +11 -2
  26. package/lib/components/standard-line/index.js +16 -13
  27. package/lib/components/standard-line/tooltipConfig.js +11 -2
  28. package/lib/components/vertical-stacked-bar/index.js +2 -2
  29. package/lib/utils/chartUtils.js +71 -0
  30. package/package.json +1 -1
@@ -452,7 +452,7 @@ function CommonBar(props) {
452
452
  var triangleWidth = 280;
453
453
  var dataIndex = (_res$2 = res[1]) === null || _res$2 === void 0 ? void 0 : _res$2.dataIndex;
454
454
  var originalItem = currentData[dataIndex];
455
- return "<div class='onesight-chart-common-bar-tooltip-box' style=\"width:278px;position: relative;\">\n ".concat(isTooltipTitleShow ? "<div class=\"tooltip-head\">".concat(res[0].format || res[0].name, "</div>") : '', "\n ").concat(originalItem !== null && originalItem !== void 0 && originalItem.currentTime ? "<div class=\"tooltip-time\">".concat(originalItem === null || originalItem === void 0 ? void 0 : originalItem.currentTime, "</div>") : '', "\n <div class='tooltip-body'>\n ").concat(dataArr.map(function (item) {
455
+ return "<div class='onesight-chart-common-bar-tooltip-box' style=\"width:278px;position: relative;\">\n ".concat(isTooltipTitleShow ? "<div class=\"tooltip-head\">\n ".concat(originalItem !== null && originalItem !== void 0 && originalItem.platformIcon ? "<span class=\"icon\">\n <img src=\"".concat(originalItem.platformIcon, "\" alt=\"\">\n </span>") : '', "\n <span>").concat(res[0].format || res[0].name, "</span>\n </div>") : '', "\n ").concat(originalItem !== null && originalItem !== void 0 && originalItem.currentTime ? "<div class=\"tooltip-time\">".concat(originalItem === null || originalItem === void 0 ? void 0 : originalItem.currentTime, "</div>") : '', "\n <div class='tooltip-body'>\n ").concat(dataArr.map(function (item) {
456
456
  var _item$data;
457
457
  var raw = (item === null || item === void 0 || (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.rawValue) !== undefined ? item.data.rawValue : item.value;
458
458
  var itemWithAlias = _objectSpread(_objectSpread({}, item), {}, {
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import * as echarts from 'echarts';
14
14
  import moment from 'moment';
15
15
  import React, { useCallback, useEffect, useRef } from 'react';
16
- import { calculateSeriesTotal, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
16
+ import { calculateSeriesTotal, canvasEllipsisMiddle, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
17
17
  import { defaultChartColors } from "../../utils/colors";
18
18
  import { createCustomTooltip } from "./tooltipConfig";
19
19
  import "./style.scss";
@@ -50,7 +50,11 @@ function CustomLine(props) {
50
50
  _props$legendDropdown = props.legendDropdownRight,
51
51
  legendDropdownRight = _props$legendDropdown === void 0 ? -98 : _props$legendDropdown,
52
52
  _props$showAllLegends = props.showAllLegends,
53
- showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends;
53
+ showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends,
54
+ _props$legendNameMaxW = props.legendNameMaxWidth,
55
+ legendNameMaxWidth = _props$legendNameMaxW === void 0 ? 120 : _props$legendNameMaxW,
56
+ _props$tooltipNameMax = props.tooltipNameMaxWidth,
57
+ tooltipNameMaxWidth = _props$tooltipNameMax === void 0 ? 140 : _props$tooltipNameMax;
54
58
  var chartRef = useRef(null);
55
59
  // 存储上一次的依赖项值,用于深度比较
56
60
  var prevDepsRef = useRef(null);
@@ -259,7 +263,9 @@ function CustomLine(props) {
259
263
  isTotalShow: isTotalShow,
260
264
  xAxis: xAxis,
261
265
  // 传入原始 xAxis 数据
262
- tooltipYOffset: tooltipYOffset // y 方向偏移量
266
+ tooltipYOffset: tooltipYOffset,
267
+ // y 方向偏移量
268
+ tooltipNameMaxWidth: tooltipNameMaxWidth // tooltip 名称最大宽度
263
269
  });
264
270
  var option = {
265
271
  legend: {
@@ -275,14 +281,11 @@ function CustomLine(props) {
275
281
  itemGap: 8,
276
282
  formatter: function formatter(name) {
277
283
  var value = legendValue ? numberFormatMust(seriesTotal[name] || 0) : 0;
278
- var showName = name;
279
- if (dealData.length >= 4) {
280
- var strLen = 15;
281
- if (name.length > strLen) {
282
- showName = name.substring(0, strLen) + '...';
283
- }
284
- }
285
- return legendValue ? "{labelName|".concat(showName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(showName, "}");
284
+ var ellipsisName = canvasEllipsisMiddle(name, legendNameMaxWidth, {
285
+ fontSize: 12,
286
+ fontWeight: 500
287
+ });
288
+ return legendValue ? "{labelName|".concat(ellipsisName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(ellipsisName, "}");
286
289
  },
287
290
  textStyle: {
288
291
  fontWeight: 500,
@@ -298,7 +301,7 @@ function CustomLine(props) {
298
301
  },
299
302
  // 给labelMark添加样式
300
303
  labelMark: {
301
- color: '#7A8283',
304
+ // color: '#7A8283',
302
305
  fontSize: 12,
303
306
  padding: [30, 0, 0, 0]
304
307
  }
@@ -586,7 +589,7 @@ function CustomLine(props) {
586
589
  }, 0)];
587
590
  }));
588
591
  var total = (_legendTotals$name = legendTotals[name]) !== null && _legendTotals$name !== void 0 ? _legendTotals$name : 0;
589
- item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:14px;vertical-align:middle;height:14px;background-color:".concat(colorObj[name], ";border-radius:4px;margin-bottom:2px;margin-right:6px\"></span>\n <span>").concat(name, "</span>\n </div>\n <div class=\"r\" style=\"padding-left:6px;\">\n <span class=\"num\">").concat(numberFormatMust(total), "</span>\n </div>\n ");
592
+ item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:16px;vertical-align:middle;height:4px;background-color:".concat(colorObj[name], ";margin-bottom:2px;margin-right:6px\"></span>\n <span>").concat(name, "</span>\n </div>\n <div class=\"r\" style=\"padding-left:6px;\">\n <span class=\"num\">").concat(numberFormatMust(total), "</span>\n </div>\n ");
590
593
  item.onclick = function () {
591
594
  var opt = myChart.getOption();
592
595
  var legend = Array.isArray(opt.legend) ? opt.legend[0] : opt.legend;
@@ -6,7 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
7
  import moment from 'moment';
8
8
  import 'moment/locale/zh-cn';
9
- import { changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
9
+ import { canvasEllipsisMiddle, changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
10
10
  var formatToolTipDate = function formatToolTipDate(value) {
11
11
  // 根据语言环境设置 moment 的 locale
12
12
  var locale = isZH() ? 'zh-cn' : 'en';
@@ -29,7 +29,9 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
29
29
  isTotalShow = _ref.isTotalShow,
30
30
  xAxis = _ref.xAxis,
31
31
  _ref$tooltipYOffset = _ref.tooltipYOffset,
32
- tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset;
32
+ tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset,
33
+ _ref$tooltipNameMaxWi = _ref.tooltipNameMaxWidth,
34
+ tooltipNameMaxWidth = _ref$tooltipNameMaxWi === void 0 ? 140 : _ref$tooltipNameMaxWi;
33
35
  return {
34
36
  className: "onesight-line-tooltip ".concat(tooltipClassName),
35
37
  trigger: 'axis',
@@ -106,7 +108,10 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
106
108
  marginRight = 3;
107
109
  }
108
110
  return "\n <div class='tooltip-wrap'>\n <div class='tooltip-head'>\n ".concat(formatToolTipDate(originalDate), "\n </div>\n <div class='tooltip-body' style=\"margin-right:").concat(marginRight, "px\">\n ").concat(dataArr.length > 1 && isTotalShow ? "\n <div class='total'>\n <div class='l'>\n ".concat(tooltipTotalName, "\n </div>\n <div class='r'>\n ").concat(changeDataTypeEn(total), "\n </div>\n </div>\n ") : '', "\n ").concat(dataArr.map(function (item) {
109
- return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(item.seriesName, "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
111
+ return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(canvasEllipsisMiddle(item.seriesName, tooltipNameMaxWidth, {
112
+ fontSize: 14,
113
+ fontWeight: 400
114
+ }), "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
110
115
  }).join(''), "\n </div>\n ").concat(tooltipPosition ? '<div class="triangle-down"></div>' : '', "\n </div>\n ");
111
116
  }
112
117
  };
@@ -1,7 +1,7 @@
1
1
  import * as echarts from 'echarts';
2
2
  import moment from 'moment';
3
3
  import React, { useCallback, useEffect, useRef } from 'react';
4
- import { calculateSeriesTotal, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull, toggleAxisPointer } from "../../utils/chartUtils";
4
+ import { calculateSeriesTotal, canvasEllipsisMiddle, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull, toggleAxisPointer } from "../../utils/chartUtils";
5
5
  import { defaultChartColors } from "../../utils/colors";
6
6
  import { createCustomTooltip } from "./tooltipConfig";
7
7
  import "./style.scss";
@@ -39,7 +39,11 @@ function Line(props) {
39
39
  _props$yAxisScale = props.yAxisScale,
40
40
  yAxisScale = _props$yAxisScale === void 0 ? true : _props$yAxisScale,
41
41
  _props$showAllLegends = props.showAllLegends,
42
- showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends;
42
+ showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends,
43
+ _props$legendNameMaxW = props.legendNameMaxWidth,
44
+ legendNameMaxWidth = _props$legendNameMaxW === void 0 ? 120 : _props$legendNameMaxW,
45
+ _props$tooltipNameMax = props.tooltipNameMaxWidth,
46
+ tooltipNameMaxWidth = _props$tooltipNameMax === void 0 ? 140 : _props$tooltipNameMax;
43
47
  var chartRef = useRef(null);
44
48
  // 存储上一次的依赖项值,用于深度比较
45
49
  var prevDepsRef = useRef(null);
@@ -194,7 +198,9 @@ function Line(props) {
194
198
  isTotalShow: isTotalShow,
195
199
  xAxis: xAxis,
196
200
  // 传入原始 xAxis 数据
197
- tooltipYOffset: tooltipYOffset // y 方向偏移量
201
+ tooltipYOffset: tooltipYOffset,
202
+ // y 方向偏移量
203
+ tooltipNameMaxWidth: tooltipNameMaxWidth // tooltip 名称最大宽度
198
204
  });
199
205
  var series = convertSeriesData(seriesData);
200
206
  var legendData = Object.keys(seriesData).map(function (item) {
@@ -219,17 +225,14 @@ function Line(props) {
219
225
  itemGap: 8,
220
226
  formatter: function formatter(name) {
221
227
  var value = legendValue ? numberFormatMust(seriesTotal[name] || 0) : 0;
222
- var showName = name;
223
- if (seriesData.length >= 4) {
224
- var strLen = 15;
225
- if (name.length > strLen) {
226
- showName = name.substring(0, strLen) + '...';
227
- }
228
- }
229
228
  if (sumData) {
230
229
  value = numberFormatMust(sumData);
231
230
  }
232
- return legendValue ? "{labelName|".concat(showName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(showName, "}");
231
+ var ellipsisName = canvasEllipsisMiddle(name, legendNameMaxWidth, {
232
+ fontSize: 12,
233
+ fontWeight: 500
234
+ });
235
+ return legendValue ? "{labelName|".concat(ellipsisName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(ellipsisName, "}");
233
236
  },
234
237
  textStyle: {
235
238
  fontWeight: 500,
@@ -245,7 +248,7 @@ function Line(props) {
245
248
  },
246
249
  // 给labelMark添加样式
247
250
  labelMark: {
248
- color: '#7A8283',
251
+ // color: '#7A8283',
249
252
  fontSize: 12,
250
253
  padding: [30, 0, 0, 0]
251
254
  }
@@ -6,7 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
7
  import moment from 'moment';
8
8
  import 'moment/locale/zh-cn';
9
- import { changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
9
+ import { canvasEllipsisMiddle, changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
10
10
  var formatToolTipDate = function formatToolTipDate(value) {
11
11
  // 根据语言环境设置 moment 的 locale
12
12
  var locale = isZH() ? 'zh-cn' : 'en';
@@ -30,7 +30,9 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
30
30
  isTotalShow = _ref.isTotalShow,
31
31
  xAxis = _ref.xAxis,
32
32
  _ref$tooltipYOffset = _ref.tooltipYOffset,
33
- tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset;
33
+ tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset,
34
+ _ref$tooltipNameMaxWi = _ref.tooltipNameMaxWidth,
35
+ tooltipNameMaxWidth = _ref$tooltipNameMaxWi === void 0 ? 140 : _ref$tooltipNameMaxWi;
34
36
  return {
35
37
  className: "onesight-line-tooltip ".concat(tooltipClassName, " ").concat(id),
36
38
  trigger: 'axis',
@@ -109,7 +111,10 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
109
111
  marginRight = 3;
110
112
  }
111
113
  return "\n <div class='tooltip-wrap'>\n <div class='tooltip-head'>\n ".concat(formatToolTipDate(originalDate), "\n </div>\n <div class='tooltip-body' style=\"margin-right:").concat(marginRight, "px\">\n ").concat(dataArr.length > 1 && isTotalShow ? "\n <div class='total'>\n <div class='l'>\n ".concat(tooltipTotalName, "\n </div>\n <div class='r'>\n ").concat(changeDataTypeEn(total), "\n </div>\n </div>\n ") : '', "\n ").concat(dataArr.map(function (item) {
112
- return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(item.seriesName, "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div>\n </div>\n ");
114
+ return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(canvasEllipsisMiddle(item.seriesName, tooltipNameMaxWidth, {
115
+ fontSize: 14,
116
+ fontWeight: 400
117
+ }), "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div>\n </div>\n ");
113
118
  }).join(''), "\n </div>\n ").concat(tooltipPosition ? '<div class="triangle-down"></div>' : '', "\n </div>\n ");
114
119
  }
115
120
  };
@@ -48,7 +48,7 @@ var LineChart = function LineChart(_ref) {
48
48
  },
49
49
  // 给labelMark添加样式
50
50
  labelMark: {
51
- color: '#7A8283',
51
+ // color: '#7A8283',
52
52
  fontSize: 12,
53
53
  padding: [30, 0, 0, 0]
54
54
  }
@@ -143,8 +143,8 @@ function Legend(props) {
143
143
  }), platformIconMap && platformIconMap[item.name] && /*#__PURE__*/React.createElement("img", {
144
144
  src: platformIconMap[item.name],
145
145
  style: {
146
- width: '13px',
147
- height: '13px',
146
+ width: '16px',
147
+ height: '16px',
148
148
  marginRight: '6px',
149
149
  flexShrink: 0,
150
150
  verticalAlign: 'middle'
@@ -133,7 +133,7 @@ function StackedBar(props) {
133
133
  var legendDataForCheck = series.map(function (s) {
134
134
  return s.name;
135
135
  });
136
- var ICON_SIZE = 18;
136
+ var ICON_SIZE = 16;
137
137
  var ICON_GAP = 0;
138
138
  var MAX_LABEL_WIDTH = 188;
139
139
 
@@ -527,7 +527,7 @@ function StackedBar(props) {
527
527
  icon: 'roundRect',
528
528
  itemWidth: 14,
529
529
  itemHeight: 14,
530
- itemGap: 24,
530
+ itemGap: 8,
531
531
  data: visibleLegends,
532
532
  formatter: function formatter(name) {
533
533
  var rawTotal = seriesTotalMap[name] || 0;
@@ -548,7 +548,7 @@ function StackedBar(props) {
548
548
  },
549
549
  // 给labelMark添加样式
550
550
  labelMark: {
551
- color: '#7A8283',
551
+ // color: '#7A8283',
552
552
  fontSize: 12,
553
553
  padding: [30, 0, 0, 0]
554
554
  }
@@ -813,7 +813,7 @@ function StackedBar(props) {
813
813
  cursor: 'pointer'
814
814
  });
815
815
  var total = (_seriesTotalMap$name = seriesTotalMap[name]) !== null && _seriesTotalMap$name !== void 0 ? _seriesTotalMap$name : 0;
816
- item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:14px;vertical-align:middle;height:14px;background-color:".concat(colorObj[name], ";border-radius:4px;margin-right:6px;flex-shrink:0;\"></span>\n <span style=\"flex:1;min-width:0;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;\">").concat(name, "</span>\n </div>\n <div class=\"r\">\n <span class=\"num\">").concat(numberFormatMust(total), "</span>\n </div>\n ");
816
+ item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:16px;vertical-align:middle;height:4px;background-color:".concat(colorObj[name], ";margin-right:6px;flex-shrink:0;\"></span>\n <span style=\"flex:1;min-width:0;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;\">").concat(name, "</span>\n </div>\n <div class=\"r\">\n <span class=\"num\">").concat(numberFormatMust(total), "</span>\n </div>\n ");
817
817
  item.onclick = function () {
818
818
  var opt = myChart.getOption();
819
819
  var legend = Array.isArray(opt.legend) ? opt.legend[0] : opt.legend;
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  import * as echarts from 'echarts';
14
14
  import moment from 'moment';
15
15
  import React, { useCallback, useEffect, useRef } from 'react';
16
- import { calculateSeriesTotal, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
16
+ import { calculateSeriesTotal, canvasEllipsisMiddle, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
17
17
  import { defaultChartColors } from "../../utils/colors";
18
18
  import { createCustomTooltip } from "./tooltipConfig";
19
19
  import "./style.scss";
@@ -54,7 +54,11 @@ function StandardCustomLine(props) {
54
54
  _props$legendDropdown = props.legendDropdownRight,
55
55
  legendDropdownRight = _props$legendDropdown === void 0 ? -98 : _props$legendDropdown,
56
56
  _props$showAllLegends = props.showAllLegends,
57
- showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends;
57
+ showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends,
58
+ _props$legendNameMaxW = props.legendNameMaxWidth,
59
+ legendNameMaxWidth = _props$legendNameMaxW === void 0 ? 120 : _props$legendNameMaxW,
60
+ _props$tooltipNameMax = props.tooltipNameMaxWidth,
61
+ tooltipNameMaxWidth = _props$tooltipNameMax === void 0 ? 140 : _props$tooltipNameMax;
58
62
  var chartRef = useRef(null);
59
63
  // 存储上一次的依赖项值,用于深度比较
60
64
  var prevDepsRef = useRef(null);
@@ -328,7 +332,9 @@ function StandardCustomLine(props) {
328
332
  // 传入映射,使 tooltip 显示原始 name
329
333
  xAxis: xAxis,
330
334
  // 传入原始 xAxis 数据
331
- tooltipYOffset: tooltipYOffset // y 方向偏移量
335
+ tooltipYOffset: tooltipYOffset,
336
+ // y 方向偏移量
337
+ tooltipNameMaxWidth: tooltipNameMaxWidth // tooltip 名称最大宽度
332
338
  });
333
339
 
334
340
  // 创建 uniqueKey 到索引的映射,用于生成安全的图标键名
@@ -347,7 +353,7 @@ function StandardCustomLine(props) {
347
353
  },
348
354
  // 给labelMark添加样式
349
355
  labelMark: {
350
- color: '#7A8283',
356
+ // color: '#7A8283',
351
357
  fontSize: 12,
352
358
  padding: [30, 0, 0, 0]
353
359
  }
@@ -410,7 +416,11 @@ function StandardCustomLine(props) {
410
416
  var index = nameToIndexMap[name];
411
417
  var iconKey = platformIcon && index !== undefined ? "icon".concat(index) : '';
412
418
  var iconPrefix = iconKey ? "{".concat(iconKey, "|} ") : '';
413
- return legendValue ? "".concat(iconPrefix, "{labelName|").concat(showName, "}\n{labelMark|").concat(value, "}") : "".concat(iconPrefix, "{labelName|").concat(showName, "}");
419
+ var ellipsisName = canvasEllipsisMiddle(showName, legendNameMaxWidth, {
420
+ fontSize: 12,
421
+ fontWeight: 500
422
+ });
423
+ return legendValue ? "".concat(iconPrefix, "{labelName|").concat(ellipsisName, "}\n{labelMark|").concat(value, "}") : "".concat(iconPrefix, "{labelName|").concat(ellipsisName, "}");
414
424
  },
415
425
  textStyle: {
416
426
  fontWeight: 500,
@@ -6,7 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
7
  import moment from 'moment';
8
8
  import 'moment/locale/zh-cn';
9
- import { changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
9
+ import { canvasEllipsisMiddle, changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
10
10
  var formatToolTipDate = function formatToolTipDate(value) {
11
11
  // 根据语言环境设置 moment 的 locale
12
12
  var locale = isZH() ? 'zh-cn' : 'en';
@@ -30,7 +30,9 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
30
30
  keyToNameMap = _ref.keyToNameMap,
31
31
  xAxis = _ref.xAxis,
32
32
  _ref$tooltipYOffset = _ref.tooltipYOffset,
33
- tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset;
33
+ tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset,
34
+ _ref$tooltipNameMaxWi = _ref.tooltipNameMaxWidth,
35
+ tooltipNameMaxWidth = _ref$tooltipNameMaxWi === void 0 ? 140 : _ref$tooltipNameMaxWi;
34
36
  return {
35
37
  className: "onesight-line-tooltip ".concat(tooltipClassName),
36
38
  trigger: 'axis',
@@ -114,7 +116,10 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
114
116
  marginRight = 3;
115
117
  }
116
118
  return "\n <div class='tooltip-wrap'>\n <div class='tooltip-head'>\n ".concat(formatToolTipDate(originalDate), "\n </div>\n <div class='tooltip-body' style=\"margin-right:").concat(marginRight, "px\">\n ").concat(dataArr.length > 1 && isTotalShow ? "\n <div class='total'>\n <div class='l'>\n ".concat(tooltipTotalName, "\n </div>\n <div class='r'>\n ").concat(changeDataTypeEn(total), "\n </div>\n </div>\n ") : '', "\n ").concat(dataArr.map(function (item) {
117
- return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(item.seriesName, "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
119
+ return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(canvasEllipsisMiddle(item.seriesName, tooltipNameMaxWidth, {
120
+ fontSize: 14,
121
+ fontWeight: 400
122
+ }), "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
118
123
  }).join(''), "\n </div>\n ").concat(tooltipPosition ? '<div class="triangle-down"></div>' : '', "\n </div>\n ");
119
124
  }
120
125
  };
@@ -13,7 +13,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
13
13
  import * as echarts from 'echarts';
14
14
  import moment from 'moment';
15
15
  import React, { useCallback, useEffect, useRef } from 'react';
16
- import { calculateSeriesTotal, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
16
+ import { calculateSeriesTotal, canvasEllipsisMiddle, convertSeriesData, dealPath, isZH, numberFormatMust, numberFormatNull } from "../../utils/chartUtils";
17
17
  import { defaultChartColors } from "../../utils/colors";
18
18
  import { createCustomTooltip } from "./tooltipConfig";
19
19
  import "./style.scss";
@@ -54,7 +54,11 @@ function StandardLine(props) {
54
54
  _props$legendDropdown = props.legendDropdownRight,
55
55
  legendDropdownRight = _props$legendDropdown === void 0 ? -98 : _props$legendDropdown,
56
56
  _props$showAllLegends = props.showAllLegends,
57
- showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends;
57
+ showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends,
58
+ _props$legendNameMaxW = props.legendNameMaxWidth,
59
+ legendNameMaxWidth = _props$legendNameMaxW === void 0 ? 120 : _props$legendNameMaxW,
60
+ _props$tooltipNameMax = props.tooltipNameMaxWidth,
61
+ tooltipNameMaxWidth = _props$tooltipNameMax === void 0 ? 140 : _props$tooltipNameMax;
58
62
  var chartRef = useRef(null);
59
63
  var legendMoreBtnRef = useRef(null);
60
64
  var legendDropdownRef = useRef(null);
@@ -267,7 +271,9 @@ function StandardLine(props) {
267
271
  isTotalShow: isTotalShow,
268
272
  xAxis: xAxis,
269
273
  // 传入原始 xAxis 数据
270
- tooltipYOffset: tooltipYOffset // y 方向偏移量
274
+ tooltipYOffset: tooltipYOffset,
275
+ // y 方向偏移量
276
+ tooltipNameMaxWidth: tooltipNameMaxWidth // tooltip 名称最大宽度
271
277
  });
272
278
  var option = {
273
279
  legend: {
@@ -289,14 +295,11 @@ function StandardLine(props) {
289
295
  } else if (sumData) {
290
296
  value = numberFormatMust(sumData);
291
297
  }
292
- var showName = name;
293
- if (dealData.length >= 4) {
294
- var strLen = 15;
295
- if (showName.length > strLen) {
296
- showName = showName.substring(0, strLen) + '...';
297
- }
298
- }
299
- return legendValue ? "{labelName|".concat(showName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(showName, "}");
298
+ var ellipsisName = canvasEllipsisMiddle(name, legendNameMaxWidth, {
299
+ fontSize: 12,
300
+ fontWeight: 500
301
+ });
302
+ return legendValue ? "{labelName|".concat(ellipsisName, "}\n{labelMark|").concat(value, "}") : "{labelName|".concat(ellipsisName, "}");
300
303
  },
301
304
  textStyle: {
302
305
  fontWeight: 500,
@@ -312,7 +315,7 @@ function StandardLine(props) {
312
315
  },
313
316
  // 给labelMark添加样式
314
317
  labelMark: {
315
- color: '#7A8283',
318
+ // color: '#7A8283',
316
319
  fontSize: 12,
317
320
  padding: [30, 0, 0, 0]
318
321
  }
@@ -617,7 +620,7 @@ function StandardLine(props) {
617
620
  } else if (sumData) {
618
621
  total = sumData;
619
622
  }
620
- item.innerHTML = "\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:14px;height:14px;background-color:".concat(colorObj[name], ";border-radius:4px;flex-shrink:0;margin-right:6px\"></span>\n <span class=\"onesight-legend-name\" style=\"flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">").concat(name, "</span>\n <span class=\"onesight-legend-num\" style=\"flex-shrink:0;padding-left:6px\">").concat(numberFormatMust(total), "</span>\n ");
623
+ item.innerHTML = "\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:16px;height:4px;background-color:".concat(colorObj[name], ";flex-shrink:0;margin-right:6px\"></span>\n <span class=\"onesight-legend-name\" style=\"flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap\">").concat(name, "</span>\n <span class=\"onesight-legend-num\" style=\"flex-shrink:0;padding-left:6px\">").concat(numberFormatMust(total), "</span>\n ");
621
624
  item.onclick = function () {
622
625
  var opt = myChart.getOption();
623
626
  var legend = Array.isArray(opt.legend) ? opt.legend[0] : opt.legend;
@@ -6,7 +6,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
6
6
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
7
  import moment from 'moment';
8
8
  import 'moment/locale/zh-cn';
9
- import { changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
9
+ import { canvasEllipsisMiddle, changeDataTypeEn, computeFloatNull, computePos, isZH } from "../../utils/chartUtils";
10
10
  var formatToolTipDate = function formatToolTipDate(value) {
11
11
  // 根据语言环境设置 moment 的 locale
12
12
  var locale = isZH() ? 'zh-cn' : 'en';
@@ -29,7 +29,9 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
29
29
  isTotalShow = _ref.isTotalShow,
30
30
  xAxis = _ref.xAxis,
31
31
  _ref$tooltipYOffset = _ref.tooltipYOffset,
32
- tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset;
32
+ tooltipYOffset = _ref$tooltipYOffset === void 0 ? -4 : _ref$tooltipYOffset,
33
+ _ref$tooltipNameMaxWi = _ref.tooltipNameMaxWidth,
34
+ tooltipNameMaxWidth = _ref$tooltipNameMaxWi === void 0 ? 140 : _ref$tooltipNameMaxWi;
33
35
  return {
34
36
  className: "onesight-line-tooltip ".concat(tooltipClassName),
35
37
  trigger: 'axis',
@@ -108,7 +110,10 @@ export var createCustomTooltip = function createCustomTooltip(_ref) {
108
110
  marginRight = 3;
109
111
  }
110
112
  return "\n <div class='tooltip-wrap'>\n <div class='tooltip-head'>\n ".concat(formatToolTipDate(originalDate), "\n </div>\n <div class='tooltip-body' style=\"margin-right:").concat(marginRight, "px\">\n ").concat(dataArr.length > 1 && isTotalShow ? "\n <div class='total'>\n <div class='l'>\n ".concat(tooltipTotalName, "\n </div>\n <div class='r'>\n ").concat(changeDataTypeEn(total), "\n </div>\n </div>\n ") : '', "\n ").concat(dataArr.map(function (item) {
111
- return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(item.seriesName, "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
113
+ return "\n <div class='item' data-series-item='".concat(JSON.stringify(item), "' key='").concat(item.seriesName, "'>\n <div class='l'>\n <span class='l-color' style=\"background-color:").concat(item.color, "\"></span>\n <span>\n ").concat(canvasEllipsisMiddle(item.seriesName, tooltipNameMaxWidth, {
114
+ fontSize: 14,
115
+ fontWeight: 400
116
+ }), "\n </span>\n </div>\n <div class='r'>\n ").concat(dataArr.length > 1 && showRate ? "<span class='rate'>(".concat(computeFloatNull(item.proportion), ")</span>") : '', "\n <span class='num'>\n ").concat(changeDataTypeEn(item.value), "\n </span>\n </div> \n </div>\n ");
112
117
  }).join(''), "\n </div>\n ").concat(tooltipPosition ? '<div class="triangle-down"></div>' : '', "\n </div>\n ");
113
118
  }
114
119
  };
@@ -577,7 +577,7 @@ function VerticalStackedBar(props) {
577
577
  icon: 'roundRect',
578
578
  itemWidth: 14,
579
579
  itemHeight: 14,
580
- itemGap: 24,
580
+ itemGap: 8,
581
581
  formatter: function formatter(name) {
582
582
  var _legendTotals$name;
583
583
  // name 是 uniqueKey,需要转换为原始 name 用于显示
@@ -805,7 +805,7 @@ function VerticalStackedBar(props) {
805
805
  // 检查是否有 platformIcon
806
806
  var platformIcon = platformIconMap[uniqueKey];
807
807
  var iconHtml = platformIcon ? "<img src=\"".concat(platformIcon, "\" style=\"width:13px;height:13px;margin-right:6px;flex-shrink:0;vertical-align:middle;\" alt=\"\" />") : '';
808
- item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:14px;vertical-align:middle;height:14px;background-color:".concat(colorObj[uniqueKey], ";border-radius:4px;margin-right:6px;flex-shrink:0;\"></span>\n ").concat(iconHtml, "\n <span style=\"flex:1;min-width:0;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;\">").concat(originalName, "</span>\n </div>\n <div class=\"r\">\n <span class=\"num\">").concat(changeDataTypeEn(total), "</span>\n </div>\n ");
808
+ item.innerHTML = "\n <div class=\"l\">\n <span class=\"onesight-legend-chip\" style=\"display:inline-block;width:16px;vertical-align:middle;height:4px;background-color:".concat(colorObj[uniqueKey], ";margin-right:6px;flex-shrink:0;\"></span>\n ").concat(iconHtml, "\n <span style=\"flex:1;min-width:0;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;\">").concat(originalName, "</span>\n </div>\n <div class=\"r\">\n <span class=\"num\">").concat(changeDataTypeEn(total), "</span>\n </div>\n ");
809
809
  item.onclick = function () {
810
810
  var opt = myChart.getOption();
811
811
  var legend = Array.isArray(opt.legend) ? opt.legend[0] : opt.legend;
@@ -3544,4 +3544,82 @@ function numberFormat(num) {
3544
3544
  var fixedNum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
3545
3545
  return numberFormatMust(num, fixedNum);
3546
3546
  }
3547
- export { calculateSeriesTotal, changeDataTypeEn, computeFloat, computeFloatNull, computePos, convertSeriesData, dealBarPath, dealPath, dealSort, isZH, mapEchartsDict, numberFormat, numberFormatMust, numberFormatNull, sumValues, toggleAxisPointer, transformedSeriesData };
3547
+ function canvasGetTextWidth(str) {
3548
+ var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3549
+ if (!str) return 0;
3550
+ var _style$fontSize = style.fontSize,
3551
+ fontSize = _style$fontSize === void 0 ? 12 : _style$fontSize,
3552
+ _style$fontWeight = style.fontWeight,
3553
+ fontWeight = _style$fontWeight === void 0 ? 500 : _style$fontWeight,
3554
+ _style$fontFamily = style.fontFamily,
3555
+ fontFamily = _style$fontFamily === void 0 ? 'sans-serif' : _style$fontFamily;
3556
+ var canvas = document.createElement('canvas');
3557
+ var ctx = canvas.getContext('2d');
3558
+ ctx.font = "".concat(fontWeight, " ").concat(fontSize, "px ").concat(fontFamily);
3559
+ return Math.ceil(ctx.measureText(str).width);
3560
+ }
3561
+ function canvasEllipsisMiddle(str, maxWidth) {
3562
+ var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3563
+ if (!str) return '';
3564
+ if (canvasGetTextWidth(str, style) <= maxWidth) return str;
3565
+ var ellipsis = '...';
3566
+ var left = 1;
3567
+ var testWidth = 0;
3568
+ var arr = [];
3569
+ // 分别从两端开始拼接,保证总宽度 <= maxWidth
3570
+ while (testWidth < maxWidth) {
3571
+ var leftPart = str.slice(0, left);
3572
+ var rightPart = str.slice(-left);
3573
+ var testStr = leftPart + ellipsis + rightPart;
3574
+ testWidth = canvasGetTextWidth(testStr, style);
3575
+ arr.push({
3576
+ left: left,
3577
+ testWidth: testWidth
3578
+ });
3579
+ left++;
3580
+ }
3581
+ var T = 0;
3582
+ for (var i = arr.length - 1; i >= 0; i--) {
3583
+ if (arr[i].testWidth < maxWidth) {
3584
+ T = arr[i].left;
3585
+ break;
3586
+ }
3587
+ }
3588
+ if (T) {
3589
+ return "".concat(str.slice(0, T)).concat(ellipsis).concat(str.slice(-T));
3590
+ } else {
3591
+ return '';
3592
+ }
3593
+ }
3594
+ var TextMeasure = function () {
3595
+ // 创建一个私有隐藏元素用于测量
3596
+ var span = document.createElement('span');
3597
+ span.style.position = 'fixed';
3598
+ span.style.visibility = 'hidden';
3599
+ span.style.whiteSpace = 'nowrap';
3600
+ span.style.pointerEvents = 'none';
3601
+ span.style.left = '-9999px';
3602
+ document.body.appendChild(span);
3603
+ function getWidth(str) {
3604
+ var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3605
+ if (!str) return 0;
3606
+ var _style$fontSize2 = style.fontSize,
3607
+ fontSize = _style$fontSize2 === void 0 ? 14 : _style$fontSize2,
3608
+ _style$fontWeight2 = style.fontWeight,
3609
+ fontWeight = _style$fontWeight2 === void 0 ? 'normal' : _style$fontWeight2,
3610
+ _style$fontFamily2 = style.fontFamily,
3611
+ fontFamily = _style$fontFamily2 === void 0 ? '"PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, "Chinese Quote", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"' : _style$fontFamily2,
3612
+ _style$letterSpacing = style.letterSpacing,
3613
+ letterSpacing = _style$letterSpacing === void 0 ? 0 : _style$letterSpacing;
3614
+ span.style.fontSize = fontSize + 'px';
3615
+ span.style.fontWeight = fontWeight;
3616
+ span.style.letterSpacing = letterSpacing + 'px';
3617
+ span.style.fontFamily = fontFamily;
3618
+ span.textContent = str;
3619
+ return Math.ceil(span.offsetWidth) + 2;
3620
+ }
3621
+ return {
3622
+ getWidth: getWidth
3623
+ };
3624
+ }();
3625
+ export { calculateSeriesTotal, canvasEllipsisMiddle, changeDataTypeEn, computeFloat, computeFloatNull, computePos, convertSeriesData, dealBarPath, dealPath, dealSort, isZH, mapEchartsDict, numberFormat, numberFormatMust, numberFormatNull, sumValues, toggleAxisPointer, transformedSeriesData };
@@ -422,7 +422,12 @@ function CommonBar(props) {
422
422
  const dataIndex = (_b = res[1]) == null ? void 0 : _b.dataIndex;
423
423
  const originalItem = currentData[dataIndex];
424
424
  return `<div class='onesight-chart-common-bar-tooltip-box' style="width:278px;position: relative;">
425
- ${isTooltipTitleShow ? `<div class="tooltip-head">${res[0].format || res[0].name}</div>` : ""}
425
+ ${isTooltipTitleShow ? `<div class="tooltip-head">
426
+ ${(originalItem == null ? void 0 : originalItem.platformIcon) ? `<span class="icon">
427
+ <img src="${originalItem.platformIcon}" alt="">
428
+ </span>` : ""}
429
+ <span>${res[0].format || res[0].name}</span>
430
+ </div>` : ""}
426
431
  ${(originalItem == null ? void 0 : originalItem.currentTime) ? `<div class="tooltip-time">${originalItem == null ? void 0 : originalItem.currentTime}</div>` : ""}
427
432
  <div class='tooltip-body'>
428
433
  ${dataArr.map((item) => {