UNPKG

2.76 kBTypeScriptView Raw
1import React from 'react';
2import { SelectProps, RefSelectProps } from 'rc-select/lib/generate';
3import { IconType } from 'rc-tree/lib/interface';
4import { FilterFunc } from 'rc-select/lib/interface/generator';
5import { Key, DefaultValueType, DataNode, LabelValueType, SimpleModeConfig, ChangeEventExtra, LegacyDataNode } from './interface';
6import { CheckedStrategy, SHOW_ALL, SHOW_PARENT, SHOW_CHILD } from './utils/strategyUtil';
7export interface TreeSelectProps<ValueType = DefaultValueType> extends Omit<SelectProps<DataNode[], ValueType>, 'onChange' | 'mode' | 'menuItemSelectedIcon' | 'dropdownRender' | 'dropdownAlign' | 'backfill' | 'getInputElement' | 'optionLabelProp' | 'tokenSeparators' | 'filterOption'> {
8 multiple?: boolean;
9 showArrow?: boolean;
10 showSearch?: boolean;
11 open?: boolean;
12 defaultOpen?: boolean;
13 value?: ValueType;
14 defaultValue?: ValueType;
15 disabled?: boolean;
16 placeholder?: React.ReactNode;
17 /** @deprecated Use `searchValue` instead */
18 inputValue?: string;
19 searchValue?: string;
20 autoClearSearchValue?: boolean;
21 maxTagTextLength?: number;
22 maxTagCount?: number;
23 maxTagPlaceholder?: (omittedValues: LabelValueType[]) => React.ReactNode;
24 loadData?: (dataNode: LegacyDataNode) => Promise<unknown>;
25 treeNodeFilterProp?: string;
26 treeNodeLabelProp?: string;
27 treeDataSimpleMode?: boolean | SimpleModeConfig;
28 treeExpandedKeys?: Key[];
29 treeDefaultExpandedKeys?: Key[];
30 treeLoadedKeys?: Key[];
31 treeCheckable?: boolean | React.ReactNode;
32 treeCheckStrictly?: boolean;
33 showCheckedStrategy?: CheckedStrategy;
34 treeDefaultExpandAll?: boolean;
35 treeData?: DataNode[];
36 treeLine?: boolean;
37 treeIcon?: IconType;
38 showTreeIcon?: boolean;
39 switcherIcon?: IconType;
40 treeMotion?: any;
41 children?: React.ReactNode;
42 filterTreeNode?: boolean | FilterFunc<LegacyDataNode>;
43 dropdownPopupAlign?: any;
44 onSearch?: (value: string) => void;
45 onChange?: (value: ValueType, labelList: React.ReactNode[], extra: ChangeEventExtra) => void;
46 onTreeExpand?: (expandedKeys: Key[]) => void;
47 onTreeLoad?: (loadedKeys: Key[]) => void;
48 /** `searchPlaceholder` has been removed since search box has been merged into input box */
49 searchPlaceholder?: React.ReactNode;
50}
51declare class TreeSelect<ValueType = DefaultValueType> extends React.Component<TreeSelectProps<ValueType>, {}> {
52 static TreeNode: React.FC<import("./TreeNode").TreeNodeProps>;
53 static SHOW_ALL: typeof SHOW_ALL;
54 static SHOW_PARENT: typeof SHOW_PARENT;
55 static SHOW_CHILD: typeof SHOW_CHILD;
56 selectRef: React.RefObject<RefSelectProps>;
57 focus: () => void;
58 blur: () => void;
59 render(): JSX.Element;
60}
61export default TreeSelect;