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

View File

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

View File

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

View File

@ -7,45 +7,46 @@ import { CollapsePanel } from './collapse-panel';
export type ExpandIconPosition = 'left' | 'right'; export type ExpandIconPosition = 'left' | 'right';
export declare class Collapse extends AntdComponent { export declare class Collapse extends AntdComponent {
static Panel: typeof CollapsePanel; static Panel: typeof CollapsePanel;
$props: {
expandIconPosition?: ExpandIconPosition;
/**
* If true, Collapse renders as Accordion
* @default false
* @type boolean
*/
accordion?: boolean;
expandIconPosition?: ExpandIconPosition; /**
/** * Key of the active panel
* If true, Collapse renders as Accordion * @default No default value. In accordion mode, it's the key of the first panel.
* @default false * @type string | string[]
* @type boolean */
*/ activeKey?: string | string[];
accordion: boolean;
/** /**
* Key of the active panel * Toggles rendering of the border around the collapse block
* @default No default value. In accordion mode, it's the key of the first panel. * @default true
* @type string | string[] * @type boolean
*/ */
activeKey: string | string[]; bordered?: boolean;
/** /**
* Toggles rendering of the border around the collapse block * Key of the initial active panel
* @default true * @type string
* @type boolean */
*/ defaultActiveKey?: string | string[];
bordered: boolean;
/** /**
* Key of the initial active panel * Destroy Inactive Panel
* @type string * @default false
*/ * @type boolean
defaultActiveKey: string | string[]; */
destroyInactivePanel?: boolean;
/** /**
* Destroy Inactive Panel * allow to customize collapse icon.
* @default false * @type any (function | slot-scope)
* @type boolean */
*/ expandIcon?: any;
destroyInactivePanel: boolean; };
/**
* 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'; import Pickr from '@simonwep/pickr';
export declare class ColorPicker extends AntdComponent { export declare class ColorPicker extends AntdComponent {
/** simonwep/pickr's options */ $props: {
config?: Pickr.Options; /** simonwep/pickr's options */
/**prefix class name */ config?: Pickr.Options;
prefixCls?: string; /**prefix class name */
/** default color value */ prefixCls?: string;
defaultValue?: string; /** default color value */
/** color value */ defaultValue?: string;
value?: string; /** color value */
/** value?: string;
* language package setting /**
* @type object * language package setting
*/ * @type object
locale: object; */
/** locale: object;
* precision of color value /**
* @default 0 * precision of color value
* @type number * @default 0
* */ * @type number
colorRounded?: number; * */
/** colorRounded?: number;
* descriptions size type /**
* @default 'default' * descriptions size type
* @type string * @default 'default'
*/ * @type string
size: 'large' | 'default' | 'small'; */
/** 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. * Parent Node which the selector should be rendered to. Default to body.
* @default () => document.body * When position issues happen, try to modify it into scrollable content and position it relative.
* @type Function * @default () => document.body
*/ * @type Function
getPopupContainer: (triggerNode: any) => HTMLElement; */
/** getPopupContainer: (triggerNode: any) => HTMLElement;
* Disabled or not /**
* @default false * Disabled or not
* @type boolean * @default false
*/ * @type boolean
disabled: boolean; */
/** disabled: boolean;
* to set the color format /**
* @default "HEXA" * to set the color format
*/ * @default "HEXA"
format: Pickr.Representation; */
format: Pickr.Representation;
};
} }

