diff --git a/components/auto-complete/__tests__/index.test.js b/components/auto-complete/__tests__/index.test.js
index 7686e70722..0ca10bf750 100644
--- a/components/auto-complete/__tests__/index.test.js
+++ b/components/auto-complete/__tests__/index.test.js
@@ -89,4 +89,18 @@ describe('AutoComplete', () => {
);
expect(container.querySelector('input').classList.contains('custom')).toBeTruthy();
});
+
+ it('should show warning when use dropdownClassName', () => {
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+ render(
+
+ 111
+ 222
+ ,
+ );
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: AutoComplete] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ errorSpy.mockRestore();
+ });
});
diff --git a/components/auto-complete/demo/certain-category.md b/components/auto-complete/demo/certain-category.md
index b2105127df..55ca772e93 100644
--- a/components/auto-complete/demo/certain-category.md
+++ b/components/auto-complete/demo/certain-category.md
@@ -66,7 +66,7 @@ const options = [
const App: React.FC = () => (
{
dataSource?: DataSourceItemType[];
status?: InputStatus;
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major version.
+ * Please use `popupClassName` instead.
+ */
+ dropdownClassName?: string;
+ popupClassName?: string;
}
function isSelectOptionOrSelectOptGroup(child: any): Boolean {
@@ -51,7 +57,14 @@ const AutoComplete: React.ForwardRefRenderFunction {
- const { prefixCls: customizePrefixCls, className, children, dataSource } = props;
+ const {
+ prefixCls: customizePrefixCls,
+ className,
+ popupClassName,
+ dropdownClassName,
+ children,
+ dataSource,
+ } = props;
const childNodes: React.ReactElement[] = toArray(children);
// ============================= Input =============================
@@ -112,6 +125,12 @@ const AutoComplete: React.ForwardRefRenderFunction document.body | |
diff --git a/components/cascader/__tests__/index.test.js b/components/cascader/__tests__/index.test.js
index 93e27fcb07..2486e85ff6 100644
--- a/components/cascader/__tests__/index.test.js
+++ b/components/cascader/__tests__/index.test.js
@@ -540,7 +540,7 @@ describe('Cascader', () => {
it('popupClassName', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const { container } = render(
- ,
+ ,
);
expect(container.querySelector('.mock-cls')).toBeTruthy();
@@ -549,7 +549,7 @@ describe('Cascader', () => {
expect(global.triggerProps.popupPlacement).toEqual('bottomLeft');
expect(errorSpy).toHaveBeenCalledWith(
- 'Warning: [antd: Cascader] `popupClassName` is deprecated. Please use `dropdownClassName` instead.',
+ 'Warning: [antd: Cascader] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
);
errorSpy.mockRestore();
diff --git a/components/cascader/index.en-US.md b/components/cascader/index.en-US.md
index f7eadde579..84095106ce 100644
--- a/components/cascader/index.en-US.md
+++ b/components/cascader/index.en-US.md
@@ -30,7 +30,7 @@ Cascade selection box.
| defaultValue | Initial selected value | string\[] \| number\[] | \[] | |
| disabled | Whether disabled select | boolean | false | |
| displayRender | The render function of displaying selected options | (label, selectedOptions) => ReactNode | label => label.join(`/`) | `multiple`: 4.18.0 |
-| dropdownClassName | The additional className of popup overlay | string | - | 4.17.0 |
+| popupClassName | The additional className of popup overlay | string | - | 4.23.0 |
| dropdownRender | Customize dropdown content | (menus: ReactNode) => ReactNode | - | 4.4.0 |
| expandIcon | Customize the current item expand icon | ReactNode | - | 4.4.0 |
| expandTrigger | expand current item when click or hover, one of `click` `hover` | string | `click` | |
diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx
index 7de0b61a45..de4d1566a3 100644
--- a/components/cascader/index.tsx
+++ b/components/cascader/index.tsx
@@ -108,6 +108,11 @@ export type CascaderProps = UnionCascaderProps & {
suffixIcon?: React.ReactNode;
options?: DataNodeType[];
status?: InputStatus;
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major
+ * version.Please use `popupClassName` instead.
+ */
+ dropdownClassName?: string;
};
export interface CascaderRef {
@@ -164,9 +169,9 @@ const Cascader = React.forwardRef((props: CascaderProps, ref: React.Ref, ref: React.Ref ReactNode | label => label.join(`/`) | `multiple`: 4.18.0 |
-| dropdownClassName | 自定义浮层类名 | string | - | 4.17.0 |
+| popupClassName | 自定义浮层类名 | string | - | 4.23.0 |
| dropdownRender | 自定义下拉框内容 | (menus: ReactNode) => ReactNode | - | 4.4.0 |
| expandIcon | 自定义次级菜单展开图标 | ReactNode | - | 4.4.0 |
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | `click` | |
diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js
index d917117c4e..b782ef3989 100644
--- a/components/date-picker/__tests__/DatePicker.test.js
+++ b/components/date-picker/__tests__/DatePicker.test.js
@@ -184,6 +184,20 @@ describe('DatePicker', () => {
).toBe(60);
});
+ it('DatePicker should show warning when use dropdownClassName', () => {
+ mount();
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: DatePicker] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ });
+
+ it('RangePicker should show warning when use dropdownClassName', () => {
+ mount();
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: RangePicker] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ });
+
it('DatePicker.RangePicker with defaultPickerValue and showTime', () => {
const startDate = moment('1982-02-12');
const endDate = moment('1982-02-22');
diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx
index 3e56dc9d3a..a7afe57978 100644
--- a/components/date-picker/generatePicker/generateRangePicker.tsx
+++ b/components/date-picker/generatePicker/generateRangePicker.tsx
@@ -18,6 +18,7 @@ import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils';
import enUS from '../locale/en_US';
import { getRangePlaceholder, transPlacement2DropdownAlign } from '../util';
import type { CommonPickerMethods, PickerComponentClass } from './interface';
+import warning from '../../_util/warning';
export default function generateRangePicker(
generateConfig: GenerateConfig,
@@ -26,7 +27,14 @@ export default function generateRangePicker(
const RangePicker = forwardRef<
InternalRangePickerProps | CommonPickerMethods,
- RangePickerProps
+ RangePickerProps & {
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major
+ * version.Please use `popupClassName` instead.
+ */
+ dropdownClassName: string;
+ popupClassName?: string;
+ }
>((props, ref) => {
const {
prefixCls: customizePrefixCls,
@@ -37,6 +45,8 @@ export default function generateRangePicker(
disabled: customDisabled,
bordered = true,
placeholder,
+ popupClassName,
+ dropdownClassName,
status: customStatus,
...restProps
} = props;
@@ -54,6 +64,12 @@ export default function generateRangePicker(
...(picker === 'time' ? getTimeProps({ format, ...props, picker }) : {}),
};
+ warning(
+ !dropdownClassName,
+ 'RangePicker',
+ '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+
// ===================== Size =====================
const size = React.useContext(SizeContext);
const mergedSize = customizeSize || size;
@@ -92,6 +108,7 @@ export default function generateRangePicker(
}
disabled={mergedDisabled}
ref={innerRef}
+ dropdownClassName={popupClassName || dropdownClassName}
dropdownAlign={transPlacement2DropdownAlign(direction, placement)}
placeholder={getRangePlaceholder(picker, locale, placeholder)}
suffixIcon={suffixNode}
diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx
index 0fdf155105..2827728e02 100644
--- a/components/date-picker/generatePicker/generateSinglePicker.tsx
+++ b/components/date-picker/generatePicker/generateSinglePicker.tsx
@@ -24,8 +24,13 @@ import type { CommonPickerMethods, DatePickRef, PickerComponentClass } from './i
export default function generatePicker(generateConfig: GenerateConfig) {
type DatePickerProps = PickerProps & {
status?: InputStatus;
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major
+ * version.Please use `popupClassName` instead.
+ */
+ dropdownClassName?: string;
+ popupClassName?: string;
};
-
function getPicker(
picker?: PickerMode,
displayName?: string,
@@ -40,17 +45,13 @@ export default function generatePicker(generateConfig: GenerateConfig<
bordered = true,
placement,
placeholder,
+ popupClassName,
+ dropdownClassName,
disabled: customDisabled,
status: customStatus,
...restProps
} = props;
- warning(
- picker !== 'quarter',
- displayName!,
- `DatePicker.${displayName} is legacy usage. Please use DatePicker[picker='${picker}'] directly.`,
- );
-
const { getPrefixCls, direction, getPopupContainer } = useContext(ConfigContext);
const prefixCls = getPrefixCls('picker', customizePrefixCls);
const innerRef = React.useRef>(null);
@@ -80,6 +81,18 @@ export default function generatePicker(generateConfig: GenerateConfig<
};
const rootPrefixCls = getPrefixCls();
+ // =================== Warning =====================
+ warning(
+ picker !== 'quarter',
+ displayName!,
+ `DatePicker.${displayName} is legacy usage. Please use DatePicker[picker='${picker}'] directly.`,
+ );
+
+ warning(
+ !dropdownClassName,
+ 'DatePicker',
+ '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
// ===================== Size =====================
const size = React.useContext(SizeContext);
const mergedSize = customizeSize || size;
@@ -110,6 +123,7 @@ export default function generatePicker(generateConfig: GenerateConfig<
placeholder={getPlaceholder(mergedPicker, locale, placeholder)}
suffixIcon={suffixNode}
dropdownAlign={transPlacement2DropdownAlign(direction, placement)}
+ dropdownClassName={popupClassName || dropdownClassName}
clearIcon={}
prevIcon={}
nextIcon={}
diff --git a/components/date-picker/index.en-US.md b/components/date-picker/index.en-US.md
index 21ce15417e..cc1a151c89 100644
--- a/components/date-picker/index.en-US.md
+++ b/components/date-picker/index.en-US.md
@@ -59,7 +59,7 @@ The following APIs are shared by DatePicker, RangePicker.
| dateRender | Custom rendering function for date cells | function(currentDate: moment, today: moment) => React.ReactNode | - | |
| disabled | Determine whether the DatePicker is disabled | boolean | false | |
| disabledDate | Specify the date that cannot be selected | (currentDate: moment) => boolean | - | |
-| dropdownClassName | To customize the className of the popup calendar | string | - | |
+| popupClassName | To customize the className of the popup calendar | string | - | 4.23.0 |
| getPopupContainer | To set the container of the floating layer, while the default is to create a `div` element in `body` | function(trigger) | - | |
| inputReadOnly | Set the `readonly` attribute of the input tag (avoids virtual keyboard on touch devices) | boolean | false | |
| locale | Localization configuration | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
diff --git a/components/date-picker/index.zh-CN.md b/components/date-picker/index.zh-CN.md
index 756a38dab9..3672b52d1f 100644
--- a/components/date-picker/index.zh-CN.md
+++ b/components/date-picker/index.zh-CN.md
@@ -60,7 +60,7 @@ import locale from 'antd/es/locale/zh_CN';
| dateRender | 自定义日期单元格的内容 | function(currentDate: moment, today: moment) => React.ReactNode | - | |
| disabled | 禁用 | boolean | false | |
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | - | |
-| dropdownClassName | 额外的弹出日历 className | string | - | |
+| popupClassName | 额外的弹出日历 className | string | - | 4.23.0 |
| getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | - | |
| inputReadOnly | 设置输入框为只读(避免在移动设备上打开虚拟键盘) | boolean | false | |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
diff --git a/components/select/__tests__/index.test.js b/components/select/__tests__/index.test.js
index cbd69cb000..39473475e7 100644
--- a/components/select/__tests__/index.test.js
+++ b/components/select/__tests__/index.test.js
@@ -91,6 +91,16 @@ describe('Select', () => {
expect(container.querySelectorAll('.anticon-down').length).toBe(0);
expect(container.querySelectorAll('.anticon-search').length).toBe(1);
});
+
+ it('should show warning when use dropdownClassName', () => {
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+ render();
+ 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', () => {
diff --git a/components/select/index.en-US.md b/components/select/index.en-US.md
index f20d6119b6..757a05666b 100644
--- a/components/select/index.en-US.md
+++ b/components/select/index.en-US.md
@@ -33,7 +33,7 @@ Select component to select value from options.
| defaultOpen | Initial open state of dropdown | boolean | - | |
| defaultValue | Initial selected option | string \| string\[]
number \| number\[]
LabeledValue \| LabeledValue\[] | - | |
| disabled | Whether disabled select | boolean | false | |
-| dropdownClassName | The className of dropdown menu | string | - | |
+| popupClassName | The className of dropdown menu | string | - | 4.23.0 |
| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | |
| dropdownRender | Customize dropdown content | (originNode: ReactNode) => ReactNode | - | |
| dropdownStyle | The style of dropdown menu | CSSProperties | - | |
diff --git a/components/select/index.tsx b/components/select/index.tsx
index 85cf6c4acf..b903cdf613 100755
--- a/components/select/index.tsx
+++ b/components/select/index.tsx
@@ -19,6 +19,7 @@ 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';
type RawValue = string | number;
@@ -53,6 +54,12 @@ 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;
}
const SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
@@ -64,6 +71,7 @@ const InternalSelect = number \| number\[]
LabeledValue \| LabeledValue\[] | - | |
| disabled | 是否禁用 | boolean | false | |
-| dropdownClassName | 下拉菜单的 className 属性 | string | - | |
+| popupClassName | 下拉菜单的 className 属性 | string | - | 4.23.0 |
| dropdownMatchSelectWidth | 下拉菜单和选择器同宽。默认将设置 `min-width`,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 | boolean \| number | true | |
| dropdownRender | 自定义下拉框内容 | (originNode: ReactNode) => ReactNode | - | |
| dropdownStyle | 下拉菜单的 style 属性 | CSSProperties | - | |
diff --git a/components/time-picker/__tests__/index.test.js b/components/time-picker/__tests__/index.test.js
index d6ac11a0c8..1f8e915aca 100644
--- a/components/time-picker/__tests__/index.test.js
+++ b/components/time-picker/__tests__/index.test.js
@@ -84,6 +84,20 @@ describe('TimePicker', () => {
expect(wrapper.find('RangePicker').last().prop('dropdownClassName')).toEqual(popupClassName);
});
+ it('RangePicker should show warning when use dropdownClassName', () => {
+ mount();
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: RangePicker] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ });
+
+ it('TimePicker should show warning when use dropdownClassName', () => {
+ mount();
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: TimePicker] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ });
+
it('should support bordered', () => {
const wrapper = mount(
, 'picker'> {
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major
+ * version.Please use `popupClassName` instead.
+ */
+ dropdownClassName?: string;
popupClassName?: string;
}
-const RangePicker = React.forwardRef((props, ref) => (
-
-));
+const RangePicker = React.forwardRef((props, ref) => {
+ const { dropdownClassName, popupClassName } = props;
+ warning(
+ !dropdownClassName,
+ 'RangePicker',
+ '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ return (
+
+ );
+});
export interface TimePickerProps extends Omit, 'picker'> {
addon?: () => React.ReactNode;
popupClassName?: string;
+ /**
+ * @deprecated `dropdownClassName` is deprecated which will be removed in next major
+ * version.Please use `popupClassName` instead.
+ */
+ dropdownClassName?: string;
status?: InputStatus;
}
const TimePicker = React.forwardRef(
- ({ addon, renderExtraFooter, popupClassName, ...restProps }, ref) => {
+ ({ addon, renderExtraFooter, popupClassName, dropdownClassName, ...restProps }, ref) => {
const internalRenderExtraFooter = React.useMemo(() => {
if (renderExtraFooter) {
return renderExtraFooter;
}
+
if (addon) {
warning(
false,
@@ -49,10 +68,16 @@ const TimePicker = React.forwardRef(
return undefined;
}, [addon, renderExtraFooter]);
+ warning(
+ !dropdownClassName,
+ 'TimePicker',
+ '`dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+
return (
{
const wrapper = mount();
expect(wrapper.text()).toBe('notFoundContent');
});
+
+ it('should show warning when use dropdownClassName', () => {
+ const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+ mount();
+ expect(errorSpy).toHaveBeenCalledWith(
+ 'Warning: [antd: TreeSelect] `dropdownClassName` is deprecated which will be removed in next major version. Please use `popupClassName` instead.',
+ );
+ errorSpy.mockRestore();
+ });
});
diff --git a/components/tree-select/index.en-US.md b/components/tree-select/index.en-US.md
index a5bd260e15..b42b60a444 100644
--- a/components/tree-select/index.en-US.md
+++ b/components/tree-select/index.en-US.md
@@ -22,7 +22,7 @@ Tree selection control.
| bordered | Whether has border style | boolean | true | |
| defaultValue | To set the initial selected treeNode(s) | string \| string\[] | - | |
| disabled | Disabled or not | boolean | false | |
-| dropdownClassName | The className of dropdown menu | string | - | |
+| popupClassName | The className of dropdown menu | string | - | 4.23.0 |
| dropdownMatchSelectWidth | Determine whether the dropdown menu and the select input are the same width. Default set `min-width` same as input. Will ignore when value less than select width. `false` will disable virtual scroll | boolean \| number | true | |
| dropdownRender | Customize dropdown content | (originNode: ReactNode, props) => ReactNode | - | |
| dropdownStyle | To set the style of the dropdown menu | CSSProperties | - | |
diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx
index 700e8cb8f1..6cc296e7f9 100644
--- a/components/tree-select/index.tsx
+++ b/components/tree-select/index.tsx
@@ -50,6 +50,12 @@ 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'];
status?: InputStatus;
@@ -73,6 +79,7 @@ const InternalTreeSelect = ReactNode | - | |
| dropdownStyle | 下拉菜单的样式 | object | - | |