mirror of https://github.com/ElemeFE/element
Tree: fix type definition (#12941)
parent
74827513d0
commit
7e29e1c66d
|
@ -4,10 +4,18 @@ import { ElementUIComponent } from './component';
|
||||||
export interface TreeData {
|
export interface TreeData {
|
||||||
id?: any;
|
id?: any;
|
||||||
label?: string;
|
label?: string;
|
||||||
|
disabled?: boolean;
|
||||||
isLeaf?: boolean;
|
isLeaf?: boolean;
|
||||||
children?: TreeData[];
|
children?: TreeData[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TreeProps {
|
||||||
|
label: string;
|
||||||
|
disabled: string;
|
||||||
|
isLeaf: string;
|
||||||
|
children: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TreeNode<K, D> {
|
export interface TreeNode<K, D> {
|
||||||
checked: boolean;
|
checked: boolean;
|
||||||
childNodes: TreeNode<K, D>[];
|
childNodes: TreeNode<K, D>[];
|
||||||
|
@ -25,6 +33,7 @@ export interface TreeNode<K, D> {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
icon: string;
|
icon: string;
|
||||||
key: K;
|
key: K;
|
||||||
|
label: string;
|
||||||
nextSibling: TreeNode<K, D> | null;
|
nextSibling: TreeNode<K, D> | null;
|
||||||
previousSibling: TreeNode<K, D> | null;
|
previousSibling: TreeNode<K, D> | null;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +58,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
|
||||||
nodeKey: string;
|
nodeKey: string;
|
||||||
|
|
||||||
/** Configuration options, see the following table */
|
/** Configuration options, see the following table */
|
||||||
props: object;
|
props: TreeProps;
|
||||||
|
|
||||||
/** Method for loading subtree data */
|
/** Method for loading subtree data */
|
||||||
load: (data: D, resolve: Function) => void;
|
load: (data: D, resolve: Function) => void;
|
||||||
|
@ -216,7 +225,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
|
||||||
*
|
*
|
||||||
* @param by node key or node data
|
* @param by node key or node data
|
||||||
*/
|
*/
|
||||||
getNode(by: D | K): D;
|
getNode(by: D | K): TreeNode<K, D>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove node by key or node data or node instance
|
* Remove node by key or node data or node instance
|
||||||
|
|
Loading…
Reference in New Issue