mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 04:13:13 +08:00
parent
06ffd9ca04
commit
ff458a2c3f
@ -5,47 +5,23 @@ import omit from 'omit.js';
|
|||||||
import Group from './Group';
|
import Group from './Group';
|
||||||
import Search from './Search';
|
import Search from './Search';
|
||||||
import TextArea from './TextArea';
|
import TextArea from './TextArea';
|
||||||
|
import { Omit } from '../_util/type';
|
||||||
|
|
||||||
function fixControlledValue(value: undefined | null | string) {
|
function fixControlledValue<T>(value: T) {
|
||||||
if (typeof value === 'undefined' || value === null) {
|
if (typeof value === 'undefined' || value === null) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AbstractInputProps {
|
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
||||||
prefixCls?: string;
|
prefixCls?: string;
|
||||||
className?: string;
|
|
||||||
defaultValue?: any;
|
|
||||||
value?: any;
|
|
||||||
tabIndex?: number;
|
|
||||||
style?: React.CSSProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface InputProps extends AbstractInputProps {
|
|
||||||
placeholder?: string;
|
|
||||||
type?: string;
|
|
||||||
id?: number | string;
|
|
||||||
name?: string;
|
|
||||||
size?: 'large' | 'default' | 'small';
|
size?: 'large' | 'default' | 'small';
|
||||||
maxLength?: number | string;
|
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
||||||
disabled?: boolean;
|
|
||||||
readOnly?: boolean;
|
|
||||||
addonBefore?: React.ReactNode;
|
addonBefore?: React.ReactNode;
|
||||||
addonAfter?: React.ReactNode;
|
addonAfter?: React.ReactNode;
|
||||||
onPressEnter?: React.FormEventHandler<HTMLInputElement>;
|
|
||||||
onKeyDown?: React.FormEventHandler<HTMLInputElement>;
|
|
||||||
onKeyUp?: React.FormEventHandler<HTMLInputElement>;
|
|
||||||
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
||||||
onClick?: React.FormEventHandler<HTMLInputElement>;
|
|
||||||
onDoubleClick?: React.FormEventHandler<HTMLInputElement>;
|
|
||||||
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
||||||
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
||||||
autoComplete?: string;
|
|
||||||
prefix?: React.ReactNode;
|
prefix?: React.ReactNode;
|
||||||
suffix?: React.ReactNode;
|
suffix?: React.ReactNode;
|
||||||
spellCheck?: boolean;
|
|
||||||
autoFocus?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Input extends React.Component<InputProps, any> {
|
export default class Input extends React.Component<InputProps, any> {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import omit from 'omit.js';
|
import omit from 'omit.js';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { AbstractInputProps } from './Input';
|
|
||||||
import calculateNodeHeight from './calculateNodeHeight';
|
import calculateNodeHeight from './calculateNodeHeight';
|
||||||
|
|
||||||
function onNextFrame(cb: () => void) {
|
function onNextFrame(cb: () => void) {
|
||||||
@ -24,9 +23,10 @@ export interface AutoSizeType {
|
|||||||
maxRows?: number;
|
maxRows?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TextAreaProps extends AbstractInputProps {
|
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||||
|
prefixCls?: string;
|
||||||
autosize?: boolean | AutoSizeType;
|
autosize?: boolean | AutoSizeType;
|
||||||
onPressEnter?: React.FormEventHandler<any>;
|
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TextAreaState {
|
export interface TextAreaState {
|
||||||
|
Loading…
Reference in New Issue
Block a user