react-icecream-charts
Advanced tools
Comparing version 0.10.3 to 0.10.4
@@ -1,162 +0,16 @@ | ||
diff --git a/react-icecream-charts/components/_chart/chart.ts b/react-icecream-charts/components/_chart/chart.ts | ||
index 39d44c35..9cb959fa 100644 | ||
--- a/react-icecream-charts/components/_chart/chart.ts | ||
+++ b/react-icecream-charts/components/_chart/chart.ts | ||
@@ -88,7 +88,8 @@ export function createHighOptions( | ||
events.redraw.bind(this)?.(...args) | ||
} | ||
} | ||
- } | ||
+ }, | ||
+ reflow: false | ||
}, | ||
lang: createHighLangOptions(langData.langOptions), | ||
xAxis: createHighXAxisOptions({ dateTimeLabelFormats: langData.xAxisDateTimeLabelFormats }), | ||
diff --git a/react-icecream-charts/components/_chart/hooks.ts b/react-icecream-charts/components/_chart/hooks.ts | ||
index c4483a6c..c736c30b 100644 | ||
--- a/react-icecream-charts/components/_chart/hooks.ts | ||
+++ b/react-icecream-charts/components/_chart/hooks.ts | ||
@@ -2,6 +2,8 @@ import { Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from 're | ||
import Highcharts from 'highcharts' | ||
import NoDataToDisplay from 'highcharts/modules/no-data-to-display' | ||
import memoize from 'lodash.memoize' | ||
+import { addListener, removeListener } from 'resize-detector' | ||
+import debounce from 'lodash.debounce' | ||
diff --git a/react-icecream-charts/components/spline/options.ts b/react-icecream-charts/components/spline/options.ts | ||
index 68b55b47..8924e784 100644 | ||
--- a/react-icecream-charts/components/spline/options.ts | ||
+++ b/react-icecream-charts/components/spline/options.ts | ||
@@ -5,7 +5,7 @@ export interface PlotSplineOptions extends PlotOptions { | ||
} | ||
import { Chart, LangOptions } from './chart' | ||
import { LangData } from './langData' | ||
@@ -102,6 +104,23 @@ export function useHighOptions(chartOptions: Highcharts.Options, { | ||
// 所以这里只需要关注组件 unmount 的时候销毁 chart 实例即可 | ||
useEffect(() => () => chartRef.current?.destroy(), []) | ||
+ useLayoutEffect(() => { | ||
+ const renderDom = renderToRef.current | ||
+ const debouncedReflowChart = debounce(() => { | ||
+ chartRef.current?.reflow() | ||
+ }, 200) | ||
+ | ||
+ if (renderDom) { | ||
+ addListener(renderDom, debouncedReflowChart) | ||
+ } | ||
+ | ||
+ return () => { | ||
+ if (renderDom) { | ||
+ removeListener(renderDom, debouncedReflowChart) | ||
+ } | ||
+ } | ||
+ }, []) | ||
+ | ||
return [renderToRef, createChartRef] as const | ||
export interface SeriesSplineOptions extends SeriesOptions, PlotSplineOptions { | ||
- data?: number[] | ||
+ data?: Array<number | [number, number]> | ||
} | ||
diff --git a/react-icecream-charts/components/area/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/area/__snapshots__/index.test.tsx.snap | ||
index d05d1718..c93a9c9d 100644 | ||
--- a/react-icecream-charts/components/area/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/area/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/areaspline/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/areaspline/__snapshots__/index.test.tsx.snap | ||
index 8915a5c5..12010c3f 100644 | ||
--- a/react-icecream-charts/components/areaspline/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/areaspline/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/bar/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/bar/__snapshots__/index.test.tsx.snap | ||
index 37bf72ef..d97503ad 100644 | ||
--- a/react-icecream-charts/components/bar/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/bar/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/column/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/column/__snapshots__/index.test.tsx.snap | ||
index 35f266d5..5ee51ae0 100644 | ||
--- a/react-icecream-charts/components/column/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/column/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/line/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/line/__snapshots__/index.test.tsx.snap | ||
index 753d6335..a96df75d 100644 | ||
--- a/react-icecream-charts/components/line/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/line/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/map/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/map/__snapshots__/index.test.tsx.snap | ||
index 7f5c395c..e4deecda 100644 | ||
--- a/react-icecream-charts/components/map/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/map/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/pie/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/pie/__snapshots__/index.test.tsx.snap | ||
index 3d031cbe..e974d8b0 100644 | ||
--- a/react-icecream-charts/components/pie/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/pie/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/scatter/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/scatter/__snapshots__/index.test.tsx.snap | ||
index c9998551..f75dd336 100644 | ||
--- a/react-icecream-charts/components/scatter/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/scatter/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
diff --git a/react-icecream-charts/components/spline/__snapshots__/index.test.tsx.snap b/react-icecream-charts/components/spline/__snapshots__/index.test.tsx.snap | ||
index e2346488..445fcf9a 100644 | ||
--- a/react-icecream-charts/components/spline/__snapshots__/index.test.tsx.snap | ||
+++ b/react-icecream-charts/components/spline/__snapshots__/index.test.tsx.snap | ||
@@ -8,6 +8,7 @@ Object { | ||
"redraw": [Function], | ||
}, | ||
"height": null, | ||
+ "reflow": false, | ||
"resetZoomButton": Object { | ||
"theme": Object { | ||
"display": "none", | ||
export function createSplineOptions( | ||
diff --git a/react-icecream-charts/package.json b/react-icecream-charts/package.json | ||
index 86600707..a02942c9 100644 | ||
index a02942c9..99d70992 100644 | ||
--- a/react-icecream-charts/package.json | ||
@@ -167,68 +21,6 @@ +++ b/react-icecream-charts/package.json | ||
"name": "react-icecream-charts", | ||
- "version": "0.10.2", | ||
+ "version": "0.10.3", | ||
- "version": "0.10.3", | ||
+ "version": "0.10.4", | ||
"license": "MIT", | ||
"main": "esm/index.js", | ||
"types": "esm/index.d.ts", | ||
@@ -37,8 +37,10 @@ | ||
"dependencies": { | ||
"highcharts": "~8.2.2", | ||
"icecream-base": "^0.0.4", | ||
+ "lodash.debounce": "^4.0.8", | ||
"lodash.memoize": "~4.1.2", | ||
- "lodash.mergewith": "^4.6.2" | ||
+ "lodash.mergewith": "^4.6.2", | ||
+ "resize-detector": "^0.3.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.0.0", | ||
@@ -48,6 +50,7 @@ | ||
"@qiniu/eslint-config": "0.0.6-beta.7", | ||
"@testing-library/jest-dom": "^5.1.1", | ||
"@types/jest": "^25.1.4", | ||
+ "@types/lodash.debounce": "^4.0.7", | ||
"@types/lodash.memoize": "^4.1.2", | ||
"@types/lodash.mergewith": "^4.6.6", | ||
"@types/react": "^16.8.14", | ||
diff --git a/react-icecream-charts/yarn.lock b/react-icecream-charts/yarn.lock | ||
index 98b86ff9..58c1a87f 100644 | ||
--- a/react-icecream-charts/yarn.lock | ||
+++ b/react-icecream-charts/yarn.lock | ||
@@ -1653,6 +1653,13 @@ | ||
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" | ||
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= | ||
+"@types/lodash.debounce@^4.0.7": | ||
+ version "4.0.7" | ||
+ resolved "https://registry.yarnpkg.com/@types/lodash.debounce/-/lodash.debounce-4.0.7.tgz#0285879defb7cdb156ae633cecd62d5680eded9f" | ||
+ integrity sha512-X1T4wMZ+gT000M2/91SYj0d/7JfeNZ9PeeOldSNoE/lunLeQXKvkmIumI29IaKMotU/ln/McOIvgzZcQ/3TrSA== | ||
+ dependencies: | ||
+ "@types/lodash" "*" | ||
+ | ||
"@types/lodash.memoize@^4.1.2": | ||
version "4.1.6" | ||
resolved "https://registry.yarnpkg.com/@types/lodash.memoize/-/lodash.memoize-4.1.6.tgz#3221f981790a415cab1a239f25c17efd8b604c23" | ||
@@ -9324,6 +9331,11 @@ lodash.clonedeep@4.5.0: | ||
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" | ||
integrity sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8= | ||
+lodash.debounce@^4.0.8: | ||
+ version "4.0.8" | ||
+ resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" | ||
+ integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== | ||
+ | ||
lodash.deburr@^4.1.0: | ||
version "4.1.0" | ||
resolved "https://registry.yarnpkg.com/lodash.deburr/-/lodash.deburr-4.1.0.tgz#ddb1bbb3ef07458c0177ba07de14422cb033ff9b" | ||
@@ -12784,6 +12796,11 @@ requires-port@^1.0.0: | ||
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" | ||
integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= | ||
+resize-detector@^0.3.0: | ||
+ version "0.3.0" | ||
+ resolved "https://registry.yarnpkg.com/resize-detector/-/resize-detector-0.3.0.tgz#fe495112e184695500a8f51e0389f15774cb1cfc" | ||
+ integrity sha512-R/tCuvuOHQ8o2boRP6vgx8hXCCy87H1eY9V5imBYeVNyNVpuL9ciReSccLj2gDcax9+2weXy3bc8Vv+NRXeEvQ== | ||
+ | ||
resize-observer-polyfill@^1.5.1: | ||
version "1.5.1" | ||
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" |
@@ -5,4 +5,4 @@ import { LangData, PlotOptions, ChartOptions, SeriesOptions } from '../_chart'; | ||
export interface SeriesSplineOptions extends SeriesOptions, PlotSplineOptions { | ||
data?: number[]; | ||
data?: Array<number | [number, number]>; | ||
} | ||
export declare function createSplineOptions(langData: LangData, options?: PlotSplineOptions, chartOptions?: ChartOptions, series?: SeriesSplineOptions[]): Highcharts.Options; |
@@ -5,4 +5,4 @@ import { LangData, PlotOptions, ChartOptions, SeriesOptions } from '../_chart'; | ||
export interface SeriesSplineOptions extends SeriesOptions, PlotSplineOptions { | ||
data?: number[]; | ||
data?: Array<number | [number, number]>; | ||
} | ||
export declare function createSplineOptions(langData: LangData, options?: PlotSplineOptions, chartOptions?: ChartOptions, series?: SeriesSplineOptions[]): Highcharts.Options; |
{ | ||
"name": "react-icecream-charts", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
4786592