1 | import * as React from 'react';
|
2 | import Group from './Group';
|
3 | import Search from './Search';
|
4 | import TextArea from './TextArea';
|
5 | import Password from './Password';
|
6 | import { Omit, LiteralUnion } from '../_util/type';
|
7 | import ClearableLabeledInput from './ClearableLabeledInput';
|
8 | import { ConfigConsumerProps, DirectionType } from '../config-provider';
|
9 | import { SizeType } from '../config-provider/SizeContext';
|
10 | export interface InputFocusOptions extends FocusOptions {
|
11 | cursor?: 'start' | 'end' | 'all';
|
12 | }
|
13 | export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
14 | prefixCls?: string;
|
15 | size?: SizeType;
|
16 | type?: 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>;
|
17 | onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
18 | addonBefore?: React.ReactNode;
|
19 | addonAfter?: React.ReactNode;
|
20 | prefix?: React.ReactNode;
|
21 | suffix?: React.ReactNode;
|
22 | allowClear?: boolean;
|
23 | bordered?: boolean;
|
24 | }
|
25 | export declare function fixControlledValue<T>(value: T): "" | T;
|
26 | export declare function resolveOnChange<E extends HTMLInputElement | HTMLTextAreaElement>(target: E, e: React.ChangeEvent<E> | React.MouseEvent<HTMLElement, MouseEvent> | React.CompositionEvent<HTMLElement>, onChange: undefined | ((event: React.ChangeEvent<E>) => void), targetValue?: string): void;
|
27 | export declare function getInputClassName(prefixCls: string, bordered: boolean, size?: SizeType, disabled?: boolean, direction?: DirectionType): string;
|
28 | export declare function triggerFocus(element?: HTMLInputElement | HTMLTextAreaElement, option?: InputFocusOptions): void;
|
29 | export interface InputState {
|
30 | value: any;
|
31 | focused: boolean;
|
32 |
|
33 | prevValue: any;
|
34 | }
|
35 | declare class Input extends React.Component<InputProps, InputState> {
|
36 | static Group: typeof Group;
|
37 | static Search: typeof Search;
|
38 | static TextArea: typeof TextArea;
|
39 | static Password: typeof Password;
|
40 | static defaultProps: {
|
41 | type: string;
|
42 | };
|
43 | input: HTMLInputElement;
|
44 | clearableInput: ClearableLabeledInput;
|
45 | removePasswordTimeout: any;
|
46 | direction: DirectionType;
|
47 | constructor(props: InputProps);
|
48 | static getDerivedStateFromProps(nextProps: InputProps, { prevValue }: InputState): Partial<InputState>;
|
49 | componentDidMount(): void;
|
50 | componentDidUpdate(): void;
|
51 | getSnapshotBeforeUpdate(prevProps: InputProps): null;
|
52 | componentWillUnmount(): void;
|
53 | focus: (option?: InputFocusOptions | undefined) => void;
|
54 | blur(): void;
|
55 | setSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void;
|
56 | select(): void;
|
57 | saveClearableInput: (input: ClearableLabeledInput) => void;
|
58 | saveInput: (input: HTMLInputElement) => void;
|
59 | onFocus: React.FocusEventHandler<HTMLInputElement>;
|
60 | onBlur: React.FocusEventHandler<HTMLInputElement>;
|
61 | setValue(value: string, callback?: () => void): void;
|
62 | handleReset: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
63 | renderInput: (prefixCls: string, size: SizeType | undefined, bordered: boolean, input?: ConfigConsumerProps['input']) => JSX.Element;
|
64 | clearPasswordValueAttribute: () => void;
|
65 | handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
66 | handleKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
67 | renderComponent: ({ getPrefixCls, direction, input }: ConfigConsumerProps) => JSX.Element;
|
68 | render(): JSX.Element;
|
69 | }
|
70 | export default Input;
|