feat: replace dropdownClassName to popupClassName (#37091)

This commit is contained in:
黑雨 2022-08-22 15:54:34 +08:00 committed by GitHub
parent a2605f757d
commit fc2b64e6ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 24 deletions

View File

@ -91,15 +91,6 @@ describe('Select', () => {
expect(container.querySelectorAll('.anticon-search').length).toBe(1);
});
it('should show warning when use dropdownClassName', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
render(<Select dropdownClassName="myCustomClassName" />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: Select] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
);
errorSpy.mockRestore();
});
//
describe('Select Custom Icons', () => {
it('should support customized icons', () => {

View File

@ -19,7 +19,6 @@ import { getTransitionDirection, getTransitionName } from '../_util/motion';
import type { InputStatus } from '../_util/statusUtils';
import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';
import getIcons from './utils/iconUtil';
import warning from '../_util/warning';
import useStyle from './style';
import genPurePanel from '../_util/PurePanel';
@ -57,11 +56,6 @@ export interface SelectProps<
placement?: SelectCommonPlacement;
mode?: 'multiple' | 'tags';
status?: InputStatus;
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName?: string;
popupClassName?: string;
}
@ -73,7 +67,6 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
bordered = true,
className,
getPopupContainer,
dropdownClassName,
popupClassName,
listHeight = 256,
placement,
@ -120,13 +113,6 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
const mergedShowArrow =
showArrow !== undefined ? showArrow : props.loading || !(isMultiple || mode === 'combobox');
// =================== Warning =====================
warning(
!dropdownClassName,
'Select',
'`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
);
// ===================== Form Status =====================
const {
status: contextStatus,
@ -159,7 +145,7 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
const selectProps = omit(props as typeof props & { itemIcon: any }, ['suffixIcon', 'itemIcon']);
const rcSelectRtlDropdownClassName = classNames(
popupClassName || dropdownClassName,
popupClassName,
{
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl',
},

View File

@ -15,4 +15,5 @@
- 组件 `dropdownClassName` 替换为 `popupClassName`
- AutoComplete 组件
- Cascader 组件
- Select 组件
- open 属性转换https://github.com/ant-design/ant-design/issues/36609