UNPKG

ukelli-ui

Version:

Base on React's UI lib. Make frontend's dev simpler and faster.

68 lines (67 loc) 2.02 kB
import React, { Component } from 'react'; import { PositionReturn, PopoverPosition } from '../utils/position'; import { Children, Color } from '../utils/props'; export interface PopoverProps { /** 是否激活 */ open: boolean; /** 关闭的回调,之前是 RequestClose */ onClose: (closeEvent: any) => void; /** 相对的元素,传入 document node */ relativeElem: HTMLElement | EventTarget; /** 弹出的位置 */ position?: PopoverPosition; /** 弹出框的颜色类型 */ type?: Color; /** 是否显示关闭按钮 */ showCloseBtn?: boolean; /** 是否 fixed 定位 */ fixed?: boolean; /** 是否 update 组件 */ update?: boolean; /** class name */ className?: string; /** class name */ children?: Children; /** style */ style?: React.CSSProperties; /** 是否支持 Esc 关闭 */ enableTabIndex?: boolean; } interface State { positionStyle: PositionReturn; prevProps: {}; childrenChange: boolean; } export default class Popover extends Component<PopoverProps, State> { static defaultProps: { position: string; type: string; showCloseBtn: boolean; enableTabIndex: boolean; }; static getDerivedStateFromProps(nextProps: any, { prevProps }: { prevProps: any; }): { childrenChange: boolean; prevProps: any; } | null; readPosition: string; popoverDOM: any; __isMounted: any; constructor(props: any); shouldComponentUpdate: (nextProps: any) => any; handleKeyDown: (event: any) => void; setContentFocus: () => void; componentDidMount(): void; componentDidUpdate(prevProps: any, prevState: any): void; getRelativeElemOffset(): { offsetWidth: number; offsetHeight: number; offsetTop: number; offsetLeft: number; }; calaStyle(position: any, popoverScale: any): PositionReturn; setSelfPosition: (elem: any) => void; render(): JSX.Element; } export {};