1
1
import React from 'react'
2
2
import ContentLoader from 'react-content-loader' ;
3
3
4
- import TableHeaderCell from './TableHeaderCell'
5
- import TableCell from './TableCell'
6
4
import ObjectUtilities from '../utilities/ObjectUtilities'
7
- import TableData , { MeasureInfo , RowRange , RowSlice } from './TableData'
8
5
import SessionController , { SessionControllerEventListener } from '../controllers/SessionController'
6
+ import TableCell from './TableCell'
7
+ import TableData , { MeasureInfo , RowRange , RowSlice } from './TableData'
8
+ import TableHeaderCell from './TableHeaderCell'
9
+
9
10
import { TablePage } from '../models/TableInfo'
10
11
11
12
interface Props {
@@ -108,10 +109,10 @@ class TableView extends React.Component<Props, State> implements SessionControll
108
109
109
110
table . onFetchRangeUpdated = ( fetchRange ) => this . setState ( { fetchRange } )
110
111
111
- return < div className = 'table-view' style = { { ...styles . tableView , ...tableStyle } } >
112
- < div className = "table-view-table" style = { styles . table } >
113
- < div className = "table-view-header" style = { { ...styles . header , left : startColumnX , height : this . minRowHeight , boxShadow : ( scrollY > 0 ? shadow : 'none' ) } } >
114
- < div className = "table-view-row" style = { { ...styles . row , height : '100%' } } >
112
+ return < div style = { { ...styles . tableView , ...tableStyle } } >
113
+ < div style = { styles . table } >
114
+ < div style = { { ...styles . header , left : startColumnX , height : this . minRowHeight , boxShadow : ( scrollY > 0 ? shadow : 'none' ) } } >
115
+ < div style = { { ...styles . row , height : '100%' } } >
115
116
< TableHeaderCell key = { '' } content = { '' } isIndex = { true } isLastColumn = { false } scrollX = { scrollX } width = { indexWidth } scrollbarWidth = { TableView . scrollbarWidth } />
116
117
{ columns . map ( ( column , j ) => {
117
118
const isLastColumn = ( j == columns . length - 1 )
@@ -120,7 +121,7 @@ class TableView extends React.Component<Props, State> implements SessionControll
120
121
} ) } </ div >
121
122
</ div >
122
123
< div style = { { display : 'flex' } } >
123
- < div className = "table-view-index" style = { { ...styles . index , top : rowSlice . startY - scrollY , boxShadow : ( scrollX > 0 ? shadow : 'none' ) } } >
124
+ < div style = { { ...styles . index , top : rowSlice . startY - scrollY , boxShadow : ( scrollX > 0 ? shadow : 'none' ) } } >
124
125
{ rowSlice . rows . map ( ( row , n ) => {
125
126
const rowIndex = rowSlice . startIndex + n
126
127
const key = row ?. index ?? `empty-${ n } `
@@ -129,12 +130,12 @@ class TableView extends React.Component<Props, State> implements SessionControll
129
130
const cellHeight = rowSlice . rowHeights [ n ]
130
131
const rowHeight = cellHeight + ( isLastRow ? 8 : 0 )
131
132
const value = row ? String ( row . index + 1 ) : '' // For UI start counting at 1
132
- return < div key = { key } className = "table-view-row" style = { { ...styles . row , height : rowHeight , borderBottom } } >
133
+ return < div key = { key } style = { { ...styles . row , height : rowHeight , borderBottom } } >
133
134
< TableCell width = { indexWidth } height = { cellHeight } value = { value } isIndex = { true } isLastColumn = { false } isLastRow = { isLastRow } scrollbarWidth = { TableView . scrollbarWidth } />
134
135
</ div >
135
136
} ) }
136
137
</ div >
137
- < div className = "table-view-body" style = { { ...styles . body , left : startColumnX , top : rowSlice . startY - scrollY , height : totalBodyHeight } } >
138
+ < div style = { { ...styles . body , left : startColumnX , top : rowSlice . startY - scrollY , height : totalBodyHeight } } >
138
139
{ rowSlice . rows . map ( ( row , n ) => {
139
140
const rowIndex = rowSlice . startIndex + n
140
141
const key = row ?. index ?? `empty-${ n } `
@@ -148,14 +149,14 @@ class TableView extends React.Component<Props, State> implements SessionControll
148
149
const rowWidth = totalBodyWidth
149
150
const innerRowHeight = rowHeight - 1 // -1 for border
150
151
const padding = 6
151
- return < div key = { key } className = "table-view-row" style = { { ...styles . row , borderBottom, width : rowWidth , height : rowHeight , background } } >
152
+ return < div key = { key } style = { { ...styles . row , borderBottom, width : rowWidth , height : rowHeight , background } } >
152
153
< ContentLoader viewBox = { `0 0 ${ rowWidth } ${ innerRowHeight } ` } >
153
154
< rect x = { padding } y = { padding } width = { rowWidth - ( 2 * padding ) } height = { innerRowHeight - ( 2 * padding ) } />
154
155
</ ContentLoader >
155
156
</ div >
156
157
}
157
158
// Regular render
158
- return < div key = { key } className = "table-view-row" style = { { ...styles . row , borderBottom, height : rowHeight , background } } > { columns . map ( ( _column , j ) => {
159
+ return < div key = { key } style = { { ...styles . row , borderBottom, height : rowHeight , background } } > { columns . map ( ( _column , j ) => {
159
160
const value = row ?. values [ j ] ?? ''
160
161
const width = columnWidths [ j ]
161
162
const isLastColumn = ( j == columns . length - 1 )
@@ -165,8 +166,8 @@ class TableView extends React.Component<Props, State> implements SessionControll
165
166
</ div >
166
167
</ div >
167
168
</ div >
168
- < div className = 'table-view-scroll-view-container' style = { { ...styles . scrollViewContainer , pointerEvents : 'auto' } } >
169
- < div ref = { this . scrollViewRef } className = 'table-view-scroll-view' style = { { ...styles . scrollView , marginLeft : indexWidth , marginTop : this . minRowHeight } } onScroll = { this . handleScrollViewportChanged } onResize = { this . handleScrollViewportChanged } >
169
+ < div style = { { ...styles . scrollViewContainer , pointerEvents : 'auto' } } >
170
+ < div ref = { this . scrollViewRef } style = { { ...styles . scrollView , marginLeft : indexWidth , marginTop : this . minRowHeight } } onScroll = { this . handleScrollViewportChanged } onResize = { this . handleScrollViewportChanged } >
170
171
< div style = { { minWidth : '100%' , width : totalBodyWidth , height : totalBodyHeight } } > </ div >
171
172
</ div >
172
173
</ div >
0 commit comments