@easyv/charts 1.5.2 → 1.5.3
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.
|
@@ -22,7 +22,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
22
22
|
var _d3v = require("d3v7");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["animation"],
|
|
25
|
-
_excluded2 = ["config", "data"];
|
|
25
|
+
_excluded2 = ["config", "data", "active"];
|
|
26
26
|
|
|
27
27
|
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); }
|
|
28
28
|
|
|
@@ -60,6 +60,7 @@ var _default = function _default(Component) {
|
|
|
60
60
|
config = (0, _objectWithoutProperties2["default"])(_ref$config, _excluded),
|
|
61
61
|
_ref$data = _ref.data,
|
|
62
62
|
data = _ref$data === void 0 ? [] : _ref$data,
|
|
63
|
+
active = _ref.active,
|
|
63
64
|
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded2);
|
|
64
65
|
var dataLength = data.length;
|
|
65
66
|
|
|
@@ -103,11 +104,11 @@ var _default = function _default(Component) {
|
|
|
103
104
|
}
|
|
104
105
|
}, [animationOn, interval, dataLength]);
|
|
105
106
|
(0, _react.useEffect)(function () {
|
|
106
|
-
carousel && carousel();
|
|
107
|
+
active && carousel && carousel();
|
|
107
108
|
return function () {
|
|
108
109
|
timer.current && timer.current.stop();
|
|
109
110
|
};
|
|
110
|
-
}, [carousel]);
|
|
111
|
+
}, [carousel, active]);
|
|
111
112
|
var onEvent = (0, _react.useCallback)(function (_ref3) {
|
|
112
113
|
var currentIndex = _ref3.currentIndex,
|
|
113
114
|
type = _ref3.type;
|
package/lib/components/Chart.js
CHANGED
|
@@ -159,7 +159,8 @@ var Chart = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
|
|
|
159
159
|
}, type == 'pie' ? /*#__PURE__*/_react["default"].createElement(_.PieChart, (0, _extends2["default"])({
|
|
160
160
|
id: id,
|
|
161
161
|
config: config,
|
|
162
|
-
data: data
|
|
162
|
+
data: data,
|
|
163
|
+
active: active
|
|
163
164
|
}, props)) : /*#__PURE__*/_react["default"].createElement(_.CartesianChart, (0, _extends2["default"])({
|
|
164
165
|
id: id,
|
|
165
166
|
config: config,
|
package/package.json
CHANGED
|
@@ -36,6 +36,7 @@ export default (Component: ComponentType<any>) =>
|
|
|
36
36
|
({
|
|
37
37
|
config: { animation, ...config },
|
|
38
38
|
data = [],
|
|
39
|
+
active,
|
|
39
40
|
...rest
|
|
40
41
|
}: {
|
|
41
42
|
data: DataType[];
|
|
@@ -77,11 +78,11 @@ export default (Component: ComponentType<any>) =>
|
|
|
77
78
|
}, [animationOn, interval, dataLength]);
|
|
78
79
|
|
|
79
80
|
useEffect(() => {
|
|
80
|
-
carousel && carousel();
|
|
81
|
+
active && carousel && carousel();
|
|
81
82
|
return () => {
|
|
82
83
|
timer.current && timer.current.stop();
|
|
83
84
|
};
|
|
84
|
-
}, [carousel]);
|
|
85
|
+
}, [carousel, active]);
|
|
85
86
|
interface Event{
|
|
86
87
|
currentIndex:number,
|
|
87
88
|
type:string
|
package/src/components/Chart.js
CHANGED
|
@@ -90,6 +90,8 @@ const Chart = memo(
|
|
|
90
90
|
[id, chartWidth, chartHeight, triggerOnRelative, svg, onEmit]
|
|
91
91
|
);
|
|
92
92
|
|
|
93
|
+
|
|
94
|
+
|
|
93
95
|
useEffect(()=>{
|
|
94
96
|
const activeHandler=(e)=>{
|
|
95
97
|
const { dynamicData = true } = e;
|
|
@@ -121,7 +123,7 @@ const Chart = memo(
|
|
|
121
123
|
return (
|
|
122
124
|
<chartContext.Provider value={context}>
|
|
123
125
|
{type == 'pie' ? (
|
|
124
|
-
<PieChart id={id} config={config} data={data} {...props} />
|
|
126
|
+
<PieChart id={id} config={config} data={data} active={active} {...props} />
|
|
125
127
|
) : (
|
|
126
128
|
<CartesianChart id={id} config={config} data={data} active={active} {...props} />
|
|
127
129
|
)}
|