import React, { FunctionComponent } from 'react'; import { BasicComponent } from '../../utils/typings'; export type PopoverLocation = 'bottom' | 'top' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end'; export interface List { key?: string; name: string; icon?: React.ReactNode; disabled?: boolean; className?: string; } export interface PopoverProps extends BasicComponent { /** * 选项列表 * @default [] */ list: List[] /** * 弹出位置,里面具体的参数值可以参考上面的位置自定义例子 * @default bottom */ location: PopoverLocation | string /** * 是否展示气泡弹出层 * @default false */ visible: boolean /** * 出现位置的偏移量 * @default [0, 12] */ offset: string[] | number[] /** * 自定义目标元素 id * @default - */ targetId: string /** * 自定义背景色 * @default - */ background: string /** * 自定义选项文字颜色 * @default - */ color: string /** * 是否显示小箭头 * @default true */ showArrow: boolean /** * 动画时长,单位秒 * @default 0.3 */ duration: string | number /** * 是否显示遮罩层 * @default false */ overlay: boolean /** * 自定义遮罩层类名 * @default '' */ overlayClassName: string /** * 自定义遮罩层样式 * @default {} */ overlayStyle: React.CSSProperties /** * 是否在点击外部元素后关闭菜单 * @default true */ closeOnClickOutside: boolean /** * 是否在点击选项后关闭 * @default true */ closeOnClickAction: boolean /** * 是否在点击遮罩层后关闭菜单 * @default true */ closeOnOverlayClick: boolean children?: React.ReactNode; /** * 点击切换 popover 展示状态 * @default () => {} */ onClick: () => void /** * 点击菜单时触发 * @default () => {} */ onOpen: () => void /** * 关闭菜单时触发 * @default () => {} */ onClose: () => void /** * 点击选项时触发 * @default (item, index) => {} */ onSelect: (item: List, index: number) => void } export declare const Popover: FunctionComponent & Omit, 'onSelect'>>;