Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tree] fix type definition #12941

Merged
merged 1 commit into from
Sep 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions types/tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ import { ElementUIComponent } from './component';
export interface TreeData {
id?: any;
label?: string;
disabled?: boolean;
isLeaf?: boolean;
children?: TreeData[];
}

export interface TreeProps {
label: string;
disabled: string;
isLeaf: string;
children: string;
}

export interface TreeNode<K, D> {
checked: boolean;
childNodes: TreeNode<K, D>[];
Expand All @@ -25,6 +33,7 @@ export interface TreeNode<K, D> {
disabled: boolean;
icon: string;
key: K;
label: string;
nextSibling: TreeNode<K, D> | null;
previousSibling: TreeNode<K, D> | null;
}
Expand All @@ -49,7 +58,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
nodeKey: string;

/** Configuration options, see the following table */
props: object;
props: TreeProps;

/** Method for loading subtree data */
load: (data: D, resolve: Function) => void;
Expand Down Expand Up @@ -216,7 +225,7 @@ export declare class ElTree<K = any, D = TreeData> extends ElementUIComponent {
*
* @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
Expand Down