2017-11-17 14:38:54 +08:00
|
|
|
import * as React from 'react';
|
2017-03-28 15:10:07 +08:00
|
|
|
import { AbstractSelectProps } from '../select';
|
2016-08-01 16:35:01 +08:00
|
|
|
|
2018-08-03 17:12:51 +08:00
|
|
|
export type TreeNode = TreeNodeNormal | TreeNodeSimpleMode;
|
|
|
|
|
2018-08-22 04:16:47 +08:00
|
|
|
export interface TreeNodeNormal {
|
2018-09-11 16:59:56 +08:00
|
|
|
value: string | number;
|
2018-07-25 17:06:44 +08:00
|
|
|
/**
|
|
|
|
* @deprecated Please use `title` instead.
|
|
|
|
*/
|
|
|
|
label?: React.ReactNode;
|
|
|
|
title?: React.ReactNode;
|
2018-08-03 17:12:51 +08:00
|
|
|
key: string;
|
|
|
|
isLeaf?: boolean;
|
|
|
|
disabled?: boolean;
|
|
|
|
disableCheckbox?: boolean;
|
|
|
|
selectable?: boolean;
|
|
|
|
children?: TreeNodeNormal[];
|
|
|
|
}
|
|
|
|
|
2018-08-22 04:16:47 +08:00
|
|
|
export interface TreeNodeSimpleMode {
|
2018-08-03 17:12:51 +08:00
|
|
|
/* It is possible to change `id` and `pId` prop keys using TreeDataSimpleMode so those keys can be anything */
|
|
|
|
[key: string]: string | boolean | React.ReactNode;
|
|
|
|
}
|
|
|
|
|
2018-08-22 04:16:47 +08:00
|
|
|
export interface TreeDataSimpleMode {
|
2018-08-03 17:12:51 +08:00
|
|
|
id?: string;
|
|
|
|
pId?: string;
|
|
|
|
rootPId?: string;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|
|
|
|
|
2017-03-28 15:10:07 +08:00
|
|
|
export interface TreeSelectProps extends AbstractSelectProps {
|
2018-09-11 16:59:56 +08:00
|
|
|
value?: string | number | Array<any>;
|
|
|
|
defaultValue?: string | number | Array<any>;
|
2016-08-01 16:35:01 +08:00
|
|
|
multiple?: boolean;
|
2018-09-06 11:49:08 +08:00
|
|
|
maxTagCount?: number;
|
2016-08-01 16:35:01 +08:00
|
|
|
onSelect?: (value: any) => void;
|
2018-09-15 00:24:30 +08:00
|
|
|
onChange?: (value: any, label: any, extra: any) => void;
|
2016-08-01 16:35:01 +08:00
|
|
|
onSearch?: (value: any) => void;
|
|
|
|
searchPlaceholder?: string;
|
|
|
|
dropdownStyle?: React.CSSProperties;
|
|
|
|
treeDefaultExpandAll?: boolean;
|
|
|
|
treeCheckable?: boolean | React.ReactNode;
|
2017-03-28 13:45:10 +08:00
|
|
|
treeDefaultExpandedKeys?: Array<string>;
|
2016-09-19 10:17:07 +08:00
|
|
|
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
|
2016-08-01 16:35:01 +08:00
|
|
|
treeNodeFilterProp?: string;
|
|
|
|
treeNodeLabelProp?: string;
|
2018-08-03 17:12:51 +08:00
|
|
|
treeData?: Array<TreeNode>;
|
|
|
|
treeDataSimpleMode?: boolean | TreeDataSimpleMode;
|
2016-08-01 16:35:01 +08:00
|
|
|
loadData?: (node: any) => void;
|
|
|
|
showCheckedStrategy?: 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
|
2016-09-19 10:17:07 +08:00
|
|
|
labelInValue?: boolean;
|
|
|
|
treeCheckStrictly?: boolean;
|
2017-03-28 13:20:05 +08:00
|
|
|
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
2018-09-16 19:47:00 +08:00
|
|
|
suffixIcon?: React.ReactNode;
|
2018-10-15 17:16:20 +08:00
|
|
|
treeExpandedKeys?: Array<string>;
|
|
|
|
onTreeExpand?: (keys: Array<string>) => void;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|