Menu.d.ts 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import type { CSSMotionProps } from 'rc-motion';
  2. import * as React from 'react';
  3. import type { BuiltinPlacements, Components, ItemType, MenuClickEventHandler, MenuMode, MenuRef, RenderIconType, SelectEventHandler, TriggerSubMenuAction } from './interface';
  4. export interface MenuProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'onClick' | 'onSelect' | 'dir'> {
  5. prefixCls?: string;
  6. rootClassName?: string;
  7. items?: ItemType[];
  8. /** @deprecated Please use `items` instead */
  9. children?: React.ReactNode;
  10. disabled?: boolean;
  11. /** @private Disable auto overflow. Pls note the prop name may refactor since we do not final decided. */
  12. disabledOverflow?: boolean;
  13. /** direction of menu */
  14. direction?: 'ltr' | 'rtl';
  15. mode?: MenuMode;
  16. inlineCollapsed?: boolean;
  17. defaultOpenKeys?: string[];
  18. openKeys?: string[];
  19. activeKey?: string;
  20. defaultActiveFirst?: boolean;
  21. selectable?: boolean;
  22. multiple?: boolean;
  23. defaultSelectedKeys?: string[];
  24. selectedKeys?: string[];
  25. onSelect?: SelectEventHandler;
  26. onDeselect?: SelectEventHandler;
  27. inlineIndent?: number;
  28. /** Menu motion define. Use `defaultMotions` if you need config motion of each mode */
  29. motion?: CSSMotionProps;
  30. /** Default menu motion of each mode */
  31. defaultMotions?: Partial<{
  32. [key in MenuMode | 'other']: CSSMotionProps;
  33. }>;
  34. subMenuOpenDelay?: number;
  35. subMenuCloseDelay?: number;
  36. forceSubMenuRender?: boolean;
  37. triggerSubMenuAction?: TriggerSubMenuAction;
  38. builtinPlacements?: BuiltinPlacements;
  39. itemIcon?: RenderIconType;
  40. expandIcon?: RenderIconType;
  41. overflowedIndicator?: React.ReactNode;
  42. /** @private Internal usage. Do not use in your production. */
  43. overflowedIndicatorPopupClassName?: string;
  44. getPopupContainer?: (node: HTMLElement) => HTMLElement;
  45. onClick?: MenuClickEventHandler;
  46. onOpenChange?: (openKeys: string[]) => void;
  47. /***
  48. * @private Only used for `pro-layout`. Do not use in your prod directly
  49. * and we do not promise any compatibility for this.
  50. */
  51. _internalRenderMenuItem?: (originNode: React.ReactElement, menuItemProps: any, stateProps: {
  52. selected: boolean;
  53. }) => React.ReactElement;
  54. /***
  55. * @private Only used for `pro-layout`. Do not use in your prod directly
  56. * and we do not promise any compatibility for this.
  57. */
  58. _internalRenderSubMenuItem?: (originNode: React.ReactElement, subMenuItemProps: any, stateProps: {
  59. selected: boolean;
  60. open: boolean;
  61. active: boolean;
  62. disabled: boolean;
  63. }) => React.ReactElement;
  64. /**
  65. * @private NEVER! EVER! USE IN PRODUCTION!!!
  66. * This is a hack API for `antd` to fix `findDOMNode` issue.
  67. * Not use it! Not accept any PR try to make it as normal API.
  68. * By zombieJ
  69. */
  70. _internalComponents?: Components;
  71. }
  72. declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<MenuRef>>;
  73. export default Menu;