import React from "react"; import { TreeSelectProps } from "antd"; declare const SHOW_ALL: "SHOW_ALL", SHOW_PARENT: "SHOW_PARENT", SHOW_CHILD: "SHOW_CHILD"; export declare const ALL_BUTTON = "ALL_BUTTON"; export declare const INVERT_BUTTON = "INVERT_BUTTON"; export type PlacementType = "bottomLeft" | "bottomRight" | "topLeft" | "topRight"; export interface TreeNodeNormal { value: string | number | string[] | number[]; title?: React.ReactNode; key: string; isLeaf?: boolean; disabled?: boolean; disableCheckbox?: boolean; selectable?: boolean; children?: TreeNodeNormal[]; } export interface TreeNodeSimpleMode { [key: string]: string | boolean | React.ReactNode; } export type TreeData = TreeNodeNormal | TreeNodeSimpleMode; export type TreeNodeValue = string | number | string[] | number[]; interface BaseTreeSelectProps { /** 显示清除按钮 */ allowClear?: boolean; /** 选择器类名 */ className?: string; /** 指定默认选中的条目 */ defaultValue?: string | string[]; /** 是否禁用 */ disabled?: boolean; /** 下拉菜单的 className 属性 */ dropdownClassName?: string; /** 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。false 时会关闭虚拟滚动 */ dropdownMatchSelectWidth?: boolean | number; /** 自定义下拉框内容 */ dropdownRender?: (originNode: React.ReactNode, props: any) => React.ReactNode; /** 已勾选项自定义下拉框内容 */ selectedDropdownRender?: (originNode: React.ReactNode, props: any) => React.ReactNode; /** 下拉菜单的样式 */ dropdownStyle?: React.CSSProperties; /** 自定义节点 label、value、children 的字段 */ fieldNames?: { value?: string; label?: string; children?: string; }; /** 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位 */ getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; /** 已勾选项菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位 */ getSelectedPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; /** 设置弹窗滚动高度 */ listHeight?: number; /** 最多显示多少个 tag,响应式模式会对性能产生损耗 */ maxTagCount?: number | "responsive"; /** 隐藏 tag 时显示的内容 */ maxTagPlaceholder?: React.ReactNode | ((omittedValues: any[]) => React.ReactNode); /** 支持多选(当设置 treeCheckable 时自动变为 true) */ multiple?: boolean; /** 当下拉列表为空时显示的内容 */ notFoundContent?: React.ReactNode; /** 选择框默认文字 */ placeholder?: string; /** 选择框弹出的位置 */ placement?: PlacementType; /** 是否显示下拉小箭头 */ showArrow?: boolean; /** 配置是否可搜索 */ /** 搜索框的值,可以通过 onSearch 获取用户输入 */ searchValue?: string; /** 选择器的样式 */ style?: React.CSSProperties; /** 自定义的选择框后缀图标, 多选模式下必须同时设置 showArrow 为 true */ suffixIcon?: React.ReactNode; /** 自定义树节点的展开/折叠图标 */ switcherIcon?: React.ReactNode | ((props: any) => React.ReactNode); /** 配置 treeCheckable 时,定义选中项回填的方式。TreeSelect.SHOW_ALL: 显示所有选中节点(包括父节点)。TreeSelect.SHOW_PARENT: 只显示父节点(当父节点下所有子节点都选中时)。 默认只显示子节点 */ showCheckedStrategy?: typeof SHOW_ALL | typeof SHOW_PARENT | typeof SHOW_CHILD; /** 配置下拉选项是否展示复选框 */ treeCheckable?: boolean; /** treeNodes 数据,如果设置则不需要手动构造 TreeNode 节点(value 在整个树范围内唯一 */ treeData?: TreeData[]; /** checkable 状态下节点选择完全受控(父子节点选中状态不再关联),会使得 labelInValue 强制为 true */ treeCheckStrictly?: boolean; /** 使用简单格式的 treeData,具体设置参考可设置的类型 (此时 treeData 应变为这样的数据结构: [{id:1, pId:0, value:'1', title:"test1",...},...], pId 是父节点的 id) */ treeDataSimpleMode?: boolean | object; /** 默认展开所有树节点 */ treeDefaultExpandAll?: boolean; /** 默认展开的树节点 */ treeDefaultExpandedKeys?: string[]; /** 设置展开的树节点 */ treeExpandedKeys?: string[]; /** 是否展示 TreeNode title 前的图标,没有默认样式,如设置为 true,需要自行定义图标相关样式 */ treeIcon?: boolean; /** 是否展示线条样式 */ treeLine?: boolean | { showLeafIcon: boolean; }; /** (受控)已经加载的节点,需要配合 loadData 使用 */ treeLoadedKeys?: React.Key[]; /** 输入项过滤对应的 treeNode 属性 */ treeNodeFilterProp?: string; /** 作为显示的 prop 设置 */ treeNodeLabelProp?: string; /** 指定当前选中的条目 */ value?: TreeNodeValue; /** 设置 false 时关闭虚拟滚动 */ virtual?: boolean; /** 选中树节点时调用此函数 */ onChange?: (value: TreeNodeValue, label: any, extra: any) => void; /** 展开下拉菜单的回调 */ onDropdownVisibleChange?: (open: boolean) => void; /** 文本框值变化时回调 */ onSearch?: (value: string) => void; /** 被选中时调用 */ onSelect?: (value: TreeNodeValue, node: any, extra: any) => void; /** 展示节点时调用 */ onTreeExpand?: (expandedKeys: string[]) => void; /** wrapper style */ wrapperStyle?: React.CSSProperties; /** wrapper className */ wrapperClassName?: string; /** 回填到选择框样式,当值为'ellipsis'时showCheckedStrategy自动设置为TreeSelect.SHOW_CHILD且不可更改;default即为antd回填样式 */ fillMode?: "default" | "ellipsis"; /** 是否展示已勾选项 仅当fillMode为'ellipsis'时可以设置true */ showSelected?: boolean; /** 展示 全选、反选 按钮 */ showExtraButton?: string[]; /** 回显文本分隔符 仅当fillMode='ellipsis'时生效 */ separator?: string; } export type FRCTreeSelectProps = BaseTreeSelectProps & Omit; export declare const TreeSelect: React.FC; export default TreeSelect;