From e6e13fa57db3fc83f0eb3b86c0ccf888d7f3f0c6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 30 Dec 2024 18:07:07 +0800 Subject: [PATCH 1/2] chore: bump rc-table (#52176) --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index cd26e953d6..5c5f15a022 100644 --- a/package.json +++ b/package.json @@ -144,7 +144,7 @@ "rc-slider": "~11.1.7", "rc-steps": "~6.0.1", "rc-switch": "~4.1.0", - "rc-table": "~7.49.0", + "rc-table": "~7.50.1", "rc-tabs": "~15.4.0", "rc-textarea": "~1.8.2", "rc-tooltip": "~6.2.1", @@ -350,4 +350,4 @@ "resolutions": { "nwsapi": "2.2.13" } -} \ No newline at end of file +} From c1b76049c49b7d58de309f2b4a3adc34382d82ac Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Mon, 30 Dec 2024 23:58:25 +0800 Subject: [PATCH 2/2] chore: TypeScript optimization (#52143) * chore: update deprecated api to stable api * chore: update * fix: fix --- components/_util/responsiveObserver.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/_util/responsiveObserver.ts b/components/_util/responsiveObserver.ts index be7dea6f41..998fc777eb 100644 --- a/components/_util/responsiveObserver.ts +++ b/components/_util/responsiveObserver.ts @@ -69,13 +69,13 @@ export default function useResponsiveObserver() { return React.useMemo(() => { const subscribers = new Map(); let subUid = -1; - let screens = {}; + let screens: Partial> = {}; return { matchHandlers: {} as { [prop: string]: { mql: MediaQueryList; - listener: ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null; + listener: (this: MediaQueryList, ev: MediaQueryListEvent) => void; }; }, dispatch(pointMap: ScreenMap) { @@ -84,7 +84,9 @@ export default function useResponsiveObserver() { return subscribers.size >= 1; }, subscribe(func: SubscribeFunc): number { - if (!subscribers.size) this.register(); + if (!subscribers.size) { + this.register(); + } subUid += 1; subscribers.set(subUid, func); func(screens); @@ -92,7 +94,9 @@ export default function useResponsiveObserver() { }, unsubscribe(paramToken: number) { subscribers.delete(paramToken); - if (!subscribers.size) this.unregister(); + if (!subscribers.size) { + this.unregister(); + } }, unregister() { Object.keys(responsiveMap).forEach((screen) => { @@ -117,7 +121,6 @@ export default function useResponsiveObserver() { mql, listener, }; - listener(mql); }); }, @@ -129,7 +132,7 @@ export default function useResponsiveObserver() { export const matchScreen = (screens: ScreenMap, screenSizes?: ScreenSizeMap) => { if (screenSizes && typeof screenSizes === 'object') { for (let i = 0; i < responsiveArray.length; i++) { - const breakpoint: Breakpoint = responsiveArray[i]; + const breakpoint = responsiveArray[i]; if (screens[breakpoint] && screenSizes[breakpoint] !== undefined) { return screenSizes[breakpoint]; }