Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Resolved table's unexpected rounded corners #1060

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
border-left: @border;
}
}

// ================== Container ==================
&-container-header{
border-start-start-radius: 8px;
border-start-end-radius: 8px;
}
// ================== Cell ==================
&-cell {
background: #f4f4f4;
Expand Down
8 changes: 8 additions & 0 deletions docs/demo/showHeader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: showHeader
nav:
title: Demo
path: /demo
---

<code src="../examples/showHeader.tsx"></code>
39 changes: 39 additions & 0 deletions docs/examples/showHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import Table from 'rc-table';
import '../../assets/index.less';

const columns = [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
},
{
title: 'Age',
dataIndex: 'age',
key: 'age',
},
{
title: 'Address',
dataIndex: 'address',
key: 'address',
},
];

const data = [
{ name: 'John', age: '25', address: '1 A Street' },
{ name: 'Fred', age: '38', address: '2 B Street' },
{ name: 'Anne', age: '47', address: '3 C Street' },
];

const Demo = () => (
<div>
<h2>Table with no header</h2>
<Table columns={columns} data={data} showHeader={false} />
<br />
<h2>Table with header</h2>
<Table columns={columns} data={data} showHeader={true} />
</div>
);

export default Demo;
8 changes: 6 additions & 2 deletions src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,6 @@ function Table<RecordType extends DefaultRecordType>(
</div>
);
}

let fullTable = (
<div
className={classNames(prefixCls, className, {
Expand All @@ -762,7 +761,12 @@ function Table<RecordType extends DefaultRecordType>(
{...dataProps}
>
{title && <Panel className={`${prefixCls}-title`}>{title(mergedData)}</Panel>}
<div ref={scrollBodyContainerRef} className={`${prefixCls}-container`}>
<div
ref={scrollBodyContainerRef}
className={classNames(`${prefixCls}-container`, {
[`${prefixCls}-container-header`]: showHeader !== false,
})}
>
{groupTableNode}
</div>
{footer && <Panel className={`${prefixCls}-footer`}>{footer(mergedData)}</Panel>}
Expand Down
18 changes: 9 additions & 9 deletions tests/__snapshots__/ExpandRow.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -141,7 +141,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -326,7 +326,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -511,7 +511,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -628,7 +628,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -853,7 +853,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -988,7 +988,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1186,7 +1186,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1371,7 +1371,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down
10 changes: 5 additions & 5 deletions tests/__snapshots__/FixedColumn.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LoadedCheerio {
class="rc-table rc-table-rtl rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -826,7 +826,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1645,7 +1645,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1934,7 +1934,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-header rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-header"
Expand Down Expand Up @@ -2807,7 +2807,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-header rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-header"
Expand Down
28 changes: 14 additions & 14 deletions tests/__snapshots__/Table.spec.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -111,7 +111,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -207,7 +207,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-header rc-table-fixed-column rc-table-scroll-horizontal rc-table-has-fix-left rc-table-has-fix-right"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-header"
Expand Down Expand Up @@ -370,7 +370,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-header rc-table-scroll-horizontal"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-header"
Expand Down Expand Up @@ -449,7 +449,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -559,7 +559,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -652,7 +652,7 @@ LoadedCheerio {
class="test-prefix test-class-name test-prefix-rtl"
>
<div
class="test-prefix-container"
class="test-prefix-container test-prefix-container-header"
>
<div
class="test-prefix-content"
Expand Down Expand Up @@ -738,7 +738,7 @@ LoadedCheerio {
class="test-prefix test-class-name"
>
<div
class="test-prefix-container"
class="test-prefix-container test-prefix-container-header"
>
<div
class="test-prefix-content"
Expand Down Expand Up @@ -824,7 +824,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -922,7 +922,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1008,7 +1008,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1087,7 +1087,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down Expand Up @@ -1185,7 +1185,7 @@ LoadedCheerio {
class="rc-table rc-table-fixed-header"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-header"
Expand Down Expand Up @@ -1258,7 +1258,7 @@ LoadedCheerio {
class="rc-table"
>
<div
class="rc-table-container"
class="rc-table-container rc-table-container-header"
>
<div
class="rc-table-content"
Expand Down
Loading