UNPKG

ukelli-ui

Version:

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

96 lines (95 loc) 2.87 kB
import React from 'react'; import { Children } from '../utils/props'; interface State { isShow: boolean; searchValue: string; } interface FuncChildrenParams extends State { /** 关闭 Dropdown */ hide: () => void; /** showSubMenu */ showSubMenu: () => void; /** focusInput */ focusInput: () => void; } export interface DropdownWrapperProps { /** 是否带搜索输入 */ withInput?: boolean; /** 是否渲染在 react root 之外 */ outside?: boolean; /** 是否有错误 */ error?: boolean; /** 弹出的位置,用 , 分隔,最多支持两个不冲突位置,如果冲突,则选择第一个值 */ position?: string; /** className */ className?: string; /** 外层的 title */ menuTitle?: string | number | Children; /** 接受函数 children,只在 show 的时候渲染 */ children?: Children | any; /** 监听滚动时隐藏的外层元素 */ scrollElem?: () => HTMLElement; /** 父容器的 scrollX 偏移值 */ scrollX?: number; /** 父容器的 scrollY 偏移值 */ scrollY?: number; /** 监听滚动时隐藏的外层元素 */ trigger?: 'click' | 'hover'; /** 用于渲染最外层的内容 */ overlay?: (helper: FuncChildrenParams) => Children; /** style */ style?: React.CSSProperties; } export default class DropdownWrapper extends React.PureComponent<DropdownWrapperProps, State> { static defaultProps: { withInput: boolean; menuTitle: string; trigger: string; outside: boolean; scrollX: number; scrollY: number; position: string; scrollElem: () => Document; }; state: { isShow: boolean; searchValue: string; }; _position: any; _input: any; _shown: boolean; overlayElem: any; displayTitleDOM: any; delayExec: any; hideDebounce: any; addScrollListener: any; clickAwayRef: any; updateNodeRef: any; constructor(props: any); handleClickAway: () => void; handleClickMenu: (e: any, preventDefault?: boolean) => void; focusInput(): void; showSubMenu: (isShow?: boolean) => void; hide: () => void; _hide: () => void; saveInput: (_i: any) => void; onSearch: (e: any) => void; getPropsForOverlay: () => { hide: () => void; showSubMenu: (isShow?: boolean) => void; focusInput: () => void; isShow: boolean; searchValue: string; }; saveItems: (e: any) => void; overlayRender: () => JSX.Element; saveClickAway: (e: any) => void; getDfaultChild: (menuTitle: any) => JSX.Element; childrenRender: () => any; handleMouseEnter: (event: any) => void; handleMouseLeave: () => void; bindOverlayTrigger: () => {}; bindWrapperTrigger: () => {}; render(): JSX.Element; } export {};