react-virtuoso 2.6.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Grid.d.ts +64 -22
- package/dist/List.d.ts +267 -86
- package/dist/Table.d.ts +213 -67
- package/dist/components.d.ts +1453 -73
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/interfaces.d.ts +71 -31
- package/package.json +1 -1
package/dist/interfaces.d.ts
CHANGED
|
@@ -3,12 +3,12 @@ export interface ListRange {
|
|
|
3
3
|
startIndex: number;
|
|
4
4
|
endIndex: number;
|
|
5
5
|
}
|
|
6
|
-
export interface ItemContent<D> {
|
|
7
|
-
(index: number, data: D): ReactNode;
|
|
6
|
+
export interface ItemContent<D, C> {
|
|
7
|
+
(index: number, data: D, context: C): ReactNode;
|
|
8
8
|
}
|
|
9
9
|
export declare type FixedHeaderContent = (() => React.ReactChildren | React.ReactNode) | null;
|
|
10
|
-
export interface GroupItemContent<D> {
|
|
11
|
-
(index: number, groupIndex: number, data: D): ReactNode;
|
|
10
|
+
export interface GroupItemContent<D, C> {
|
|
11
|
+
(index: number, groupIndex: number, data: D, context: C): ReactNode;
|
|
12
12
|
}
|
|
13
13
|
export interface GroupContent {
|
|
14
14
|
(index: number): ReactNode;
|
|
@@ -63,86 +63,118 @@ export interface GridScrollSeekPlaceholderProps {
|
|
|
63
63
|
/**
|
|
64
64
|
* Customize the Virtuoso rendering by passing a set of custom components.
|
|
65
65
|
*/
|
|
66
|
-
export interface Components {
|
|
66
|
+
export interface Components<Context = unknown> {
|
|
67
67
|
/**
|
|
68
68
|
* Set to render a component at the top of the list.
|
|
69
69
|
*
|
|
70
70
|
* The header remains above the top items and does not remain sticky.
|
|
71
71
|
*/
|
|
72
|
-
Header?: ComponentType
|
|
72
|
+
Header?: ComponentType<{
|
|
73
|
+
context?: Context;
|
|
74
|
+
}>;
|
|
73
75
|
/**
|
|
74
76
|
* Set to render a component at the bottom of the list.
|
|
75
77
|
*/
|
|
76
|
-
Footer?: ComponentType
|
|
78
|
+
Footer?: ComponentType<{
|
|
79
|
+
context?: Context;
|
|
80
|
+
}>;
|
|
77
81
|
/**
|
|
78
82
|
* Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
79
83
|
*/
|
|
80
|
-
Item?: ComponentType<ItemProps
|
|
84
|
+
Item?: ComponentType<ItemProps & {
|
|
85
|
+
context?: Context;
|
|
86
|
+
}>;
|
|
81
87
|
/**
|
|
82
88
|
* Set to customize the group item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
83
89
|
*/
|
|
84
|
-
Group?: ComponentType<GroupProps
|
|
90
|
+
Group?: ComponentType<GroupProps & {
|
|
91
|
+
context?: Context;
|
|
92
|
+
}>;
|
|
85
93
|
/**
|
|
86
94
|
* Set to customize the top list item wrapping element. Use if you would like to render list from elements different than a `div`
|
|
87
95
|
* or you want to set a custom z-index for the sticky position.
|
|
88
96
|
*/
|
|
89
|
-
TopItemList?: ComponentType<TopItemListProps
|
|
97
|
+
TopItemList?: ComponentType<TopItemListProps & {
|
|
98
|
+
context?: Context;
|
|
99
|
+
}>;
|
|
90
100
|
/**
|
|
91
101
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
92
102
|
* as the component passes its HTML attribute props to it.
|
|
93
103
|
*/
|
|
94
|
-
Scroller?: ComponentType<ScrollerProps
|
|
104
|
+
Scroller?: ComponentType<ScrollerProps & {
|
|
105
|
+
context?: Context;
|
|
106
|
+
}>;
|
|
95
107
|
/**
|
|
96
108
|
* Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
|
|
97
109
|
*/
|
|
98
|
-
List?: ComponentType<ListProps
|
|
110
|
+
List?: ComponentType<ListProps & {
|
|
111
|
+
context?: Context;
|
|
112
|
+
}>;
|
|
99
113
|
/**
|
|
100
114
|
* Set to render a custom UI when the list is empty.
|
|
101
115
|
*/
|
|
102
|
-
EmptyPlaceholder?: ComponentType
|
|
116
|
+
EmptyPlaceholder?: ComponentType<{
|
|
117
|
+
context?: Context;
|
|
118
|
+
}>;
|
|
103
119
|
/**
|
|
104
120
|
* Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
|
|
105
121
|
*/
|
|
106
|
-
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps
|
|
122
|
+
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
|
|
123
|
+
context?: Context;
|
|
124
|
+
}>;
|
|
107
125
|
}
|
|
108
126
|
/**
|
|
109
127
|
* Customize the TableVirtuoso rendering by passing a set of custom components.
|
|
110
128
|
*/
|
|
111
|
-
export interface TableComponents {
|
|
129
|
+
export interface TableComponents<Context = unknown> {
|
|
112
130
|
/**
|
|
113
131
|
* Set to customize the wrapping `table` element.
|
|
114
132
|
*
|
|
115
133
|
*/
|
|
116
|
-
Table?: ComponentType<TableProps
|
|
134
|
+
Table?: ComponentType<TableProps & {
|
|
135
|
+
context?: Context;
|
|
136
|
+
}>;
|
|
117
137
|
/**
|
|
118
138
|
* Set to render a fixed header at the top of the table (`thead`). use [[fixedHeaderHeight]] to set the contents
|
|
119
139
|
*
|
|
120
140
|
*/
|
|
121
|
-
TableHead?: ComponentType
|
|
141
|
+
TableHead?: ComponentType<{
|
|
142
|
+
context?: Context;
|
|
143
|
+
}>;
|
|
122
144
|
/**
|
|
123
145
|
* Set to customize the item wrapping element. Default is `tr`.
|
|
124
146
|
*/
|
|
125
|
-
TableRow?: ComponentType<ItemProps
|
|
147
|
+
TableRow?: ComponentType<ItemProps & {
|
|
148
|
+
context?: Context;
|
|
149
|
+
}>;
|
|
126
150
|
/**
|
|
127
151
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
128
152
|
* as the component passes its HTML attribute props to it.
|
|
129
153
|
*/
|
|
130
|
-
Scroller?: ComponentType<ScrollerProps
|
|
154
|
+
Scroller?: ComponentType<ScrollerProps & {
|
|
155
|
+
context?: Context;
|
|
156
|
+
}>;
|
|
131
157
|
/**
|
|
132
158
|
* Set to customize the items wrapper. Default is `tbody`.
|
|
133
159
|
*/
|
|
134
|
-
TableBody?: ComponentType<ListProps
|
|
160
|
+
TableBody?: ComponentType<ListProps & {
|
|
161
|
+
context?: Context;
|
|
162
|
+
}>;
|
|
135
163
|
/**
|
|
136
164
|
* Set to render a custom UI when the list is empty.
|
|
137
165
|
*/
|
|
138
|
-
EmptyPlaceholder?: ComponentType
|
|
166
|
+
EmptyPlaceholder?: ComponentType<{
|
|
167
|
+
context?: Context;
|
|
168
|
+
}>;
|
|
139
169
|
/**
|
|
140
170
|
* Set to render an item placeholder when the user scrolls fast. See the `scrollSeek` property for more details.
|
|
141
171
|
*/
|
|
142
|
-
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps
|
|
172
|
+
ScrollSeekPlaceholder?: ComponentType<ScrollSeekPlaceholderProps & {
|
|
173
|
+
context?: Context;
|
|
174
|
+
}>;
|
|
143
175
|
}
|
|
144
|
-
export interface ComputeItemKey<D> {
|
|
145
|
-
(index: number, item: D): Key;
|
|
176
|
+
export interface ComputeItemKey<D, C> {
|
|
177
|
+
(index: number, item: D, context: C): Key;
|
|
146
178
|
}
|
|
147
179
|
export interface ScrollSeekToggle {
|
|
148
180
|
(velocity: number, range: ListRange): boolean;
|
|
@@ -206,31 +238,39 @@ export interface GridItem {
|
|
|
206
238
|
'data-index': number;
|
|
207
239
|
className?: string;
|
|
208
240
|
}
|
|
209
|
-
export interface GridComponents {
|
|
241
|
+
export interface GridComponents<Context = any> {
|
|
210
242
|
/**
|
|
211
243
|
* Set to customize the item wrapping element. Use only if you would like to render list from elements different than a `div`.
|
|
212
244
|
*/
|
|
213
|
-
Item?: ComponentType<GridItem
|
|
245
|
+
Item?: ComponentType<GridItem & {
|
|
246
|
+
context?: Context;
|
|
247
|
+
}>;
|
|
214
248
|
/**
|
|
215
249
|
* Set to customize the outermost scrollable element. This should not be necessary in general,
|
|
216
250
|
* as the component passes its HTML attribute props to it.
|
|
217
251
|
*/
|
|
218
|
-
Scroller?: ComponentType<ScrollerProps
|
|
252
|
+
Scroller?: ComponentType<ScrollerProps & {
|
|
253
|
+
context?: Context;
|
|
254
|
+
}>;
|
|
219
255
|
/**
|
|
220
256
|
* Set to customize the items wrapper. Use only if you would like to render list from elements different than a `div`.
|
|
221
257
|
*/
|
|
222
|
-
List?: ComponentType<GridListProps
|
|
258
|
+
List?: ComponentType<GridListProps & {
|
|
259
|
+
context?: Context;
|
|
260
|
+
}>;
|
|
223
261
|
/**
|
|
224
262
|
* Set to render an item placeholder when the user scrolls fast.
|
|
225
263
|
* See the `scrollSeekConfiguration` property for more details.
|
|
226
264
|
*/
|
|
227
|
-
ScrollSeekPlaceholder?: ComponentType<GridScrollSeekPlaceholderProps
|
|
265
|
+
ScrollSeekPlaceholder?: ComponentType<GridScrollSeekPlaceholderProps & {
|
|
266
|
+
context?: Context;
|
|
267
|
+
}>;
|
|
228
268
|
}
|
|
229
269
|
export interface GridComputeItemKey {
|
|
230
270
|
(index: number): Key;
|
|
231
271
|
}
|
|
232
|
-
export interface GridItemContent {
|
|
233
|
-
(index: number): ReactNode;
|
|
272
|
+
export interface GridItemContent<C> {
|
|
273
|
+
(index: number, context: C): ReactNode;
|
|
234
274
|
}
|
|
235
275
|
export interface WindowViewportInfo {
|
|
236
276
|
offsetTop: number;
|