refactor: avoid circular import (#42764)

This commit is contained in:
Dunqing 2023-06-01 12:41:44 +08:00 committed by GitHub
parent f6dc5f39e0
commit e1e5c740e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -16,7 +16,6 @@ import Menu from '../menu';
import { OverrideProvider } from '../menu/OverrideContext';
import { NoCompactStyle } from '../space/Compact';
import theme from '../theme';
import DropdownButton from './dropdown-button';
import useStyle from './style';
const Placements = [
@ -30,7 +29,7 @@ const Placements = [
'bottom',
] as const;
type Placement = typeof Placements[number];
type Placement = (typeof Placements)[number];
type DropdownPlacement = Exclude<Placement, 'topCenter' | 'bottomCenter'>;
type OverlayFunc = () => React.ReactElement;
@ -88,7 +87,6 @@ export interface DropdownProps {
}
type CompoundedComponent = React.FC<DropdownProps> & {
Button: typeof DropdownButton;
_InternalPanelDoNotUseOrYouWillBeFired: typeof WrapPurePanel;
};
@ -305,8 +303,6 @@ const Dropdown: CompoundedComponent = (props) => {
);
};
Dropdown.Button = DropdownButton;
function postPureProps(props: DropdownProps) {
return {
...props,

View File

@ -1,10 +1,17 @@
import Dropdown from './dropdown';
import InternalDropdown from './dropdown';
import DropdownButton 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,
DropdownProps,
} from './dropdown';
export type { DropdownButtonProps, DropdownButtonType } from './dropdown-button';
const Dropdown = InternalDropdown as typeof InternalDropdown & {
Button: typeof DropdownButton;
};
Dropdown.Button = DropdownButton;
export default Dropdown;