forked from p96170835/amis
表格所有列label都为空时,不展示表头;isHead
This commit is contained in:
parent
674565660d
commit
19134eac64
|
@ -11,3 +11,4 @@
|
|||
- `popOver` 是否支持点击查看详情。当内容较长时,可以开启此配置。
|
||||
- `quickEdit` 配置后在内容区增加一个编辑按钮,点击后弹出一个编辑框。
|
||||
- `toggled` 控制默认是展示还是不展示,只有 Table 的 `columnsTogglable` 开启了才有效。
|
||||
- `isHead` 标识当前列是否以表头的样式展示。
|
||||
|
|
|
@ -206,7 +206,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
> thead > tr {
|
||||
> thead > tr,
|
||||
> tbody > tr {
|
||||
background-color: $Table-thead-bg;
|
||||
|
||||
> th {
|
||||
|
|
|
@ -1890,12 +1890,14 @@ export default class Table extends React.Component<TableProps, object> {
|
|||
</tr>
|
||||
) : null}
|
||||
<tr>
|
||||
{store.filteredColumns.map(column =>
|
||||
{store.filteredColumns.some(column => !!column.label)
|
||||
? store.filteredColumns.map(column =>
|
||||
this.renderHeadCell(column, {
|
||||
'data-index': column.index,
|
||||
'key': column.index
|
||||
})
|
||||
)}
|
||||
)
|
||||
: null}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -2618,6 +2620,7 @@ export class TableCell extends React.Component<RendererProps> {
|
|||
remark,
|
||||
prefix,
|
||||
affix,
|
||||
isHead,
|
||||
...rest
|
||||
} = this.props;
|
||||
|
||||
|
@ -2659,6 +2662,10 @@ export class TableCell extends React.Component<RendererProps> {
|
|||
return body as JSX.Element;
|
||||
}
|
||||
|
||||
if (isHead) {
|
||||
Component = 'th';
|
||||
}
|
||||
|
||||
return (
|
||||
<Component
|
||||
rowSpan={rowSpan > 1 ? rowSpan : undefined}
|
||||
|
|
Loading…
Reference in New Issue