zenas-react-icecream-charts
Advanced tools
Comparing version 0.10.4 to 0.10.5
@@ -65,6 +65,2 @@ import { useEffect, useImperativeHandle, useLayoutEffect, useRef } from 'react'; | ||
}); | ||
var debouncedRedrawChart = useRef(debounce(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 100)).current; | ||
/** | ||
@@ -89,12 +85,17 @@ * highcharts 的 chart.update 不能响应 lang 数据的变化,每次 lang 变化都需要: | ||
useEffect(function () { return function () { var _a; return (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.destroy(); }; }, []); | ||
useLayoutEffect(function () { | ||
if (renderToRef.current) { | ||
addListener(renderToRef.current, debouncedRedrawChart); | ||
useEffect(function () { | ||
var renderDom = renderToRef.current; | ||
var debouncedReflowChart = debounce(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 200); | ||
if (renderDom) { | ||
addListener(renderDom, debouncedReflowChart); | ||
} | ||
return function () { | ||
if (renderToRef.current) { | ||
removeListener(renderToRef.current, debouncedRedrawChart); | ||
if (renderDom) { | ||
removeListener(renderDom, debouncedReflowChart); | ||
} | ||
}; | ||
}, [debouncedRedrawChart]); | ||
}, []); | ||
return [renderToRef, createChartRef]; | ||
@@ -101,0 +102,0 @@ } |
@@ -90,6 +90,2 @@ "use strict"; | ||
}); | ||
var debouncedRedrawChart = react_1.useRef(lodash_1.debounce(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 100)).current; | ||
/** | ||
@@ -114,12 +110,17 @@ * highcharts 的 chart.update 不能响应 lang 数据的变化,每次 lang 变化都需要: | ||
react_1.useEffect(function () { return function () { var _a; return (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.destroy(); }; }, []); | ||
react_1.useLayoutEffect(function () { | ||
if (renderToRef.current) { | ||
resize_detector_1.addListener(renderToRef.current, debouncedRedrawChart); | ||
react_1.useEffect(function () { | ||
var renderDom = renderToRef.current; | ||
var debouncedReflowChart = lodash_1.debounce(function () { | ||
var _a; | ||
(_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.reflow(); | ||
}, 200); | ||
if (renderDom) { | ||
resize_detector_1.addListener(renderDom, debouncedReflowChart); | ||
} | ||
return function () { | ||
if (renderToRef.current) { | ||
resize_detector_1.removeListener(renderToRef.current, debouncedRedrawChart); | ||
if (renderDom) { | ||
resize_detector_1.removeListener(renderDom, debouncedReflowChart); | ||
} | ||
}; | ||
}, [debouncedRedrawChart]); | ||
}, []); | ||
return [renderToRef, createChartRef]; | ||
@@ -126,0 +127,0 @@ } |
{ | ||
"name": "zenas-react-icecream-charts", | ||
"version": "0.10.4", | ||
"version": "0.10.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "esm/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145049
4814428