import { InputProps as IProps } from '../types'; import { FormatterType, FormatterTypeEnum } from './formatter'; type HTMLString = string; export interface InputProps extends IProps { /** * 输入框类型, type=text时有效 */ type?: 'text' | 'textarea' | 'password' | 'number'; /** * 长度限制; 若设置, 自动显示数量提示, type=text时有效 */ maxlength?: string | number; /** * 数据格式化类型, type=text时有效 * @description currency(货币), tel(电话号码) */ formatType?: FormatterTypeEnum | FormatterType; tooltip?: HTMLString; /** * 自身提示, 优先级高于tooltip * @todo 等待实现 */ selfTooltip?: HTMLString; /** * 小数点位数, type=number时有效,若设置将允许小数,否则为整数 */ decimal?: number; /** * 是否为正数, type=number时有效 */ positive?: boolean; /** * 是否显示控制器, type=number时有效 */ controls?: boolean; /** * 最小输入值, type=number时有效 */ min?: number; /** * 最大输入值, type=number时有效 */ max?: number; /** * 步数, type=number时有效 */ step?: number; } export type InputValue = string | number | ''; export type InputSlots = { /** * 默认前置插槽(内) */ prefix: () => void; /** * 默认后置插槽(内) */ suffix: () => void; /** * 前置插槽(外) */ prepend: (props: { size?: InputProps['size']; }) => void; /** * 后置插槽(外) */ append: (props: { size?: InputProps['size']; }) => void; /** * 自定义前置插槽(外) */ before: (props: { size?: InputProps['size']; }) => void; /** * 自定义后置插槽(外) */ after: (props: { size?: InputProps['size']; }) => void; }; export interface InputEmits { (e: 'change', value: InputValue): void; (e: 'clear'): void; } export {};