UNPKG

ukelli-ui

Version:

Base on React's UI lib. Make frontend's dev simpler and faster.

103 lines (102 loc) 2.68 kB
import { Component } from 'react'; import { IconProps } from '../icon/icon'; import { Sizes } from '../utils/props'; declare type FilterType = string | number; export interface InputProps { /** 是否必填项 */ required?: boolean; /** 是否显示 title */ showTitle?: boolean; /** title 是否在获取焦点后上浮 */ flowTitle?: boolean; /** 是否获取焦点后选中文字 */ forceToSelect?: boolean; /** size */ size?: Sizes; /** 输入框类型 */ type?: 'input' | 'pw' | 'password' | 'text' | 'number'; /** 期望输出的值的类型 */ outputType?: 'string' | 'number'; /** placeholder */ placeholder?: any; /** 固定的 title */ title?: any; /** className */ className?: string; /** onChange 前执行的过滤器 */ filter?: (value: FilterType) => FilterType; /** defaultValue */ defaultValue?: number | string; /** value */ value?: number | string; /** 输入框右侧的按钮配置 */ inputBtnConfig?: { /** 传入 input 的 target */ action: (inputRef: any) => void; text: string; color?: string; icon?: string; className?: string; }; /** 传入 input element 的属性 */ propsForInput?: {}; /** onChange */ onChange?: (value: any, targetElement: HTMLElement) => void; /** onFocus */ onFocus?: (focusEvent: any) => void; /** onBlur */ onBlur?: (value: any, blurEvent: any) => void; /** 输入框的 icon */ icon?: IconProps['n']; /** 输入框的 icon */ n?: IconProps['n']; /** IconProps['s'] */ s?: IconProps['s']; } interface State { viewClass: string; stateVal: any; focusing: boolean; } /** * 通用输入的封装控件 * * @export * @class Input * @extends {Component} */ export default class Input extends Component<InputProps, State> { static defaultProps: { required: boolean; forceToSelect: boolean; className: string; type: string; size: string; outputType: string; propsForInput: {}; }; /** * 设置 input 控件的默认行为 * @public */ static setConfig: ({ showTitle }: { showTitle: any; }) => void; isControl: any; value: any; iconInput: any; constructor(props: any); onFocus(): void; onBlur(): void; focus(): void; select(): void; getValue(): any; /** * 用于过滤是 number 类型的值 */ numberValFilter(val?: any): any; changeVal(val: any, elem: any): void; filterVal: (val: any) => any; render(): JSX.Element; } export {};