Skip to content

Commit 1da0ebf

Browse files
committed
fix: Table body missing className
1 parent 045deb0 commit 1da0ebf

File tree

4 files changed

+55
-19
lines changed

4 files changed

+55
-19
lines changed

src/Header/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ function Header<RecordType>({
9494
flattenColumns,
9595
onHeaderRow,
9696
}: HeaderProps<RecordType>): React.ReactElement {
97-
const { getComponent } = React.useContext(TableContext);
97+
const { prefixCls, getComponent } = React.useContext(TableContext);
9898
const rows: CellType<RecordType>[][] = React.useMemo(() => parseHeaderRows(columns), [columns]);
9999

100100
const WrapperComponent = getComponent(['header', 'wrapper'], 'thead');
101101
const trComponent = getComponent(['header', 'row'], 'tr');
102102
const thComponent = getComponent(['header', 'cell'], 'th');
103103

104104
return (
105-
<WrapperComponent>
105+
<WrapperComponent className={`${prefixCls}-thead`}>
106106
{rows.map((row, rowIndex) => {
107107
const rowNode = (
108108
<HeaderRow

tests/__snapshots__/ExpandRow.spec.js.snap

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ exports[`Table.Expand childrenColumnName 1`] = `
1717
<col />
1818
<col />
1919
</colgroup>
20-
<thead>
20+
<thead
21+
class="rc-table-thead"
22+
>
2123
<tr>
2224
<th
2325
class="rc-table-cell"
@@ -126,7 +128,9 @@ exports[`Table.Expand renders fixed column correctly work 1`] = `
126128
<col />
127129
<col />
128130
</colgroup>
129-
<thead>
131+
<thead
132+
class="rc-table-thead"
133+
>
130134
<tr>
131135
<th
132136
class="rc-table-cell rc-table-row-expand-icon-cell rc-table-cell-fix-left"
@@ -290,7 +294,9 @@ exports[`Table.Expand renders tree row correctly 1`] = `
290294
<col />
291295
<col />
292296
</colgroup>
293-
<thead>
297+
<thead
298+
class="rc-table-thead"
299+
>
294300
<tr>
295301
<th
296302
class="rc-table-cell"
@@ -394,7 +400,9 @@ exports[`Table.Expand renders tree row correctly with different children 1`] = `
394400
<col />
395401
<col />
396402
</colgroup>
397-
<thead>
403+
<thead
404+
class="rc-table-thead"
405+
>
398406
<tr>
399407
<th
400408
class="rc-table-cell"

tests/__snapshots__/FixedColumn.spec.js.snap

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ exports[`Table.FixedColumn fixed column renders correctly RTL 1`] = `
3333
style="width: 100px; min-width: 100px;"
3434
/>
3535
</colgroup>
36-
<thead>
36+
<thead
37+
class="rc-table-thead"
38+
>
3739
<tr>
3840
<th
3941
class="rc-table-cell rc-table-cell-fix-right"
@@ -612,7 +614,9 @@ exports[`Table.FixedColumn renders correctly scrollX - with data 1`] = `
612614
style="width: 100px; min-width: 100px;"
613615
/>
614616
</colgroup>
615-
<thead>
617+
<thead
618+
class="rc-table-thead"
619+
>
616620
<tr>
617621
<th
618622
class="rc-table-cell rc-table-cell-fix-left"
@@ -1233,7 +1237,9 @@ exports[`Table.FixedColumn renders correctly scrollX - without data 1`] = `
12331237
style="width: 100px; min-width: 100px;"
12341238
/>
12351239
</colgroup>
1236-
<thead>
1240+
<thead
1241+
class="rc-table-thead"
1242+
>
12371243
<tr>
12381244
<th
12391245
class="rc-table-cell rc-table-cell-fix-left"
@@ -1400,7 +1406,9 @@ exports[`Table.FixedColumn renders correctly scrollXY - with data 1`] = `
14001406
style="width: 15px; min-width: 15px;"
14011407
/>
14021408
</colgroup>
1403-
<thead>
1409+
<thead
1410+
class="rc-table-thead"
1411+
>
14041412
<tr>
14051413
<th
14061414
class="rc-table-cell rc-table-cell-fix-left"
@@ -2054,7 +2062,9 @@ exports[`Table.FixedColumn renders correctly scrollXY - without data 1`] = `
20542062
style="width: 100px; min-width: 100px;"
20552063
/>
20562064
</colgroup>
2057-
<thead>
2065+
<thead
2066+
class="rc-table-thead"
2067+
>
20582068
<tr>
20592069
<th
20602070
class="rc-table-cell rc-table-cell-fix-left"

tests/__snapshots__/Table.spec.js.snap

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ exports[`Table.Basic custom components renders correctly 1`] = `
1818
<col />
1919
</colgroup>
2020
<thead
21+
class="rc-table-thead"
2122
name="my-header-wrapper"
2223
>
2324
<tr
@@ -89,6 +90,7 @@ exports[`Table.Basic custom components renders fixed column and header correctly
8990
/>
9091
</colgroup>
9192
<thead
93+
class="rc-table-thead"
9294
name="my-header-wrapper"
9395
>
9496
<tr
@@ -213,7 +215,9 @@ exports[`Table.Basic custom components scroll content with scroll 1`] = `
213215
style="width: 15px; min-width: 15px;"
214216
/>
215217
</colgroup>
216-
<thead>
218+
<thead
219+
class="rc-table-thead"
220+
>
217221
<tr>
218222
<th
219223
class="rc-table-cell"
@@ -253,7 +257,9 @@ exports[`Table.Basic internal api transformColumns 1`] = `
253257
<col />
254258
<col />
255259
</colgroup>
256-
<thead>
260+
<thead
261+
class="rc-table-thead"
262+
>
257263
<tr>
258264
<th
259265
class="rc-table-cell"
@@ -331,7 +337,9 @@ exports[`Table.Basic renders colSpan correctly 1`] = `
331337
<col />
332338
<col />
333339
</colgroup>
334-
<thead>
340+
<thead
341+
class="rc-table-thead"
342+
>
335343
<tr>
336344
<th
337345
class="rc-table-cell"
@@ -393,7 +401,9 @@ exports[`Table.Basic renders correctly RTL 1`] = `
393401
<colgroup>
394402
<col />
395403
</colgroup>
396-
<thead>
404+
<thead
405+
class="test-prefix-thead"
406+
>
397407
<tr>
398408
<th
399409
class="test-prefix-cell"
@@ -448,7 +458,9 @@ exports[`Table.Basic renders correctly basic 1`] = `
448458
<colgroup>
449459
<col />
450460
</colgroup>
451-
<thead>
461+
<thead
462+
class="test-prefix-thead"
463+
>
452464
<tr>
453465
<th
454466
class="test-prefix-cell"
@@ -503,7 +515,9 @@ exports[`Table.Basic renders correctly no columns 1`] = `
503515
<colgroup>
504516
<col />
505517
</colgroup>
506-
<thead>
518+
<thead
519+
class="rc-table-thead"
520+
>
507521
<tr>
508522
<th
509523
class="rc-table-cell"
@@ -553,7 +567,9 @@ exports[`Table.Basic renders rowSpan correctly 1`] = `
553567
<col />
554568
<col />
555569
</colgroup>
556-
<thead>
570+
<thead
571+
class="rc-table-thead"
572+
>
557573
<tr>
558574
<th
559575
class="rc-table-cell"
@@ -619,7 +635,9 @@ exports[`Table.Basic syntactic sugar 1`] = `
619635
<colgroup>
620636
<col />
621637
</colgroup>
622-
<thead>
638+
<thead
639+
class="rc-table-thead"
640+
>
623641
<tr>
624642
<th
625643
class="rc-table-cell"

0 commit comments

Comments
 (0)