import React, { KeyboardEvent } from 'react'; import { InputProps, InputSize } from './Input'; export declare const VerifyCodeFilterType: { OnlyDigital: string; OnlyLetter: string; DigitalOrLetter: string; }; export declare const VerifyCodeThemeType: { Border: string; Underline: string; }; export declare const InputFilterType: { OnlyDigital: string; OnlyLetter: string; DigitalOrLetter: string; }; export declare type VerifyCodeSize = InputSize; export interface VerifyCodeProps extends Pick { /** * 组件class名 */ className?: string; /** * 输入框数量 */ length: number; /** * 组件样式主题 */ theme?: typeof VerifyCodeThemeType.Border | typeof VerifyCodeThemeType.Underline; /** * 输入内容格式校验,会过滤不合规的输入,默认为OnlyLetter * OnlyDigital: 只允许输入数字 * OnlyLetter: 只允许输入字母 * DigitalOrLetter: 只允许输入数字或字母 */ filterType?: typeof InputFilterType.OnlyDigital | typeof InputFilterType.OnlyLetter | typeof InputFilterType.DigitalOrLetter; /** * 每次填写都会调用 * @param value 当前输入内容(以string类型拼接完返回) * @param isCompleted 是否全部输入完毕 * @param valueList 当前输入内容(以数组形式按序返回) */ onChange: (value: string, isCompleted: boolean, valueList: string[]) => void; } interface VerifyCodeState { inputList: { key: string; value: string; }[]; } declare class VerifyCode extends React.Component { readonly prefixCls = "abs-verify-code"; static defaultProps: { length: number; theme: string; filterType: string; }; wrapRef: React.RefObject; completed: boolean; constructor(props: any); static getDerivedStateFromProps(nextProps: VerifyCodeProps, prevState: VerifyCodeState): { inputList: { key: any; value: string; }[]; }; getIndex: (key: any) => number; getInputEle: (index: any) => HTMLInputElement | { focus: () => void; blur: () => void; }; /** * 聚焦下一个输入框 * @param nextIndex */ focusNext: (nextIndex: any) => void; /** * 获取新的input框值 * @param currentIndex * @param nextIndex * @param newValueArr */ getInputList: (currentIndex: any, nextIndex: any, newValueArr: any) => { key: string; value: any; }[]; /** * 只允许聚焦最后一个待输入的输入框 * @param _v * @param key */ onFocus: (_v: any, key: any) => void; onChange: (inputList: any, nextFocusIndex: any) => void; onKeyDown: (ev: KeyboardEvent, key: any) => void; onValueChange: (rawValue: any, key: any) => void; render(): JSX.Element; } export default VerifyCode;