Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/utilities",
"comment": "fix bug in IE that IE does not support Number.IsInteger",
"type": "patch"
}
],
"packageName": "@uifabric/utilities",
"email": "zhiliu@microsoft.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "make onShouldVirtualize work for grouped list",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "zhiliu@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ export class GroupedList extends BaseComponent<IGroupedListProps, IGroupedListSt
onRenderCell,
selectionMode,
selection,
viewport
viewport,
onShouldVirtualize
} = this.props;

// override group header/footer props as needed
Expand Down Expand Up @@ -194,6 +195,7 @@ export class GroupedList extends BaseComponent<IGroupedListProps, IGroupedListSt
selection={ selection }
showAllProps={ showAllProps }
viewport={ viewport }
onShouldVirtualize={ onShouldVirtualize }
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
import { assign, css } from '../../Utilities';
import { IViewport } from '../../utilities/decorators/withViewport';
import * as stylesImport from './GroupedList.scss';
import { IList, IListProps } from '../List/index';

const styles: any = stylesImport;

export interface IGroupedListSectionProps extends React.Props<GroupedListSection> {
Expand Down Expand Up @@ -104,6 +106,14 @@ export interface IGroupedListSectionProps extends React.Props<GroupedListSection

/** Override for rendering the group footer. */
onRenderGroupFooter?: IRenderFunction<IGroupDividerProps>;

/**
* Optional callback to determine whether the list should be rendered in full, or virtualized.
* Virtualization will add and remove pages of items as the user scrolls them into the visible range.
* This benefits larger list scenarios by reducing the DOM on the screen, but can negatively affect performance for smaller lists.
* The default implementation will virtualize when this callback is not provided.
*/
onShouldVirtualize?: (props: IListProps) => boolean;
}

export interface IGroupedListSectionState {
Expand Down Expand Up @@ -182,7 +192,8 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
selectionMode,
onRenderGroupHeader = this._onRenderGroupHeader,
onRenderGroupShowAll = this._onRenderGroupShowAll,
onRenderGroupFooter = this._onRenderGroupFooter
onRenderGroupFooter = this._onRenderGroupFooter,
onShouldVirtualize
} = this.props;
let { isSelected } = this.state;
let renderCount = group && getGroupItemLimit ? getGroupItemLimit(group) : Infinity;
Expand Down Expand Up @@ -220,6 +231,7 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
items={ group!.children }
onRenderCell={ this._renderSubGroup }
getItemCountForPage={ this._returnOne }
onShouldVirtualize={ onShouldVirtualize }
/>
) :
this._onRenderGroup(renderCount)
Expand Down Expand Up @@ -303,7 +315,8 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
items,
onRenderCell,
listProps,
groupNestingDepth
groupNestingDepth,
onShouldVirtualize
} = this.props;
let count = group ? group.count : items.length;
let startIndex = group ? group.startIndex : 0;
Expand All @@ -315,6 +328,7 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
ref={ 'list' }
renderCount={ Math.min(count, renderCount) }
startIndex={ startIndex }
onShouldVirtualize={ onShouldVirtualize }
{ ...listProps }
/>
);
Expand All @@ -339,7 +353,8 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
viewport,
onRenderGroupHeader,
onRenderGroupShowAll,
onRenderGroupFooter
onRenderGroupFooter,
onShouldVirtualize
} = this.props;

return (!subGroup || subGroup.count > 0) ? (
Expand All @@ -365,6 +380,7 @@ export class GroupedListSection extends BaseComponent<IGroupedListSectionProps,
onRenderGroupHeader={ onRenderGroupHeader }
onRenderGroupShowAll={ onRenderGroupShowAll }
onRenderGroupFooter={ onRenderGroupFooter }
onShouldVirtualize={ onShouldVirtualize }
/>
) : null;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/utilities/src/FabricPerformance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class FabricPerformance {
* @param func - The logic to be measured for execution time
*/
public static measure(name: string, func: () => void): void {
if (Number.isInteger(FabricPerformance._timeoutId)) {
if (FabricPerformance._timeoutId) {
FabricPerformance.setPeriodicReset();
}
const start = now();
Expand Down