import type { ChangeEvent, CSSProperties, CompositionEvent, FocusEvent, HTMLAttributes, KeyboardEvent, KeyboardEventHandler, MouseEvent, ReactNode, Ref, RefObject, ReactElement } from 'react'; import type { LiteralUnion } from './../../wui-core/src/utils/type'; import type { BaseProps } from '../../wui-core/src/iCore'; export type SizeType = 'sm' | 'md' | 'nm' | 'lg' | 'small' | 'middle' | 'large'; export type InputType = LiteralUnion<'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week', string>; export type BlurHandler = (value: FocusEvent | string | number, event: FocusEvent, isClear?: boolean) => any; export type FocusHandler = (value: FocusEvent | string | number, event: FocusEvent) => any; export type SearchHandler = (value: string, event: KeyboardEvent | MouseEvent) => any; export type ChangeHandler = (value: ChangeEvent | MouseEvent | CompositionEvent | string | number, event?: ChangeEvent | MouseEvent | CompositionEvent) => any; type OmitType = 'size' | 'prefix' | 'type' | 'onChange' | 'onBlur' | 'onFocus' | 'onSearch'; export interface InputProps extends Omit, OmitType>, BaseProps { componentClass?: keyof JSX.IntrinsicElements; size?: SizeType; type?: InputType; ref?: Ref; autoComplete?: string; antd?: boolean; disabled?: boolean; showClose?: boolean; allowClear?: boolean; loading?: boolean; focusSelect?: boolean; innerStyle?: CSSProperties; innerClassName?: string; wrapperClassName?: string; debounceDelay?: number; maxLength?: number; showMaxLabel?: boolean; showCount?: boolean; allowInputOverMax?: boolean; value?: string | number; defaultValue?: string | number; autoSize?: { minRows?: number; maxRows?: number; }; onResize?: (position: { width?: number; height?: number; offsetHeight?: number; offsetWidth?: number; }) => void; onFocus?: FocusHandler; onSearch?: SearchHandler; onChange?: ChangeHandler; onBlur?: BlurHandler; onPressEnter?: KeyboardEventHandler; prefix?: ReactNode; suffix?: ReactNode; icon?: ReactElement; trigger?: 'click' | 'hover'; iconRender?: (visible?: boolean) => ReactNode; enterButton?: ReactNode | boolean; visibilityToggle?: boolean; passwordVisible?: boolean; onVisibleChange?: (visible?: boolean) => void; readOnly?: boolean; autoFocus?: boolean; } export interface InputState { showSearch?: boolean; value?: InputProps['value']; focused?: boolean; prevValue?: InputProps['value']; passwordVisible?: boolean; } export interface MutableRefObject extends RefObject { current: any; } export interface DefaultProps { componentClass: any; clsPrefix: string; type: string; size: string; trigger: 'click' | 'hover'; iconRender: (visible?: boolean) => ReactNode; allowInputOverMax: boolean; visibilityToggle: boolean; debounceDelay: number; antd: boolean; } export interface InputWithDefaultProps extends Omit, DefaultProps { } export {};