File tree Expand file tree Collapse file tree 3 files changed +17
-12
lines changed
superset-frontend/plugins/plugin-chart-table/src Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 1616 * specific language governing permissions and limitations
1717 * under the License.
1818 */
19+
1920import React , {
2021 useCallback ,
2122 useRef ,
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ const fixedTableLayout: CSSProperties = { tableLayout: 'fixed' };
110110/**
111111 * An HOC for generating sticky header and fixed-height scrollable area
112112 */
113+
113114function StickyWrap ( {
114115 sticky = { } ,
115116 width : maxWidth ,
@@ -215,7 +216,8 @@ function StickyWrap({
215216 let sizerTable : ReactElement | undefined ;
216217 let headerTable : ReactElement | undefined ;
217218 let footerTable : ReactElement | undefined ;
218- let bodyTable : ReactElement | undefined ;
219+ let fullTable : ReactElement | undefined ;
220+
219221 if ( needSizer ) {
220222 const theadWithRef = React . cloneElement ( thead , { ref : theadRef } ) ;
221223 const tfootWithRef = tfoot && React . cloneElement ( tfoot , { ref : tfootRef } ) ;
@@ -253,6 +255,7 @@ function StickyWrap({
253255 style = { {
254256 overflow : 'hidden' ,
255257 } }
258+ aria-hidden = "true"
256259 >
257260 { React . cloneElement (
258261 table ,
@@ -290,20 +293,18 @@ function StickyWrap({
290293 scrollFooterRef . current . scrollLeft = e . currentTarget . scrollLeft ;
291294 }
292295 } ;
293- bodyTable = (
296+
297+ fullTable = (
294298 < div
295- key = "body "
299+ key = "full-table "
296300 ref = { scrollBodyRef }
297- style = { {
298- height : bodyHeight ,
299- overflow : 'auto' ,
300- } }
301301 onScroll = { sticky . hasHorizontalScroll ? onScroll : undefined }
302302 >
303303 { React . cloneElement (
304304 table ,
305305 mergeStyleProp ( table , fixedTableLayout ) ,
306306 colgroup ,
307+ thead ,
307308 tbody ,
308309 ) }
309310 </ div >
@@ -315,11 +316,11 @@ function StickyWrap({
315316 style = { {
316317 width : maxWidth ,
317318 height : sticky . realHeight || maxHeight ,
318- overflow : 'hidden' ,
319+ overflow : 'auto' ,
320+ padding : '0' ,
319321 } }
320322 >
321- { headerTable }
322- { bodyTable }
323+ { fullTable }
323324 { footerTable }
324325 { sizerTable }
325326 </ div >
Original file line number Diff line number Diff line change @@ -32,10 +32,13 @@ export default styled.div`
3232 td {
3333 min-width: 4.3em;
3434 }
35-
3635 thead > tr > th {
36+ position: sticky;
37+ top: -1px;
3738 padding-right: 0;
38- position: relative;
39+ z-index: 100;
40+ border-bottom: ${ theme . gridUnit / 2 } px solid
41+ ${ theme . colors . grayscale . light2 } ;
3942 background: ${ theme . colors . grayscale . light5 } ;
4043 text-align: left;
4144 }
You can’t perform that action at this time.
0 commit comments