1- import React from 'react' ;
21import { CellMeasurerCache , CellMeasurer } from 'react-virtualized' ;
32import { AutoSizer , VirtualTableBody , WindowScroller } from '@patternfly/react-virtualized-extension' ;
43import { Table , Thead , Tr , Th , Td , TableGridBreakpoint , ActionsColumn , Tbody } from '@patternfly/react-table' ;
@@ -25,10 +24,11 @@ import {
2524 Bullseye
2625} from '@patternfly/react-core' ;
2726import { FilterIcon , SearchIcon } from '@patternfly/react-icons' ;
27+ import { Fragment , useEffect , useState , CSSProperties , Ref , MouseEvent as ReactMouseEvent , SyntheticEvent , KeyboardEvent as ReactKeyboardEvent } from 'react' ;
2828
2929export const ComposableTableWindowScroller = ( ) => {
30- const [ scrollableElement , setScrollableElement ] = React . useState < HTMLElement > ( ) ;
31- React . useEffect ( ( ) => {
30+ const [ scrollableElement , setScrollableElement ] = useState < HTMLElement > ( ) ;
31+ useEffect ( ( ) => {
3232 const scrollableElement = document . getElementById ( 'content-scrollable-2' ) as HTMLElement ;
3333 setScrollableElement ( scrollableElement ) ;
3434 } , [ ] ) ;
@@ -86,11 +86,11 @@ export const ComposableTableWindowScroller = () => {
8686 const columns = [ 'Servers' , 'Threads' , 'Applications' , 'Status' , 'Location' ] ;
8787 const scrollToIndex = - 1 ; // can be used to programmatically set current index
8888
89- const [ isCategoryDropdownOpen , setIsCategoryDropdownOpen ] = React . useState ( false ) ;
90- const [ isFilterDropdownOpen , setIsFilterDropdownOpen ] = React . useState ( false ) ;
91- const [ currentCategory , setCurrentCategory ] = React . useState ( 'Name' ) ;
92- const [ filters , setFilters ] = React . useState < Record < string , string [ ] > > ( { location : [ ] , name : [ ] , status : [ ] } ) ;
93- const [ inputValue , setInputValue ] = React . useState ( '' ) ;
89+ const [ isCategoryDropdownOpen , setIsCategoryDropdownOpen ] = useState ( false ) ;
90+ const [ isFilterDropdownOpen , setIsFilterDropdownOpen ] = useState ( false ) ;
91+ const [ currentCategory , setCurrentCategory ] = useState ( 'Name' ) ;
92+ const [ filters , setFilters ] = useState < Record < string , string [ ] > > ( { location : [ ] , name : [ ] , status : [ ] } ) ;
93+ const [ inputValue , setInputValue ] = useState ( '' ) ;
9494
9595 const onDelete = ( type : string | ToolbarLabelGroup , id : string ) => {
9696 if ( type === 'Location' ) {
@@ -130,7 +130,7 @@ export const ComposableTableWindowScroller = () => {
130130 setInputValue ( newValue ) ;
131131 } ;
132132
133- const onStatusSelect = ( event : React . MouseEvent < Element , MouseEvent > | undefined , selection : string | number | undefined ) => {
133+ const onStatusSelect = ( event : ReactMouseEvent < Element , MouseEvent > | undefined , selection : string | number | undefined ) => {
134134 const checked = ( event ?. target as HTMLInputElement ) . checked ;
135135 setFilters ( {
136136 ...filters ,
@@ -139,9 +139,9 @@ export const ComposableTableWindowScroller = () => {
139139 setIsFilterDropdownOpen ( false ) ;
140140 } ;
141141
142- const onNameInput = ( event : React . SyntheticEvent < HTMLButtonElement > | React . KeyboardEvent ) => {
142+ const onNameInput = ( event : SyntheticEvent < HTMLButtonElement > | ReactKeyboardEvent ) => {
143143 setIsCategoryDropdownOpen ( false ) ;
144- const pressedKey = ( event as React . KeyboardEvent ) . key ;
144+ const pressedKey = ( event as ReactKeyboardEvent ) . key ;
145145 if ( pressedKey && pressedKey !== 'Enter' ) {
146146 return ;
147147 }
@@ -155,7 +155,7 @@ export const ComposableTableWindowScroller = () => {
155155 setIsCategoryDropdownOpen ( false ) ;
156156 } ;
157157
158- const onLocationSelect = ( _event : React . MouseEvent < Element , MouseEvent > | undefined , selection : string | number | undefined ) => {
158+ const onLocationSelect = ( _event : ReactMouseEvent < Element , MouseEvent > | undefined , selection : string | number | undefined ) => {
159159 setFilters ( { ...filters , location : [ `${ selection } ` ] } ) ;
160160
161161 setIsFilterDropdownOpen ( false ) ;
@@ -180,7 +180,7 @@ export const ComposableTableWindowScroller = () => {
180180 < Select
181181 onSelect = { onCategorySelect }
182182 selected = { currentCategory }
183- toggle = { ( toggleRef : React . Ref < MenuToggleElement > ) => (
183+ toggle = { ( toggleRef : Ref < MenuToggleElement > ) => (
184184 < MenuToggle
185185 ref = { toggleRef }
186186 onClick = { onCategoryToggle }
@@ -190,7 +190,7 @@ export const ComposableTableWindowScroller = () => {
190190 {
191191 width : '100%' ,
192192 verticalAlign : 'text-bottom'
193- } as React . CSSProperties
193+ } as CSSProperties
194194 }
195195 >
196196 { currentCategory }
@@ -247,7 +247,7 @@ export const ComposableTableWindowScroller = () => {
247247 ] ;
248248
249249 return (
250- < React . Fragment >
250+ < Fragment >
251251 < ToolbarFilter
252252 labels = { filters . location }
253253 deleteLabel = { ( category , chip ) => onDelete ( category , chip as string ) }
@@ -260,7 +260,7 @@ export const ComposableTableWindowScroller = () => {
260260 selected = { filters . location [ 0 ] }
261261 isOpen = { isFilterDropdownOpen }
262262 popperProps = { { minWidth : '100px' } }
263- toggle = { ( toggleRef : React . Ref < MenuToggleElement > ) => (
263+ toggle = { ( toggleRef : Ref < MenuToggleElement > ) => (
264264 < MenuToggle
265265 ref = { toggleRef }
266266 onClick = { onFilterToggle }
@@ -269,7 +269,7 @@ export const ComposableTableWindowScroller = () => {
269269 {
270270 width : '100%' ,
271271 verticalAlign : 'text-bottom'
272- } as React . CSSProperties
272+ } as CSSProperties
273273 }
274274 >
275275 { filters . location [ 0 ] || `Any` }
@@ -308,7 +308,7 @@ export const ComposableTableWindowScroller = () => {
308308 popperProps = { { minWidth : '100px' } }
309309 onSelect = { onStatusSelect }
310310 selected = { filters . status }
311- toggle = { ( toggleRef : React . Ref < MenuToggleElement > ) => (
311+ toggle = { ( toggleRef : Ref < MenuToggleElement > ) => (
312312 < MenuToggle
313313 ref = { toggleRef }
314314 onClick = { onFilterToggle }
@@ -317,7 +317,7 @@ export const ComposableTableWindowScroller = () => {
317317 {
318318 width : '100%' ,
319319 verticalAlign : 'text-bottom'
320- } as React . CSSProperties
320+ } as CSSProperties
321321 }
322322 >
323323 Filter by status
@@ -328,7 +328,7 @@ export const ComposableTableWindowScroller = () => {
328328 { statusMenuItems }
329329 </ Select >
330330 </ ToolbarFilter >
331- </ React . Fragment >
331+ </ Fragment >
332332 ) ;
333333 } ;
334334
0 commit comments