import React from 'react'; /** * */ interface MultilineProps { /** * 指定多行输入框的最大行数 */ maxRows?: number; /** * 指定多行输入框的最小行数 */ minRows?: number; /** * 指定多行输入框的行数 */ rows?: number; } /** * */ export interface BaseInputProps> { /** * 值 */ value?: string; /** * 默认值 */ defaultValue?: string; /** * 占位符文字 */ placeholder?: string; /** * 输入框类型 */ type?: string; /** * 输入框属性 */ inputProps?: React.ComponentPropsWithRef & Record & ExtendInputProps; /** * 为输入框元素指定 ref */ inputRef?: React.Ref; /** * 是否是多行文本输入框。如果设置为`true`,则采用 AutosizeTextarea 渲染出 textarea */ multiline?: boolean; /** * 是否只读,默认为false */ readOnly?: boolean; /** * 必填 */ required?: boolean; /** * 自动补全 */ autoComplete?: string; /** * 自动获取焦点 */ autoFocus?: boolean; /** * 自定义样式类名称 */ className?: string; /** * 自定义样式 */ style?: React.CSSProperties; /** * 失去焦点时的回调函数 */ onBlur?: (event: React.FocusEvent) => void; /** * 获取焦点时的回调函数 */ onFocus?: (event: React.FocusEvent) => void; /** * 值变化时的回调函数 */ onChange?: (event: React.ChangeEvent) => void; /** * 点击事件的回调函数 */ onClick?: (event: React.MouseEvent) => void; /** * 在组件的开头添加装饰器`InputAdornment`。 */ startAdornment?: React.ReactNode; /** * 在组件的末尾添加装饰器`InputAdornment`。 */ endAdornment?: React.ReactNode; /** * 不可用状态 */ disabled?: boolean; /** * 全宽模式 */ fullWidth?: boolean; /** * 指定包含的子元素 */ children?: React.ReactNode; /** * 输入区域渲染元素 */ inputComponent?: React.ElementType; /** * 输入框文本对齐方式。默认为`start`。 */ align?: 'start' | 'end'; /** * 引用根元素 */ ref?: React.Ref; /** * 设置输入框元素的id */ id?: string; /** * 设置输入框的name */ name?: string; /** * 最小行数目 */ minRows?: number; /** * 最大行数目 */ maxRows?: number; /** * 指定输入框校验错误信息 */ error?: boolean; /** * 指定输入框校验错误信息 */ errorText?: string; /** * 是否允许清除 */ allowClear?: boolean; /** * 点击清除按钮时的回调函数 */ onClear?: (event: React.MouseEvent) => void; /** * 输入框区域描述性文字 */ title?: string; } /** * */ export interface BaseInputComponentType { (props: { /** * */ inputComponent: C; } & BaseInputProps): JSX.Element | null; (props: { /** * */ multiline: true; } & BaseInputProps<'textarea', HTMLTextAreaElement, MultilineProps>): JSX.Element | null; (props: BaseInputProps<'input', InputElementType>): JSX.Element | null; } /** * 基础输入框组件 * * `BaseInput` 是一个包含尽量少样式的组件。它是用来简化构建输入框的基础组件。包含了输入框的重置样式和部分状态控制。 */ declare const BaseInput: BaseInputComponentType; export default BaseInput;