@@ -3,49 +3,18 @@ import styles from './ListView.DragDrop.module.scss';
3
3
import { DetailsList , DetailsListLayoutMode , Selection , SelectionMode , IGroup , IDetailsHeaderProps } from 'office-ui-fabric-react/lib/DetailsList' ;
4
4
import { IListViewProps , IListViewState , IViewField , IGrouping , GroupOrder } from './IListView' ;
5
5
import { IColumn , IGroupRenderProps , IObjectWithKey } from 'office-ui-fabric-react/lib/components/DetailsList' ;
6
- import { ScrollablePane , ScrollbarVisibility } from 'office-ui-fabric-react/lib/ScrollablePane' ;
7
- import { Sticky , StickyPositionType } from 'office-ui-fabric-react/lib/Sticky' ;
8
- import { IRenderFunction } from 'office-ui-fabric-react/lib/Utilities' ;
9
6
import { findIndex , has , sortBy , isEqual , cloneDeep } from '@microsoft/sp-lodash-subset' ;
10
7
import { FileTypeIcon , IconType } from '../fileTypeIcon/index' ;
11
8
import * as strings from 'ControlStrings' ;
12
9
import { IGroupsItems } from './IListView' ;
13
10
import * as telemetry from '../../common/telemetry' ;
14
11
import { Icon } from 'office-ui-fabric-react/lib/Icon' ;
15
- import { mergeStyleSets } from 'office-ui-fabric-react/lib/Styling ';
12
+ import './ListView.stickyHeader.css ';
16
13
17
14
import filter from 'lodash/filter' ;
18
15
import { SearchBox } from 'office-ui-fabric-react/lib/SearchBox' ;
19
16
import { Guid } from '@microsoft/sp-core-library' ;
20
17
21
- const classNames = mergeStyleSets ( {
22
- wrapper : {
23
- height : '50vh' ,
24
- position : 'relative'
25
- }
26
- } ) ;
27
-
28
- /**
29
- * Wrap the listview in a scrollable pane if sticky header = true
30
- */
31
- const ListViewWrapper = ( { stickyHeader, children } ) => ( stickyHeader ?
32
- < div className = { classNames . wrapper } >
33
- < ScrollablePane scrollbarVisibility = { ScrollbarVisibility . auto } >
34
- { children }
35
- </ ScrollablePane >
36
- </ div >
37
- : children
38
- ) ;
39
-
40
- /**
41
- * Lock the searchbox when scrolling if sticky header = true
42
- */
43
- const SearchBoxWrapper = ( { stickyHeader, children } ) => ( stickyHeader ?
44
- < Sticky stickyPosition = { StickyPositionType . Header } >
45
- { children }
46
- </ Sticky >
47
- : children
48
- ) ;
49
18
50
19
/**
51
20
* File type icon component
@@ -596,22 +565,15 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
596
565
}
597
566
}
598
567
599
- /**
600
- * Custom render of header
601
- * @param props
602
- * @param defaultRender
603
- */
604
- private _onRenderDetailsHeader : IRenderFunction < IDetailsHeaderProps > = ( props , defaultRender ) => {
605
- if ( ! props ) {
606
- return null ;
568
+ /**
569
+ * Return Classname with StickyHeader
570
+ */
571
+ private _getClassName ( ) {
572
+ if ( this . props . stickyHeader ) {
573
+ return "StickyHeader" ;
574
+ } else {
575
+ return "" ;
607
576
}
608
- return (
609
- < Sticky stickyPosition = { StickyPositionType . Header } isScrollSynced >
610
- { defaultRender ! ( {
611
- ...props ,
612
- } ) }
613
- </ Sticky >
614
- ) ;
615
577
}
616
578
617
579
/**
@@ -645,13 +607,9 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
645
607
</ div >
646
608
</ div >
647
609
}
648
- < ListViewWrapper stickyHeader = { ! ! stickyHeader } >
649
- < div >
650
610
{
651
611
showFilter &&
652
- < SearchBoxWrapper stickyHeader = { ! ! stickyHeader } >
653
612
< SearchBox placeholder = { filterPlaceHolder || strings . ListViewFilterLabel } onSearch = { this . _updateFilterValue } onChange = { this . _updateFilterValue } value = { filterValue } />
654
- </ SearchBoxWrapper >
655
613
}
656
614
< DetailsList
657
615
key = "ListViewControl"
@@ -665,10 +623,8 @@ export class ListView extends React.Component<IListViewProps, IListViewState> {
665
623
compact = { compact }
666
624
setKey = "ListViewControl"
667
625
groupProps = { groupProps }
668
- onRenderDetailsHeader = { this . _onRenderDetailsHeader }
626
+ className = { this . _getClassName ( ) }
669
627
/>
670
- </ div >
671
- </ ListViewWrapper >
672
628
</ div >
673
629
) ;
674
630
}
0 commit comments