Browse Source

feat: replace dropdownClassName to popupClassName (#37092)

pull/37195/head
黑雨 2 years ago
committed by GitHub
parent
commit
15c82b6f7e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      components/tree-select/__tests__/index.test.js
  2. 15
      components/tree-select/index.tsx
  3. 1
      v5-note.md

9
components/tree-select/__tests__/index.test.js

@ -50,13 +50,4 @@ describe('TreeSelect', () => {
const wrapper = mount(<TreeSelect treeIcon open notFoundContent="notFoundContent" />);
expect(wrapper.text()).toBe('notFoundContent');
});
it('should show warning when use dropdownClassName', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
mount(<TreeSelect dropdownClassName="myCustomClassName" />);
expect(errorSpy).toHaveBeenCalledWith(
'Warning: [antd: TreeSelect] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
);
errorSpy.mockRestore();
});
});

15
components/tree-select/index.tsx

@ -54,11 +54,6 @@ export interface TreeSelectProps<
size?: SizeType;
disabled?: boolean;
placement?: SelectCommonPlacement;
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName?: string;
popupClassName?: string;
bordered?: boolean;
treeLine?: TreeProps['showLine'];
@ -82,7 +77,6 @@ const InternalTreeSelect = <OptionType extends BaseOptionType | DefaultOptionTyp
switcherIcon,
treeLine,
getPopupContainer,
dropdownClassName,
popupClassName,
treeIcon = false,
transitionName,
@ -111,13 +105,6 @@ const InternalTreeSelect = <OptionType extends BaseOptionType | DefaultOptionTyp
);
const rootPrefixCls = getPrefixCls();
warning(
!dropdownClassName,
'TreeSelect',
'`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
);
const prefixCls = getPrefixCls('select', customizePrefixCls);
const treePrefixCls = getPrefixCls('select-tree', customizePrefixCls);
const treeSelectPrefixCls = getPrefixCls('tree-select', customizePrefixCls);
@ -126,7 +113,7 @@ const InternalTreeSelect = <OptionType extends BaseOptionType | DefaultOptionTyp
const [wrapTreeSelectSSR] = useStyle(treeSelectPrefixCls, treePrefixCls);
const mergedDropdownClassName = classNames(
popupClassName || dropdownClassName,
popupClassName,
`${treeSelectPrefixCls}-dropdown`,
{
[`${treeSelectPrefixCls}-dropdown-rtl`]: direction === 'rtl',

1
v5-note.md

@ -16,4 +16,5 @@
- AutoComplete 组件
- Cascader 组件
- Select 组件
- TreeSelect 组件
- open 属性转换:https://github.com/ant-design/ant-design/issues/36609

Loading…
Cancel
Save