///
/**
* Sortable details list using helpers.
*/
import * as React from "react";
import { IDetailsListProps, IColumn, ISelection } from "office-ui-fabric-react/lib/DetailsList";
import * as Helpers from "./DetailsListHelpers";
export { SortingState, ColumnSortInfo, SortOrderTransitions, defaultOrder, SortOrder, SortOrderState, OTHER } from "./DetailsListHelpers";
export interface Props {
className?: string;
/** Selection. This is *not* updated via setItems upon sort. See onSort. */
selection?: ISelection;
allowSelection?: boolean;
items: T[];
detailsListProps?: Partial;
/** These columns override any specified in detailsListProps. */
columns: Array>;
/** Default sorting state */
defaultSortState?: Helpers.SortingState;
/** Callback when sort state changes. */
onSortStateChanged?: (s: Helpers.SortingState) => void;
/**
* Callback when this component sorts the items.
* You may need to update the selection object (setItems) if you maintain your own selection
* object.
*/
onSort?: (items: Array) => void;
}
export interface State {
/** Sorting state. */
sortState: Helpers.SortingState;
/** Function that can be used to sort items to create sorted. */
sorter: Helpers.Sorter;
/** Item cache to detect changes. */
items: T[];
/** Sorted items, based on items. */
sorted: T[];
/** Column cache to detect changes. */
origColumns: Partial[];
/** Current augmented columns */
columns: IColumn[];
}
/**
* Maintains sorting state and sort data when requested. Columns can be augmented with
* `data.sortAttribute` to specify the attribute to sort on otherwise it defaults
* to `fieldName.` `data.isSortable=true/false` indicates whether a column can
* be sorted on. defaultSortState can hold the initial sort state to provide e.g.
* `{ column1Key: { position: 0, direction: "asc"}}` indicates that column 1 (indicated
* by the key column1Key), should be sorted first in ascending order. position indicates the
* order/priority of the column sorts since you can sort on more than one column. A lower
* position means that column is sorted before other columns with a lower position.
* `data.sortAttribute` should indicate the attribute to sort on if its different than
* fieldname.
*
* The DetailsList component is wrapped in ScrollablePane and the header is made sticky.
* The class name `sortableDeailsList` that helps you constrain the size of the list and is
* marked with a `data-is-scrollable` attribute per github.
*
* @see https://github.com/OfficeDev/office-ui-fabric-react/issues/3267
*/
export declare class SortableDetailsList extends React.Component, State> {
constructor(props: Props);
protected onSort: (items: T[]) => void;
readonly sortState: Helpers.SortingState;
protected onSortColumn: (col: IColumn) => void;
protected updateSortState: (props: Props) => void;
componentWillReceiveProps(nextProps: any): void;
render(): JSX.Element;
}
export default SortableDetailsList;