Skip to content

Commit efdb38d

Browse files
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 <[email protected]>
1 parent 47c5191 commit efdb38d

File tree

6 files changed

+99
-86
lines changed

6 files changed

+99
-86
lines changed

types/card.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ export declare class Card extends AntdComponent {
1313
static Meta: typeof Meta;
1414

1515
$props: AntdProps & {
16-
tabBarExtraContent?: any;
16+
tabBarExtraContent?: VNodeChild | JSX.Element;
17+
1718
/**
1819
* The action list, shows at the bottom of the Card.
1920
* @type any (slots)
2021
*/
21-
actions?: VNodeChild | JSX.Element;
22-
22+
actions?: VNodeChild[] | JSX.Element[];
23+
2324
/**
2425
* Current TabPane's key
2526
* @type string
@@ -93,7 +94,7 @@ export declare class Card extends AntdComponent {
9394
* Card style type, can be set to inner or not set
9495
* @type string
9596
*/
96-
type?: string;
97+
type?: 'inner';
9798

9899
/**
99100
* Size of card

types/input/input-search.d.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44

55
import { AntdComponent, AntdProps } from '../component';
66
import { VNodeChild } from 'vue';
7+
import { InputProps } from './input';
78

89
export declare class InputSearch extends AntdComponent {
9-
$props: AntdProps & {
10-
/**
11-
* to show an enter button after input
12-
* @default false
13-
* @type any (boolean | slot)
14-
*/
15-
enterButton?: boolean | VNodeChild | JSX.Element;
16-
};
10+
$props: AntdProps &
11+
InputProps & {
12+
/**
13+
* to show an enter button after input
14+
* @default false
15+
* @type any (boolean | slot)
16+
*/
17+
enterButton?: boolean | VNodeChild | JSX.Element;
18+
19+
/**
20+
* Callback when search is clicked or enter is pressed
21+
* @type Function
22+
*/
23+
onSearch?: (value: string | number, event: Event) => void;
24+
};
1725
}

types/input/input.d.ts

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,77 +9,79 @@ import { TextArea } from './textarea';
99
import { Password } from './password';
1010
import { VNodeChild } from 'vue';
1111

12-
export declare class Input extends AntdComponent {
13-
static Group: typeof InputGroup;
14-
static Search: typeof InputSearch;
15-
static TextArea: typeof TextArea;
16-
static Password: typeof Password;
17-
$props: AntdProps & {
18-
/**
19-
* The label text displayed after (on the right side of) the input field.
20-
* @type any (string | slot)
21-
*/
22-
addonAfter?: VNodeChild | JSX.Element;
12+
export type InputProps = {
13+
/**
14+
* The label text displayed after (on the right side of) the input field.
15+
* @type any (string | slot)
16+
*/
17+
addonAfter?: VNodeChild | JSX.Element;
18+
19+
/**
20+
* The label text displayed before (on the left side of) the input field.
21+
* @type any (string | slot)
22+
*/
23+
addonBefore?: VNodeChild | JSX.Element;
2324

24-
/**
25-
* The label text displayed before (on the left side of) the input field.
26-
* @type any (string | slot)
27-
*/
28-
addonBefore?: VNodeChild | JSX.Element;
25+
/**
26+
* The initial input content
27+
* @type string | number
28+
*/
29+
defaultValue?: string | number;
2930

30-
/**
31-
* The initial input content
32-
* @type string | number
33-
*/
34-
defaultValue?: string | number;
31+
/**
32+
* Whether the input is disabled.
33+
* @default false
34+
* @type boolean
35+
*/
36+
disabled?: boolean;
3537

36-
/**
37-
* Whether the input is disabled.
38-
* @default false
39-
* @type boolean
40-
*/
41-
disabled?: boolean;
38+
/**
39+
* The ID for input
40+
* @type string
41+
*/
42+
id?: string;
4243

43-
/**
44-
* The ID for input
45-
* @type string
46-
*/
47-
id?: string;
44+
/**
45+
* The prefix icon for the Input.
46+
* @type any (string | slot)
47+
*/
48+
prefix?: VNodeChild | JSX.Element;
4849

49-
/**
50-
* The prefix icon for the Input.
51-
* @type any (string | slot)
52-
*/
53-
prefix?: VNodeChild | JSX.Element;
50+
/**
51+
* The size of the input box. Note: in the context of a form, the large size is used. Available: large default small
52+
* @default 'default'
53+
* @type string
54+
*/
55+
size?: 'small' | 'large' | 'default';
5456

55-
/**
56-
* The size of the input box. Note: in the context of a form, the large size is used. Available: large default small
57-
* @default 'default'
58-
* @type string
59-
*/
60-
size?: 'small' | 'large' | 'default';
57+
/**
58+
* The suffix icon for the Input.
59+
* @type any (string | slot)
60+
*/
61+
suffix?: VNodeChild | JSX.Element;
6162

62-
/**
63-
* The suffix icon for the Input.
64-
* @type any (string | slot)
65-
*/
66-
suffix?: VNodeChild | JSX.Element;
63+
/**
64+
* The type of input, see: MDN (use Input.TextArea instead of type="textarea")
65+
* @default 'text'
66+
* @type string
67+
*/
68+
type?: string;
6769

68-
/**
69-
* The type of input, see: MDN (use Input.TextArea instead of type="textarea")
70-
* @default 'text'
71-
* @type string
72-
*/
73-
type?: string;
70+
/**
71+
* The input content value
72+
* @type string | number
73+
*/
74+
value?: string | number;
75+
/**
76+
* allow to remove input content with clear icon
77+
*/
78+
allowClear?: boolean;
79+
};
7480

75-
/**
76-
* The input content value
77-
* @type string | number
78-
*/
79-
value?: string | number;
80-
/**
81-
* allow to remove input content with clear icon
82-
*/
83-
allowClear?: boolean;
84-
};
81+
export declare class Input extends AntdComponent {
82+
static Group: typeof InputGroup;
83+
static Search: typeof InputSearch;
84+
static TextArea: typeof TextArea;
85+
static Password: typeof Password;
86+
$props: AntdProps & InputProps;
8587
}

types/input/password.d.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

55
import { AntdComponent, AntdProps } from '../component';
6+
import { InputProps } from './input';
67

78
export declare class Password extends AntdComponent {
8-
$props: AntdProps & {
9-
/**
10-
* Whether show toggle button
11-
* @default true
12-
*/
13-
visibilityToggle?: boolean;
14-
};
9+
$props: AntdProps &
10+
Omit<InputProps, 'type' | 'suffix'> & {
11+
/**
12+
* Whether show toggle button
13+
* @default true
14+
*/
15+
visibilityToggle?: boolean;
16+
};
1517
}

types/page-header.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ export declare class PageHeader extends AntdComponent {
6969
/**
7070
* Specify a callback that will be called when a user clicks backIcon.
7171
*/
72-
onBack(): () => void;
72+
onBack?: (e: MouseEvent) => void;
7373
};
7474
}

types/tag/tag.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export declare class Tag extends AntdComponent {
1010

1111
$props: AntdProps & {
1212
/**
13-
* Callback executed when close animation is completed
13+
* Callback executed when close
1414
* @type Function
1515
*/
16-
afterClose?: () => void;
16+
onClose?: (e: MouseEvent) => void;
1717

1818
/**
1919
* Whether the Tag can be closed

0 commit comments

Comments
 (0)