Skip to content

Commit

Permalink
update the props types of some components (vueComponent#2860)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
John60676 and tangjinzhou authored Sep 18, 2020
1 parent 47c5191 commit efdb38d
Showing 6 changed files with 99 additions and 86 deletions.
9 changes: 5 additions & 4 deletions types/card.d.ts
Original file line number Diff line number Diff line change
@@ -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
24 changes: 16 additions & 8 deletions types/input/input-search.d.ts
Original file line number Diff line number Diff line change
@@ -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;
};
}
130 changes: 66 additions & 64 deletions types/input/input.d.ts
Original file line number Diff line number Diff line change
@@ -9,77 +9,79 @@ import { TextArea } from './textarea';
import { Password } from './password';
import { VNodeChild } from 'vue';

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;
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 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;

/**
* The initial input content
* @type string | number
*/
defaultValue?: string | number;
/**
* Whether the input is disabled.
* @default false
* @type boolean
*/
disabled?: boolean;

/**
* Whether the input is disabled.
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* The ID for input
* @type string
*/
id?: string;

/**
* The ID for input
* @type string
*/
id?: string;
/**
* The prefix icon for the Input.
* @type any (string | slot)
*/
prefix?: VNodeChild | JSX.Element;

/**
* 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 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 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 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;
};

/**
* 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 & InputProps;
}
16 changes: 9 additions & 7 deletions types/input/password.d.ts
Original file line number Diff line number Diff line change
@@ -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;
};
}
2 changes: 1 addition & 1 deletion types/page-header.d.ts
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 2 deletions types/tag/tag.d.ts
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit efdb38d

Please sign in to comment.