@@ -30,7 +30,7 @@ import useInfiniteScroll from "./hooks/useInfiniteScroll"
3030const noop = ( ) => { }
3131
3232const NetdataTable = ( {
33- bulkActions = { } ,
33+ bulkActions,
3434 columnPinningOptions = { } ,
3535 columnVisibility : initialColumnVisibility ,
3636 data,
@@ -62,6 +62,7 @@ const NetdataTable = ({
6262 testPrefix = "" ,
6363 testPrefixCallback,
6464 virtualizeOptions = { } ,
65+ ...rest
6566} ) => {
6667 const [ isColumnDropdownVisible , setIsColumnDropdownVisible ] = useState ( false )
6768 const [ columnVisibility , setColumnVisibility ] = useState ( initialColumnVisibility )
@@ -102,22 +103,25 @@ const NetdataTable = ({
102103
103104 const makeActionsColumn = useMemo ( ( ) => makeRowActions ( { rowActions, testPrefix } ) , [ rowActions ] )
104105
105- const renderBulkActions = ( ) => [
106- makeBulkActions ( {
107- bulkActions,
108- columnPinning,
109- columnVisibilityOptions : {
110- handleAction : ( ) => setIsColumnDropdownVisible ( true ) ,
111- isOpen : isColumnDropdownVisible ,
112- onClose : ( ) => setIsColumnDropdownVisible ( false ) ,
113- visible : enableColumnVisibility ,
114- } ,
115- enableColumnPinning,
116- selectedRows : originalSelectedRows ,
117- table,
118- testPrefix,
119- } ) ,
120- ]
106+ const renderBulkActions = ( ) =>
107+ bulkActions
108+ ? [
109+ makeBulkActions ( {
110+ bulkActions,
111+ columnPinning,
112+ columnVisibilityOptions : {
113+ handleAction : ( ) => setIsColumnDropdownVisible ( true ) ,
114+ isOpen : isColumnDropdownVisible ,
115+ onClose : ( ) => setIsColumnDropdownVisible ( false ) ,
116+ visible : enableColumnVisibility ,
117+ } ,
118+ enableColumnPinning,
119+ selectedRows : originalSelectedRows ,
120+ table,
121+ testPrefix,
122+ } ) ,
123+ ]
124+ : null
121125
122126 const makeSelectionColumn = enableSelection ? [ makeRowSelection ( { testPrefix } ) ] : [ ]
123127
@@ -220,12 +224,14 @@ const NetdataTable = ({
220224 return (
221225 < SharedTableProvider >
222226 < Flex height = "100%" overflow = "hidden" width = "100%" column >
223- < GlobalControls
224- bulkActions = { renderBulkActions }
225- dataGa = { dataGa }
226- handleSearch = { onGlobalSearchChange ? handleGlobalSearch : null }
227- searchValue = { globalFilter }
228- />
227+ { onGlobalSearchChange || bulkActions ? (
228+ < GlobalControls
229+ bulkActions = { renderBulkActions }
230+ dataGa = { dataGa }
231+ handleSearch = { onGlobalSearchChange ? handleGlobalSearch : null }
232+ searchValue = { globalFilter }
233+ />
234+ ) : null }
229235 < Flex
230236 ref = { scrollParentRef }
231237 overflow = { { vertical : "auto" , horizontal : "auto" } }
@@ -264,6 +270,7 @@ const NetdataTable = ({
264270 flexRender = { flexRender }
265271 onHoverRow = { onHoverRow }
266272 virtualizeOptions = { virtualizeOptions }
273+ { ...rest }
267274 />
268275 </ Flex >
269276 { enablePagination && makePagination ( { table } ) }
0 commit comments