From d375070da58e0bcf919c379b769bea1b8c8e44ae Mon Sep 17 00:00:00 2001 From: HeskeyBaozi Date: Fri, 24 Aug 2018 14:08:06 +0800 Subject: [PATCH] waiting for upgrade rc-tree-select --- components/tree-select/index.tsx | 36 ++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 91a994efc1..ccbdbbdfc3 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -5,6 +5,8 @@ import { TreeSelectProps } from './interface'; import { SelectLocale } from '../select'; import LocaleReceiver from '../locale-provider/LocaleReceiver'; import warning from '../_util/warning'; +import Icon from '../icon'; +import { AntTreeNodeProps } from '../tree'; export { TreeNode, TreeSelectProps } from './interface'; @@ -44,6 +46,28 @@ export default class TreeSelect extends React.Component { this.rcTreeSelect = node; } + renderSwitcherIcon = ({ isLeaf, loading }: AntTreeNodeProps) => { + const { + prefixCls, + } = this.props; + if (loading) { + return ( + + ); + } + if (isLeaf) { + return null; + } + return ( + + ); + } + renderTreeSelect = (locale: SelectLocale) => { const { prefixCls, @@ -64,6 +88,15 @@ export default class TreeSelect extends React.Component { if (checkable) { checkable = ; } + + const inputIcon = ( + + ); + + const removeIcon = ( + + ); + return ( { treeCheckable={checkable} notFoundContent={notFoundContent || locale.notFoundContent} ref={this.saveTreeSelect} + switcherIcon={this.renderSwitcherIcon} + inputIcon={inputIcon} + removeIcon={removeIcon} /> ); } diff --git a/package.json b/package.json index b1e6bb5178..a7e0d8bc24 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "rc-time-picker": "~3.4.0", "rc-tooltip": "~3.7.0", "rc-tree": "~1.14.3", - "rc-tree-select": "~2.1.0", + "rc-tree-select": "~2.1.1", "rc-trigger": "^2.5.4", "rc-upload": "~2.5.0", "rc-util": "^4.0.4",