UNPKG

jamis

Version:

一种支持通过JSON配置方式生成页面的组件库

48 lines (47 loc) 1.97 kB
import React from 'react'; import type { DebouncedFunc } from 'lodash-es/debounce'; import type { HistoryRecord, SearchBoxProps, SearchHistoryOptions } from './types'; interface SearchBoxState { isFocused: boolean; isHistoryOpened: boolean; inputValue: string; historyRecords: HistoryRecord[]; } export default class SearchBox extends React.Component<SearchBoxProps, SearchBoxState> { inputRef: React.RefObject<HTMLInputElement>; static defaultProps: Partial<SearchBoxProps>; state: { isHistoryOpened: boolean; isFocused: boolean; inputValue: string; historyRecords: HistoryRecord[]; }; onSearchLazyAfterChanged: DebouncedFunc<(keywords: string) => void> | undefined; constructor(props: SearchBoxProps); componentDidUpdate(prevProps: SearchBoxProps): void; componentWillUnmount(): void; handleActive: () => void; handleCancel: () => void; handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void; handleSearch: () => void; handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void; handleClear: (e: React.MouseEvent<HTMLDivElement>) => void; handleFocus: () => void; handleBlur: (e: React.FocusEvent<HTMLInputElement>) => void; handleHistoryRecordSelect: (record: HistoryRecord) => void; /** 获取历史搜索配置 */ getHistoryOptions(): Required<SearchHistoryOptions>; /** 获取历史记录 */ getHistoryRecords(): HistoryRecord[]; /** 清空历史记录 */ clearHistoryRecords: (e: React.MouseEvent<any>) => HistoryRecord[]; /** 删除一条历史记录 */ removeHistoryRecord: (record: HistoryRecord) => HistoryRecord[]; /** 新增一条历史记录 */ insertHistoryRecord(value: string): HistoryRecord[]; renderInput: () => JSX.Element; renderTag: (item: HistoryRecord, index: number) => JSX.Element; renderHistory: () => JSX.Element; render(): JSX.Element; } export {};