View File

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

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export interface LayoutFooterProps { 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 * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @type boolean

View File

@ -7,19 +7,6 @@ import { CSSProperties } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export interface LayoutHeaderProps { 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 * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @type boolean

View File

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

View File

@ -10,19 +10,6 @@ import LayoutFooter from './layout-footer';
import { CSSProperties } from 'vue'; import { CSSProperties } from 'vue';
export interface LayoutProps { 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 * whether contain Sider in children, don't have to assign it normally. Useful in ssr avoid style flickering
* @type boolean * @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'; import { VNodeChild } from 'vue';
export declare class MenuItemGroup extends AntdComponent { export declare class MenuItemGroup extends AntdComponent {
$props:{ $props: {
/** /**
* sub menu items * sub menu items
* @type MenuItem[] * @type MenuItem[]
*/ */
children?: MenuItem[]; children?: MenuItem[];
/** /**
* title of the group * title of the group
* @type string | slot * @type string | slot
*/ */
title?: VNodeChild | JSX.Element; title?: VNodeChild | JSX.Element;
} };
} }

26
types/modal.d.ts vendored
View File

@ -39,7 +39,7 @@ export interface ModalOptions {
* Modal content * Modal content
* @type string | VNode | (h) => VNode * @type string | VNode | (h) => VNode
*/ */
content?: VNodeChild | JSX.Element; content?: VNodeChild | JSX.Element;
/** /**
* custom icon (Added in 1.14.0) * custom icon (Added in 1.14.0)
*/ */
@ -94,7 +94,7 @@ export interface ModalOptions {
* Title * Title
* @type string | VNode | (h) => VNode * @type string | VNode | (h) => VNode
*/ */
title?: VNodeChild | JSX.Element; title?: VNodeChild | JSX.Element;
/** /**
* Width of the modal dialog * Width of the modal dialog
@ -112,7 +112,7 @@ export interface ModalOptions {
/** /**
* Style of floating layer, typically used at least for adjusting the position. * Style of floating layer, typically used at least for adjusting the position.
*/ */
dialogStyle?: CSSProperties dialogStyle?: CSSProperties;
/** /**
* className of floating layer. * className of floating layer.
*/ */
@ -155,9 +155,9 @@ export interface ModalConfirm {
export declare class Modal extends AntdComponent { export declare class Modal extends AntdComponent {
$props: { $props: {
/** /**
* Specify a function that will be called when modal is closed completely. * Specify a function that will be called when modal is closed completely.
* @type Function * @type Function
*/ */
afterClose?: () => any; afterClose?: () => any;
/** /**
@ -271,7 +271,7 @@ export declare class Modal extends AntdComponent {
* The modal dialog's title * The modal dialog's title
* @type any (string | slot) * @type any (string | slot)
*/ */
title?: VNodeChild | JSX.Element; title?: VNodeChild | JSX.Element;
/** /**
* Whether the modal dialog is visible or not * Whether the modal dialog is visible or not
@ -299,7 +299,7 @@ export declare class Modal extends AntdComponent {
* @type number * @type number
*/ */
zIndex?: number; zIndex?: number;
} };
static info(options: ModalOptions): ModalConfirm; static info(options: ModalOptions): ModalConfirm;
static success(options: ModalOptions): ModalConfirm; static success(options: ModalOptions): ModalConfirm;
static error(options: ModalOptions): ModalConfirm; static error(options: ModalOptions): ModalConfirm;
@ -307,13 +307,3 @@ export declare class Modal extends AntdComponent {
static confirm(options: ModalOptions): ModalConfirm; static confirm(options: ModalOptions): ModalConfirm;
static destroyAll(): void; 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 by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { AntdComponent } from './component';
import { VNodeChild, CSSProperties } from 'vue'; import { VNodeChild, CSSProperties } from 'vue';
export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; export type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
export interface NotificationOptions extends NotificationConfigOptions { 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 by: akki-jat <https://github.com/akki-jat>
// Definitions: https://github.com/vueComponent/ant-design-vue/types // Definitions: https://github.com/vueComponent/ant-design-vue/types
import { VNodeChild, Slots } from 'vue'; import { VNodeChild } from 'vue';
import { AntdComponent } from '../component'; import { AntdComponent } from '../component';
export declare class ColumnGroup extends AntdComponent { export declare class ColumnGroup extends AntdComponent {
@ -12,12 +12,5 @@ export declare class ColumnGroup extends AntdComponent {
* @type any * @type any
*/ */
title?: VNodeChild | JSX.Element; 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'} * such as slots: { filterIcon: 'XXX'}
* @type object * @type object
*/ */
slots?: { [key: string]: string }; slots?: Record<string, string>;
} }
export declare class Column<T> extends AntdComponent { export declare class Column<T> extends AntdComponent {

View File

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

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

@ -7,20 +7,6 @@ import { VNodeChild } from 'vue';
export declare class TreeNode extends AntdComponent { export declare class TreeNode extends AntdComponent {
$props: { $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 * When Tree is checkable, set TreeNode display Checkbox or not
* @version 1.5.0 * @version 1.5.0
@ -90,19 +76,5 @@ export declare class TreeNode extends AntdComponent {
* @type string * @type string
*/ */
value?: 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 { export interface TreeData {
key: string | number; key: string | number;
title: string | VNodeChild | JSX.Element;
value: string; value: string;
label: any; label?: any;
children: any; children?: object[];
disabled?: boolean; disabled?: boolean;
disableCheckbox?: boolean; disableCheckbox?: boolean;
selectable?: 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 { export interface ReplaceFields {

View File

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