|
|
@ -3,6 +3,7 @@ import Menu, { SubMenu, Item as MenuItem } from 'rc-menu'; |
|
|
|
import Dropdown from '../dropdown'; |
|
|
|
import Icon from '../icon'; |
|
|
|
import Checkbox from '../checkbox'; |
|
|
|
import Radio from '../radio'; |
|
|
|
|
|
|
|
export default class FilterMenu extends React.Component { |
|
|
|
static defaultProps = { |
|
|
@ -53,9 +54,15 @@ export default class FilterMenu extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
renderMenuItem(item) { |
|
|
|
const { column } = this.props; |
|
|
|
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; |
|
|
|
return ( |
|
|
|
<MenuItem key={item.value}> |
|
|
|
<Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} /> |
|
|
|
{ |
|
|
|
multiple |
|
|
|
? <Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} /> |
|
|
|
: <Radio checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} /> |
|
|
|
} |
|
|
|
<span>{item.text}</span> |
|
|
|
</MenuItem> |
|
|
|
); |
|
|
@ -95,13 +102,11 @@ export default class FilterMenu extends React.Component { |
|
|
|
} |
|
|
|
|
|
|
|
render() { |
|
|
|
let { column, locale } = this.props; |
|
|
|
const { column, locale } = this.props; |
|
|
|
// default multiple selection in filter dropdown |
|
|
|
let multiple = true; |
|
|
|
if ('filterMultiple' in column) { |
|
|
|
multiple = column.filterMultiple; |
|
|
|
} |
|
|
|
let menus = ( |
|
|
|
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true; |
|
|
|
|
|
|
|
const menus = ( |
|
|
|
<div className="ant-table-filter-dropdown"> |
|
|
|
<Menu multiple={multiple} |
|
|
|
onClick={this.handleMenuItemClick} |
|
|
@ -124,10 +129,8 @@ export default class FilterMenu extends React.Component { |
|
|
|
</div> |
|
|
|
); |
|
|
|
|
|
|
|
let dropdownSelectedClass = ''; |
|
|
|
if (this.props.selectedKeys.length > 0) { |
|
|
|
dropdownSelectedClass = 'ant-table-filter-selected'; |
|
|
|
} |
|
|
|
const dropdownSelectedClass = (this.props.selectedKeys.length > 0) |
|
|
|
? 'ant-table-filter-selected' : ''; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Dropdown trigger={['click']} |
|
|
|