|
@ -5,6 +5,8 @@ import { TreeSelectProps } from './interface'; |
|
|
import { SelectLocale } from '../select'; |
|
|
import { SelectLocale } from '../select'; |
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
import warning from '../_util/warning'; |
|
|
import warning from '../_util/warning'; |
|
|
|
|
|
import Icon from '../icon'; |
|
|
|
|
|
import { AntTreeNodeProps } from '../tree'; |
|
|
|
|
|
|
|
|
export { TreeNode, TreeSelectProps } from './interface'; |
|
|
export { TreeNode, TreeSelectProps } from './interface'; |
|
|
|
|
|
|
|
@ -44,6 +46,28 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> { |
|
|
this.rcTreeSelect = node; |
|
|
this.rcTreeSelect = node; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderSwitcherIcon = ({ isLeaf, loading }: AntTreeNodeProps) => { |
|
|
|
|
|
const { |
|
|
|
|
|
prefixCls, |
|
|
|
|
|
} = this.props; |
|
|
|
|
|
if (loading) { |
|
|
|
|
|
return ( |
|
|
|
|
|
<Icon |
|
|
|
|
|
type="reload" |
|
|
|
|
|
spin |
|
|
|
|
|
className={`${prefixCls}-switcher-loading-icon`} |
|
|
|
|
|
svgClassName={`${prefixCls}-switcher-loading-icon-svg`} |
|
|
|
|
|
/> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
if (isLeaf) { |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
return ( |
|
|
|
|
|
<Icon type="down" className={`${prefixCls}-switcher-icon`} /> |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
renderTreeSelect = (locale: SelectLocale) => { |
|
|
renderTreeSelect = (locale: SelectLocale) => { |
|
|
const { |
|
|
const { |
|
|
prefixCls, |
|
|
prefixCls, |
|
@ -64,6 +88,15 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> { |
|
|
if (checkable) { |
|
|
if (checkable) { |
|
|
checkable = <span className={`${prefixCls}-tree-checkbox-inner`} />; |
|
|
checkable = <span className={`${prefixCls}-tree-checkbox-inner`} />; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const inputIcon = ( |
|
|
|
|
|
<Icon type="down" className={`${prefixCls}-arrow-icon`} /> |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const removeIcon = ( |
|
|
|
|
|
<Icon type="close" className={`${prefixCls}-remove-icon`} /> |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<RcTreeSelect |
|
|
<RcTreeSelect |
|
|
{...restProps} |
|
|
{...restProps} |
|
@ -74,6 +107,9 @@ export default class TreeSelect extends React.Component<TreeSelectProps, any> { |
|
|
treeCheckable={checkable} |
|
|
treeCheckable={checkable} |
|
|
notFoundContent={notFoundContent || locale.notFoundContent} |
|
|
notFoundContent={notFoundContent || locale.notFoundContent} |
|
|
ref={this.saveTreeSelect} |
|
|
ref={this.saveTreeSelect} |
|
|
|
|
|
switcherIcon={this.renderSwitcherIcon} |
|
|
|
|
|
inputIcon={inputIcon} |
|
|
|
|
|
removeIcon={removeIcon} |
|
|
/> |
|
|
/> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|