import { IColumn } from 'office-ui-fabric-react/lib/DetailsList'; export declare const OTHER: string; export declare type SortOrder = "asc" | "desc" | "OTHER"; export declare type SortOrderState = SortOrder | "FIRST"; /** Sorting state for a single column. */ export interface ColumnSortInfo { /** Sorting direction. */ direction: SortOrder; /** Position in column sorting order e.g. if firstname to be sorted *after* lastname, * pos=1 for firstname and pos=0 for lastname. */ position: number; } /** Group of individual column sort infos. State key is column index or IColumn.key. */ export declare type SortingState = { [col: number]: ColumnSortInfo; [col: string]: ColumnSortInfo; }; /** Transition table for sorting direction state machine. */ export interface SortOrderTransitions extends Partial> { /** Starting state is required. */ FIRST: SortOrder; } /** * Default sort order state machine table. You can also store these as state in * in your component and provide them to the byColumns* functions. */ export declare const defaultOrder: SortOrderTransitions; /** * Previous SortingState => new SortingState (state machine). Only allows single * column sorting. Cycles through sorting order if its already sorted on that column. */ export declare function byColumn({current, transitions, selectedColumn, defaultPosition}: { current: SortingState; transitions: SortOrderTransitions; selectedColumn: number | string; defaultPosition?: number; }): SortingState; /** * Updates a multi column sorting state by updating the selectedColumn. * If selectedColumn is new to the sorting state, it is placed last in the * positions. */ export declare function byColumns({current, transitions, selectedColumn}: { current: SortingState; transitions: SortOrderTransitions; selectedColumn: number | string; }): SortingState; /** Sort data. */ export declare type Sorter = (a: Array) => Array; /** Create Sorter functions given sorting information. */ export declare type SortFunctionFactory = (info: Array<{ property: string; direction: SortOrder; }>) => Sorter; /** * Create a Sorter given columns, sorting state and a sort function factory. * Uses IColumn.key to lookup fieldname|data.sortAttribute if sorting state has a property name as a key, * or IColumn[index] to lookup the column. */ export declare const sorter: ({ columns, state, factory }: { columns: IColumn[]; factory?: SortFunctionFactory | undefined; state: SortingState; }) => Sorter; /** Sort function factory that uses ramda sortWith. */ export declare function ramdaSortFunctionFactory(info: Array<{ property: string; direction: SortOrder; }>): Sorter; /** Update column definitios based on the column key and the map of updates. */ export declare function updateColumns(columns: IColumn[], updates: { [key: string]: Partial; }): IColumn[]; /** * Enhance a list of column-like information based on the sortState. All columns are * are sortable unless data.isSortable = false. * You can set a DetailsList.onColumnHeaderClick instead of passing in onSortColumn. */ export declare function augmentColumns(cols: any[], sortState: SortingState, onSortColumn?: (c: IColumn) => void, getMoreProps?: (c: IColumn, idx: number) => Record): IColumn[]; /** * Given a request to sort, update critical key parts of the sorting infrastructure. * You will need to sort your data with the returned sorter function. The returned * columns are updated with the new sort state (e.g. isSorted, isSortedDescending). */ export declare function onSortColumn(c: IColumn, columns: IColumn[], sortState: SortingState, transitions: SortOrderTransitions, factory?: SortFunctionFactory): { columns: IColumn[]; sortState: SortingState; sorter: Sorter; };