Skip to content

Commit 61e4f19

Browse files
committed
fix(Table): fix table stripe style error
fix: Tencent#2669
1 parent 1c1ce39 commit 61e4f19

File tree

10 files changed

+3437
-3414
lines changed

10 files changed

+3437
-3414
lines changed

src/table/TBody.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default function TBody(props: TableBodyProps) {
137137
'rowHeight',
138138
'scrollType',
139139
];
140+
140141
data?.forEach((row, rowIndex) => {
141142
const trProps = {
142143
...pick(props, TABLE_PROPS),
@@ -158,7 +159,12 @@ export default function TBody(props: TableBodyProps) {
158159
}
159160

160161
const trNode = (
161-
<TR key={get(row, props.rowKey || 'id') || rowIndex} {...trProps} onRowMounted={props.handleRowMounted}></TR>
162+
<TR
163+
key={get(row, props.rowKey || 'id') || rowIndex}
164+
{...trProps}
165+
onRowMounted={props.handleRowMounted}
166+
rowClassName={[trProps.rowClassName, allTableClasses.tableBaseClass.row]}
167+
></TR>
162168
);
163169
trNodeList.push(trNode);
164170

src/table/__tests__/__snapshots__/pagination.test.tsx.snap

+20-20
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`BaseTable Pagination > locale data pagination controlled > both pagination.pageSize and pagination.current changed 1`] = `
44
NodeList [
55
<tr
6-
class=""
6+
class="t-table__row-even t-table__row"
77
>
88
<td
99
class="table-test-column-index"
@@ -22,7 +22,7 @@ NodeList [
2222
</td>
2323
</tr>,
2424
<tr
25-
class=""
25+
class="t-table__row-odd t-table__row"
2626
>
2727
<td
2828
class="table-test-column-index"
@@ -41,7 +41,7 @@ NodeList [
4141
</td>
4242
</tr>,
4343
<tr
44-
class=""
44+
class="t-table__row-even t-table__row"
4545
>
4646
<td
4747
class="table-test-column-index"
@@ -60,7 +60,7 @@ NodeList [
6060
</td>
6161
</tr>,
6262
<tr
63-
class=""
63+
class="t-table__row-odd t-table__row"
6464
>
6565
<td
6666
class="table-test-column-index"
@@ -77,7 +77,7 @@ NodeList [
7777
/>
7878
</tr>,
7979
<tr
80-
class=""
80+
class="t-table__row-even t-table__row"
8181
>
8282
<td
8383
class="table-test-column-index"
@@ -101,7 +101,7 @@ NodeList [
101101
exports[`BaseTable Pagination > locale data pagination controlled > pagination.current changed 1`] = `
102102
NodeList [
103103
<tr
104-
class=""
104+
class="t-table__row-even t-table__row"
105105
>
106106
<td
107107
class="table-test-column-index"
@@ -120,7 +120,7 @@ NodeList [
120120
</td>
121121
</tr>,
122122
<tr
123-
class=""
123+
class="t-table__row-odd t-table__row"
124124
>
125125
<td
126126
class="table-test-column-index"
@@ -139,7 +139,7 @@ NodeList [
139139
</td>
140140
</tr>,
141141
<tr
142-
class=""
142+
class="t-table__row-even t-table__row"
143143
>
144144
<td
145145
class="table-test-column-index"
@@ -158,7 +158,7 @@ NodeList [
158158
</td>
159159
</tr>,
160160
<tr
161-
class=""
161+
class="t-table__row-odd t-table__row"
162162
>
163163
<td
164164
class="table-test-column-index"
@@ -175,7 +175,7 @@ NodeList [
175175
/>
176176
</tr>,
177177
<tr
178-
class=""
178+
class="t-table__row-even t-table__row"
179179
>
180180
<td
181181
class="table-test-column-index"
@@ -258,7 +258,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
258258
class="t-table__body"
259259
>
260260
<tr
261-
class=""
261+
class="t-table__row-even t-table__row"
262262
>
263263
<td
264264
class="table-test-column-index"
@@ -277,7 +277,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
277277
</td>
278278
</tr>
279279
<tr
280-
class=""
280+
class="t-table__row-odd t-table__row"
281281
>
282282
<td
283283
class="table-test-column-index"
@@ -296,7 +296,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
296296
</td>
297297
</tr>
298298
<tr
299-
class=""
299+
class="t-table__row-even t-table__row"
300300
>
301301
<td
302302
class="table-test-column-index"
@@ -313,7 +313,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
313313
/>
314314
</tr>
315315
<tr
316-
class=""
316+
class="t-table__row-odd t-table__row"
317317
>
318318
<td
319319
class="table-test-column-index"
@@ -332,7 +332,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
332332
</td>
333333
</tr>
334334
<tr
335-
class=""
335+
class="t-table__row-even t-table__row"
336336
>
337337
<td
338338
class="table-test-column-index"
@@ -535,7 +535,7 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
535535
exports[`BaseTable Pagination > locale data pagination controlled > pagination.pageSize changed 1`] = `
536536
NodeList [
537537
<tr
538-
class=""
538+
class="t-table__row-even t-table__row"
539539
>
540540
<td
541541
class="table-test-column-index"
@@ -554,7 +554,7 @@ NodeList [
554554
</td>
555555
</tr>,
556556
<tr
557-
class=""
557+
class="t-table__row-odd t-table__row"
558558
>
559559
<td
560560
class="table-test-column-index"
@@ -573,7 +573,7 @@ NodeList [
573573
</td>
574574
</tr>,
575575
<tr
576-
class=""
576+
class="t-table__row-even t-table__row"
577577
>
578578
<td
579579
class="table-test-column-index"
@@ -592,7 +592,7 @@ NodeList [
592592
</td>
593593
</tr>,
594594
<tr
595-
class=""
595+
class="t-table__row-odd t-table__row"
596596
>
597597
<td
598598
class="table-test-column-index"
@@ -609,7 +609,7 @@ NodeList [
609609
/>
610610
</tr>,
611611
<tr
612-
class=""
612+
class="t-table__row-even t-table__row"
613613
>
614614
<td
615615
class="table-test-column-index"

0 commit comments

Comments
 (0)