zent
Version:
一套前端设计语言和基于React的实现
81 lines (80 loc) • 2.65 kB
TypeScript
import { Component } from 'react';
import { IInputClearEvent } from '../input';
import SelectMenu from '../select-menu';
export interface ICompoundMentionSuggestion {
value: unknown;
content?: React.ReactNode;
isGroup?: boolean;
isDivider?: boolean;
icon?: string;
disabled?: boolean;
}
export interface IMentionProps {
value: string;
onChange: (val: string) => void;
onSearchChange?: (search: string) => void;
multiLine?: boolean;
position?: 'top' | 'bottom';
suggestions: string | number | ICompoundMentionSuggestion;
suggestionNotFoundContent?: React.ReactNode;
triggerText?: string;
className?: string;
loading?: boolean;
type?: string;
onBlur?: React.FocusEventHandler;
onKeyUp?: React.FocusEventHandler;
onKeyDown?: React.KeyboardEventHandler;
inline?: boolean;
}
export declare class Mention extends Component<IMentionProps> {
static defaultProps: {
multiLine: boolean;
position: string;
suggestionNotFoundContent: string;
suggestions: any[];
triggerText: string;
inline: boolean;
};
_compositing: boolean;
input: HTMLInputElement | HTMLTextAreaElement | null;
suggestionList: SelectMenu | null;
state: {
position: any;
placeholder: any;
suggestionVisible: boolean;
search: any;
};
BottomPosition: import("../popover").IPositionFunction;
TopPosition: import("../popover").IPositionFunction;
render(): JSX.Element;
componentDidUpdate(prevProps: any): void;
componentDidMount(): void;
onSuggestionVisibleChange: (visible: any) => void;
onCloseMenuList: () => void;
onSelectSuggestion: (val: any) => void;
onInputChange: (evt: IInputClearEvent | React.ChangeEvent<HTMLInputElement>) => void;
onInputScroll: (() => void) & import("../utils/types").ICancelable;
onInputCompositionStart: () => void;
onInputCompositionEnd: () => void;
onInputBlur: (evt: any) => void;
onInputKeyUp: (evt: any) => void;
onInputKeyDown: (evt: any) => void;
onSelectionChange: () => void;
triggerEventCallback(eventName: any, evt: any): void;
saveInputRef: (instance: any) => void;
onSuggestionListRefChange: (instance: any) => void;
setSuggestionVisible: (value?: unknown) => void;
setStateIfChange(state: any): void;
getCaretCoordinates(start: any): {
top: number;
left: number;
height: number;
};
getDefaultState(): {
suggestionVisible: boolean;
search: any;
position: any;
placeholder: any;
};
}
export default Mention;