Skip to content

Commit

Permalink
fix: can not hide col when multi-header
Browse files Browse the repository at this point in the history
  • Loading branch information
solarjoker committed Dec 31, 2019
1 parent d373824 commit 3a6443e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/table/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,6 @@ export default class Header extends Component {
if (origin && origin.url) {
sc = false
}
Menu.show(e, cbs, key, !!sc, size)
Menu.show(e, cbs, key, !!sc, size, this.props.headerColumns.length === 1)
}
}
8 changes: 4 additions & 4 deletions components/table/menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import prifix from '../prefix'

class HeaderMenu extends Component {
render () {
let {highlighCol, freezeCol, hideCol, index, freeze} = this.props
let {highlighCol, freezeCol, hideCol, index, freeze, canHideCol} = this.props

return (
<div className={prifix('table-header-menu')}>
<p onClick={(e) => highlighCol(index)} >高亮</p>
{freeze && <p onClick={(e) => freezeCol(index)} >冻结</p>}
<p onClick={(e) => hideCol(index)}>隐藏</p>
{canHideCol && <p onClick={(e) => hideCol(index)}>隐藏</p>}
</div>
)
}
Expand All @@ -32,12 +32,12 @@ document.addEventListener('click', () => {
setTimeout(hide, 0)
})
export default {
show (e, cbs, key, freeze, size = 'normal') {
show (e, cbs, key, freeze, size = 'normal', canHideCol) {
div && hide()
div = document.createElement('div')
div.className = 'hi-table-header-menu-' + size
div.style.zIndex = '99999'
ReactDOM.render(<HeaderMenu {...cbs} index={key} freeze={freeze} />, div)
ReactDOM.render(<HeaderMenu {...cbs} canHideCol={canHideCol} index={key} freeze={freeze} />, div)
div.style.position = 'absolute'
div.style.left = e.pageX + 'px'
div.style.top = e.pageY + 'px'
Expand Down

0 comments on commit 3a6443e

Please sign in to comment.