Skip to content

Commit

Permalink
Fix icon style problem with Table Tree (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo authored Mar 4, 2019
1 parent 3f68be9 commit 13bd8d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/Cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,21 @@ class Cell extends React.PureComponent<Props> {
};
renderExpandIcon() {
const { hasChildren, firstColumn, rowData, renderTreeToggle } = this.props;
const expandButton = (
<i
role="button"
tabIndex={-1}
className={this.addPrefix('expand-icon')}
onClick={event => {
event.stopPropagation();
this.handleExpandClick(event);
}}
/>
);
const expandButton = <i className={this.addPrefix('expand-icon')} />;

/**
* 如果用子节点,同时是第一列,则创建一个 icon 用于展开节点
*/
if (hasChildren && firstColumn) {
return renderTreeToggle ? (
return (
<span
role="button"
tabIndex={-1}
className={this.addPrefix('expand-wrapper')}
onClick={this.handleExpandClick}
>
{renderTreeToggle(expandButton, rowData)}
{renderTreeToggle ? renderTreeToggle(expandButton, rowData) : expandButton}
</span>
) : (
expandButton
);
}

Expand Down
6 changes: 6 additions & 0 deletions src/less/treetable.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@
content: ' + ';
}
}

&-table-cell-expand-wrapper {
margin-right: 10px;
display: inline-block;
cursor: pointer;
}

0 comments on commit 13bd8d1

Please sign in to comment.