@@ -14,7 +14,7 @@ import makePagination from "./features/pagination"
1414import useBulkActions from "./features/useBulkActions"
1515import ColumnPinning from "./features/columnPinning"
1616import GlobalControls from "./features/globalControls"
17- import useRowHover from "./features/useRowHover "
17+ import TableProvider from "./features/provider "
1818
1919import MainTable from "./features/mainTable"
2020
@@ -59,8 +59,6 @@ const NetdataTable = ({
5959 virtualizeOptions = { } ,
6060 ...rest
6161} ) => {
62- const [ hoveredRow , setHoveredRow ] = useRowHover ( onHoverRow )
63-
6462 const [ columnVisibility , setColumnVisibility ] = useState ( defaultColumnVisibility )
6563
6664 useEffect ( ( ) => {
@@ -174,53 +172,51 @@ const NetdataTable = ({
174172 } )
175173
176174 return (
177- < Flex height = "100%" overflow = "hidden" width = "100%" column >
178- { onGlobalSearchChange || hasBulkActions ? (
179- < GlobalControls
180- bulkActions = { actions }
181- dataGa = { dataGa }
182- handleSearch = { onGlobalSearchChange ? onGlobalFilterChange : null }
183- searchValue = { globalFilter }
184- />
185- ) : null }
186- < Flex ref = { scrollParentRef } overflow = "auto" width = "100%" height = "100%" >
187- { enableColumnPinning && (
188- < ColumnPinning
175+ < TableProvider onHoverRow = { onHoverRow } >
176+ < Flex height = "100%" overflow = "hidden" width = "100%" column >
177+ { onGlobalSearchChange || hasBulkActions ? (
178+ < GlobalControls
179+ bulkActions = { actions }
180+ dataGa = { dataGa }
181+ handleSearch = { onGlobalSearchChange ? onGlobalFilterChange : null }
182+ searchValue = { globalFilter }
183+ />
184+ ) : null }
185+ < Flex ref = { scrollParentRef } overflow = "auto" width = "100%" height = "100%" >
186+ { enableColumnPinning && (
187+ < ColumnPinning
188+ enableResize = { enableResize }
189+ disableClickRow = { disableClickRow }
190+ onClickRow = { onClickRow }
191+ testPrefixCallback = { testPrefixCallback }
192+ enableSorting = { enableSorting }
193+ table = { table }
194+ headers = { table . getLeftFlatHeaders ( ) }
195+ testPrefix = { testPrefix }
196+ dataGa = { dataGa }
197+ scrollParentRef = { scrollParentRef }
198+ virtualizeOptions = { virtualizeOptions }
199+ />
200+ ) }
201+ < MainTable
202+ scrollParentRef = { scrollParentRef }
189203 enableResize = { enableResize }
190204 disableClickRow = { disableClickRow }
191205 onClickRow = { onClickRow }
192206 testPrefixCallback = { testPrefixCallback }
193207 enableSorting = { enableSorting }
208+ enableColumnPinning = { enableColumnPinning }
194209 table = { table }
195- headers = { table . getLeftFlatHeaders ( ) }
196- testPrefix = { testPrefix }
197210 dataGa = { dataGa }
198- onHoverRow = { setHoveredRow }
199- hoveredRow = { hoveredRow }
200- scrollParentRef = { scrollParentRef }
211+ tableRef = { tableRef }
212+ testPrefix = { testPrefix }
201213 virtualizeOptions = { virtualizeOptions }
214+ { ...rest }
202215 />
203- ) }
204- < MainTable
205- scrollParentRef = { scrollParentRef }
206- enableResize = { enableResize }
207- disableClickRow = { disableClickRow }
208- onClickRow = { onClickRow }
209- testPrefixCallback = { testPrefixCallback }
210- enableSorting = { enableSorting }
211- enableColumnPinning = { enableColumnPinning }
212- table = { table }
213- dataGa = { dataGa }
214- tableRef = { tableRef }
215- testPrefix = { testPrefix }
216- onHoverRow = { setHoveredRow }
217- hoveredRow = { hoveredRow }
218- virtualizeOptions = { virtualizeOptions }
219- { ...rest }
220- />
216+ </ Flex >
217+ { enablePagination && makePagination ( { table } ) }
221218 </ Flex >
222- { enablePagination && makePagination ( { table } ) }
223- </ Flex >
219+ </ TableProvider >
224220 )
225221}
226222
0 commit comments