@easyv/charts 1.8.23 → 1.8.24
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.
- package/lib/components/Legend.js +68 -62
- package/lib/components/PieChart.js +2 -0
- package/lib/components/pieTooltip.js +19 -21
- package/package.json +1 -1
- package/src/components/Legend.js +222 -135
- package/src/components/PieChart.js +2 -0
- package/src/components/PieTooltip.jsx +279 -198
package/lib/components/Legend.js
CHANGED
|
@@ -22,8 +22,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
24
|
var defaultFont = {
|
|
25
|
-
fontStyle:
|
|
26
|
-
fontWeight:
|
|
25
|
+
fontStyle: "normal",
|
|
26
|
+
fontWeight: "normal"
|
|
27
27
|
};
|
|
28
28
|
var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
29
29
|
var _config$value, _config$percent, _config$value2, _config$value3, _config$name;
|
|
@@ -33,7 +33,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
33
33
|
_ref$config = _ref.config,
|
|
34
34
|
show = _ref$config.show,
|
|
35
35
|
_ref$config$order = _ref$config.order,
|
|
36
|
-
order = _ref$config$order === void 0 ?
|
|
36
|
+
order = _ref$config$order === void 0 ? "" : _ref$config$order,
|
|
37
37
|
interactive = _ref$config.interactive,
|
|
38
38
|
LegendType = _ref$config.LegendType,
|
|
39
39
|
maxWidth = _ref$config.maxWidth,
|
|
@@ -41,7 +41,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
41
41
|
speed = _ref$config.speed,
|
|
42
42
|
_ref$config$layout = _ref$config.layout,
|
|
43
43
|
_ref$config$layout$al = _ref$config$layout.alignment,
|
|
44
|
-
alignment = _ref$config$layout$al === void 0 ?
|
|
44
|
+
alignment = _ref$config$layout$al === void 0 ? "right center" : _ref$config$layout$al,
|
|
45
45
|
gridTemplateColumns = _ref$config$layout.gridTemplateColumns,
|
|
46
46
|
_ref$config$layout$gr = _ref$config$layout.gridGap,
|
|
47
47
|
gridColumnGap = _ref$config$layout$gr.gridColumnGap,
|
|
@@ -62,7 +62,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
62
62
|
opacity = _ref$config$unselect3 === void 0 ? 1 : _ref$config$unselect3,
|
|
63
63
|
filterData = _ref.filterData,
|
|
64
64
|
formatter = _ref.formatter,
|
|
65
|
-
judge = _ref.judge
|
|
65
|
+
judge = _ref.judge,
|
|
66
|
+
pieClick = _ref.pieClick;
|
|
66
67
|
if (!show) return null;
|
|
67
68
|
var ref_container = (0, _react.useRef)(null); // 滚动容器
|
|
68
69
|
var ref_scrollTop = (0, _react.useRef)(0); // 当前滚动距离
|
|
@@ -75,7 +76,7 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
75
76
|
// 初始化行高
|
|
76
77
|
(0, _react.useEffect)(function () {
|
|
77
78
|
if (ref_container.current) {
|
|
78
|
-
var rowHeight = ref_container.current.querySelector(
|
|
79
|
+
var rowHeight = ref_container.current.querySelector("li").clientHeight + gridRowGap;
|
|
79
80
|
setScrollStep(rowHeight);
|
|
80
81
|
}
|
|
81
82
|
}, [gridRowGap]);
|
|
@@ -106,11 +107,11 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
106
107
|
}
|
|
107
108
|
table.scrollTo({
|
|
108
109
|
top: ref_scrollTop.current,
|
|
109
|
-
behavior:
|
|
110
|
+
behavior: "smooth"
|
|
110
111
|
});
|
|
111
112
|
};
|
|
112
113
|
var _series = (0, _utils.sortPie)(series, order);
|
|
113
|
-
var _alignment$split = alignment.split(
|
|
114
|
+
var _alignment$split = alignment.split(" "),
|
|
114
115
|
_alignment$split2 = (0, _slicedToArray2["default"])(_alignment$split, 2),
|
|
115
116
|
_alignment = _alignment$split2[0],
|
|
116
117
|
position = _alignment$split2[1];
|
|
@@ -119,7 +120,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
119
120
|
var dataset = e.currentTarget.dataset;
|
|
120
121
|
var name = dataset.name;
|
|
121
122
|
filterData && interactive && filterData(name);
|
|
122
|
-
|
|
123
|
+
pieClick && pieClick(e);
|
|
124
|
+
}, [interactive, filterData, pieClick]);
|
|
123
125
|
if (judge == 0) {
|
|
124
126
|
_series.forEach(function (d) {
|
|
125
127
|
d.percent = 0;
|
|
@@ -129,75 +131,77 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
129
131
|
// 计算最大宽度
|
|
130
132
|
var valueFont = ((_config$value = config.value) === null || _config$value === void 0 ? void 0 : _config$value.font) || {};
|
|
131
133
|
var percentFont = ((_config$percent = config.percent) === null || _config$percent === void 0 ? void 0 : _config$percent.font) || {};
|
|
132
|
-
var valueSuffix = ((_config$value2 = config.value) === null || _config$value2 === void 0 || (_config$value2 = _config$value2.suffix) === null || _config$value2 === void 0 ? void 0 : _config$value2.text) ||
|
|
134
|
+
var valueSuffix = ((_config$value2 = config.value) === null || _config$value2 === void 0 || (_config$value2 = _config$value2.suffix) === null || _config$value2 === void 0 ? void 0 : _config$value2.text) || "";
|
|
133
135
|
var valueSplitConfig = ((_config$value3 = config.value) === null || _config$value3 === void 0 ? void 0 : _config$value3.splitConfig) || {};
|
|
134
136
|
var getValueStr = function getValueStr(item) {
|
|
135
137
|
var _ref2, _item$data$y, _item$data;
|
|
136
|
-
var valueStr = ((_ref2 = (_item$data$y = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.y) !== null && _item$data$y !== void 0 ? _item$data$y : item.value) !== null && _ref2 !== void 0 ? _ref2 :
|
|
138
|
+
var valueStr = ((_ref2 = (_item$data$y = (_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.y) !== null && _item$data$y !== void 0 ? _item$data$y : item.value) !== null && _ref2 !== void 0 ? _ref2 : "") + (valueSuffix || "");
|
|
137
139
|
if (valueSplitConfig.show && valueSplitConfig.separator) {
|
|
138
140
|
valueStr = valueStr.toString().replace(/\B(?=(\d{3})+(?!\d))/g, valueSplitConfig.separator);
|
|
139
141
|
}
|
|
140
142
|
return valueStr;
|
|
141
143
|
};
|
|
142
144
|
var valueMaxWidth = Math.max.apply(Math, (0, _toConsumableArray2["default"])(_series.map(function (item) {
|
|
143
|
-
return parseFloat(getCanvasTextWidth(getValueStr(item), valueFont.letterSpacing || 0, "".concat(valueFont.fontSize || 12, "px ").concat(valueFont.fontFamily ||
|
|
145
|
+
return parseFloat(getCanvasTextWidth(getValueStr(item), valueFont.letterSpacing || 0, "".concat(valueFont.fontSize || 12, "px ").concat(valueFont.fontFamily || "Arial")));
|
|
144
146
|
})));
|
|
145
147
|
var percentMaxWidth = Math.max.apply(Math, (0, _toConsumableArray2["default"])(_series.map(function (item) {
|
|
146
148
|
var _item$data2;
|
|
147
|
-
var percentStr = (item.percent !== undefined ? item.percent : (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.percent) +
|
|
148
|
-
return parseFloat(getCanvasTextWidth(percentStr, percentFont.letterSpacing || 0, "".concat(percentFont.fontSize || 12, "px ").concat(percentFont.fontFamily ||
|
|
149
|
+
var percentStr = (item.percent !== undefined ? item.percent : (_item$data2 = item.data) === null || _item$data2 === void 0 ? void 0 : _item$data2.percent) + "%";
|
|
150
|
+
return parseFloat(getCanvasTextWidth(percentStr, percentFont.letterSpacing || 0, "".concat(percentFont.fontSize || 12, "px ").concat(percentFont.fontFamily || "Arial")));
|
|
149
151
|
})));
|
|
150
152
|
var nameMaxWidth = ((_config$name = config.name) === null || _config$name === void 0 ? void 0 : _config$name.maxWidth) || 80;
|
|
151
153
|
var stylePieOrAxis = formatter ? _objectSpread(_objectSpread({
|
|
152
|
-
display:
|
|
154
|
+
display: "flex",
|
|
153
155
|
alignContent: alignment.split(" ")[0] == "center" && (alignment.split(" ")[1] == "left" || alignment.split(" ")[1] == "right") ? alignment.split(" ")[1] == "left" ? "flex-start" : "flex-end" : alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
|
|
154
156
|
flexDirection: "column",
|
|
155
|
-
position:
|
|
157
|
+
position: "absolute"
|
|
156
158
|
}, getPosition(position, _alignment, x, y)), {}, {
|
|
157
|
-
height: loop.show ? height :
|
|
158
|
-
overflowY: loop.show ?
|
|
159
|
+
height: loop.show ? height : "auto",
|
|
160
|
+
overflowY: loop.show ? "scroll" : "auto"
|
|
159
161
|
}) : _objectSpread(_objectSpread({
|
|
160
|
-
display:
|
|
162
|
+
display: "flex",
|
|
161
163
|
flexWrap: "wrap",
|
|
162
164
|
alignContent: alignment.split(" ")[0] == "center" && (alignment.split(" ")[1] == "left" || alignment.split(" ")[1] == "right") ? alignment.split(" ")[1] == "left" ? "flex-start" : "flex-end" : alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
|
|
163
165
|
flexDirection: "column",
|
|
164
|
-
position:
|
|
166
|
+
position: "absolute"
|
|
165
167
|
}, getPosition(position, _alignment, x, y)), {}, {
|
|
166
|
-
height: loop.show ? height :
|
|
167
|
-
overflowY: loop.show ?
|
|
168
|
+
height: loop.show ? height : "auto",
|
|
169
|
+
overflowY: loop.show ? "scroll" : "auto"
|
|
168
170
|
});
|
|
169
171
|
return LegendType == "FixedWidth" ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
170
172
|
className: "__easyv-legend-wrapper",
|
|
171
173
|
style: _objectSpread(_objectSpread({
|
|
172
|
-
position:
|
|
173
|
-
display:
|
|
174
|
+
position: "absolute",
|
|
175
|
+
display: "flex"
|
|
174
176
|
}, getPosition(position, _alignment, x, y)), {}, {
|
|
175
|
-
height: loop.show ? height :
|
|
176
|
-
overflowY: loop.show ?
|
|
177
|
+
height: loop.show ? height : "auto",
|
|
178
|
+
overflowY: loop.show ? "scroll" : "auto"
|
|
177
179
|
}),
|
|
178
180
|
ref: ref_container
|
|
179
181
|
}, /*#__PURE__*/_react["default"].createElement("ul", {
|
|
180
182
|
style: {
|
|
181
|
-
display:
|
|
182
|
-
gridGap: gridRowGap +
|
|
183
|
-
gridTemplateColumns: formatter ? "".concat(nameMaxWidth, "px ").concat(valueMaxWidth, "px ").concat(percentMaxWidth, "px") :
|
|
183
|
+
display: "grid",
|
|
184
|
+
gridGap: gridRowGap + "px " + gridColumnGap + "px",
|
|
185
|
+
gridTemplateColumns: formatter ? "".concat(nameMaxWidth, "px ").concat(valueMaxWidth, "px ").concat(percentMaxWidth, "px") : "repeat(" + Math.min(gridTemplateColumns, length) + ", 1fr)" //饼图或者柱状图配合不同的图例显示格式
|
|
184
186
|
}
|
|
185
|
-
}, _series.map(function (series,
|
|
187
|
+
}, _series.map(function (series, i) {
|
|
186
188
|
var _series$config;
|
|
187
189
|
var type = series.type,
|
|
188
190
|
name = series.name,
|
|
189
191
|
displayName = series.displayName,
|
|
190
192
|
icon = series.icon,
|
|
191
|
-
selected = series.selected
|
|
193
|
+
selected = series.selected,
|
|
194
|
+
index = series.index;
|
|
192
195
|
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 || (_series$config = series.config) === null || _series$config === void 0 || (_series$config = _series$config.line) === null || _series$config === void 0 ? void 0 : _series$config.type);
|
|
193
196
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
194
|
-
key:
|
|
197
|
+
key: i,
|
|
195
198
|
onClick: onClick,
|
|
196
|
-
"data-name": name,
|
|
199
|
+
"data-name": displayName || name,
|
|
200
|
+
"data-index": index,
|
|
197
201
|
style: {
|
|
198
|
-
display:
|
|
202
|
+
display: "flex",
|
|
199
203
|
opacity: selected === false ? opacity / 100 : 1,
|
|
200
|
-
alignItems:
|
|
204
|
+
alignItems: "center",
|
|
201
205
|
cursor: "pointer",
|
|
202
206
|
gap: _icon.gap
|
|
203
207
|
}
|
|
@@ -212,8 +216,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
212
216
|
value: displayName || name,
|
|
213
217
|
style: _objectSpread(_objectSpread({}, font), {}, {
|
|
214
218
|
width: maxWidth,
|
|
215
|
-
fontStyle: italic ?
|
|
216
|
-
fontWeight: bold ?
|
|
219
|
+
fontStyle: italic ? "italic" : "normal",
|
|
220
|
+
fontWeight: bold ? "bold" : "normal"
|
|
217
221
|
}),
|
|
218
222
|
speed: speed
|
|
219
223
|
})));
|
|
@@ -225,29 +229,31 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
225
229
|
return /*#__PURE__*/_react["default"].createElement("ul", {
|
|
226
230
|
key: indexs,
|
|
227
231
|
style: (0, _defineProperty2["default"])({
|
|
228
|
-
display:
|
|
229
|
-
width:
|
|
232
|
+
display: "flex",
|
|
233
|
+
width: "fit-content",
|
|
230
234
|
justifyContent: alignment.split(" ")[0] == "left" ? "flex-start" : alignment.split(" ")[0] == "center" ? "center" : "flex-end",
|
|
231
235
|
marginBottom: "0px",
|
|
232
236
|
gap: "".concat(gridRowGap, "px ").concat(gridColumnGap, "px")
|
|
233
237
|
}, "marginBottom", gridRowGap + "px")
|
|
234
|
-
}, _series.map(function (series,
|
|
235
|
-
if (Math.floor(
|
|
238
|
+
}, _series.map(function (series, i) {
|
|
239
|
+
if (Math.floor(i / gridTemplateColumns) == indexs) {
|
|
236
240
|
var _series$config2;
|
|
237
241
|
var type = series.type,
|
|
238
242
|
name = series.name,
|
|
239
243
|
displayName = series.displayName,
|
|
240
244
|
icon = series.icon,
|
|
241
|
-
selected = series.selected
|
|
245
|
+
selected = series.selected,
|
|
246
|
+
index = series.index;
|
|
242
247
|
var _icon = (0, _utils.getIcon)(type, icon, series === null || series === void 0 || (_series$config2 = series.config) === null || _series$config2 === void 0 || (_series$config2 = _series$config2.line) === null || _series$config2 === void 0 ? void 0 : _series$config2.type);
|
|
243
248
|
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
244
|
-
key:
|
|
249
|
+
key: i,
|
|
245
250
|
onClick: onClick,
|
|
246
|
-
"data-name": name,
|
|
251
|
+
"data-name": displayName || name,
|
|
252
|
+
"data-index": index,
|
|
247
253
|
style: {
|
|
248
|
-
display:
|
|
254
|
+
display: "flex",
|
|
249
255
|
opacity: selected === false ? opacity / 100 : 1,
|
|
250
|
-
alignItems:
|
|
256
|
+
alignItems: "center",
|
|
251
257
|
cursor: "pointer",
|
|
252
258
|
gap: _icon.gap
|
|
253
259
|
}
|
|
@@ -262,8 +268,8 @@ var _default = exports["default"] = /*#__PURE__*/(0, _react.memo)(function (_ref
|
|
|
262
268
|
type: "ellipsis",
|
|
263
269
|
value: displayName || name,
|
|
264
270
|
style: _objectSpread(_objectSpread({}, font), {}, {
|
|
265
|
-
fontStyle: italic ?
|
|
266
|
-
fontWeight: bold ?
|
|
271
|
+
fontStyle: italic ? "italic" : "normal",
|
|
272
|
+
fontWeight: bold ? "bold" : "normal",
|
|
267
273
|
minWidth: getCanvasTextWidth(displayName ? displayName.substring(0, 5) || name.substring(0, 5) : "", font.letterSpacing, "".concat(font.fontSize, "px ").concat(font.fontFamily))
|
|
268
274
|
}),
|
|
269
275
|
speed: speed
|
|
@@ -276,39 +282,39 @@ var getPosition = function getPosition(position, alignment) {
|
|
|
276
282
|
var x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
277
283
|
var y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
278
284
|
switch (position) {
|
|
279
|
-
case
|
|
285
|
+
case "top":
|
|
280
286
|
return {
|
|
281
|
-
left: alignment ==
|
|
282
|
-
right: alignment ==
|
|
287
|
+
left: alignment == "left" ? 5 : alignment == "center" ? "50%" : "",
|
|
288
|
+
right: alignment == "right" ? 10 : "",
|
|
283
289
|
top: 5,
|
|
284
|
-
transform: "translate3d(calc(".concat(alignment ==
|
|
290
|
+
transform: "translate3d(calc(".concat(alignment == "center" ? "-50%" : "0px", " + ").concat(x, "px), ").concat(y, "px, 0px)")
|
|
285
291
|
};
|
|
286
|
-
case
|
|
292
|
+
case "right":
|
|
287
293
|
return {
|
|
288
|
-
top:
|
|
294
|
+
top: "50%",
|
|
289
295
|
right: 10,
|
|
290
296
|
transform: "translate3d(".concat(x, "px, calc(-50% + ").concat(y, "px), 0px)")
|
|
291
297
|
};
|
|
292
|
-
case
|
|
298
|
+
case "left":
|
|
293
299
|
return {
|
|
294
|
-
top:
|
|
300
|
+
top: "50%",
|
|
295
301
|
left: 5,
|
|
296
302
|
transform: "translate3d(".concat(x, "px, calc(-50% + ").concat(y, "px), 0px)")
|
|
297
303
|
};
|
|
298
304
|
default:
|
|
299
305
|
// bottom
|
|
300
306
|
return {
|
|
301
|
-
left: alignment ==
|
|
302
|
-
right: alignment ==
|
|
307
|
+
left: alignment == "left" ? 5 : alignment == "center" ? "50%" : "",
|
|
308
|
+
right: alignment == "right" ? 10 : "",
|
|
303
309
|
bottom: 5,
|
|
304
|
-
transform: "translate3d(calc(".concat(alignment ==
|
|
310
|
+
transform: "translate3d(calc(".concat(alignment == "center" ? "-50%" : "0px", " + ").concat(x, "px), ").concat(y, "px, 0px)")
|
|
305
311
|
};
|
|
306
312
|
}
|
|
307
313
|
};
|
|
308
314
|
var getCanvasTextWidth = function getCanvasTextWidth(text, letterSpacing) {
|
|
309
|
-
var font = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
|
310
|
-
var canvas = document.createElement(
|
|
311
|
-
var ctx = canvas.getContext(
|
|
315
|
+
var font = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "16px Arial";
|
|
316
|
+
var canvas = document.createElement("canvas");
|
|
317
|
+
var ctx = canvas.getContext("2d");
|
|
312
318
|
ctx.font = font;
|
|
313
319
|
return ctx.measureText(text).width + text.length * letterSpacing + "px";
|
|
314
320
|
// return ctx.measureText(text).width+(text.length-1)*letterSpacing+"px";//-1有bug
|
|
@@ -627,6 +627,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
627
627
|
percent: arc.percent.toFixed(legendPrecision)
|
|
628
628
|
});
|
|
629
629
|
}),
|
|
630
|
+
pieClick: onClick,
|
|
630
631
|
formatter: formatter,
|
|
631
632
|
judge: judgeData
|
|
632
633
|
}))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -795,6 +796,7 @@ var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
|
795
796
|
percent: arc.percent.toFixed(legendPrecision)
|
|
796
797
|
});
|
|
797
798
|
}),
|
|
799
|
+
pieClick: onClick,
|
|
798
800
|
formatter: formatter,
|
|
799
801
|
judge: judgeData
|
|
800
802
|
})));
|
|
@@ -69,21 +69,21 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
|
|
|
69
69
|
var _icon = (0, _utils.getIcon)(type, icon);
|
|
70
70
|
return /*#__PURE__*/_react["default"].createElement("dd", {
|
|
71
71
|
style: {
|
|
72
|
-
display:
|
|
73
|
-
justifyContent:
|
|
74
|
-
lineHeight: lineHeight +
|
|
72
|
+
display: "flex",
|
|
73
|
+
justifyContent: "space-between",
|
|
74
|
+
lineHeight: lineHeight + "px"
|
|
75
75
|
}
|
|
76
76
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
77
77
|
style: {
|
|
78
78
|
// border: '1px solid red',
|
|
79
|
-
display:
|
|
80
|
-
alignItems:
|
|
79
|
+
display: "flex",
|
|
80
|
+
alignItems: "center",
|
|
81
81
|
gap: icon.iconGap
|
|
82
82
|
}
|
|
83
83
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
84
84
|
style: _objectSpread(_objectSpread({}, _icon), {}, {
|
|
85
|
-
width: iconSize +
|
|
86
|
-
height: iconSize +
|
|
85
|
+
width: iconSize + "px",
|
|
86
|
+
height: iconSize + "px"
|
|
87
87
|
})
|
|
88
88
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
89
89
|
style: (0, _utils.getFontStyle)(name)
|
|
@@ -95,30 +95,28 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
|
|
|
95
95
|
};
|
|
96
96
|
var getBigScreenScale = function getBigScreenScale() {
|
|
97
97
|
// 优先使用全局提供的方法
|
|
98
|
-
if (typeof window.getScreenScale ===
|
|
98
|
+
if (typeof window.getScreenScale === "function") {
|
|
99
99
|
try {
|
|
100
100
|
var _result = window.getScreenScale();
|
|
101
101
|
if (Array.isArray(_result) && _result.length >= 6) {
|
|
102
102
|
return _result;
|
|
103
103
|
}
|
|
104
104
|
} catch (e) {
|
|
105
|
-
console.error(
|
|
105
|
+
console.error("调用全局 getScreenScale 出错:", e);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// 获取容器元素
|
|
110
|
-
var bigscreenDom = document.getElementById(
|
|
110
|
+
var bigscreenDom = document.getElementById("bigscreen-container");
|
|
111
111
|
|
|
112
112
|
// 元素不存在时的处理
|
|
113
113
|
if (!bigscreenDom) {
|
|
114
|
-
console.warn('未找到 bigscreen-container 元素,使用视口尺寸');
|
|
115
114
|
return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
// 确保元素可见(未被隐藏)
|
|
119
|
-
var isVisible = window.getComputedStyle(bigscreenDom).display !==
|
|
118
|
+
var isVisible = window.getComputedStyle(bigscreenDom).display !== "none" && window.getComputedStyle(bigscreenDom).visibility !== "hidden";
|
|
120
119
|
if (!isVisible) {
|
|
121
|
-
console.warn('bigscreen-container 元素不可见,使用视口尺寸');
|
|
122
120
|
return [1, 1, window.innerWidth, window.innerHeight, 0, 0];
|
|
123
121
|
}
|
|
124
122
|
|
|
@@ -137,14 +135,14 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
|
|
|
137
135
|
try {
|
|
138
136
|
var computedStyle = window.getComputedStyle(bigscreenDom);
|
|
139
137
|
var transform = computedStyle.transform;
|
|
140
|
-
if (transform && transform !==
|
|
138
|
+
if (transform && transform !== "none") {
|
|
141
139
|
// 解析 transform matrix
|
|
142
140
|
var matrix = new DOMMatrix(transform);
|
|
143
141
|
scaleX = matrix.a; // 缩放X因子
|
|
144
142
|
scaleY = matrix.d; // 缩放Y因子
|
|
145
143
|
}
|
|
146
144
|
} catch (e) {
|
|
147
|
-
console.error(
|
|
145
|
+
console.error("解析缩放样式出错:", e);
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
// 最终返回值(确保不会有undefined)
|
|
@@ -185,19 +183,19 @@ var PieTooltip = exports.PieTooltip = /*#__PURE__*/(0, _react.memo)(function (pr
|
|
|
185
183
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
186
184
|
className: "__easyv-tooltip",
|
|
187
185
|
style: {
|
|
188
|
-
pointerEvents:
|
|
186
|
+
pointerEvents: "none",
|
|
189
187
|
transform: getTipPos(mousePos, pieCenter),
|
|
190
188
|
width: tipWidth,
|
|
191
189
|
height: tipHeight,
|
|
192
190
|
padding: (0, _utils.getMargin)(margin),
|
|
193
|
-
background: image ?
|
|
191
|
+
background: image ? "50% 50% / 100% 100% no-repeat url(" + window.appConfig.ASSETS_URL + image + ")" : "rgba(48, 55, 66, 0.85)"
|
|
194
192
|
}
|
|
195
193
|
}, /*#__PURE__*/_react["default"].createElement("dl", {
|
|
196
194
|
style: {
|
|
197
|
-
display:
|
|
198
|
-
flexDirection:
|
|
199
|
-
justifyContent:
|
|
200
|
-
height:
|
|
195
|
+
display: "flex",
|
|
196
|
+
flexDirection: "column",
|
|
197
|
+
justifyContent: "space-between",
|
|
198
|
+
height: "100%"
|
|
201
199
|
}
|
|
202
200
|
}, Item()));
|
|
203
201
|
});
|