|
|
@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
import { AntdComponent } from './component';
|
|
|
|
import { AntdComponent } from './component';
|
|
|
|
import { TreeNode } from './tree-node';
|
|
|
|
import { TreeNode } from './tree-node';
|
|
|
|
|
|
|
|
import { VNodeChild, CSSProperties } from 'vue';
|
|
|
|
|
|
|
|
|
|
|
|
export interface TreeData {
|
|
|
|
export interface TreeData {
|
|
|
|
key: string | number;
|
|
|
|
key: string | number;
|
|
|
@ -15,214 +16,259 @@ export interface TreeData {
|
|
|
|
selectable?: boolean;
|
|
|
|
selectable?: boolean;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export interface ReplaceFields {
|
|
|
|
|
|
|
|
children: 'children';
|
|
|
|
|
|
|
|
title: 'title';
|
|
|
|
|
|
|
|
key: 'key';
|
|
|
|
|
|
|
|
value: 'value';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export type TreeNodeValue = string | number | string[] | number[];
|
|
|
|
export type TreeNodeValue = string | number | string[] | number[];
|
|
|
|
|
|
|
|
|
|
|
|
export declare class TreeSelect extends AntdComponent {
|
|
|
|
export declare class TreeSelect extends AntdComponent {
|
|
|
|
static TreeNode: typeof TreeNode;
|
|
|
|
static TreeNode: typeof TreeNode;
|
|
|
|
|
|
|
|
|
|
|
|
treeIcon?: boolean;
|
|
|
|
$props: {
|
|
|
|
|
|
|
|
treeIcon?: boolean;
|
|
|
|
notFoundContent?: any;
|
|
|
|
|
|
|
|
|
|
|
|
notFoundContent?: VNodeChild | JSX.Element;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Whether allow clear
|
|
|
|
/**
|
|
|
|
* @default false
|
|
|
|
* Whether allow clear
|
|
|
|
* @type boolean
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
* @type boolean
|
|
|
|
allowClear: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
allowClear?: boolean;
|
|
|
|
defaultValue: TreeNodeValue;
|
|
|
|
|
|
|
|
|
|
|
|
defaultValue?: TreeNodeValue;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Disabled or not
|
|
|
|
/**
|
|
|
|
* @default false
|
|
|
|
* Disabled or not
|
|
|
|
* @type boolean
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
* @type boolean
|
|
|
|
disabled: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
disabled?: boolean;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* className of dropdown menu
|
|
|
|
/**
|
|
|
|
* @type string
|
|
|
|
* className of dropdown menu
|
|
|
|
*/
|
|
|
|
* @type string
|
|
|
|
dropdownClassName: string;
|
|
|
|
*/
|
|
|
|
|
|
|
|
dropdownClassName?: string;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Determine whether the dropdown menu and the select input are the same width
|
|
|
|
/**
|
|
|
|
* @default true
|
|
|
|
* Determine whether the dropdown menu and the select input are the same width
|
|
|
|
* @type boolean
|
|
|
|
* @default true
|
|
|
|
*/
|
|
|
|
* @type boolean
|
|
|
|
dropdownMatchSelectWidth: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
dropdownMatchSelectWidth?: boolean;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* To set the style of the dropdown menu
|
|
|
|
/**
|
|
|
|
* @type object
|
|
|
|
* To set the style of the dropdown menu
|
|
|
|
*/
|
|
|
|
* @type object
|
|
|
|
dropdownStyle: object;
|
|
|
|
*/
|
|
|
|
|
|
|
|
dropdownStyle?: CSSProperties;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Whether to filter treeNodes by input value. The value of treeNodeFilterProp is used for filtering by default.
|
|
|
|
/**
|
|
|
|
* @default Function
|
|
|
|
* Whether to filter treeNodes by input value. The value of treeNodeFilterProp is used for filtering by default.
|
|
|
|
* @type boolean | Function
|
|
|
|
* @default Function
|
|
|
|
*/
|
|
|
|
* @type boolean | Function
|
|
|
|
filterTreeNode: boolean | Function;
|
|
|
|
*/
|
|
|
|
|
|
|
|
filterTreeNode?: boolean | Function;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* To set the container of the dropdown menu.
|
|
|
|
/**
|
|
|
|
* The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition.
|
|
|
|
* To set the container of the dropdown menu.
|
|
|
|
* @default () => document.body
|
|
|
|
* The default is to create a div element in body, you can reset it to the scrolling area and make a relative reposition.
|
|
|
|
* @type Function
|
|
|
|
* @default () => document.body
|
|
|
|
*/
|
|
|
|
* @type Function
|
|
|
|
getPopupContainer: (triggerNode: any) => HTMLElement;
|
|
|
|
*/
|
|
|
|
|
|
|
|
getPopupContainer?: (triggerNode: any) => HTMLElement;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* whether to embed label in value, turn the format of value from string to {value: string, label: VNode, halfChecked: string[]}
|
|
|
|
/**
|
|
|
|
* @default false
|
|
|
|
* whether to embed label in value, turn the format of value from string to {value: string, label: VNode, halfChecked: string[]}
|
|
|
|
* @type boolean
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
* @type boolean
|
|
|
|
labelInValue: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
labelInValue?: boolean;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Load data asynchronously.
|
|
|
|
/**
|
|
|
|
* @type
|
|
|
|
* Load data asynchronously.
|
|
|
|
*/
|
|
|
|
* @param node
|
|
|
|
loadData: (node: any) => void;
|
|
|
|
*/
|
|
|
|
|
|
|
|
loadData?: (node: object) => Promise<void>;
|
|
|
|
maxTagCount: number;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
maxTagPlaceholder: any;
|
|
|
|
* Max tag count to show
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
maxTagCount?: number;
|
|
|
|
* Support multiple or not, will be true when enable treeCheckable.
|
|
|
|
|
|
|
|
* @default false
|
|
|
|
/**
|
|
|
|
* @type boolean
|
|
|
|
* Placeholder for not showing tags
|
|
|
|
*/
|
|
|
|
* @param omittedValues
|
|
|
|
multiple: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
maxTagPlaceholder?: (omittedValues: any[]) => VNodeChild | JSX.Element;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Placeholder of the select input
|
|
|
|
/**
|
|
|
|
* @type any (string | slot)
|
|
|
|
* Support multiple or not, will be true when enable treeCheckable.
|
|
|
|
*/
|
|
|
|
* @default false
|
|
|
|
placeholder: any;
|
|
|
|
* @type boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
multiple?: boolean;
|
|
|
|
* Placeholder of the search input
|
|
|
|
|
|
|
|
* @type any (string | slot)
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
* Placeholder of the select input
|
|
|
|
searchPlaceholder: any;
|
|
|
|
* @type any (string | slot)
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
placeholder?: string | VNodeChild | JSX.Element;
|
|
|
|
* work with `search` event to make search value controlled.
|
|
|
|
|
|
|
|
* @type string
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
* Placeholder of the search input
|
|
|
|
searchValue: string;
|
|
|
|
* @type any (string | slot)
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
searchPlaceholder?: string | VNodeChild | JSX.Element;
|
|
|
|
* Show Checked Strategy
|
|
|
|
|
|
|
|
* @description The way show selected item in box. Default: just show child nodes.
|
|
|
|
/**
|
|
|
|
* TreeSelect.SHOW_ALL: show all checked treeNodes (include parent treeNode).
|
|
|
|
* work with `search` event to make search value controlled.
|
|
|
|
* TreeSelect.SHOW_PARENT: show checked treeNodes (just show parent treeNode).
|
|
|
|
* @type string
|
|
|
|
* @default TreeSelect.SHOW_CHILD
|
|
|
|
*/
|
|
|
|
* @type
|
|
|
|
searchValue?: string;
|
|
|
|
*/
|
|
|
|
|
|
|
|
showCheckedStrategy: 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Show Checked Strategy
|
|
|
|
/**
|
|
|
|
* @description The way show selected item in box. Default: just show child nodes.
|
|
|
|
* Whether to display a search input in the dropdown menu(valid only in the single mode)
|
|
|
|
* TreeSelect.SHOW_ALL: show all checked treeNodes (include parent treeNode).
|
|
|
|
* @default false
|
|
|
|
* TreeSelect.SHOW_PARENT: show checked treeNodes (just show parent treeNode).
|
|
|
|
* @type boolean
|
|
|
|
* @default TreeSelect.SHOW_CHILD
|
|
|
|
*/
|
|
|
|
* @type TreeSelect ENUMS
|
|
|
|
showSearch: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
showCheckedStrategy?: 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
|
|
|
|
/**
|
|
|
|
|
|
|
|
* To set the size of the select input, options: large small
|
|
|
|
/**
|
|
|
|
* @default 'default'
|
|
|
|
* Whether to display a search input in the dropdown menu(valid only in the single mode)
|
|
|
|
* @type string
|
|
|
|
* @default false
|
|
|
|
*/
|
|
|
|
* @type boolean
|
|
|
|
size: 'small' | 'large' | 'default';
|
|
|
|
*/
|
|
|
|
|
|
|
|
showSearch?: boolean;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Whether to show checkbox on the treeNodes
|
|
|
|
/**
|
|
|
|
* @default false
|
|
|
|
* To set the size of the select input, options: large small
|
|
|
|
* @type boolean
|
|
|
|
* @default 'default'
|
|
|
|
*/
|
|
|
|
* @type string
|
|
|
|
treeCheckable: boolean;
|
|
|
|
*/
|
|
|
|
|
|
|
|
size?: 'small' | 'large' | 'default';
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Whether to check nodes precisely (in the checkable mode), means parent and
|
|
|
|
/**
|
|
|
|
* child nodes are not associated, and it will make labelInValue be true
|
|
|
|
* Whether to show checkbox on the treeNodes
|
|
|
|
* @default false
|
|
|
|
* @default false
|
|
|
|
* @type boolean
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
treeCheckStrictly: boolean;
|
|
|
|
treeCheckable?: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Data of the treeNodes, manual construction work is no longer needed
|
|
|
|
* Whether to check nodes precisely (in the checkable mode), means parent and
|
|
|
|
* if this property has been set(ensure the Uniqueness of each value)
|
|
|
|
* child nodes are not associated, and it will make labelInValue be true
|
|
|
|
* @default []
|
|
|
|
* @default false
|
|
|
|
* @type object[]
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
treeData: TreeData[];
|
|
|
|
treeCheckStrictly?: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Enable simple mode of treeData.
|
|
|
|
* Data of the treeNodes, manual construction work is no longer needed
|
|
|
|
* (treeData should like this: [{id:1, pId:0, value:'1', label:"test1",...},...], pId is parent node's id)
|
|
|
|
* if this property has been set(ensure the Uniqueness of each value)
|
|
|
|
* @default false
|
|
|
|
* @default []
|
|
|
|
* @type boolean | object[]
|
|
|
|
* @type object[]
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
treeDataSimpleMode:
|
|
|
|
treeData?: TreeData[];
|
|
|
|
| boolean
|
|
|
|
|
|
|
|
| Array<{
|
|
|
|
/**
|
|
|
|
id: string;
|
|
|
|
* Enable simple mode of treeData.
|
|
|
|
pId: string;
|
|
|
|
* (treeData should like this: [{id:1, pId:0, value:'1', label:"test1",...},...], pId is parent node's id)
|
|
|
|
rootPId: any;
|
|
|
|
* @default false
|
|
|
|
}>;
|
|
|
|
* @type boolean | object[]
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
treeDataSimpleMode?:
|
|
|
|
* Whether to expand all treeNodes by default
|
|
|
|
| boolean
|
|
|
|
* @default false
|
|
|
|
| Array<{
|
|
|
|
* @type boolean
|
|
|
|
id: string;
|
|
|
|
*/
|
|
|
|
pId: string;
|
|
|
|
treeDefaultExpandAll: boolean;
|
|
|
|
rootPId: any;
|
|
|
|
|
|
|
|
}>;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Default expanded treeNodes
|
|
|
|
/**
|
|
|
|
* @type string[] | number[]
|
|
|
|
* Whether to expand all treeNodes by default
|
|
|
|
*/
|
|
|
|
* @default false
|
|
|
|
treeDefaultExpandedKeys: string[] | number[];
|
|
|
|
* @type boolean
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
treeDefaultExpandAll?: boolean;
|
|
|
|
* Set expanded keys
|
|
|
|
|
|
|
|
* @type string[] | number[]
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
* Default expanded treeNodes
|
|
|
|
treeExpandedKeys: string[] | number[];
|
|
|
|
* @type string[] | number[]
|
|
|
|
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
treeDefaultExpandedKeys?: string[] | number[];
|
|
|
|
* Will be used for filtering if filterTreeNode returns true
|
|
|
|
|
|
|
|
* @default 'value'
|
|
|
|
/**
|
|
|
|
* @type string
|
|
|
|
* Set expanded keys
|
|
|
|
*/
|
|
|
|
* @type string[] | number[]
|
|
|
|
treeNodeFilterProp: string;
|
|
|
|
*/
|
|
|
|
|
|
|
|
treeExpandedKeys?: string[] | number[];
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Will render as content of select
|
|
|
|
/**
|
|
|
|
* @default 'title'
|
|
|
|
* Will be used for filtering if filterTreeNode returns true
|
|
|
|
* @type string
|
|
|
|
* @default 'value'
|
|
|
|
*/
|
|
|
|
* @type string
|
|
|
|
treeNodeLabelProp: string;
|
|
|
|
*/
|
|
|
|
|
|
|
|
treeNodeFilterProp?: string;
|
|
|
|
value: TreeNodeValue;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Will render as content of select
|
|
|
|
* The custom suffix icon
|
|
|
|
* @default 'title'
|
|
|
|
* @type any (VNode | slot)
|
|
|
|
* @type string
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
suffixIcon: any;
|
|
|
|
treeNodeLabelProp?: string;
|
|
|
|
|
|
|
|
|
|
|
|
removeIcon?: any;
|
|
|
|
value?: TreeNodeValue;
|
|
|
|
|
|
|
|
|
|
|
|
clearIcon?: any;
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The custom suffix icon
|
|
|
|
replaceFields: object;
|
|
|
|
* @type any (VNode | slot)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
suffixIcon?: VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeIcon?: VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearIcon?: VNodeChild | JSX.Element;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
replaceFields?: ReplaceFields | object;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A callback function, can be executed when selected treeNodes or input value change
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param value
|
|
|
|
|
|
|
|
* @param label
|
|
|
|
|
|
|
|
* @param extra
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onChange?: (value?: any, label?: any, extra?: any) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A callback function, can be executed when the search input changes.
|
|
|
|
|
|
|
|
* @param value
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onSearch?: (value?: string) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A callback function, can be executed when you select a treeNode.
|
|
|
|
|
|
|
|
* @param value
|
|
|
|
|
|
|
|
* @param label
|
|
|
|
|
|
|
|
* @param extra
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onSelect?: (value?: any, label?: any, extra?: any) => void;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* A callback function, can be executed when treeNode expanded
|
|
|
|
|
|
|
|
* @param expandedKeys
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
onTreeExpand?: (expandedKeys?: any[]) => void;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* remove focus
|
|
|
|
* remove focus
|
|
|
|