index.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import type { CSSMotionProps } from 'rc-motion';
  2. import * as React from 'react';
  3. import type { ActionType, AlignType, AnimationType, ArrowTypeOuter, BuildInPlacements, TransitionNameType } from './interface';
  4. export type { ActionType, AlignType, ArrowTypeOuter as ArrowType, BuildInPlacements, };
  5. export interface TriggerRef {
  6. nativeElement: HTMLElement;
  7. popupElement: HTMLDivElement;
  8. forceAlign: VoidFunction;
  9. }
  10. export interface TriggerProps {
  11. children: React.ReactElement;
  12. action?: ActionType | ActionType[];
  13. showAction?: ActionType[];
  14. hideAction?: ActionType[];
  15. prefixCls?: string;
  16. zIndex?: number;
  17. onPopupAlign?: (element: HTMLElement, align: AlignType) => void;
  18. stretch?: string;
  19. popupVisible?: boolean;
  20. defaultPopupVisible?: boolean;
  21. onPopupVisibleChange?: (visible: boolean) => void;
  22. afterPopupVisibleChange?: (visible: boolean) => void;
  23. getPopupContainer?: (node: HTMLElement) => HTMLElement;
  24. forceRender?: boolean;
  25. autoDestroy?: boolean;
  26. /** @deprecated Please use `autoDestroy` instead */
  27. destroyPopupOnHide?: boolean;
  28. mask?: boolean;
  29. maskClosable?: boolean;
  30. /** Set popup motion. You can ref `rc-motion` for more info. */
  31. popupMotion?: CSSMotionProps;
  32. /** Set mask motion. You can ref `rc-motion` for more info. */
  33. maskMotion?: CSSMotionProps;
  34. /** @deprecated Please us `popupMotion` instead. */
  35. popupTransitionName?: TransitionNameType;
  36. /** @deprecated Please us `popupMotion` instead. */
  37. popupAnimation?: AnimationType;
  38. /** @deprecated Please us `maskMotion` instead. */
  39. maskTransitionName?: TransitionNameType;
  40. /** @deprecated Please us `maskMotion` instead. */
  41. maskAnimation?: AnimationType;
  42. mouseEnterDelay?: number;
  43. mouseLeaveDelay?: number;
  44. focusDelay?: number;
  45. blurDelay?: number;
  46. popup: React.ReactNode | (() => React.ReactNode);
  47. popupPlacement?: string;
  48. builtinPlacements?: BuildInPlacements;
  49. popupAlign?: AlignType;
  50. popupClassName?: string;
  51. popupStyle?: React.CSSProperties;
  52. getPopupClassNameFromAlign?: (align: AlignType) => string;
  53. onPopupClick?: React.MouseEventHandler<HTMLDivElement>;
  54. alignPoint?: boolean;
  55. /**
  56. * Trigger will memo content when close.
  57. * This may affect the case if want to keep content update.
  58. * Set `fresh` to `false` will always keep update.
  59. */
  60. fresh?: boolean;
  61. arrow?: boolean | ArrowTypeOuter;
  62. /** @deprecated Add `className` on `children`. Please add `className` directly instead. */
  63. className?: string;
  64. /**
  65. * @private Get trigger DOM node.
  66. * Used for some component is function component which can not access by `findDOMNode`
  67. */
  68. getTriggerDOMNode?: (node: React.ReactInstance) => HTMLElement;
  69. }
  70. export declare function generateTrigger(PortalComponent?: React.ComponentType<any>): React.ForwardRefExoticComponent<TriggerProps & React.RefAttributes<TriggerRef>>;
  71. declare const _default: React.ForwardRefExoticComponent<TriggerProps & React.RefAttributes<TriggerRef>>;
  72. export default _default;