From 8694abf14b932d0748ed9ae2f1b3769ad9dd683c Mon Sep 17 00:00:00 2001 From: binhaoCen Date: Fri, 21 Aug 2020 22:10:10 +0800 Subject: [PATCH] chore: update type tooltip & TooltipCommon (#2742) --- types/popconfirm.d.ts | 5 +- types/popover.d.ts | 5 +- types/tootip/common.d.ts | 159 +++++++++++++++++++------------------- types/tootip/tooltip.d.ts | 17 ++-- 4 files changed, 96 insertions(+), 90 deletions(-) diff --git a/types/popconfirm.d.ts b/types/popconfirm.d.ts index b82fb4258..c3d56ad84 100644 --- a/types/popconfirm.d.ts +++ b/types/popconfirm.d.ts @@ -4,7 +4,8 @@ import { TooltipCommon } from './tootip/common'; import { VNodeChild } from 'vue'; -export declare class Popconfirm extends TooltipCommon { +import { AntdComponent } from './component'; +export declare class Popconfirm extends AntdComponent { $props: { /** * text of the Cancel button @@ -45,6 +46,6 @@ export declare class Popconfirm extends TooltipCommon { * @type boolean */ disabled?: boolean; - } + } & TooltipCommon } diff --git a/types/popover.d.ts b/types/popover.d.ts index 6289bc756..d275319e2 100644 --- a/types/popover.d.ts +++ b/types/popover.d.ts @@ -4,7 +4,8 @@ import { TooltipCommon } from './tootip/common'; import { VNodeChild } from 'vue'; -export declare class Popover extends TooltipCommon { +import { AntdComponent } from './component'; +export declare class Popover extends AntdComponent { $props: { /** * Content of the card @@ -17,5 +18,5 @@ export declare class Popover extends TooltipCommon { * @type any (string | slot | VNode) */ title?: VNodeChild | JSX.Element; - } + } & TooltipCommon } diff --git a/types/tootip/common.d.ts b/types/tootip/common.d.ts index 223c8c8c4..660a24e43 100644 --- a/types/tootip/common.d.ts +++ b/types/tootip/common.d.ts @@ -2,72 +2,72 @@ // Definitions by: akki-jat // Definitions: https://github.com/vueComponent/ant-design-vue/types -import { AntdComponent } from '../component'; - +import { CSSProperties } from 'vue'; export declare type triggerType = 'hover' | 'focus' | 'click' | 'contextmenu'; -export declare class TooltipCommon extends AntdComponent { - /** - * Whether the arrow is pointed at the center of target - * @default false - * @type boolean - */ - arrowPointAtCenter: boolean; +export declare class TooltipCommon { + // $props: { + /** + * Whether the arrow is pointed at the center of target + * @default false + * @type boolean + */ + arrowPointAtCenter?: boolean; - /** - * Whether to adjust popup placement automatically when popup is off screen - * @default true - * @type boolean - */ - autoAdjustOverflow: boolean | object; + /** + * Whether to adjust popup placement automatically when popup is off screen + * @default true + * @type boolean + */ + autoAdjustOverflow?: boolean | object; - /** - * Whether the floating tooltip card is visible by default - * @default false - * @type boolean - */ - defaultVisible: boolean; + /** + * Whether the floating tooltip card is visible by default + * @default false + * @type boolean + */ + defaultVisible?: boolean; - /** - * The DOM container of the tip, the default behavior is to create a div element in body. - * @default () => document.body - * @type Function - */ - getPopupContainer: (triggerNode: any) => any; + /** + * The DOM container of the tip, the default behavior is to create a div element in body. + * @default () => document.body + * @type Function + */ + getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; - /** - * Delay in seconds, before tooltip is shown on mouse enter - * @default 0 - * @type number - */ - mouseEnterDelay: number; + /** + * Delay in seconds, before tooltip is shown on mouse enter + * @default 0 + * @type number + */ + mouseEnterDelay?: number; - /** - * Delay in seconds, before tooltip is hidden on mouse leave - * @default 0.1 - * @type number - */ - mouseLeaveDelay: number; + /** + * Delay in seconds, before tooltip is hidden on mouse leave + * @default 0.1 + * @type number + */ + mouseLeaveDelay?: number; - /** - * Class name of the tooltip card - * @type string - */ - overlayClassName: string; + /** + * Class name of the tooltip card + * @type string + */ + overlayClassName?: string; - /** - * Style of the tooltip card - * @type undefined - */ - overlayStyle: object; + /** + * Style of the tooltip card + * @type undefined + */ + overlayStyle?: CSSProperties; - /** - * The position of the tooltip relative to the target, which can be one of top - * left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom - * @default 'top' - * @type string - */ - placement: + /** + * The position of the tooltip relative to the target, which can be one of top + * left right bottom topLeft topRight bottomLeft bottomRight leftTop leftBottom rightTop rightBottom + * @default 'top' + * @type string + */ + placement?: | 'top' | 'left' | 'right' @@ -81,30 +81,31 @@ export declare class TooltipCommon extends AntdComponent { | 'rightTop' | 'rightBottom'; - /** - * Tooltip trigger mode - * @default 'hover' - * @type triggerType | triggerType[] - */ - trigger: triggerType | triggerType[]; + /** + * Tooltip trigger mode + * @default 'hover' + * @type triggerType | triggerType[] + */ + trigger?: triggerType | triggerType[]; - /** - * Whether the floating tooltip card is visible or not - * @default false - * @type boolean - */ - visible: boolean; + /** + * Whether the floating tooltip card is visible or not + * @default false + * @type boolean + */ + visible?: boolean; - /** - * Whether to destroy tooltip on hide - * @default false - * @type boolean - */ - destroyTooltipOnHide: boolean; + /** + * Whether to destroy tooltip on hide + * @default false + * @type boolean + */ + destroyTooltipOnHide?: boolean; - /** - * this value will be merged into placement's config, please refer to the settings dom-align - * @type object - */ - align: object; + /** + * this value will be merged into placement's config, please refer to the settings dom-align + * @type object + */ + align?: unknown; + // } } diff --git a/types/tootip/tooltip.d.ts b/types/tootip/tooltip.d.ts index b17a17c2c..5c4768e7d 100644 --- a/types/tootip/tooltip.d.ts +++ b/types/tootip/tooltip.d.ts @@ -2,13 +2,16 @@ // Definitions by: akki-jat // Definitions: https://github.com/vueComponent/ant-design-vue/types -import Vue from 'vue'; +import Vue, { VNodeChild } from 'vue'; +import { AntdComponent } from '../component'; import { TooltipCommon } from './common'; -export declare class Tooltip extends TooltipCommon { - /** - * The text shown in the tooltip - * @type any (string | slot) - */ - title: any; +export declare class Tooltip extends AntdComponent { + $props: { + /** + * The text shown in the tooltip + * @type any (string | slot) + */ + title: VNodeChild | JSX.Element + } & TooltipCommon }