@@ -63,91 +63,64 @@ const getStyle = (
63
63
const alternateBackground = genLinerGradient ( rowStyle . alternateBackground ) ;
64
64
65
65
return css `
66
- border-color : ${ style . border } ;
67
- border-radius : ${ style . radius } ;
68
-
69
- & > div > div > div > .ant-table > .ant-table-container > .ant-table-content > table {
70
- > thead > tr > th ,
71
- > tbody > tr > td {
72
- border-color : ${ style . border } ;
73
- }
74
-
75
- > .ant-table-thead > tr > th ::before {
76
- background-color : ${ style . border } ;
66
+ .ant-table-body {
67
+ background : white;
68
+ }
69
+ .ant-table-tbody {
70
+ > tr : nth-of-type (2n + 1 ) {
71
+ & ,
72
+ > td {
73
+ background : ${ genLinerGradient ( rowStyle . background ) } ;
74
+ }
77
75
}
78
76
79
- > .ant-table-thead {
80
- > tr > th {
81
- background-color : ${ style . headerBackground } ;
82
- border-color : ${ style . border } ;
83
- color : ${ style . headerText } ;
84
-
85
- & .ant-table-column-has-sorters : hover {
86
- background-color : ${ darkenColor ( style . headerBackground , 0.05 ) } ;
87
- }
88
-
89
- > .ant-table-column-sorters > .ant-table-column-sorter {
90
- color : ${ style . headerText === defaultTheme . textDark ? "#bfbfbf" : style . headerText } ;
91
- }
77
+ > tr : nth-of-type (2n ) {
78
+ & ,
79
+ > td {
80
+ background : ${ alternateBackground } ;
92
81
}
93
82
}
94
83
95
- > .ant-table-tbody {
96
- > tr : nth-of-type (2n + 1 ) {
97
- & ,
98
- > td {
99
- background : ${ genLinerGradient ( rowStyle . background ) } ;
100
- }
84
+ // selected row
85
+ > tr : nth-of-type (2n + 1 ).ant-table-row-selected {
86
+ > td {
87
+ background : ${ selectedRowBackground } , ${ rowStyle . background } !important ;
101
88
}
102
89
103
- > tr : nth-of-type (2n ) {
104
- & ,
105
- > td {
106
- background : ${ alternateBackground } ;
107
- }
90
+ > td .ant-table-cell-row-hover ,
91
+ & : hover > td {
92
+ background : ${ hoverRowBackground } , ${ selectedRowBackground } , ${ rowStyle . background } !important ;
108
93
}
94
+ }
109
95
110
- // selected row
111
- > tr : nth-of-type (2n + 1 ).ant-table-row-selected {
112
- > td {
113
- background : ${ selectedRowBackground } , ${ rowStyle . background } !important ;
114
- }
115
-
116
- > td .ant-table-cell-row-hover ,
117
- & : hover > td {
118
- background : ${ hoverRowBackground } , ${ selectedRowBackground } , ${ rowStyle . background } !important ;
119
- }
96
+ > tr : nth-of-type (2n ).ant-table-row-selected {
97
+ > td {
98
+ background : ${ selectedRowBackground } , ${ alternateBackground } !important ;
120
99
}
121
100
122
- > tr : nth-of-type (2n ).ant-table-row-selected {
123
- > td {
124
- background : ${ selectedRowBackground } , ${ alternateBackground } !important ;
125
- }
126
-
127
- > td .ant-table-cell-row-hover ,
128
- & : hover > td {
129
- background : ${ hoverRowBackground } , ${ selectedRowBackground } , ${ alternateBackground } !important ;
130
- }
101
+ > td .ant-table-cell-row-hover ,
102
+ & : hover > td {
103
+ background : ${ hoverRowBackground } , ${ selectedRowBackground } , ${ alternateBackground } !important ;
131
104
}
105
+ }
132
106
133
- // hover row
134
- > tr : nth-of-type (2n + 1 ) > td .ant-table-cell-row-hover {
135
- & ,
136
- > div : nth-of-type (2 ) {
137
- background : ${ hoverRowBackground } , ${ rowStyle . background } !important ;
138
- }
107
+ // hover row
108
+ > tr : nth-of-type (2n + 1 ) > td .ant-table-cell-row-hover {
109
+ & ,
110
+ > div : nth-of-type (2 ) {
111
+ background : ${ hoverRowBackground } , ${ rowStyle . background } !important ;
139
112
}
113
+ }
140
114
141
- > tr : nth-of-type (2n ) > td .ant-table-cell-row-hover {
142
- & ,
143
- > div : nth-of-type (2 ) {
144
- background : ${ hoverRowBackground } , ${ alternateBackground } !important ;
145
- }
115
+ > tr : nth-of-type (2n ) > td .ant-table-cell-row-hover {
116
+ & ,
117
+ > div : nth-of-type (2 ) {
118
+ background : ${ hoverRowBackground } , ${ alternateBackground } !important ;
146
119
}
120
+ }
147
121
148
- > tr .ant-table-expanded-row > td {
149
- background : ${ background } ;
150
- }
122
+ > tr .ant-table-expanded-row > td {
123
+ background : ${ background } ;
151
124
}
152
125
}
153
126
` ;
@@ -157,11 +130,13 @@ const TableWrapper = styled.div<{
157
130
$style : TableStyleType ;
158
131
$rowStyle : TableRowStyleType ;
159
132
toolbarPosition : "above" | "below" | "close" ;
133
+ fixedHeader : boolean ;
160
134
} > `
161
135
max-height: 100%;
162
- overflow-y: auto;
136
+ overflow-y: ${ ( props ) => ( props . fixedHeader ? "hidden" : " auto" ) } ;
163
137
background: white;
164
- border: 1px solid #d7d9e0;
138
+ border: ${ ( props ) => `1px solid ${ props . $style . border } ` } ;
139
+ border-radius: ${ ( props ) => props . $style . radius } ;
165
140
166
141
.ant-table-wrapper {
167
142
border-top: ${ ( props ) => ( props . toolbarPosition === "above" ? "1px solid" : "unset" ) } ;
@@ -193,64 +168,91 @@ const TableWrapper = styled.div<{
193
168
border-top: none !important;
194
169
border-inline-start: none !important;
195
170
196
- .ant-table-content {
197
- // A table expand row contains table
198
- .ant-table-tbody .ant-table-wrapper:only-child .ant-table {
199
- margin: 0;
200
- }
201
-
202
- table {
203
- border-top: unset;
171
+ // A table expand row contains table
172
+ .ant-table-tbody .ant-table-wrapper:only-child .ant-table {
173
+ margin: 0;
174
+ }
204
175
205
- td {
206
- padding: 0px 0px;
207
- }
176
+ table {
177
+ border-top: unset;
178
+
179
+ > .ant-table-thead {
180
+ > tr > th {
181
+ background-color: ${ ( props ) => props . $style . headerBackground } ;
182
+ border-color: ${ ( props ) => props . $style . border } ;
183
+ color: ${ ( props ) => props . $style . headerText } ;
184
+ border-inline-end: ${ ( props ) => `1px solid ${ props . $style . border } ` } !important;
185
+
186
+ &:last-child {
187
+ border-inline-end: none !important;
188
+ }
189
+ &.ant-table-column-has-sorters:hover {
190
+ background-color: ${ ( props ) => darkenColor ( props . $style . headerBackground , 0.05 ) } ;
191
+ }
192
+
193
+ > .ant-table-column-sorters > .ant-table-column-sorter {
194
+ color: ${ ( props ) => props . $style . headerText === defaultTheme . textDark ? "#bfbfbf" : props . $style . headerText } ;
195
+ }
208
196
209
- thead > tr:first-child {
210
- th:last-child {
211
- border-right: unset;
197
+ &::before {
198
+ background-color: ${ ( props ) => props . $style . border } ;
212
199
}
213
200
}
201
+ }
214
202
215
- tbody > tr > td:last-child {
203
+ > thead > tr > th,
204
+ > tbody > tr > td {
205
+ border-color: ${ ( props ) => props . $style . border } ;
206
+ }
207
+
208
+ td {
209
+ padding: 0px 0px;
210
+ }
211
+
212
+ thead > tr:first-child {
213
+ th:last-child {
216
214
border-right: unset;
217
215
}
216
+ }
218
217
219
- .ant-empty-img-simple-g {
220
- fill: #fff ;
221
- }
218
+ tbody > tr > td:last-child {
219
+ border-right: unset ;
220
+ }
222
221
223
- > thead > tr:first-child {
224
- th:first-child {
225
- border-top-left-radius: 0px;
226
- }
222
+ .ant-empty-img-simple-g {
223
+ fill: #fff;
224
+ }
227
225
228
- th:last -child {
229
- border-top-right-radius: 0px;
230
- }
226
+ > thead > tr:first -child {
227
+ th:first-child {
228
+ border-top-left-radius: 0px;
231
229
}
232
230
233
- // hide the bottom border of the last row
234
- ${ ( props ) =>
235
- props . toolbarPosition !== "below" &&
236
- `
237
- tbody > tr:last-child > td {
238
- border-bottom: unset;
239
- }
240
- ` }
231
+ th:last-child {
232
+ border-top-right-radius: 0px;
233
+ }
241
234
}
242
235
243
- .ant-table-expanded-row-fixed:after {
244
- border-right: unset !important;
245
- }
236
+ // hide the bottom border of the last row
237
+ ${ ( props ) =>
238
+ props . toolbarPosition !== "below" &&
239
+ `
240
+ tbody > tr:last-child > td {
241
+ border-bottom: unset;
242
+ }
243
+ ` }
244
+ }
245
+
246
+ .ant-table-expanded-row-fixed:after {
247
+ border-right: unset !important;
246
248
}
247
249
}
248
250
}
249
-
251
+
250
252
${ ( props ) =>
251
253
props . $style && getStyle ( props . $style , props . $rowStyle ) }
252
254
` ;
253
-
255
+
254
256
const TableTh = styled . th < { width ?: number } > `
255
257
overflow: hidden;
256
258
@@ -272,6 +274,11 @@ const TableTd = styled.td<{
272
274
.ant-table-row-indent {
273
275
display: ${ ( props ) => ( props . $isEditing ? "none" : "initial" ) } ;
274
276
}
277
+ &.ant-table-row-expand-icon-cell {
278
+ background: ${ ( props ) => props . background } ;
279
+ border-color: ${ ( props ) => props . $style . border } ;
280
+ }
281
+
275
282
background: ${ ( props ) => props . background } !important;
276
283
border-color: ${ ( props ) => props . $style . border } !important;
277
284
border-width: ${ ( props ) => props . $style . borderWidth } !important;
@@ -681,6 +688,7 @@ export function TableCompView(props: {
681
688
$style = { style }
682
689
$rowStyle = { rowStyle }
683
690
toolbarPosition = { toolbar . position }
691
+ fixedHeader = { compChildren . fixedHeader . getView ( ) }
684
692
>
685
693
{ toolbar . position === "above" && toolbarView }
686
694
< ResizeableTable < RecordType >
0 commit comments