chore: update types

pull/2750/head
undefined 2020-08-22 10:21:34 +08:00
parent 4636463fde
commit 01c0a03ac8
24 changed files with 538 additions and 635 deletions

View File

@ -32,7 +32,7 @@ import { Input } from './input/input';
import { InputNumber } from './input-number';
import { Layout } from './layout/layout';
import { List } from './list/list';
import { LocaleProvider } from './locale-provider';
import { Space } from './space';
import { Message } from './message';
import { Mentions } from './mentions/mentions';
import { Menu } from './menu/menu';
@ -104,7 +104,7 @@ export {
InputNumber,
Layout,
List,
LocaleProvider,
Space,
message,
Menu,
Mentions,

View File

@ -3,100 +3,102 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { CSSProperties } from 'vue';
export declare type Value = { key: string };
export declare type SelectValue = string | number | Value | Array<Value | string | number>;
export declare class AutoComplete extends AntdComponent {
dropdownMenuStyle: object;
/**
* Show clear button, effective in multiple mode only.
* @default false
* @type boolean
*/
allowClear: boolean;
$props: {
dropdownMenuStyle: CSSProperties;
/**
* Show clear button, effective in multiple mode only.
* @default false
* @type boolean
*/
allowClear: boolean;
/**
* get focus when component mounted
* @default false
* @type boolean
*/
autofocus: boolean;
/**
* get focus when component mounted
* @default false
* @type boolean
*/
autofocus: boolean;
/**
* backfill selected item the input when using keyboard
* @default false
* @type boolean
*/
backfill: boolean;
/**
* backfill selected item the input when using keyboard
* @default false
* @type boolean
*/
backfill: boolean;
/**
* Data source for autocomplete
* @type slot | Array<{ value: String, text: String }>
*/
dataSource: any;
/**
* Data source for autocomplete
* @type slot | Array<{ value: String, text: String }>
*/
dataSource: any;
/**
* Whether active first option by default
* @default true
* @type boolean
*/
defaultActiveFirstOption: boolean;
/**
* Whether active first option by default
* @default true
* @type boolean
*/
defaultActiveFirstOption: boolean;
/**
* Initial selected option.
* @type SelectValue
*/
defaultValue: SelectValue;
/**
* Initial selected option.
* @type SelectValue
*/
defaultValue: SelectValue;
/**
* Whether disabled select
* @default false
* @type boolean
*/
disabled: boolean;
/**
* Whether disabled select
* @default false
* @type boolean
*/
disabled: boolean;
/**
* If true, filter options by input, if function, filter options against it.
* The function will receive two arguments, inputValue and option,
* if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded.
* @default true
* @type boolean | Function
*/
filterOption: boolean | Function;
/**
* If true, filter options by input, if function, filter options against it.
* The function will receive two arguments, inputValue and option,
* if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded.
* @default true
* @type boolean | Function
*/
filterOption: boolean | Function;
/**
* Which prop value of option will render as content of select.
* @default 'children'
* @type string
*/
optionLabelProp: string;
/**
* Which prop value of option will render as content of select.
* @default 'children'
* @type string
*/
optionLabelProp: string;
/**
* placeholder of input
* @type string
*/
placeholder: string;
/**
* placeholder of input
* @type string
*/
placeholder: string;
/**
* selected option
* @type SelectValue
*/
value: SelectValue;
/**
* selected option
* @type SelectValue
*/
value: SelectValue;
/**
* Initial open state of dropdown
* @type boolean
*/
defaultOpen: boolean;
/**
* Controlled open state of dropdown
* @type boolean
*/
open: boolean;
/**
* Initial open state of dropdown
* @type boolean
*/
defaultOpen: boolean;
/**
* Controlled open state of dropdown
* @type boolean
*/
open: boolean;
};
/**
* remove focus
*/

2
types/card.d.ts vendored
View File

@ -81,7 +81,7 @@ export declare class Card extends AntdComponent {
* List of TabPane's head, Custom tabs can be created with the scopedSlots property
* @type Array<{key: string, tab: any, scopedSlots: {tab: string}}>
*/
tabList?: Array<{ key: string; tab: any; scopedSlots: { tab: string } }>;
tabList?: Array<{ key: string; tab: any; slots: { tab: string } }>;
/**
* Card title

View File

@ -5,38 +5,40 @@
import { AntdComponent } from '../component';
export declare class CollapsePanel extends AntdComponent {
/**
* If true, panel cannot be opened or closed
* @default false
* @type boolean
*/
disabled: boolean;
$props: {
/**
* If true, panel cannot be opened or closed
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* Forced render of content on panel, instead of lazy rending after clicking on header
* @default false
* @type boolean
*/
forceRender: boolean;
/**
* Forced render of content on panel, instead of lazy rending after clicking on header
* @default false
* @type boolean
*/
forceRender?: boolean;
/**
* Title of the panel
* @type string
*/
header: string;
/**
* Title of the panel
* @type string
*/
header?: string;
/**
* Unique key identifying the panel from among its siblings
* @type string
*/
key: string;
/**
* Unique key identifying the panel from among its siblings
* @type string
*/
key?: string;
/**
* If false, panel will not show arrow icon
* @default true
* @type boolean
*/
showArrow: boolean;
/**
* If false, panel will not show arrow icon
* @default true
* @type boolean
*/
showArrow?: boolean;
extra: any;
extra?: any;
};
}

View File

@ -7,45 +7,46 @@ import { CollapsePanel } from './collapse-panel';
export type ExpandIconPosition = 'left' | 'right';
export declare class Collapse extends AntdComponent {
static Panel: typeof CollapsePanel;
$props: {
expandIconPosition?: ExpandIconPosition;
/**
* If true, Collapse renders as Accordion
* @default false
* @type boolean
*/
accordion?: boolean;
expandIconPosition?: ExpandIconPosition;
/**
* If true, Collapse renders as Accordion
* @default false
* @type boolean
*/
accordion: boolean;
/**
* Key of the active panel
* @default No default value. In accordion mode, it's the key of the first panel.
* @type string | string[]
*/
activeKey?: string | string[];
/**
* Key of the active panel
* @default No default value. In accordion mode, it's the key of the first panel.
* @type string | string[]
*/
activeKey: string | string[];
/**
* Toggles rendering of the border around the collapse block
* @default true
* @type boolean
*/
bordered?: boolean;
/**
* Toggles rendering of the border around the collapse block
* @default true
* @type boolean
*/
bordered: boolean;
/**
* Key of the initial active panel
* @type string
*/
defaultActiveKey?: string | string[];
/**
* Key of the initial active panel
* @type string
*/
defaultActiveKey: string | string[];
/**
* Destroy Inactive Panel
* @default false
* @type boolean
*/
destroyInactivePanel?: boolean;
/**
* Destroy Inactive Panel
* @default false
* @type boolean
*/
destroyInactivePanel: boolean;
/**
* allow to customize collapse icon.
* @type any (function | slot-scope)
*/
expandIcon: any;
/**
* allow to customize collapse icon.
* @type any (function | slot-scope)
*/
expandIcon?: any;
};
}

View File

@ -5,47 +5,49 @@ import { AntdComponent } from './component';
import Pickr from '@simonwep/pickr';
export declare class ColorPicker extends AntdComponent {
/** simonwep/pickr's options */
config?: Pickr.Options;
/**prefix class name */
prefixCls?: string;
/** default color value */
defaultValue?: string;
/** color value */
value?: string;
/**
* language package setting
* @type object
*/
locale: object;
/**
* precision of color value
* @default 0
* @type number
* */
colorRounded?: number;
/**
* descriptions size type
* @default 'default'
* @type string
*/
size: 'large' | 'default' | 'small';
/**
* Parent Node which the selector should be rendered to. Default to body.
* When position issues happen, try to modify it into scrollable content and position it relative.
* @default () => document.body
* @type Function
*/
getPopupContainer: (triggerNode: any) => HTMLElement;
/**
* Disabled or not
* @default false
* @type boolean
*/
disabled: boolean;
/**
* to set the color format
* @default "HEXA"
*/
format: Pickr.Representation;
$props: {
/** simonwep/pickr's options */
config?: Pickr.Options;
/**prefix class name */
prefixCls?: string;
/** default color value */
defaultValue?: string;
/** color value */
value?: string;
/**
* language package setting
* @type object
*/
locale: object;
/**
* precision of color value
* @default 0
* @type number
* */
colorRounded?: number;
/**
* descriptions size type
* @default 'default'
* @type string
*/
size: 'large' | 'default' | 'small';
/**
* Parent Node which the selector should be rendered to. Default to body.
* When position issues happen, try to modify it into scrollable content and position it relative.
* @default () => document.body
* @type Function
*/
getPopupContainer: (triggerNode: any) => HTMLElement;
/**
* Disabled or not
* @default false
* @type boolean
*/
disabled: boolean;
/**
* to set the color format
* @default "HEXA"
*/
format: Pickr.Representation;
};
}

View File

@ -5,27 +5,29 @@
import { AntdComponent } from '../component';
export declare class TextArea extends AntdComponent {
/**
* Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 }
* @default false
* @type boolean | object
*/
autoSize?: boolean | { minRows: number; maxRows: number };
$props: {
/**
* Height autosize feature, can be set to true|false or an object { minRows: 2, maxRows: 6 }
* @default false
* @type boolean | object
*/
autoSize?: boolean | { minRows: number; maxRows: number };
/**
* The initial input content
* @type string | number
*/
defaultValue?: string | number;
/**
* The initial input content
* @type string | number
*/
defaultValue?: string | number;
/**
* The input content value
* @type string | number
*/
value?: string | number;
/**
*allow to remove input content with clear icon (1.5.0)
* @type boolean
*/
allowClear?: boolean
/**
* The input content value
* @type string | number
*/
value?: string | number;
/**
*allow to remove input content with clear icon (1.5.0)
* @type boolean
*/
allowClear?: boolean;
};
}

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component';
export interface LayoutFooterProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component';
export interface LayoutHeaderProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean

View File

@ -6,12 +6,6 @@ import { CSSProperties, Slot, VNodeChild } from 'vue';
import { AntdComponent } from '../component';
export interface LayoutSiderProps {
/**
* container className
* @type string
*/
class?: string;
/**
* whether can be collapsed
* @default false
@ -39,12 +33,6 @@ export interface LayoutSiderProps {
*/
reverseArrow?: boolean;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/**
* specify the customized trigger, set to null to hide the trigger
* @type string | | VNodeChild | JSX.Element

View File

@ -10,19 +10,6 @@ import LayoutFooter from './layout-footer';
import { CSSProperties } from 'vue';
export interface LayoutProps {
/**
* container className
* @default undefined
* @type string
*/
class?: string;
/**
* to customize the styles
* @type CSSProperties
*/
style?: CSSProperties;
/**
* whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean

View File

@ -1,32 +0,0 @@
// Project: https://github.com/vueComponent/ant-design-vue
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
export interface ModalLocale {
okText: string;
cancelText: string;
justOkText: string;
}
export interface Locale {
locale: string;
Pagination?: Object;
DatePicker?: Object;
TimePicker?: Object;
Calendar?: Object;
Table?: Object;
Modal?: ModalLocale;
Popconfirm?: Object;
Transfer?: Object;
Select?: Object;
Upload?: Object;
}
export declare class LocaleProvider extends AntdComponent {
/**
* language package setting, you can find the packages in this path: antd/lib/locale-provider/
* @type object
*/
locale: object;
}

View File

@ -7,16 +7,16 @@ import { MenuItem } from './menu-item';
import { VNodeChild } from 'vue';
export declare class MenuItemGroup extends AntdComponent {
$props:{
/**
* sub menu items
* @type MenuItem[]
*/
children?: MenuItem[];
/**
* title of the group
* @type string | slot
*/
title?: VNodeChild | JSX.Element;
}
$props: {
/**
* sub menu items
* @type MenuItem[]
*/
children?: MenuItem[];
/**
* title of the group
* @type string | slot
*/
title?: VNodeChild | JSX.Element;
};
}

26
types/modal.d.ts vendored
View File

@ -39,7 +39,7 @@ export interface ModalOptions {
* Modal content
* @type string | VNode | (h) => VNode
*/
content?: VNodeChild | JSX.Element;
content?: VNodeChild | JSX.Element;
/**
* custom icon (Added in 1.14.0)
*/
@ -94,7 +94,7 @@ export interface ModalOptions {
* Title
* @type string | VNode | (h) => VNode
*/
title?: VNodeChild | JSX.Element;
title?: VNodeChild | JSX.Element;
/**
* Width of the modal dialog
@ -112,7 +112,7 @@ export interface ModalOptions {
/**
* Style of floating layer, typically used at least for adjusting the position.
*/
dialogStyle?: CSSProperties
dialogStyle?: CSSProperties;
/**
* className of floating layer.
*/
@ -155,9 +155,9 @@ export interface ModalConfirm {
export declare class Modal extends AntdComponent {
$props: {
/**
* Specify a function that will be called when modal is closed completely.
* @type Function
*/
* Specify a function that will be called when modal is closed completely.
* @type Function
*/
afterClose?: () => any;
/**
@ -271,7 +271,7 @@ export declare class Modal extends AntdComponent {
* The modal dialog's title
* @type any (string | slot)
*/
title?: VNodeChild | JSX.Element;
title?: VNodeChild | JSX.Element;
/**
* Whether the modal dialog is visible or not
@ -299,7 +299,7 @@ export declare class Modal extends AntdComponent {
* @type number
*/
zIndex?: number;
}
};
static info(options: ModalOptions): ModalConfirm;
static success(options: ModalOptions): ModalConfirm;
static error(options: ModalOptions): ModalConfirm;
@ -307,13 +307,3 @@ export declare class Modal extends AntdComponent {
static confirm(options: ModalOptions): ModalConfirm;
static destroyAll(): void;
}
declare module 'vue/types/vue' {
interface Vue {
$info: (modalOptios: ModalOptions) => ModalConfirm;
$success: (modalOptios: ModalOptions) => ModalConfirm;
$error: (modalOptios: ModalOptions) => ModalConfirm;
$warning: (modalOptios: ModalOptions) => ModalConfirm;
$confirm: (modalOptios: ModalOptions) => ModalConfirm;
}
}

View File

@ -2,7 +2,6 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { VNodeChild, CSSProperties } from 'vue';
export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
export interface NotificationOptions extends NotificationConfigOptions {

View File

11
types/space.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
import { AntdComponent } from './component';
export type SizeType = 'small' | 'middle' | 'large' | undefined;
export declare class Space extends AntdComponent {
$props: {
prefixCls?: string;
size?: SizeType | number;
direction?: 'horizontal' | 'vertical';
// No `stretch` since many components do not support that.
align?: 'start' | 'end' | 'center' | 'baseline';
};
}

View File

@ -2,7 +2,7 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { VNodeChild, Slots } from 'vue';
import { VNodeChild } from 'vue';
import { AntdComponent } from '../component';
export declare class ColumnGroup extends AntdComponent {
@ -12,12 +12,5 @@ export declare class ColumnGroup extends AntdComponent {
* @type any
*/
title?: VNodeChild | JSX.Element;
/**
* When using columns, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: Slots;
};
}

View File

@ -199,7 +199,7 @@ export interface ColumnProps<T> {
* such as slots: { filterIcon: 'XXX'}
* @type object
*/
slots?: { [key: string]: string };
slots?: Record<string, string>;
}
export declare class Column<T> extends AntdComponent {

View File

@ -2,16 +2,16 @@
// Definitions by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import Vue, { VNodeChild } from 'vue';
import { VNodeChild } from 'vue';
import { AntdComponent } from '../component';
import { TooltipCommon } from './common';
export declare class Tooltip extends AntdComponent {
export declare class Tooltip extends AntdComponent {
$props: {
/**
* The text shown in the tooltip
* @type any (string | slot)
*/
title: VNodeChild | JSX.Element
} & TooltipCommon
title: VNodeChild | JSX.Element;
} & TooltipCommon;
}

28
types/tree-node.d.ts vendored
View File

@ -7,20 +7,6 @@ import { VNodeChild } from 'vue';
export declare class TreeNode extends AntdComponent {
$props: {
/**
* Class
* @description className
* @type string
*/
class?: string;
/**
* Style
* @description style of tree node
* @type string | object
*/
style?: string | object;
/**
* When Tree is checkable, set TreeNode display Checkbox or not
* @version 1.5.0
@ -90,19 +76,5 @@ export declare class TreeNode extends AntdComponent {
* @type string
*/
value?: string;
/**
* Slots
* @description When using treeNodes, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: object;
/**
* When using treeNodes, you can use this property to configure the events,
* such as on: { click: () => {}}
*/
on?: object;
};
}

View File

@ -8,12 +8,21 @@ import { VNodeChild, CSSProperties } from 'vue';
export interface TreeData {
key: string | number;
title: string | VNodeChild | JSX.Element;
value: string;
label: any;
children: any;
label?: any;
children?: object[];
disabled?: boolean;
disableCheckbox?: boolean;
selectable?: boolean;
checkable?: boolean;
/**
* Slots
* @description When using treeNodes, you can use this property to configure the properties that support the slot,
* such as slots: { title: 'XXX'}
* @type object
*/
slots?: Record<string, string>;
}
export interface ReplaceFields {

View File

@ -3,15 +3,16 @@
// Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from '../component';
import { Tree } from './tree';
import { TreeProps } from './tree';
export declare class DictionaryTree extends Tree {
$props: {
/**
* Directory open logic, optional `false` 'click' 'dblclick'
* @default 'click'
* @type string
*/
expandAction?: string | boolean;
};
interface DictionaryTreeProps extends TreeProps {
/**
* Directory open logic, optional `false` 'click' 'dblclick'
* @default 'click'
* @type string
*/
expandAction?: string | boolean;
}
export declare class DictionaryTree extends AntdComponent {
$props: DictionaryTreeProps;
}

522
types/tree/tree.d.ts vendored
View File

@ -5,269 +5,271 @@
import { AntdComponent } from '../component';
import { TreeNode } from '../tree-node';
import { DictionaryTree } from './dictionary-tree';
import { TreeData } from '../tree-select';
import { VNode } from 'vue';
export interface TreeProps {
/**
* Whether treeNode fill remaining horizontal space
* @version 1.5.0
*/
blockNode?: boolean;
/**
* whether can be selected
*/
selectable?: boolean;
/**
* treeNode of tree
* @type TreeNode[]
*/
treeData?: TreeData[];
/**
*
*@description Replace the title,key and children fields in treeNode with the corresponding fields in treeData
*/
replaceFields?: {
/**@default 'children' */
children?: string;
/**@default 'title' */
title?: string;
/**@default 'key' */
key?: string;
};
/**
* Whether to automatically expand a parent treeNode
* @default true
* @type boolean
*/
autoExpandParent?: boolean;
/**
* Adds a Checkbox before the treeNodes
* @default false
* @type boolean
*/
checkable?: boolean;
/**
* (Controlled) Specifies the keys of the checked treeNodes
* (PS: When this specifies the key of a treeNode which is also a parent treeNode,
* all the children treeNodes of will be checked; and vice versa,
* when it specifies the key of a treeNode which is a child treeNode,
* its parent treeNode will also be checked. When checkable and checkStrictly is true,
* its object has checked and halfChecked property. Regardless of whether the child or parent treeNode is checked,
* they won't impact each other.
* @default []
* @type string[] | number[] | { checked: string[]; halfChecked: string[] }
*/
checkedKeys?:
| string[]
| number[]
| {
checked: string[];
halfChecked: string[];
};
/**
* Check treeNode precisely; parent treeNode and children treeNodes are not associated
* @default false
* @type boolean
*/
checkStrictly?: boolean;
/**
* Specifies the keys of the default checked treeNodes
* @default []
* @type string[] | number[]
*/
defaultCheckedKeys?: string[] | number[];
/**
* Whether to expand all treeNodes by default
* @default false
* @type boolean
*/
defaultExpandAll?: boolean;
/**
* Specify the keys of the default expanded treeNodes
* @default []
* @type string[] | number[]
*/
defaultExpandedKeys?: string[] | number[];
/**
* auto expand parent treeNodes when init
* @default true
* @type boolean
*/
defaultExpandParent?: boolean;
/**
* Specifies the keys of the default selected treeNodes
* @default []
* @type string[] | number[]
*/
defaultSelectedKeys?: string[] | number[];
/**
* whether disabled the tree
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* Specifies whether this Tree is draggable (IE > 8)
* @default false
* @type boolean
*/
draggable?: boolean;
/**
* (Controlled) Specifies the keys of the expanded treeNodes
* @default []
* @type string[] | number[]
*/
expandedKeys?: string[] | number[];
/**
* Defines a function to filter (highlight) treeNodes.
* When the function returns true, the corresponding treeNode will be highlighted
* @type Function
*/
filterTreeNode?: (node?: VNode) => any | boolean;
/**
* Load data asynchronously
* @type Function
*/
loadData?: (node?: VNode) => any;
/**
* (Controlled) Set loaded tree nodes. Need work with loadData
* @default []
* @type string[]
*/
loadedKeys?: string[];
/**
* Allows selecting multiple treeNodes
* @default false
* @type boolean
*/
multiple?: boolean;
/**
* (Controlled) Specifies the keys of the selected treeNodes
* @type string[] | number[]
*/
selectedKeys?: string[] | number[];
/**
* Shows the icon before a TreeNode's title.
* There is no default style; you must set a custom style for it if set to true
* @default false
* @type boolean
*/
showIcon?: boolean;
/**
* Shows a connecting line
* @default false
* @type boolean
*/
showLine?: boolean;
/**
* Callback function for when the onCheck event occurs
* @param checkedKeys
* @param e
*/
onClick?: (
checkedKeys: string[],
e: { checked: boolean; checkedNodes: any[]; node: any; event: any },
) => void;
/**
* Callback function for when the onDragEnd event occurs
* @param event
* @param node
*/
onDragend?: ({ event, node }) => void;
/**
* Callback function for when the onDragEnter event occurs
* @param event
* @param node
* @param expandedKeys
*/
onDragenter?: ({ event, node, expandedKeys }) => void;
/**
* Callback function for when the onDragLeave event occurs
* @param event
* @param node
*/
onDragleave?: ({ event, node }) => void;
/**
* Callback function for when the onDragOver event occurs
* @param event
* @param node
*/
onDragover?: ({ event, node }) => void;
/**
* Callback function for when the onDragStart event occurs
* @param event
* @param node
*/
onDragstart?: ({ event, node }) => void;
/**
* Callback function for when the onDrop event occurs
*
* @param event
* @param node
* @param dragNode
* @param dragNodesKeys
*/
onDrop?: ({ event, node, dragNode, dragNodesKeys }) => void;
/**
* Callback function for when a treeNode is expanded or collapsed
* @param expandedKeys
* @param bool
* @param node
*/
onExpand?: (expandedKeys: string[], { expanded, node }) => void;
/**
* Callback function for when a treeNode is loaded
* @param loadedKeys
* @param event
* @param node
*/
onLoad?: (loadedKeys: string[], { event, node }) => void;
/**
* Callback function for when the user right clicks a treeNode
* @param event
* @param node
*/
onRightClick?: ({ event, node }) => void;
/**
* Callback function for when the user clicks a treeNode
* @param selectedKeys
* @param event
*/
onSelect?: (selectedKeys: string[], event: { selected; selectedNodes; node; event }) => void;
}
export declare class Tree extends AntdComponent {
static TreeNode: typeof TreeNode;
static DirectoryTree: typeof DictionaryTree;
$props: {
/**
* Whether treeNode fill remaining horizontal space
* @version 1.5.0
*/
blockNode?: boolean;
/**
* whether can be selected
*/
selectable?: boolean;
/**
* treeNode of tree
* @type TreeNode[]
*/
treeData?: TreeNode[];
/**
*
*@description Replace the title,key and children fields in treeNode with the corresponding fields in treeData
*/
replaceFields?: {
/**@default 'children' */
children?: string;
/**@default 'title' */
title?: string;
/**@default 'key' */
key?: string;
};
/**
* Whether to automatically expand a parent treeNode
* @default true
* @type boolean
*/
autoExpandParent?: boolean;
/**
* Adds a Checkbox before the treeNodes
* @default false
* @type boolean
*/
checkable?: boolean;
/**
* (Controlled) Specifies the keys of the checked treeNodes
* (PS: When this specifies the key of a treeNode which is also a parent treeNode,
* all the children treeNodes of will be checked; and vice versa,
* when it specifies the key of a treeNode which is a child treeNode,
* its parent treeNode will also be checked. When checkable and checkStrictly is true,
* its object has checked and halfChecked property. Regardless of whether the child or parent treeNode is checked,
* they won't impact each other.
* @default []
* @type string[] | number[] | { checked: string[]; halfChecked: string[] }
*/
checkedKeys?:
| string[]
| number[]
| {
checked: string[];
halfChecked: string[];
};
/**
* Check treeNode precisely; parent treeNode and children treeNodes are not associated
* @default false
* @type boolean
*/
checkStrictly?: boolean;
/**
* Specifies the keys of the default checked treeNodes
* @default []
* @type string[] | number[]
*/
defaultCheckedKeys?: string[] | number[];
/**
* Whether to expand all treeNodes by default
* @default false
* @type boolean
*/
defaultExpandAll?: boolean;
/**
* Specify the keys of the default expanded treeNodes
* @default []
* @type string[] | number[]
*/
defaultExpandedKeys?: string[] | number[];
/**
* auto expand parent treeNodes when init
* @default true
* @type boolean
*/
defaultExpandParent?: boolean;
/**
* Specifies the keys of the default selected treeNodes
* @default []
* @type string[] | number[]
*/
defaultSelectedKeys?: string[] | number[];
/**
* whether disabled the tree
* @default false
* @type boolean
*/
disabled?: boolean;
/**
* Specifies whether this Tree is draggable (IE > 8)
* @default false
* @type boolean
*/
draggable?: boolean;
/**
* (Controlled) Specifies the keys of the expanded treeNodes
* @default []
* @type string[] | number[]
*/
expandedKeys?: string[] | number[];
/**
* Defines a function to filter (highlight) treeNodes.
* When the function returns true, the corresponding treeNode will be highlighted
* @type Function
*/
filterTreeNode?: (node?: TreeNode) => any;
/**
* Load data asynchronously
* @type Function
*/
loadData?: (node?: TreeNode) => any;
/**
* (Controlled) Set loaded tree nodes. Need work with loadData
* @default []
* @type string[]
*/
loadedKeys?: string[];
/**
* Allows selecting multiple treeNodes
* @default false
* @type boolean
*/
multiple?: boolean;
/**
* (Controlled) Specifies the keys of the selected treeNodes
* @type string[] | number[]
*/
selectedKeys?: string[] | number[];
/**
* Shows the icon before a TreeNode's title.
* There is no default style; you must set a custom style for it if set to true
* @default false
* @type boolean
*/
showIcon?: boolean;
/**
* Shows a connecting line
* @default false
* @type boolean
*/
showLine?: boolean;
/**
* Callback function for when the onCheck event occurs
* @param checkedKeys
* @param e
*/
onClick?: (
checkedKeys: string[],
e: { checked: boolean; checkedNodes: any[]; node: any; event: any },
) => void;
/**
* Callback function for when the onDragEnd event occurs
* @param event
* @param node
*/
onDragend?: ({ event, node }) => void;
/**
* Callback function for when the onDragEnter event occurs
* @param event
* @param node
* @param expandedKeys
*/
onDragenter?: ({ event, node, expandedKeys }) => void;
/**
* Callback function for when the onDragLeave event occurs
* @param event
* @param node
*/
onDragleave?: ({ event, node }) => void;
/**
* Callback function for when the onDragOver event occurs
* @param event
* @param node
*/
onDragover?: ({ event, node }) => void;
/**
* Callback function for when the onDragStart event occurs
* @param event
* @param node
*/
onDragstart?: ({ event, node }) => void;
/**
* Callback function for when the onDrop event occurs
*
* @param event
* @param node
* @param dragNode
* @param dragNodesKeys
*/
onDrop?: ({ event, node, dragNode, dragNodesKeys }) => void;
/**
* Callback function for when a treeNode is expanded or collapsed
* @param expandedKeys
* @param bool
* @param node
*/
onExpand?: (expandedKeys: string[], { expanded, node }) => void;
/**
* Callback function for when a treeNode is loaded
* @param loadedKeys
* @param event
* @param node
*/
onLoad?: (loadedKeys: string[], { event, node }) => void;
/**
* Callback function for when the user right clicks a treeNode
* @param event
* @param node
*/
onRightClick?: ({ event, node }) => void;
/**
* Callback function for when the user clicks a treeNode
* @param selectedKeys
* @param event
*/
onSelect?: (selectedKeys: string[], event: { selected; selectedNodes; node; event }) => void;
};
$props: TreeProps;
}