fix: DropDownProps => DropdownProps (#35161)

* fix: DropDown => Dropdown

* chore: leave DropDownProps for compatibility
This commit is contained in:
afc163 2022-04-21 22:09:59 +08:00 committed by GitHub
parent 93b55d5e8c
commit 8f06430336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 17 deletions

View File

@ -1,15 +1,15 @@
import * as React from 'react';
import DownOutlined from '@ant-design/icons/DownOutlined';
import DropDown, { DropDownProps } from '../dropdown/dropdown';
import Dropdown, { DropdownProps } from '../dropdown/dropdown';
import { ConfigContext } from '../config-provider';
export interface BreadcrumbItemProps {
prefixCls?: string;
separator?: React.ReactNode;
href?: string;
overlay?: DropDownProps['overlay'];
dropdownProps?: DropDownProps;
overlay?: DropdownProps['overlay'];
dropdownProps?: DropdownProps;
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLSpanElement>;
className?: string;
children?: React.ReactNode;
@ -27,16 +27,16 @@ const BreadcrumbItem: BreadcrumbItemInterface = ({
}) => {
const { getPrefixCls } = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls);
/** If overlay is have Wrap a DropDown */
/** If overlay is have Wrap a Dropdown */
const renderBreadcrumbNode = (breadcrumbItem: React.ReactNode) => {
if (overlay) {
return (
<DropDown overlay={overlay} placement="bottom" {...dropdownProps}>
<Dropdown overlay={overlay} placement="bottom" {...dropdownProps}>
<span className={`${prefixCls}-overlay-link`}>
{breadcrumbItem}
<DownOutlined />
</span>
</DropDown>
</Dropdown>
);
}
return breadcrumbItem;

View File

@ -5,13 +5,13 @@ import Button, { ButtonProps } from '../button';
import { ButtonHTMLType } from '../button/button';
import { ButtonGroupProps } from '../button/button-group';
import { ConfigContext } from '../config-provider';
import Dropdown, { DropDownProps } from './dropdown';
import Dropdown, { DropdownProps } from './dropdown';
const ButtonGroup = Button.Group;
export type DropdownButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'link' | 'text';
export interface DropdownButtonProps extends ButtonGroupProps, DropDownProps {
export interface DropdownButtonProps extends ButtonGroupProps, DropdownProps {
type?: DropdownButtonType;
htmlType?: ButtonHTMLType;
disabled?: boolean;
@ -76,7 +76,7 @@ const DropdownButton: DropdownButtonInterface = props => {
overlayClassName,
overlayStyle,
destroyPopupOnHide,
} as DropDownProps;
} as DropdownProps;
if ('visible' in props) {
dropdownProps.visible = visible;

View File

@ -41,7 +41,7 @@ export type DropdownArrowOptions = {
pointAtCenter?: boolean;
};
export interface DropDownProps {
export interface DropdownProps {
arrow?: boolean | DropdownArrowOptions;
trigger?: ('click' | 'hover' | 'contextMenu')[];
overlay: React.ReactElement | OverlayFunc;
@ -64,7 +64,7 @@ export interface DropDownProps {
children?: React.ReactNode;
}
interface DropdownInterface extends React.FC<DropDownProps> {
interface DropdownInterface extends React.FC<DropdownProps> {
Button: typeof DropdownButton;
}

View File

@ -1,5 +1,10 @@
import Dropdown from './dropdown';
export { DropDownProps } from './dropdown';
export { DropdownButtonProps, DropdownButtonType } from './dropdown-button';
export type {
DropdownProps,
// typo, but we need to support it for backwards compatibility
// https://github.com/ant-design/ant-design/pull/35161
DropdownProps as DropDownProps,
} from './dropdown';
export type { DropdownButtonProps, DropdownButtonType } from './dropdown-button';
export default Dropdown;

View File

@ -78,7 +78,12 @@ export { default as Descriptions } from './descriptions';
export type { DividerProps } from './divider';
export { default as Divider } from './divider';
export type { DropDownProps } from './dropdown';
export type {
DropdownProps,
// typo, but we need to support it for backwards compatibility
// https://github.com/ant-design/ant-design/pull/35161
DropdownProps as DropDownProps,
} from './dropdown';
export { default as Dropdown } from './dropdown';
export type { DrawerProps } from './drawer';

View File

@ -130,7 +130,7 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
const selectProps = omit(props as typeof props & { itemIcon: any }, ['suffixIcon', 'itemIcon']);
const rcSelectRtlDropDownClassName = classNames(dropdownClassName, {
const rcSelectRtlDropdownClassName = classNames(dropdownClassName, {
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl',
});
@ -181,7 +181,7 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
notFoundContent={mergedNotFound}
className={mergedClassName}
getPopupContainer={getPopupContainer || getContextPopupContainer}
dropdownClassName={rcSelectRtlDropDownClassName}
dropdownClassName={rcSelectRtlDropdownClassName}
showArrow={hasFeedback || showArrow}
/>
);

View File

@ -2198,7 +2198,7 @@ describe('Table.filter', () => {
});
});
it('filterDropDown should support filterResetToDefaultFilteredValue', () => {
it('filterDropdown should support filterResetToDefaultFilteredValue', () => {
jest.useFakeTimers();
jest.spyOn(console, 'error').mockImplementation(() => undefined);