From 6f82f41d5c375cd5f397d4c388f4e4b4c1d57704 Mon Sep 17 00:00:00 2001 From: MadCcc <1075746765@qq.com> Date: Wed, 8 Mar 2023 11:54:40 +0800 Subject: [PATCH] refactor: checkbox (#41117) * refactor: checkbox * type: export CheckboxRef * type: fix --- components/checkbox/Checkbox.tsx | 3 +- .../__snapshots__/checkbox.test.tsx.snap | 1 - components/checkbox/index.ts | 1 + .../__snapshots__/components.test.tsx.snap | 42 ------ .../__snapshots__/index.test.tsx.snap | 1 - components/index.ts | 2 +- .../__snapshots__/index.test.tsx.snap | 136 ------------------ .../__snapshots__/radio-button.test.tsx.snap | 2 - .../__snapshots__/radio.test.tsx.snap | 3 - components/radio/radio.tsx | 5 +- .../__snapshots__/Table.filter.test.tsx.snap | 4 - .../Table.rowSelection.test.tsx.snap | 30 ---- .../__snapshots__/index.test.tsx.snap | 18 --- .../__snapshots__/list.test.tsx.snap | 4 - package.json | 2 +- typings/custom-typings.d.ts | 4 - 16 files changed, 8 insertions(+), 250 deletions(-) diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index 7742b4158a..459f38b75d 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,4 +1,5 @@ import classNames from 'classnames'; +import type { CheckboxRef } from 'rc-checkbox'; import RcCheckbox from 'rc-checkbox'; import * as React from 'react'; import { ConfigContext } from '../config-provider'; @@ -48,7 +49,7 @@ export interface CheckboxProps extends AbstractCheckboxProps = ( +const InternalCheckbox: React.ForwardRefRenderFunction = ( { prefixCls: customizePrefixCls, className, diff --git a/components/checkbox/__tests__/__snapshots__/checkbox.test.tsx.snap b/components/checkbox/__tests__/__snapshots__/checkbox.test.tsx.snap index 178dd7bc05..ae18e74176 100644 --- a/components/checkbox/__tests__/__snapshots__/checkbox.test.tsx.snap +++ b/components/checkbox/__tests__/__snapshots__/checkbox.test.tsx.snap @@ -10,7 +10,6 @@ exports[`Checkbox rtl render component should be rendered correctly in RTL direc diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 4f46b16164..cc91ae49cb 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -12035,7 +12035,6 @@ exports[`ConfigProvider components Checkbox configProvider 1`] = ` = (props, ref) => { +const InternalRadio: React.ForwardRefRenderFunction = (props, ref) => { const groupContext = React.useContext(RadioGroupContext); const radioOptionTypeContext = React.useContext(RadioOptionTypeContext); const { getPrefixCls, direction } = React.useContext(ConfigContext); - const innerRef = React.useRef(); + const innerRef = React.useRef(null); const mergedRef = composeRef(ref, innerRef); const { isFormItemInput } = React.useContext(FormItemInputContext); diff --git a/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap b/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap index 69cd5c4b30..798ddcc715 100644 --- a/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap +++ b/components/table/__tests__/__snapshots__/Table.filter.test.tsx.snap @@ -579,7 +579,6 @@ exports[`Table.filter renders menu correctly 1`] = `