-
Notifications
You must be signed in to change notification settings - Fork 415
Expand file tree
/
Copy pathIListView.ts
More file actions
163 lines (154 loc) · 3.92 KB
/
IListView.ts
File metadata and controls
163 lines (154 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import { IColumn, IGroup, SelectionMode, IDetailsRowProps } from '@fluentui/react/lib/DetailsList';
export { SelectionMode };
export enum GroupOrder {
ascending = 1,
descending
}
export interface IListViewProps {
/**
* Specify if drag and drop option is selected.
**/
dragDropFiles?: boolean;
/**
* Handler to return the files from drag and drop.
**/
onDrop?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Specify the name of the file URL path which will be used to show the file icon.
*/
iconFieldName?: string;
/**
* The items to render.
*/
items?: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* The fields you want to view in your list view
*/
viewFields?: IViewField[];
/**
* The fields you want to group your list view by
*/
groupByFields?: IGrouping[];
/**
* Boolean value to indicate if the component should render in compact mode.
* Set to false by default
*/
compact?: boolean;
/**
* Specify the item selection mode.
* By default this is set to none.
*/
selectionMode?: SelectionMode;
/**
* Selection event that passes the selected item(s)
*/
selection?: (items: any[]) => void; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* The index of the items to be select by default
*/
defaultSelection?: number[];
/**
* Specify the placeholder for the filter text box. Default 'Search'
*/
filterPlaceHolder?: string;
/**
* Specify if the filter text box should be rendered.
*/
showFilter?: boolean;
/**
* Specify the initial filter to be applied to the list.
*/
defaultFilter?: string;
/**
* Boolean value to create a fixed/sticky header.
* Set to false by default
*/
stickyHeader?: boolean;
/**
* Callback to override the default row rendering.
*/
onRenderRow?: (props: IDetailsRowProps) => JSX.Element | undefined;
/**
* Class name to apply additional styles on list view wrapper
*/
className?: string;
/**
* Class name to apply additional styles on list view
*/
listClassName?: string;
/**
* Custom sorting function.
* @returns sorted collection of items
*/
sortItems?: (items: any[], columnName: string, descending: boolean) => any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Specify if items should be flatten or not.
* Default value is `true`.
*/
flattenItems?: boolean;
}
export interface IListViewState {
/**
* Current value of the filter input
*/
filterValue?: string;
/**
* The items to render.
*/
items?: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
/**
* Given column definitions.
* If none are provided, default columns will be created based on the item's properties.
*/
columns?: IColumn[];
/**
* Grouping applied to the view.
*/
groups?: IGroup[];
}
export interface IGrouping {
name: string;
order: GroupOrder;
}
export interface IGroupsItems {
items: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
groups: IGroup[];
}
export interface IViewField {
/**
* Name of the field
*/
name: string;
/**
* Name of the field that will be used as the column title
*/
displayName?: string;
/**
* Specify the field name that needs to be used to render a link
*/
linkPropertyName?: string;
/**
* Specify if you want to enable column sorting
*/
sorting?: boolean;
/**
* Specify the minimum width of the column
*/
minWidth?: number;
/**
* Specify the maximum width of the column
*/
maxWidth?: number;
/**
* Determines if the column can be resized.
*/
isResizable?: boolean;
/**
* Determines if the column should be rendered as multiline.
*/
isMultiline?: boolean;
/**
* Override the render method of the field
*/
render?: (item?: any, index?: number, column?: IColumn) => any; // eslint-disable-line @typescript-eslint/no-explicit-any
}