UNPKG

6.55 kBTypeScriptView Raw
1import * as React from 'react';
2import { CollapseAllVisibility } from '../../GroupedList';
3import { DetailsHeaderBase } from './DetailsHeader.base';
4import { DetailsListLayoutMode, ColumnDragEndLocation } from './DetailsList.types';
5import { SelectionMode } from '../../Selection';
6import type { IRefObject, IRenderFunction, IStyleFunctionOrObject } from '../../Utilities';
7import type { ITheme, IStyle } from '../../Styling';
8import type { IColumn, IColumnReorderOptions } from './DetailsList.types';
9import type { ICellStyleProps, IDetailsItemProps } from './DetailsRow.types';
10import type { ISelection } from '../../Selection';
11import type { IDetailsCheckboxProps } from './DetailsRowCheck.types';
12import type { IDetailsColumnRenderTooltipProps } from './DetailsColumn.types';
13/**
14 * {@docCategory DetailsList}
15 */
16export interface IDetailsHeader {
17 /** sets focus into the header */
18 focus: () => boolean;
19}
20/**
21 * {@docCategory DetailsList}
22 */
23export interface IDetailsHeaderBaseProps extends React.ClassAttributes<DetailsHeaderBase>, IDetailsItemProps {
24 /** Theme from the Higher Order Component */
25 theme?: ITheme;
26 /** Call to provide customized styling that will layer on top of the variant rules. */
27 styles?: IStyleFunctionOrObject<IDetailsHeaderStyleProps, IDetailsHeaderStyles>;
28 /** Ref to the component itself */
29 componentRef?: IRefObject<IDetailsHeader>;
30 /** Layout mode - fixedColumns or justified */
31 layoutMode: DetailsListLayoutMode;
32 /** Callback for when column sizing has changed */
33 onColumnIsSizingChanged?: (column: IColumn, isSizing: boolean) => void;
34 /** Callback for when column is resized */
35 onColumnResized?: (column: IColumn, newWidth: number, columnIndex: number) => void;
36 /** Callback for when column is automatically resized */
37 onColumnAutoResized?: (column: IColumn, columnIndex: number) => void;
38 /** Callback for when the column is clicked */
39 onColumnClick?: (ev: React.MouseEvent<HTMLElement>, column: IColumn) => void;
40 /** Callback for when the column needs to show a context menu */
41 onColumnContextMenu?: (column: IColumn, ev: React.MouseEvent<HTMLElement>) => void;
42 /** Callback to render a tooltip for the column header */
43 onRenderColumnHeaderTooltip?: IRenderFunction<IDetailsColumnRenderTooltipProps>;
44 /** Whether to collapse for all visibility */
45 collapseAllVisibility?: CollapseAllVisibility;
46 /** Whether or not all is collapsed */
47 isAllCollapsed?: boolean;
48 /** Callback for when collapse all is toggled */
49 onToggleCollapseAll?: (isAllCollapsed: boolean) => void;
50 /** ariaLabel for the entire header */
51 ariaLabel?: string;
52 /** ariaLabel for expand/collapse group button */
53 ariaLabelForToggleAllGroupsButton?: string;
54 /** ariaLabel for the header checkbox that selects or deselects everything */
55 ariaLabelForSelectAllCheckbox?: string;
56 /** ariaLabel for the selection column */
57 ariaLabelForSelectionColumn?: string;
58 /** Select all button visibility */
59 selectAllVisibility?: SelectAllVisibility;
60 /** Column reordering options */
61 columnReorderOptions?: IColumnReorderOptions;
62 /** Column reordering options */
63 columnReorderProps?: IColumnReorderHeaderProps;
64 /** Minimum pixels to be moved before dragging is registered */
65 minimumPixelsForDrag?: number;
66 /** Overriding class name */
67 className?: string;
68 /** If provided, can be used to render a custom checkbox */
69 onRenderDetailsCheckbox?: IRenderFunction<IDetailsCheckboxProps>;
70 /**
71 * Whether to use fast icon and check components. The icons can't be targeted by customization
72 * but are still customizable via class names.
73 * @defaultvalue true
74 */
75 useFastIcons?: boolean;
76}
77/**
78 * {@docCategory DetailsList}
79 */
80export interface IDetailsHeaderProps extends IDetailsHeaderBaseProps {
81 /**
82 * Column metadata
83 */
84 columns: IColumn[];
85 /**
86 * Selection from utilities
87 */
88 selection: ISelection;
89 /**
90 * Selection mode
91 */
92 selectionMode: SelectionMode;
93}
94/**
95 * {@docCategory DetailsList}
96 */
97export declare enum SelectAllVisibility {
98 none = 0,
99 hidden = 1,
100 visible = 2
101}
102/**
103 * {@docCategory DetailsList}
104 */
105export interface IDetailsHeaderState {
106 columnResizeDetails?: IColumnResizeDetails;
107 isAllSelected?: boolean;
108 isSizing?: boolean;
109 isAllCollapsed?: boolean;
110}
111/**
112 * {@docCategory DetailsList}
113 */
114export interface IColumnResizeDetails {
115 columnIndex: number;
116 originX?: number;
117 columnMinWidth: number;
118}
119/**
120 * {@docCategory DetailsList}
121 */
122export interface IColumnReorderHeaderProps extends IColumnReorderOptions {
123 /** Callback to notify the column dragEnd event to List
124 * Need this to check whether the dragEnd has happened on
125 * corresponding list or outside of the list
126 */
127 onColumnDragEnd?: (props: {
128 dropLocation?: ColumnDragEndLocation;
129 }, event: MouseEvent) => void;
130}
131/**
132 * {@docCategory DetailsList}
133 */
134export interface IDropHintDetails {
135 originX: number;
136 startX: number;
137 endX: number;
138 dropHintElementRef: HTMLElement;
139}
140/**
141 * {@docCategory DetailsList}
142 */
143export declare type IDetailsHeaderStyleProps = Required<Pick<IDetailsHeaderProps, 'theme'>> & Pick<IDetailsHeaderProps, 'className'> & {
144 /** Whether to hide select all checkbox */
145 isSelectAllHidden?: boolean;
146 /** Whether the "select all" checkbox is checked */
147 isAllSelected?: boolean;
148 /** Is column being resized */
149 isResizingColumn?: boolean;
150 /** Are all columns collapsed */
151 isAllCollapsed?: boolean;
152 /** Whether the header is sizing */
153 isSizing?: boolean;
154 /** Whether checkbox is hidden */
155 isCheckboxHidden?: boolean;
156 cellStyleProps?: ICellStyleProps;
157};
158/**
159 * {@docCategory DetailsList}
160 */
161export interface IDetailsHeaderStyles {
162 root: IStyle;
163 check: IStyle;
164 /**
165 * @deprecated Not used
166 */
167 cellWrapperPadded: IStyle;
168 cellIsCheck: IStyle;
169 /**
170 * @deprecated Not used
171 */
172 cellIsActionable: IStyle;
173 /**
174 * @deprecated Not used
175 */
176 cellIsEmpty: IStyle;
177 cellSizer: IStyle;
178 cellSizerStart: IStyle;
179 cellSizerEnd: IStyle;
180 cellIsResizing: IStyle;
181 cellIsGroupExpander: IStyle;
182 collapseButton: IStyle;
183 checkTooltip: IStyle;
184 sizingOverlay: IStyle;
185 dropHintCircleStyle: IStyle;
186 dropHintCaretStyle: IStyle;
187 dropHintLineStyle: IStyle;
188 dropHintStyle: IStyle;
189 accessibleLabel: IStyle;
190}