Skip to content

Commit 8694abf

Browse files
author
binhaoCen
authored
chore: update type tooltip & TooltipCommon (#2742)
1 parent 16575da commit 8694abf

File tree

4 files changed

+96
-90
lines changed

4 files changed

+96
-90
lines changed

types/popconfirm.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import { TooltipCommon } from './tootip/common';
66
import { VNodeChild } from 'vue';
7-
export declare class Popconfirm extends TooltipCommon {
7+
import { AntdComponent } from './component';
8+
export declare class Popconfirm extends AntdComponent {
89
$props: {
910
/**
1011
* text of the Cancel button
@@ -45,6 +46,6 @@ export declare class Popconfirm extends TooltipCommon {
4546
* @type boolean
4647
*/
4748
disabled?: boolean;
48-
}
49+
} & TooltipCommon
4950

5051
}

types/popover.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
import { TooltipCommon } from './tootip/common';
66
import { VNodeChild } from 'vue';
7-
export declare class Popover extends TooltipCommon {
7+
import { AntdComponent } from './component';
8+
export declare class Popover extends AntdComponent {
89
$props: {
910
/**
1011
* Content of the card
@@ -17,5 +18,5 @@ export declare class Popover extends TooltipCommon {
1718
* @type any (string | slot | VNode)
1819
*/
1920
title?: VNodeChild | JSX.Element;
20-
}
21+
} & TooltipCommon
2122
}

types/tootip/common.d.ts

Lines changed: 80 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,72 @@
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-
5+
import { CSSProperties } from 'vue';
76
export declare type triggerType = 'hover' | 'focus' | 'click' | 'contextmenu';
87

9-
export declare class TooltipCommon extends AntdComponent {
10-
/**
11-
* Whether the arrow is pointed at the center of target
12-
* @default false
13-
* @type boolean
14-
*/
15-
arrowPointAtCenter: boolean;
8+
export declare class TooltipCommon {
9+
// $props: {
10+
/**
11+
* Whether the arrow is pointed at the center of target
12+
* @default false
13+
* @type boolean
14+
*/
15+
arrowPointAtCenter?: boolean;
1616

17-
/**
18-
* Whether to adjust popup placement automatically when popup is off screen
19-
* @default true
20-
* @type boolean
21-
*/
22-
autoAdjustOverflow: boolean | object;
17+
/**
18+
* Whether to adjust popup placement automatically when popup is off screen
19+
* @default true
20+
* @type boolean
21+
*/
22+
autoAdjustOverflow?: boolean | object;
2323

24-
/**
25-
* Whether the floating tooltip card is visible by default
26-
* @default false
27-
* @type boolean
28-
*/
29-
defaultVisible: boolean;
24+
/**
25+
* Whether the floating tooltip card is visible by default
26+
* @default false
27+
* @type boolean
28+
*/
29+
defaultVisible?: boolean;
3030

31-
/**
32-
* The DOM container of the tip, the default behavior is to create a div element in body.
33-
* @default () => document.body
34-
* @type Function
35-
*/
36-
getPopupContainer: (triggerNode: any) => any;
31+
/**
32+
* The DOM container of the tip, the default behavior is to create a div element in body.
33+
* @default () => document.body
34+
* @type Function
35+
*/
36+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
3737

38-
/**
39-
* Delay in seconds, before tooltip is shown on mouse enter
40-
* @default 0
41-
* @type number
42-
*/
43-
mouseEnterDelay: number;
38+
/**
39+
* Delay in seconds, before tooltip is shown on mouse enter
40+
* @default 0
41+
* @type number
42+
*/
43+
mouseEnterDelay?: number;
4444

45-
/**
46-
* Delay in seconds, before tooltip is hidden on mouse leave
47-
* @default 0.1
48-
* @type number
49-
*/
50-
mouseLeaveDelay: number;
45+
/**
46+
* Delay in seconds, before tooltip is hidden on mouse leave
47+
* @default 0.1
48+
* @type number
49+
*/
50+
mouseLeaveDelay?: number;
5151

52-
/**
53-
* Class name of the tooltip card
54-
* @type string
55-
*/
56-
overlayClassName: string;
52+
/**
53+
* Class name of the tooltip card
54+
* @type string
55+
*/
56+
overlayClassName?: string;
5757

58-
/**
59-
* Style of the tooltip card
60-
* @type undefined
61-
*/
62-
overlayStyle: object;
58+
/**
59+
* Style of the tooltip card
60+
* @type undefined
61+
*/
62+
overlayStyle?: CSSProperties;
6363

64-
/**
65-
* The position of the tooltip relative to the target, which can be one of top
66-
* left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom
67-
* @default 'top'
68-
* @type string
69-
*/
70-
placement:
64+
/**
65+
* The position of the tooltip relative to the target, which can be one of top
66+
* left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom
67+
* @default 'top'
68+
* @type string
69+
*/
70+
placement?:
7171
| 'top'
7272
| 'left'
7373
| 'right'
@@ -81,30 +81,31 @@ export declare class TooltipCommon extends AntdComponent {
8181
| 'rightTop'
8282
| 'rightBottom';
8383

84-
/**
85-
* Tooltip trigger mode
86-
* @default 'hover'
87-
* @type triggerType | triggerType[]
88-
*/
89-
trigger: triggerType | triggerType[];
84+
/**
85+
* Tooltip trigger mode
86+
* @default 'hover'
87+
* @type triggerType | triggerType[]
88+
*/
89+
trigger?: triggerType | triggerType[];
9090

91-
/**
92-
* Whether the floating tooltip card is visible or not
93-
* @default false
94-
* @type boolean
95-
*/
96-
visible: boolean;
91+
/**
92+
* Whether the floating tooltip card is visible or not
93+
* @default false
94+
* @type boolean
95+
*/
96+
visible?: boolean;
9797

98-
/**
99-
* Whether to destroy tooltip on hide
100-
* @default false
101-
* @type boolean
102-
*/
103-
destroyTooltipOnHide: boolean;
98+
/**
99+
* Whether to destroy tooltip on hide
100+
* @default false
101+
* @type boolean
102+
*/
103+
destroyTooltipOnHide?: boolean;
104104

105-
/**
106-
* this value will be merged into placement's config, please refer to the settings dom-align
107-
* @type object
108-
*/
109-
align: object;
105+
/**
106+
* this value will be merged into placement's config, please refer to the settings dom-align
107+
* @type object
108+
*/
109+
align?: unknown;
110+
// }
110111
}

types/tootip/tooltip.d.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
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 Vue, { VNodeChild } from 'vue';
6+
import { AntdComponent } from '../component';
67
import { TooltipCommon } from './common';
78

8-
export declare class Tooltip extends TooltipCommon {
9-
/**
10-
* The text shown in the tooltip
11-
* @type any (string | slot)
12-
*/
13-
title: any;
9+
export declare class Tooltip extends AntdComponent {
10+
$props: {
11+
/**
12+
* The text shown in the tooltip
13+
* @type any (string | slot)
14+
*/
15+
title: VNodeChild | JSX.Element
16+
} & TooltipCommon
1417
}

0 commit comments

Comments
 (0)