🐛 Fix Table filter submenu checkbox margin

https://user-images.githubusercontent.com/507615/65814464-a5c6c000-e214-11e9-8085-2c6fb1f5c6f2.png
This commit is contained in:
afc163 2019-09-28 17:21:59 +08:00 committed by 偏右
parent d41b5be377
commit e1a4f2891e
2 changed files with 14 additions and 9 deletions

View File

@ -146,7 +146,6 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState<
const { keyPathOfSelectedItem } = this.state;
if (selectedKeys && selectedKeys.indexOf(info.key) >= 0) {
// deselect SubMenu child
console.log('delete keyPathOfSelectedItem[info.key]');
delete keyPathOfSelectedItem[info.key];
} else {
// select SubMenu child
@ -178,17 +177,18 @@ class FilterMenu<T> extends React.Component<FilterMenuProps<T>, FilterMenuState<
}
renderMenus(items: ColumnFilterItem[]): React.ReactElement<any>[] {
const { dropdownPrefixCls, prefixCls } = this.props;
return items.map(item => {
if (item.children && item.children.length > 0) {
const { keyPathOfSelectedItem } = this.state;
const containSelected = Object.keys(keyPathOfSelectedItem).some(
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0,
);
const subMenuCls = containSelected
? `${this.props.dropdownPrefixCls}-submenu-contain-selected`
: '';
const subMenuCls = classNames(`${prefixCls}-dropdown-submenu`, {
[`${dropdownPrefixCls}-submenu-contain-selected`]: containSelected,
});
return (
<SubMenu title={item.text} className={subMenuCls} key={item.value.toString()}>
<SubMenu title={item.text} popupClassName={subMenuCls} key={item.value.toString()}>
{this.renderMenus(item.children)}
</SubMenu>
);

View File

@ -477,10 +477,6 @@
overflow: hidden;
}
.@{ant-prefix}-checkbox-wrapper + span {
padding-left: 8px;
}
> .@{ant-prefix}-dropdown-menu > .@{ant-prefix}-dropdown-menu-item:last-child,
> .@{ant-prefix}-dropdown-menu
> .@{ant-prefix}-dropdown-menu-submenu:last-child
@ -777,6 +773,15 @@
}
}
.@{table-prefix-cls}-filter-dropdown {
&,
&-submenu {
.@{ant-prefix}-checkbox-wrapper + span {
padding-left: 8px;
}
}
}
/**
* Another fix of Firefox:
*/