diff --git a/search-parts/src/components/DetailsListComponent.tsx b/search-parts/src/components/DetailsListComponent.tsx index ef4d84fe..48f233de 100644 --- a/search-parts/src/components/DetailsListComponent.tsx +++ b/search-parts/src/components/DetailsListComponent.tsx @@ -1,14 +1,14 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { Fabric, ShimmeredDetailsList, IShimmeredDetailsListProps, Sticky, StickyPositionType, Stack, ScrollablePane, ScrollbarVisibility, Checkbox } from '@fluentui/react'; +import { Fabric, ShimmeredDetailsList, IShimmeredDetailsListProps, Checkbox } from '@fluentui/react'; import { ITooltipHostProps, TooltipHost, ITooltipStyles, Shimmer, ShimmerElementsGroup, ShimmerElementType, IShimmerElement, mergeStyleSets, ITheme, Selection } from '@fluentui/react'; import * as Handlebars from 'handlebars'; import { IReadonlyTheme } from '@microsoft/sp-component-base'; import { BaseWebComponent, BuiltinTemplateSlots, ExtensibilityConstants, ISortInfo, SortFieldDirection } from '@pnp/modern-search-extensibility'; import { groupBy, sortBy, findIndex, isEmpty } from "@microsoft/sp-lodash-subset"; import { FileIcon } from '../components/FileIconComponent'; -import { DetailsListLayoutMode, SelectionMode, IColumn, IGroup, IDetailsRowProps, DetailsRow, IDetailsHeaderProps, CheckboxVisibility, IDetailsRowCheckProps, DetailsRowCheck, IDetailsCheckboxProps } from '@fluentui/react/lib/DetailsList'; +import { DetailsListLayoutMode, SelectionMode, IColumn, IGroup, IDetailsRowProps, DetailsRow, IDetailsHeaderProps, CheckboxVisibility, IDetailsRowCheckProps, DetailsRowCheck, IDetailsCheckboxProps, IDetailsListStyles, ConstrainMode, ISelectionZoneProps } from '@fluentui/react/lib/DetailsList'; import { DEFAULT_CELL_STYLE_PROPS, DEFAULT_ROW_HEIGHTS } from '@fluentui/react/lib/components/DetailsList/DetailsRow.styles'; import { ISearchResultsTemplateContext } from '../models/common/ITemplateContext'; import { ObjectHelper } from '../helpers/ObjectHelper'; @@ -46,9 +46,15 @@ const classNames = mergeStyleSets({ maxHeight: '16px', maxWidth: '16px' }, - controlWrapper: { - display: 'flex', - flexWrap: 'wrap' + header: { + margin: 0, + }, + row: { + flex: '0 0 auto', + }, + selectionZone: { + height: '100%', + overflow: 'hidden', } }); @@ -242,16 +248,6 @@ export class DetailsListComponent extends React.Component = { + root: { + overflowX: 'auto', + selectors: { + '& [role=grid]': { + display: 'flex', + flexDirection: 'column', + alignItems: 'start', + height: this.props.stickyHeaderListViewHeight ? `${this.props.stickyHeaderListViewHeight}px` : '100%', + }, + }, + }, + headerWrapper: { + flex: '0 0 auto', + }, + contentWrapper: { + flex: '1 1 auto', + overflow: 'hidden', + }, + focusZone: { + height: '100%', + overflowY: 'auto', + overflowX: 'hidden', + }, + }; + + const focusZoneProps = { + 'data-is-scrollable': 'true', + } as React.HTMLAttributes; + + const selectionZoneProps: ISelectionZoneProps = { + className: classNames.selectionZone, + selection: this._selection, + }; + + shimmeredDetailsListProps.detailsListStyles = gridStyles; + shimmeredDetailsListProps.focusZoneProps = focusZoneProps; + shimmeredDetailsListProps.selectionZoneProps = selectionZoneProps; + shimmeredDetailsListProps.constrainMode = ConstrainMode.unconstrained; + shimmeredDetailsListProps.layoutMode = DetailsListLayoutMode.fixedColumns; + } + if (this.state.groups.length > 0) { shimmeredDetailsListProps.groups = this.state.groups; shimmeredDetailsListProps.groupProps = { @@ -467,20 +506,6 @@ export class DetailsListComponent extends React.Component - - - - - - - - - ); - } - return ( @@ -640,14 +665,6 @@ export class DetailsListComponent extends React.Component; }; - if (this.props.enableStickyHeader) { - return ( - - {defaultRender!({...props, theme: this.props.themeVariant as ITheme})} - - ); - } - return defaultRender!({...props, theme: this.props.themeVariant as ITheme}); }