diff --git a/components/style/themes/default.less b/components/style/themes/default.less index f1c67226a1..ac83c5fee7 100644 --- a/components/style/themes/default.less +++ b/components/style/themes/default.less @@ -344,6 +344,7 @@ @table-header-bg: @background-color-light; @table-header-color: @heading-color; @table-header-sort-bg: @background-color-base; +@table-body-sort-bg: rgba(0, 0, 0, .01); @table-row-hover-bg: @primary-1; @table-selected-row-bg: #fafafa; @table-expanded-row-bg: #fbfbfb; diff --git a/components/table/filterDropdown.tsx b/components/table/filterDropdown.tsx index a58960dbae..f7379b937c 100755 --- a/components/table/filterDropdown.tsx +++ b/components/table/filterDropdown.tsx @@ -70,6 +70,10 @@ export default class FilterMenu extends React.Component, F } } + getDropdownVisible() { + return this.neverShown ? false : this.state.visible; + } + setNeverShown = (column: ColumnProps) => { const rootNode = ReactDOM.findDOMNode(this); const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`); @@ -183,22 +187,27 @@ export default class FilterMenu extends React.Component, F if (typeof filterIcon === 'function') { filterIcon = filterIcon(filterd); } - const dropdownSelectedClass = filterd ? `${prefixCls}-selected` : ''; + + const dropdownIconClass = classNames({ + [`${prefixCls}-selected`]: filterd, + [`${prefixCls}-open`]: this.getDropdownVisible(), + }); return filterIcon ? React.cloneElement(filterIcon as any, { title: locale.filterTitle, - className: classNames(`${prefixCls}-icon`, filterIcon.props.className), + className: classNames(`${prefixCls}-icon`, dropdownIconClass, filterIcon.props.className), onClick: stopPropagation, }) : ( ); } + render() { const { column, locale, prefixCls, dropdownPrefixCls, getPopupContainer } = this.props; // default multiple selection in filter dropdown @@ -259,7 +268,7 @@ export default class FilterMenu extends React.Component, F trigger={['click']} placement="bottomRight" overlay={menus} - visible={this.neverShown ? false : this.state.visible} + visible={this.getDropdownVisible()} onVisibleChange={this.onVisibleChange} getPopupContainer={getPopupContainer} forceRender diff --git a/components/table/style/index.less b/components/table/style/index.less index 46338b8f4c..959727f834 100644 --- a/components/table/style/index.less +++ b/components/table/style/index.less @@ -115,6 +115,14 @@ } } + .@{iconfont-css-prefix}-filter, + .@{table-prefix-cls}-filter-icon { + &.@{table-prefix-cls}-filter-open { + color: @text-color-secondary; + background: #ebebeb; + } + } + &:active { .@{table-prefix-cls}-column-sorter-up:not(.on), .@{table-prefix-cls}-column-sorter-down:not(.on) { @@ -245,6 +253,10 @@ background: @table-header-sort-bg; } + &-tbody > tr > td.@{table-prefix-cls}-column-sort { + background: @table-body-sort-bg; + } + &-thead > tr > th, &-tbody > tr > td { padding: @table-padding-vertical @table-padding-horizontal;