Skip to content

Commit

Permalink
fix(Table): 修复Empty 在表格中未沾满tbody问题 #768 (#770)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuilanxin committed Apr 15, 2022
1 parent 3b6b458 commit e4716ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/react-table/src/index.tsx
Expand Up @@ -288,7 +288,6 @@ export default function Table<T extends { [key: string]: V }, V>(props: TablePro
}, [scroll]);
const cls = [prefixCls, className, bordered ? `${prefixCls}-bordered` : null].filter(Boolean).join(' ').trim();
const { header, render, ellipsis } = getLevelItems(self.selfColumns);

return (
<React.Fragment>
<div className={cls} {...other} style={{ ...other.style, ...style.div }}>
Expand Down Expand Up @@ -324,7 +323,7 @@ export default function Table<T extends { [key: string]: V }, V>(props: TablePro
{data && data.length === 0 && empty && (
<tbody>
<tr>
<td colSpan={columns.length} style={{ position: 'relative', left: 0 }}>
<td colSpan={self.keys.length} style={{ position: 'relative', left: 0 }}>
{empty}
</td>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-table/src/util.ts
Expand Up @@ -124,6 +124,8 @@ export function getAllColumnsKeys<T>(data: TableColumns<T>[], keys: TableColumns
keys = keys.concat(getAllColumnsKeys(data[i].children || []));
} else if (data[i].key) {
keys.push(data[i]);
} else {
keys.push({ ...data[i], key: i.toString() });
}
}
return keys;
Expand Down

0 comments on commit e4716ec

Please sign in to comment.