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;
|
|
|
|
|
2019-06-16 20:51:47 +08:00
|
|
|
export type TreeNodeValue = string | number | string[] | number[];
|
|
|
|
|
2018-08-22 04:16:47 +08:00
|
|
|
export interface TreeNodeNormal {
|
2019-06-16 20:51:47 +08:00
|
|
|
value: TreeNodeValue;
|
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
|
|
|
}
|
|
|
|
|
2019-06-16 20:51:47 +08:00
|
|
|
export interface TreeSelectProps<T extends TreeNodeValue> extends AbstractSelectProps {
|
2018-11-13 10:42:10 +08:00
|
|
|
autoFocus?: boolean;
|
2019-06-16 20:51:47 +08:00
|
|
|
defaultValue?: T;
|
2018-11-09 00:22:32 +08:00
|
|
|
dropdownStyle?: React.CSSProperties;
|
2019-06-24 11:29:58 +08:00
|
|
|
filterTreeNode?: (inputValue: string, treeNode: any) => boolean | boolean;
|
2018-11-09 00:22:32 +08:00
|
|
|
labelInValue?: boolean;
|
2019-06-24 11:29:58 +08:00
|
|
|
loadData?: (node: any) => void;
|
2018-09-06 11:49:08 +08:00
|
|
|
maxTagCount?: number;
|
2019-06-24 11:29:58 +08:00
|
|
|
maxTagPlaceholder?: React.ReactNode | ((omittedValues: any[]) => React.ReactNode);
|
2018-11-09 00:22:32 +08:00
|
|
|
multiple?: boolean;
|
2018-12-26 16:01:00 +08:00
|
|
|
notFoundContent?: React.ReactNode;
|
2019-06-24 11:29:58 +08:00
|
|
|
onChange?: (value: T, label: any, extra: any) => void;
|
|
|
|
onSearch?: (value: any) => void;
|
|
|
|
onSelect?: (value: any) => void;
|
2018-11-09 00:22:32 +08:00
|
|
|
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>;
|
2019-01-29 11:21:07 +08:00
|
|
|
treeIcon?: boolean;
|
2018-11-09 00:22:32 +08:00
|
|
|
treeNodeFilterProp?: string;
|
|
|
|
treeNodeLabelProp?: string;
|
2019-06-16 20:51:47 +08:00
|
|
|
value?: T;
|
2016-08-01 16:35:01 +08:00
|
|
|
}
|