Skip to content

Commit 254a663

Browse files
sendyaAmour1688
andauthored
fix: install types (#2682)
* chore: compatible types with jsx * fix: install types * fix: anchor, breadcrumb, button, checkbox types Co-authored-by: Amour1688 <[email protected]>
1 parent 2891168 commit 254a663

File tree

12 files changed

+325
-266
lines changed

12 files changed

+325
-266
lines changed

types/anchor/anchor-link.d.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,26 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from '../component';
5+
import { VNode } from 'vue';
66

7-
export declare class AnchorLink extends AntdComponent {
8-
/**
9-
* target of hyperlink
10-
* @type string
11-
*/
12-
href: string;
7+
export declare class AnchorLink {
8+
$props: {
9+
/**
10+
* target of hyperlink
11+
* @type string
12+
*/
13+
href: string;
1314

14-
/**
15-
* content of hyperlink
16-
* @type any (string | slot)
17-
*/
18-
title: any;
15+
/**
16+
* content of hyperlink
17+
* @type any (string | slot)
18+
*/
19+
title?: string | VNode | VNode[];
20+
21+
/**
22+
* Specifies where to display the linked URL
23+
* @version 1.5.0
24+
*/
25+
target?: string;
26+
};
1927
}

types/anchor/anchor.d.ts

Lines changed: 84 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,93 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from '../component';
65
import { AnchorLink } from './anchor-link';
6+
import { AntdComponent } from '../component';
77

88
export declare class Anchor extends AntdComponent {
99
static Link: typeof AnchorLink;
1010

11-
/**
12-
* Fixed mode of Anchor
13-
* @default true
14-
* @type boolean
15-
*/
16-
affix: boolean;
17-
18-
/**
19-
* Bounding distance of anchor area
20-
* @default 5
21-
* @type number
22-
*/
23-
bounds: number;
24-
25-
/**
26-
* Scrolling container
27-
* @default () => window
28-
* @type Function
29-
*/
30-
getContainer: () => HTMLElement;
31-
32-
/**
33-
* Pixels to offset from bottom when calculating position of scroll
34-
* @type number
35-
*/
36-
offsetBottom: number;
37-
38-
/**
39-
* Pixels to offset from top when calculating position of scroll
40-
* @default 0
41-
* @type number
42-
*/
43-
offsetTop: number;
44-
45-
/**
46-
* Whether show ink-balls in Fixed mode
47-
* @default false
48-
* @type boolean
49-
*/
50-
showInkInFixed: boolean;
51-
52-
/**
53-
* The class name of the container
54-
* @type string
55-
*/
56-
wrapperClass: string;
57-
58-
/**
59-
* The style of the container
60-
* @type object
61-
*/
62-
wrapperStyle: object;
11+
$props: {
12+
/**
13+
* Fixed mode of Anchor
14+
* @default true
15+
* @type boolean
16+
*/
17+
affix?: boolean;
18+
19+
/**
20+
* Bounding distance of anchor area
21+
* @default 5
22+
* @type number
23+
*/
24+
bounds?: number;
25+
26+
/**
27+
* Scrolling container
28+
* @default () => window
29+
* @type Function
30+
*/
31+
getContainer?: () => HTMLElement;
32+
33+
/**
34+
* Pixels to offset from bottom when calculating position of scroll
35+
* @type number
36+
*/
37+
offsetBottom?: number;
38+
39+
/**
40+
* Pixels to offset from top when calculating position of scroll
41+
* @default 0
42+
* @type number
43+
*/
44+
offsetTop?: number;
45+
46+
/**
47+
* Whether show ink-balls in Fixed mode
48+
* @default false
49+
* @type boolean
50+
*/
51+
showInkInFixed?: boolean;
52+
53+
/**
54+
* The class name of the container
55+
* @type string
56+
*/
57+
wrapperClass?: string;
58+
59+
/**
60+
* The style of the container
61+
* @type object
62+
*/
63+
wrapperStyle?: object;
64+
65+
/**
66+
* Customize the anchor highlight
67+
* @version 1.5.0
68+
* @type function
69+
* @return string
70+
*/
71+
getCurrentAnchor?: () => string;
72+
73+
/**
74+
* Anchor scroll offset, default as `offsetTop`
75+
* e.g. https://antdv.com/components/anchor/#components-anchor-demo-targetOffset
76+
* @version 1.5.0
77+
* @type number
78+
*/
79+
targetOffset?: number;
80+
81+
/**
82+
* set the handler to handle click event
83+
* @param e
84+
* @param link
85+
*/
86+
onClick?: (e?: Event, link?: { [key: string]: any }) => void;
87+
88+
/**
89+
* Listening for anchor link change
90+
* @param currentActiveLink
91+
*/
92+
onChange?: (currentActiveLink?: string) => void;
93+
};
6394
}

types/ant-design-vue.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import Vue from 'vue';
5+
import { App } from 'vue';
66

77
import { Affix } from './affix';
88
import { Anchor } from './anchor/anchor';
@@ -73,7 +73,7 @@ import { PageHeader } from './page-header';
7373
* Please do not invoke this method directly.
7474
* Call `Vue.use(Antd)` to install.
7575
*/
76-
export function install(vue: typeof Vue): void;
76+
export function install(app: App): void;
7777

7878
declare const message: Message;
7979
declare const notification: Notification;

types/breadcrumb/breadcrumb-item.d.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
// Project: https://github.com/vueComponent/ant-design-vue
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
4-
5-
import { AntdComponent } from '../component';
6-
7-
export declare class BreadcrumbItem extends AntdComponent {
8-
/**
9-
* add navigation
10-
* @default ''
11-
* @type string
12-
*/
13-
href?: String;
14-
overlay?: any;
4+
export declare class BreadcrumbItem {
5+
$props: {
6+
/**
7+
* add navigation
8+
* @default ''
9+
* @type string
10+
*/
11+
href?: String;
12+
overlay?: any;
13+
};
1514
}

types/breadcrumb/breadcrumb-separator.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from '../component';
6-
7-
export declare class BreadcrumbSeparator extends AntdComponent {}
5+
export declare class BreadcrumbSeparator {}

types/breadcrumb/breadcrumb.d.ts

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,55 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from '../component';
65
import { VNode } from 'vue';
76
import { BreadcrumbItem } from './breadcrumb-item';
87
import { BreadcrumbSeparator } from './breadcrumb-separator';
8+
import { AntdComponent } from '../component';
99

1010
export interface Route {
1111
path?: String;
1212
breadcrumbName?: String;
13+
children?: Route[];
1314
}
1415

1516
export declare class Breadcrumb extends AntdComponent {
1617
static Item: typeof BreadcrumbItem;
1718
static Separator: typeof BreadcrumbSeparator;
18-
/**
19-
* The routing stack information of router
20-
* @type Route[]
21-
*/
22-
routes: Route[];
2319

24-
/**
25-
* Routing parameters
26-
* @type object
27-
*/
28-
params: object;
20+
$props: {
21+
/**
22+
* The routing stack information of router
23+
* @type Route[]
24+
*/
25+
routes?: Route[];
26+
27+
/**
28+
* Routing parameters
29+
* @type object
30+
*/
31+
params?: object;
2932

30-
/**
31-
* Custom separator
32-
* @default '/'
33-
* @type any (string | slot)
34-
*/
35-
separator: any;
33+
/**
34+
* Custom separator
35+
* @default '/'
36+
* @type any (string | slot)
37+
*/
38+
separator?: string | VNode | VNode[];
3639

37-
/**
38-
* Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}"
39-
* @type Function
40-
*/
41-
itemRender: ({
42-
route,
43-
params,
44-
routes,
45-
paths,
46-
}: {
47-
route: any;
48-
params: any;
49-
routes: any;
50-
paths: any;
51-
}) => VNode;
40+
/**
41+
* Custom item renderer, slot="itemRender" and slot-scope="{route, params, routes, paths}"
42+
* @type Function
43+
*/
44+
itemRender?: ({
45+
route,
46+
params,
47+
routes,
48+
paths,
49+
}: {
50+
route: any;
51+
params: any;
52+
routes: any;
53+
paths: any;
54+
}) => VNode;
55+
};
5256
}

types/button/button-group.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// Definitions by: akki-jat <https://github.com/akki-jat>
33
// Definitions: https://github.com/vueComponent/ant-design-vue/types
44

5-
import { AntdComponent } from '../component';
6-
7-
export declare class ButtonGroup extends AntdComponent {
8-
/**
9-
* can be set to small large or omitted
10-
* @default 'default'
11-
* @type string
12-
*/
13-
size: 'small' | 'large' | 'default';
5+
export declare class ButtonGroup {
6+
$props: {
7+
/**
8+
* can be set to small large or omitted
9+
* @default 'default'
10+
* @type string
11+
*/
12+
size?: 'small' | 'large' | 'default';
13+
};
1414
}

0 commit comments

Comments
 (0)