mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
parent
06ffd9ca04
commit
ff458a2c3f
@ -5,47 +5,23 @@ import omit from 'omit.js';
|
||||
import Group from './Group';
|
||||
import Search from './Search';
|
||||
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) {
|
||||
return '';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
export interface AbstractInputProps {
|
||||
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
||||
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';
|
||||
maxLength?: number | string;
|
||||
disabled?: boolean;
|
||||
readOnly?: boolean;
|
||||
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
||||
addonBefore?: 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;
|
||||
suffix?: React.ReactNode;
|
||||
spellCheck?: boolean;
|
||||
autoFocus?: boolean;
|
||||
}
|
||||
|
||||
export default class Input extends React.Component<InputProps, any> {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import omit from 'omit.js';
|
||||
import classNames from 'classnames';
|
||||
import { AbstractInputProps } from './Input';
|
||||
import calculateNodeHeight from './calculateNodeHeight';
|
||||
|
||||
function onNextFrame(cb: () => void) {
|
||||
@ -24,9 +23,10 @@ export interface AutoSizeType {
|
||||
maxRows?: number;
|
||||
}
|
||||
|
||||
export interface TextAreaProps extends AbstractInputProps {
|
||||
export interface TextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
||||
prefixCls?: string;
|
||||
autosize?: boolean | AutoSizeType;
|
||||
onPressEnter?: React.FormEventHandler<any>;
|
||||
onPressEnter?: React.KeyboardEventHandler<HTMLTextAreaElement>;
|
||||
}
|
||||
|
||||
export interface TextAreaState {
|
||||
|
Loading…
Reference in New Issue
Block a user