1- const columns = generateColumns ( 10 )
1+ const columns = generateColumns ( 15 )
22const data = generateData ( columns , 200 )
33
44const GroupCell = styled . div `
@@ -12,9 +12,12 @@ const GroupCell = styled.div`
1212 }
1313`
1414
15- columns [ 0 ] . frozen = Column . FrozenDirection . LEFT
16- columns [ 1 ] . frozen = Column . FrozenDirection . LEFT
17- columns [ 2 ] . frozen = Column . FrozenDirection . RIGHT
15+ const fixedColumns = columns . map ( ( column , columnIndex ) => {
16+ let frozen
17+ if ( columnIndex < 3 ) frozen = Column . FrozenDirection . LEFT
18+ if ( columnIndex > 12 ) frozen = Column . FrozenDirection . RIGHT
19+ return { ...column , frozen, width : 100 }
20+ } )
1821
1922const headerRenderer = ( { cells, columns, headerIndex } ) => {
2023 if ( headerIndex === 2 ) return cells
@@ -34,7 +37,7 @@ const headerRenderer = ({ cells, columns, headerIndex }) => {
3437 if (
3538 columnIndex === columns . length - 1 ||
3639 nextColumn [ Table . PlaceholderKey ] ||
37- idx === 3 - headerIndex
40+ idx === ( headerIndex === 0 ? 4 : 2 )
3841 ) {
3942 groupCells . push (
4043 < GroupCell
@@ -55,7 +58,7 @@ const headerRenderer = ({ cells, columns, headerIndex }) => {
5558export default ( ) => (
5659 < Table
5760 fixed
58- columns = { columns }
61+ columns = { fixedColumns }
5962 data = { data }
6063 headerHeight = { [ 30 , 40 , 50 ] }
6164 headerRenderer = { headerRenderer }
0 commit comments