@@ -152,7 +152,6 @@ function useColumns<RecordType>(
152152 columns : ColumnsType < RecordType > ,
153153 flattenColumns : readonly ColumnType < RecordType > [ ] ,
154154 realScrollWidth : undefined | number ,
155- hasGapFixed : boolean ,
156155] {
157156 const baseColumns = React . useMemo < ColumnsType < RecordType > > ( ( ) => {
158157 const newColumns = columns || convertChildrenToColumns ( children ) || [ ] ;
@@ -275,50 +274,14 @@ function useColumns<RecordType>(
275274 // eslint-disable-next-line react-hooks/exhaustive-deps
276275 } , [ mergedColumns , direction , scrollWidth ] ) ;
277276
278- // ========================= Gap Fixed ========================
279- // TODO: Remove this. We no need gapped check anymore
280- const hasGapFixed = React . useMemo ( ( ) => {
281- // Fixed: left, since old browser not support `findLastIndex`, we should use reverse loop
282- let lastLeftIndex = - 1 ;
283- for ( let i = flattenColumns . length - 1 ; i >= 0 ; i -= 1 ) {
284- const colFixed = flattenColumns [ i ] . fixed ;
285- if ( colFixed === 'left' || colFixed === true ) {
286- lastLeftIndex = i ;
287- break ;
288- }
289- }
290-
291- if ( lastLeftIndex >= 0 ) {
292- for ( let i = 0 ; i <= lastLeftIndex ; i += 1 ) {
293- const colFixed = flattenColumns [ i ] . fixed ;
294- if ( colFixed !== 'left' && colFixed !== true ) {
295- return true ;
296- }
297- }
298- }
299-
300- // Fixed: right
301- const firstRightIndex = flattenColumns . findIndex ( ( { fixed : colFixed } ) => colFixed === 'right' ) ;
302- if ( firstRightIndex >= 0 ) {
303- for ( let i = firstRightIndex ; i < flattenColumns . length ; i += 1 ) {
304- const colFixed = flattenColumns [ i ] . fixed ;
305- if ( colFixed !== 'right' ) {
306- return true ;
307- }
308- }
309- }
310-
311- return false ;
312- } , [ flattenColumns ] ) ;
313-
314277 // ========================= FillWidth ========================
315278 const [ filledColumns , realScrollWidth ] = useWidthColumns (
316279 flattenColumns ,
317280 scrollWidth ,
318281 clientWidth ,
319282 ) ;
320283
321- return [ mergedColumns , filledColumns , realScrollWidth , hasGapFixed ] ;
284+ return [ mergedColumns , filledColumns , realScrollWidth ] ;
322285}
323286
324287export default useColumns ;
0 commit comments