update the props types of some components (#2860)

* chore(types): update tags props types
remove afterClose prop types and add onClose prop types

* chore(types): update input props types

* chore(types): update card props types

* chore(types): update page-header props types

Co-authored-by: tangjinzhou <415800467@qq.com>
pull/2868/head
John60676 2020-09-18 23:00:27 +08:00 committed by GitHub
parent 47c5191b8c
commit efdb38d9f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 103 additions and 90 deletions

9
types/card.d.ts vendored
View File

@ -13,13 +13,14 @@ export declare class Card extends AntdComponent {
static Meta: typeof Meta;
$props: AntdProps & {
tabBarExtraContent?: any;
tabBarExtraContent?: VNodeChild | JSX.Element;
/**
* The action list, shows at the bottom of the Card.
* @type any (slots)
*/
actions?: VNodeChild | JSX.Element;
actions?: VNodeChild[] | JSX.Element[];
/**
* Current TabPane's key
* @type string
@ -93,7 +94,7 @@ export declare class Card extends AntdComponent {
* Card style type, can be set to inner or not set
* @type string
*/
type?: string;
type?: 'inner';
/**
* Size of card

View File

@ -4,14 +4,22 @@
import { AntdComponent, AntdProps } from '../component';
import { VNodeChild } from 'vue';
import { InputProps } from './input';
export declare class InputSearch extends AntdComponent {
$props: AntdProps & {
/**
* to show an enter button after input
* @default false
* @type any (boolean | slot)
*/
enterButton?: boolean | VNodeChild | JSX.Element;
};
$props: AntdProps &
InputProps & {
/**
* to show an enter button after input
* @default false
* @type any (boolean | slot)
*/
enterButton?: boolean | VNodeChild | JSX.Element;
/**
* Callback when search is clicked or enter is pressed
* @type Function
*/
onSearch?: (value: string | number, event: Event) => void;
};
}

138
types/input/input.d.ts vendored
View File

@ -9,77 +9,79 @@ import { TextArea } from './textarea';
import { Password } from './password';
import { VNodeChild } from 'vue';
export type InputProps = {
/**
* The label text displayed after (on the right side of) the input field.
* @type any (string | slot)
*/
addonAfter?: VNodeChild | JSX.Element;
/**
* The label text displayed before (on the left side of) the input field.
* @type any (string | slot)
*/
addonBefore?: VNodeChild | JSX.Element;
/**
* The initial input content
* @type string | number
*/
defaultValue?: string | number;
/**
* Whether the input is disabled.
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* The ID for input
* @type string
*/
id?: string;
/**
* The prefix icon for the Input.
* @type any (string | slot)
*/
prefix?: VNodeChild | JSX.Element;
/**
* The size of the input box. Note: in the context of a form, the large size is used. Available: large default small
* @default 'default'
* @type string
*/
size?: 'small' | 'large' | 'default';
/**
* The suffix icon for the Input.
* @type any (string | slot)
*/
suffix?: VNodeChild | JSX.Element;
/**
* The type of input, see: MDN (use Input.TextArea instead of type="textarea")
* @default 'text'
* @type string
*/
type?: string;
/**
* The input content value
* @type string | number
*/
value?: string | number;
/**
* allow to remove input content with clear icon
*/
allowClear?: boolean;
};
export declare class Input extends AntdComponent {
static Group: typeof InputGroup;
static Search: typeof InputSearch;
static TextArea: typeof TextArea;
static Password: typeof Password;
$props: AntdProps & {
/**
* The label text displayed after (on the right side of) the input field.
* @type any (string | slot)
*/
addonAfter?: VNodeChild | JSX.Element;
/**
* The label text displayed before (on the left side of) the input field.
* @type any (string | slot)
*/
addonBefore?: VNodeChild | JSX.Element;
/**
* The initial input content
* @type string | number
*/
defaultValue?: string | number;
/**
* Whether the input is disabled.
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* The ID for input
* @type string
*/
id?: string;
/**
* The prefix icon for the Input.
* @type any (string | slot)
*/
prefix?: VNodeChild | JSX.Element;
/**
* The size of the input box. Note: in the context of a form, the large size is used. Available: large default small
* @default 'default'
* @type string
*/
size?: 'small' | 'large' | 'default';
/**
* The suffix icon for the Input.
* @type any (string | slot)
*/
suffix?: VNodeChild | JSX.Element;
/**
* The type of input, see: MDN (use Input.TextArea instead of type="textarea")
* @default 'text'
* @type string
*/
type?: string;
/**
* The input content value
* @type string | number
*/
value?: string | number;
/**
* allow to remove input content with clear icon
*/
allowClear?: boolean;
};
$props: AntdProps & InputProps;
}

View File

@ -3,13 +3,15 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent, AntdProps } from '../component';
import { InputProps } from './input';
export declare class Password extends AntdComponent {
$props: AntdProps & {
/**
* Whether show toggle button
* @default true
*/
visibilityToggle?: boolean;
};
$props: AntdProps &
Omit<InputProps, 'type' | 'suffix'> & {
/**
* Whether show toggle button
* @default true
*/
visibilityToggle?: boolean;
};
}

View File

@ -69,6 +69,6 @@ export declare class PageHeader extends AntdComponent {
/**
* Specify a callback that will be called when a user clicks backIcon.
*/
onBack(): () => void;
onBack?: (e: MouseEvent) => void;
};
}

4
types/tag/tag.d.ts vendored
View File

@ -10,10 +10,10 @@ export declare class Tag extends AntdComponent {
$props: AntdProps & {
/**
* Callback executed when close animation is completed
* Callback executed when close
* @type Function
*/
afterClose?: () => void;
onClose?: (e: MouseEvent) => void;
/**
* Whether the Tag can be closed