@ -19,6 +19,7 @@ export interface FilterMenuProps {
filterDropdownVisible? : boolean ,
onFilterDropdownVisibleChange ? : ( visible : boolean ) = > any ,
fixed? : boolean | string ,
filterIcon? : React.ReactNode ;
} ;
confirmFilter : ( column : Object , selectedKeys : string [ ] ) = > any ;
prefixCls : string ;
@ -168,6 +169,18 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
this . setState ( { keyPathOfSelectedItem } ) ;
}
renderFilterIcon = ( ) = > {
const { column , locale , prefixCls } = this . props ;
const filterIcon = column . filterIcon as any ;
const dropdownSelectedClass = this . props . selectedKeys . length > 0 ? ` ${ prefixCls } -selected ` : '' ;
return filterIcon ? React . cloneElement ( filterIcon as any , {
title : locale.filterTitle ,
className : classNames ( filterIcon . className , {
[ ` ${ prefixCls } -icon ` ] : true ,
} ) ,
} ) : < Icon title = { locale . filterTitle } type = "filter" className = { dropdownSelectedClass } / > ;
}
render() {
const { column , locale , prefixCls , dropdownPrefixCls } = this . props ;
// default multiple selection in filter dropdown
@ -209,9 +222,6 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
< / FilterDropdownMenuWrapper >
) ;
const dropdownSelectedClass = ( this . props . selectedKeys . length > 0 )
? ` ${ prefixCls } -selected ` : '' ;
return (
< Dropdown
trigger = { [ 'click' ] }
@ -219,7 +229,7 @@ export default class FilterMenu extends React.Component<FilterMenuProps, any> {
visible = { this . neverShown ? false : this . state . visible }
onVisibleChange = { this . onVisibleChange }
>
< Icon title = { locale . filterTitle } type = "filter" className = { dropdownSelectedClass } / >
{ this . renderFilterIcon ( ) }
< / Dropdown >
) ;
}