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-11-13 10:42:10 +08:00
|
|
|
autoFocus?: boolean;
|
2018-09-11 16:59:56 +08:00
|
|
|
defaultValue?: string | number | Array<any>;
|
2018-11-09 00:22:32 +08:00
|
|
|
dropdownStyle?: React.CSSProperties;
|
|
|
|
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
|
|
|
|
getPopupContainer?: (triggerNode: Element) => HTMLElement;
|
|
|
|
labelInValue?: boolean;
|
|
|
|
loadData?: (node: any) => void;
|
2018-09-06 11:49:08 +08:00
|
|
|
maxTagCount?: number;
|
2018-11-09 00:22:32 +08:00
|
|
|
maxTagPlaceholder?: React.ReactNode | ((omittedValues: any[]) => React.ReactNode);
|
|
|
|
multiple?: boolean;
|
2018-12-26 16:01:00 +08:00
|
|
|
notFoundContent?: React.ReactNode;
|
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;
|
2018-11-09 00:22:32 +08:00
|
|
|
onSelect?: (value: any) => void;
|
|
|
|
onTreeExpand?: (keys: Array<string>) => void;
|
2018-11-13 00:16:10 +08:00
|
|
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
|
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
2016-08-01 16:35:01 +08:00
|
|
|
searchPlaceholder?: string;
|
2018-12-02 02:22:51 +08:00
|
|
|
searchValue?: string;
|
2018-11-09 00:22:32 +08:00
|
|
|
showCheckedStrategy?: 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
|
|
|
|
suffixIcon?: React.ReactNode;
|
2016-08-01 16:35:01 +08:00
|
|
|
treeCheckable?: boolean | React.ReactNode;
|
2018-11-09 00:22:32 +08:00
|
|
|
treeCheckStrictly?: boolean;
|
2018-08-03 17:12:51 +08:00
|
|
|
treeData?: Array<TreeNode>;
|
|
|
|
treeDataSimpleMode?: boolean | TreeDataSimpleMode;
|
2018-11-09 00:22:32 +08:00
|
|
|
treeDefaultExpandAll?: boolean;
|
|
|
|
treeDefaultExpandedKeys?: Array<string>;
|
2018-10-15 17:16:20 +08:00
|
|
|
treeExpandedKeys?: Array<string>;
|
2018-11-09 00:22:32 +08:00
|
|
|
treeNodeFilterProp?: string;
|
|
|
|
treeNodeLabelProp?: string;
|
|
|
|
value?: string | number | Array<any>;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|