@easyv/charts 1.7.23 → 1.7.25
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.
|
@@ -24,13 +24,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
24
24
|
* 轴类图表
|
|
25
25
|
*/
|
|
26
26
|
var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
27
|
-
var
|
|
27
|
+
var width = _ref.width,
|
|
28
|
+
height = _ref.height,
|
|
29
|
+
_ref$config = _ref.config,
|
|
28
30
|
axesConfig = _ref$config.axes,
|
|
29
31
|
background = _ref$config.background,
|
|
30
32
|
_ref$config$chart = _ref$config.chart,
|
|
31
|
-
_ref$config$chart$dim = _ref$config$chart.dimension.chartDimension,
|
|
32
|
-
height = _ref$config$chart$dim.height,
|
|
33
|
-
width = _ref$config$chart$dim.width,
|
|
34
33
|
_ref$config$chart$mar = _ref$config$chart.margin,
|
|
35
34
|
marginLeft = _ref$config$chart$mar.marginLeft,
|
|
36
35
|
marginTop = _ref$config$chart$mar.marginTop,
|
|
@@ -394,20 +393,22 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
394
393
|
var mouseleave = function mouseleave() {
|
|
395
394
|
isEnter = false;
|
|
396
395
|
};
|
|
396
|
+
var svgDom = svg.current;
|
|
397
|
+
var controlDom = controlEl.current;
|
|
397
398
|
if (hover) {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
svgDom && svgDom.addEventListener("mouseenter", mouseenter);
|
|
400
|
+
svgDom && svgDom.addEventListener("mouseleave", mouseleave);
|
|
401
|
+
controlDom && controlDom.addEventListener("mouseenter", mouseenter);
|
|
402
|
+
controlDom && controlDom.addEventListener("mouseleave", mouseleave);
|
|
402
403
|
}
|
|
403
404
|
if (show) {
|
|
404
405
|
startAnimate();
|
|
405
406
|
}
|
|
406
407
|
return function () {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
408
|
+
svgDom && svgDom.removeEventListener("mouseenter", mouseenter);
|
|
409
|
+
svgDom && svgDom.removeEventListener("mouseleave", mouseleave);
|
|
410
|
+
controlDom && controlDom.removeEventListener("mouseenter", mouseenter);
|
|
411
|
+
controlDom && controlDom.removeEventListener("mouseleave", mouseleave);
|
|
411
412
|
cancelAnimationFrame(controlTimer.current);
|
|
412
413
|
};
|
|
413
414
|
}
|
|
@@ -442,11 +443,12 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
442
443
|
});
|
|
443
444
|
}, [tooltipX, tickName]);
|
|
444
445
|
(0, _react.useEffect)(function () {
|
|
445
|
-
svg.current
|
|
446
|
+
var svgDom = svg.current;
|
|
447
|
+
svgDom && svgDom.addEventListener("touchmove", setTouchIndex, {
|
|
446
448
|
passive: false
|
|
447
449
|
});
|
|
448
450
|
return function () {
|
|
449
|
-
|
|
451
|
+
svgDom && svgDom.removeEventListener("touchmove", setTouchIndex);
|
|
450
452
|
};
|
|
451
453
|
}, [control]);
|
|
452
454
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_.ChartContainer, {
|
package/lib/components/Chart.js
CHANGED
|
@@ -39,11 +39,7 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
39
39
|
config = _ref2.config,
|
|
40
40
|
_ref2$config = _ref2.config,
|
|
41
41
|
axes = _ref2$config.axes,
|
|
42
|
-
_ref2$config$chart = _ref2$config.chart,
|
|
43
|
-
_ref2$config$chart$di = _ref2$config$chart.dimension.chartDimension,
|
|
44
|
-
height = _ref2$config$chart$di.height,
|
|
45
|
-
width = _ref2$config$chart$di.width,
|
|
46
|
-
_ref2$config$chart$ma = _ref2$config$chart.margin,
|
|
42
|
+
_ref2$config$chart$ma = _ref2$config.chart.margin,
|
|
47
43
|
marginRight = _ref2$config$chart$ma.marginRight,
|
|
48
44
|
marginLeft = _ref2$config$chart$ma.marginLeft,
|
|
49
45
|
marginBottom = _ref2$config$chart$ma.marginBottom,
|
|
@@ -54,6 +50,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
54
50
|
emit = _ref2.emit,
|
|
55
51
|
emitEvent = _ref2.emitEvent,
|
|
56
52
|
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
53
|
+
var width = props.width,
|
|
54
|
+
height = props.height;
|
|
57
55
|
var isIOS = (0, _react.useRef)(/iPad|iPhone|iPod|iOS|CriOS/i.test(navigator.userAgent));
|
|
58
56
|
var svg = /*#__PURE__*/(0, _react.createRef)();
|
|
59
57
|
var chartWidth = width - marginLeft - marginRight;
|
|
@@ -232,11 +232,10 @@ var getCircleScale = function getCircleScale() {
|
|
|
232
232
|
}));
|
|
233
233
|
};
|
|
234
234
|
var Component = /*#__PURE__*/(0, _react.memo)(function (_ref5) {
|
|
235
|
-
var
|
|
235
|
+
var width = _ref5.width,
|
|
236
|
+
height = _ref5.height,
|
|
237
|
+
_ref5$config = _ref5.config,
|
|
236
238
|
_ref5$config$chart = _ref5$config.chart,
|
|
237
|
-
_ref5$config$chart$di = _ref5$config$chart.dimension.chartDimension,
|
|
238
|
-
width = _ref5$config$chart$di.width,
|
|
239
|
-
height = _ref5$config$chart$di.height,
|
|
240
239
|
label = _ref5$config$chart.label,
|
|
241
240
|
_ref5$config$chart$le = _ref5$config$chart.legend,
|
|
242
241
|
_ref5$config$chart$le2 = _ref5$config$chart$le.formatter,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyv/charts",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.25",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"standard-version": "^9.3.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@easyv/utils": "^0.0.
|
|
35
|
+
"@easyv/utils": "^0.0.50",
|
|
36
36
|
"d3v7": "npm:d3@^7.0.0",
|
|
37
37
|
"gitignore": "^0.7.0",
|
|
38
38
|
"mrm": "^4.0.0",
|
|
@@ -33,13 +33,11 @@ import {
|
|
|
33
33
|
|
|
34
34
|
const Chart = memo(
|
|
35
35
|
({
|
|
36
|
+
width, height,
|
|
36
37
|
config: {
|
|
37
38
|
axes: axesConfig,
|
|
38
39
|
background,
|
|
39
40
|
chart: {
|
|
40
|
-
dimension: {
|
|
41
|
-
chartDimension: { height, width },
|
|
42
|
-
},
|
|
43
41
|
margin: { marginLeft, marginTop, marginRight, marginBottom },
|
|
44
42
|
animation,
|
|
45
43
|
legend,
|
|
@@ -372,20 +370,22 @@ const Chart = memo(
|
|
|
372
370
|
const mouseleave = () => {
|
|
373
371
|
isEnter = false;
|
|
374
372
|
};
|
|
373
|
+
const svgDom = svg.current;
|
|
374
|
+
const controlDom = controlEl.current;
|
|
375
375
|
if(hover){
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
376
|
+
svgDom && svgDom.addEventListener("mouseenter",mouseenter);
|
|
377
|
+
svgDom && svgDom.addEventListener("mouseleave",mouseleave);
|
|
378
|
+
controlDom && controlDom.addEventListener("mouseenter",mouseenter);
|
|
379
|
+
controlDom && controlDom.addEventListener("mouseleave",mouseleave);
|
|
380
380
|
}
|
|
381
381
|
if(show){
|
|
382
382
|
startAnimate();
|
|
383
383
|
}
|
|
384
384
|
return () => {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
svgDom && svgDom.removeEventListener("mouseenter",mouseenter);
|
|
386
|
+
svgDom && svgDom.removeEventListener("mouseleave",mouseleave);
|
|
387
|
+
controlDom && controlDom.removeEventListener("mouseenter",mouseenter);
|
|
388
|
+
controlDom && controlDom.removeEventListener("mouseleave",mouseleave);
|
|
389
389
|
cancelAnimationFrame(controlTimer.current);
|
|
390
390
|
};
|
|
391
391
|
}
|
|
@@ -411,9 +411,10 @@ const Chart = memo(
|
|
|
411
411
|
})
|
|
412
412
|
},[tooltipX, tickName]);
|
|
413
413
|
useEffect(()=>{
|
|
414
|
-
svg.current
|
|
414
|
+
const svgDom = svg.current;
|
|
415
|
+
svgDom && svgDom.addEventListener("touchmove", setTouchIndex, {passive:false});
|
|
415
416
|
return ()=>{
|
|
416
|
-
|
|
417
|
+
svgDom && svgDom.removeEventListener("touchmove", setTouchIndex);
|
|
417
418
|
}
|
|
418
419
|
},[control]);
|
|
419
420
|
|
package/src/components/Chart.js
CHANGED
|
@@ -26,9 +26,6 @@ const Chart = memo(
|
|
|
26
26
|
config: {
|
|
27
27
|
axes,
|
|
28
28
|
chart: {
|
|
29
|
-
dimension: {
|
|
30
|
-
chartDimension: { height, width },
|
|
31
|
-
},
|
|
32
29
|
margin: { marginRight, marginLeft, marginBottom, marginTop },
|
|
33
30
|
},
|
|
34
31
|
interaction,
|
|
@@ -39,6 +36,7 @@ const Chart = memo(
|
|
|
39
36
|
emitEvent,
|
|
40
37
|
...props
|
|
41
38
|
}) => {
|
|
39
|
+
const { width, height } = props;
|
|
42
40
|
const isIOS = useRef(/iPad|iPhone|iPod|iOS|CriOS/i.test(navigator.userAgent));
|
|
43
41
|
const svg = createRef();
|
|
44
42
|
const chartWidth = width - marginLeft - marginRight;
|
|
@@ -247,11 +247,9 @@ const getCircleScale = ({ count, color, width, length } = tick, radius) => {
|
|
|
247
247
|
|
|
248
248
|
const Component = memo(
|
|
249
249
|
({
|
|
250
|
+
width, height,
|
|
250
251
|
config: {
|
|
251
252
|
chart: {
|
|
252
|
-
dimension: {
|
|
253
|
-
chartDimension: { width, height },
|
|
254
|
-
},
|
|
255
253
|
label,
|
|
256
254
|
legend: { formatter = legendFormatter, ...legend },
|
|
257
255
|
animation: { ringDuration, labelDuration } = {},
|