chore: update type dropdown (#2721)

pull/2722/head
binhaoCen 2020-08-19 21:02:18 +08:00 committed by GitHub
parent 6681b50892
commit e3c38b68f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 85 deletions

View File

@ -4,53 +4,58 @@
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { VNodeChild } from 'vue';
export declare class DropdownButton extends AntdComponent { export declare class DropdownButton extends AntdComponent {
/** $props: {
* whether the dropdown menu is disabled /**
* @type boolean * whether the dropdown menu is disabled
*/ * @type boolean
disabled: boolean; */
disabled?: boolean;
/** /**
* the dropdown menu * the dropdown menu
* @type () => Menu * @type () => Menu
*/ */
overlay: any; overlay?: () => Menu
/** /**
* placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight * placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight
* @default 'bottomLeft' * @default 'bottomLeft'
* @type string * @type string
*/ */
placement: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight'; placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
/** /**
* size of the button, the same as Button * size of the button, the same as Button
* @default 'default' * @default 'default'
* @type string * @type string
*/ */
size: 'small' | 'large' | 'default'; size?: 'small' | 'large' | 'default';
/** /**
* the trigger mode which executes the drop-down action * the trigger mode which executes the drop-down action
* @default ['hover'] * @default ['hover']
* @type string[] * @type string[]
*/ */
trigger: Array<'click' | 'hover' | 'contextmenu'>; trigger?: Array<'click' | 'hover' | 'contextmenu'>;
/** /**
* type of the button, the same as Button * type of the button, the same as Button
* @default 'default' * @default 'default'
* @type string * @type string
*/ */
type: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default'; type?: 'primary' | 'danger' | 'dashed' | 'ghost' | 'default';
/** /**
* whether the dropdown menu is visible * whether the dropdown menu is visible
* @type boolean * @type boolean
*/ */
visible: boolean; visible?: boolean;
icon: any; /**
title: string; * Icon (appears on the right) (1.5.0)
*/
icon?: VNodeChild | JSX.Element;
}
} }

View File

@ -5,58 +5,60 @@
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { DropdownButton } from './dropdown-button'; import { DropdownButton } from './dropdown-button';
import { CSSProperties } from 'vue';
export declare class Dropdown extends AntdComponent { export declare class Dropdown extends AntdComponent {
static Button: typeof DropdownButton; static Button: typeof DropdownButton;
$props: {
/**
* the trigger mode which executes the drop-down action
* @default ['hover']
* @type string[]
*/
trigger?: Array<'click' | 'hover' | 'contextmenu'>;
/** /**
* the trigger mode which executes the drop-down action * the dropdown menu
* @default ['hover'] * @type () => Menu
* @type string[] */
*/ overlay?: () => Menu
trigger: Array<'click' | 'hover' | 'contextmenu'>;
/** /**
* the dropdown menu * Class name of the dropdown root element
* @type () => Menu * @type string
*/ */
overlay: any; overlayClassName?: string;
/** /**
* Class name of the dropdown root element * Style of the dropdown root element
* @type string * @type object
*/ */
overlayClassName: string; overlayStyle?: CSSProperties;
/** /**
* Style of the dropdown root element * whether the dropdown menu is visible
* @type object * @type boolean
*/ */
overlayStyle: object; visible?: boolean;
/** /**
* whether the dropdown menu is visible * whether the dropdown menu is disabled
* @type boolean * @type boolean
*/ */
visible: boolean; disabled?: boolean;
/** /**
* whether the dropdown menu is disabled * to set the ontainer of the dropdown menu. The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition.
* @type boolean * @default () => document.body
*/ * @type Function
disabled: boolean; */
getPopupContainer?: (triggerNode?: any) => HTMLElement;
/** /**
* to set the ontainer of the dropdown menu. The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition. * placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight
* @default () => document.body * @default 'bottomLeft'
* @type Function * @type string
*/ */
getPopupContainer: (triggerNode?: any) => HTMLElement; placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
}
/**
* placement of pop menu: bottomLeft bottomCenter bottomRight topLeft topCenter topRight
* @default 'bottomLeft'
* @type string
*/
placement: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
} }