@ringcentral/juno 2.4.1 → 2.5.0
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/components/Buttons/IconButton/IconButton.d.ts +6 -2
- package/components/Buttons/IconButton/IconButton.js +9 -7
- package/components/Buttons/IconButton/styles/StyledIconButton.js +15 -7
- package/components/Buttons/IconButton/utils/IconButtonUtils.d.ts +1 -1
- package/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
- package/components/Dialer/DialPad/DialPad.d.ts +25 -7
- package/components/Dialer/DialPad/DialPad.js +6 -6
- package/components/Dialer/DialPad/utils/useDialKeyboard.d.ts +8 -9
- package/components/Dialer/DialTextField/DialTextField.d.ts +3 -1
- package/components/Dialer/DialTextField/DialTextField.js +7 -6
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
- package/components/Downshift/SuggestionList/SuggestionList.js +4 -1
- package/components/Downshift/styles/DownshiftStyle.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledDatePickerHeader.d.ts +1 -1
- package/components/Forms/Picker/DatePicker/styles/StyledYear.d.ts +1 -1
- package/components/Forms/Picker/TimePicker/styles/StyledSelectionItem.d.ts +1 -1
- package/components/Forms/Picker/TimePicker/styles/StyledTimeIconButton.d.ts +1 -1
- package/components/Forms/Picker/styles/PickerBaseIconButton.d.ts +1 -1
- package/components/Forms/TextField/styles/ClearIconButton.d.ts +2 -2
- package/components/Grid/Grid.d.ts +1 -1
- package/components/Pagination/Pagination/Pagination.d.ts +1 -1
- package/components/Stepper/StepButton/StepButton.d.ts +1 -1
- package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
- package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/components/Table/types.d.ts +1 -1
- package/components/TablePagination/TablePagination.d.ts +1 -1
- package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
- package/components/VirtualizedMenu/VirtualizedMenuList.js +7 -14
- package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
- package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
- package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
- package/components/Virtuoso/react-virtuoso/List.js +83 -70
- package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
- package/components/Virtuoso/react-virtuoso/Table.js +184 -0
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
- package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
- package/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
- package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
- package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
- package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
- package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
- package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/index.js +2 -0
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
- package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
- package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
- package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
- package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
- package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
- package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
- package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
- package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
- package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
- package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +4 -0
- package/components/Virtuoso/utils/useHighlightScroll.js +17 -0
- package/es6/components/Buttons/IconButton/IconButton.js +11 -9
- package/es6/components/Buttons/IconButton/styles/StyledIconButton.js +16 -8
- package/es6/components/Buttons/IconButton/utils/IconButtonUtils.js +9 -1
- package/es6/components/Dialer/DialPad/DialPad.js +6 -6
- package/es6/components/Dialer/DialTextField/DialTextField.js +7 -6
- package/es6/components/Downshift/SuggestionList/SuggestionList.js +5 -2
- package/es6/components/Table/TableCell/TableCell.js +2 -2
- package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +9 -16
- package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
- package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
- package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
- package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
- package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
- package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
- package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
- package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
- package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
- package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
- package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
- package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
- package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
- package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
- package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
- package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/es6/components/Virtuoso/utils/useHighlightScroll.js +16 -0
- package/es6/foundation/hooks/useLongPress/useLongPress.js +7 -7
- package/es6/foundation/index.js +1 -1
- package/es6/foundation/isWebKit154.js +57 -0
- package/es6/foundation/theme/ThemeProvider.js +4 -4
- package/foundation/hooks/useLongPress/useLongPress.d.ts +3 -1
- package/foundation/hooks/useLongPress/useLongPress.js +7 -7
- package/foundation/index.d.ts +1 -1
- package/foundation/index.js +1 -1
- package/foundation/isWebKit154.d.ts +20 -0
- package/foundation/{isSafari154.js → isWebKit154.js} +22 -17
- package/foundation/theme/ThemeProvider.d.ts +1 -1
- package/foundation/theme/ThemeProvider.js +4 -4
- package/package.json +2 -2
- package/es6/foundation/isSafari154.js +0 -52
- package/foundation/isSafari154.d.ts +0 -15
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { Components, ComputeItemKey, FollowOutput, GroupContent, GroupItemContent, IndexLocationWithAlign, ItemContent, ListItem, ListRange, ScrollSeekConfiguration } from './interfaces';
|
|
4
|
-
|
|
5
|
-
declare type CompProps<T> = T extends React.ForwardRefExoticComponent<infer R> ? R : never;
|
|
6
|
-
declare type ListProps = CompProps<typeof List>;
|
|
7
|
-
declare type GridProps = CompProps<typeof Grid>;
|
|
8
|
-
export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'groupContent' | 'itemsRendered'> {
|
|
1
|
+
/// <reference types="styled-jsx" />
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { Components, ComputeItemKey, FixedHeaderContent, FollowOutput, GridComponents, GridComputeItemKey, GridItemContent, GridRootProps, GroupContent, GroupItemContent, IndexLocationWithAlign, ItemContent, ListItem, ListRange, ListRootProps, ScrollIntoViewLocation, ScrollSeekConfiguration, TableComponents } from './interfaces';
|
|
4
|
+
export interface VirtuosoProps<D, C> extends ListRootProps {
|
|
9
5
|
/**
|
|
10
6
|
* The total amount of items to be rendered.
|
|
11
7
|
*/
|
|
@@ -15,14 +11,35 @@ export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'group
|
|
|
15
11
|
*/
|
|
16
12
|
data?: readonly D[];
|
|
17
13
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
* Additional context available in the custom components and content callbacks
|
|
15
|
+
*/
|
|
16
|
+
context?: C;
|
|
17
|
+
/**
|
|
18
|
+
* *The property accepts pixel values.*
|
|
19
|
+
*
|
|
20
|
+
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
21
|
+
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
22
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
23
|
+
* See the `increaseViewportBy` property for a similar behavior (equivalent to the `overscan` in react-window).
|
|
24
|
+
*
|
|
21
25
|
*/
|
|
22
26
|
overscan?: number | {
|
|
23
27
|
main: number;
|
|
24
28
|
reverse: number;
|
|
25
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* *The property accepts pixel values.*
|
|
33
|
+
*
|
|
34
|
+
* Set the increaseViewportBy property to artificially increase the viewport size, causing items to be rendered before outside of the viewport.
|
|
35
|
+
* The property causes the component to render more items than the necessary, but can help with slow loading content.
|
|
36
|
+
* Using `{ top?: number, bottom?: number }` lets you set the increase for each end separately.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
increaseViewportBy?: number | {
|
|
40
|
+
top: number;
|
|
41
|
+
bottom: number;
|
|
42
|
+
};
|
|
26
43
|
/**
|
|
27
44
|
* Set the amount of items to remain fixed at the top of the list.
|
|
28
45
|
*
|
|
@@ -31,8 +48,9 @@ export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'group
|
|
|
31
48
|
topItemCount?: number;
|
|
32
49
|
/**
|
|
33
50
|
* Set to a value between 0 and totalCount - 1 to make the list start scrolled to that item.
|
|
51
|
+
* Pass in an object to achieve additional effects similar to `scrollToIndex`.
|
|
34
52
|
*/
|
|
35
|
-
initialTopMostItemIndex?: number;
|
|
53
|
+
initialTopMostItemIndex?: number | IndexLocationWithAlign;
|
|
36
54
|
/**
|
|
37
55
|
* Set this value to offset the initial location of the list.
|
|
38
56
|
* Warning: using this property will still run a render cycle at the scrollTop: 0 list window.
|
|
@@ -47,15 +65,15 @@ export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'group
|
|
|
47
65
|
/**
|
|
48
66
|
* Use the `components` property for advanced customization of the elements rendered by the list.
|
|
49
67
|
*/
|
|
50
|
-
components?: Components
|
|
68
|
+
components?: Components<C>;
|
|
51
69
|
/**
|
|
52
70
|
* Set the callback to specify the contents of the item.
|
|
53
71
|
*/
|
|
54
|
-
itemContent?: ItemContent<D>;
|
|
72
|
+
itemContent?: ItemContent<D, C>;
|
|
55
73
|
/**
|
|
56
74
|
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
57
75
|
*/
|
|
58
|
-
computeItemKey?: ComputeItemKey
|
|
76
|
+
computeItemKey?: ComputeItemKey<D, C>;
|
|
59
77
|
/**
|
|
60
78
|
* By default, the component assumes the default item height from the first rendered item (rendering it as a "probe").
|
|
61
79
|
*
|
|
@@ -69,14 +87,9 @@ export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'group
|
|
|
69
87
|
/**
|
|
70
88
|
* Allows customizing the height/width calculation of `Item` elements.
|
|
71
89
|
*
|
|
72
|
-
* The default implementation reads `el.
|
|
90
|
+
* The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
|
|
73
91
|
*/
|
|
74
92
|
itemSize?: (el: HTMLElement, field: 'offsetHeight' | 'offsetWidth') => number;
|
|
75
|
-
/**
|
|
76
|
-
* Custom window object for use different window instance
|
|
77
|
-
*
|
|
78
|
-
* The default will be browser `window`
|
|
79
|
-
*/
|
|
80
93
|
/**
|
|
81
94
|
* Can be used to improve performance if the rendered items are of known size.
|
|
82
95
|
* Setting it causes the component to skip item measurements.
|
|
@@ -161,12 +174,20 @@ export interface VirtuosoProps<D> extends Omit<ListProps, 'groupCounts' | 'group
|
|
|
161
174
|
* Uses the document scroller rather than wrapping the list in its own.
|
|
162
175
|
*/
|
|
163
176
|
useWindowScroll?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Pass a reference to a scrollable parent element, so that the list won't wrap in its own.
|
|
179
|
+
*/
|
|
180
|
+
customScrollParent?: HTMLElement;
|
|
164
181
|
/**
|
|
165
182
|
* Provides access to the root DOM element
|
|
166
183
|
*/
|
|
167
184
|
scrollerRef?: (ref: HTMLElement | Window | null) => any;
|
|
185
|
+
/**
|
|
186
|
+
* By default `4`. Redefine to change how much away from the bottom the scroller can be before the list is not considered not at bottom.
|
|
187
|
+
*/
|
|
188
|
+
atBottomThreshold?: number;
|
|
168
189
|
}
|
|
169
|
-
export interface GroupedVirtuosoProps<D> extends Omit<VirtuosoProps<D>, 'totalCount' | 'itemContent'
|
|
190
|
+
export interface GroupedVirtuosoProps<D, C> extends Omit<VirtuosoProps<D, C>, 'totalCount' | 'itemContent'> {
|
|
170
191
|
/**
|
|
171
192
|
* Specifies the amount of items in each group (and, actually, how many groups are there).
|
|
172
193
|
* For example, passing [20, 30] will display 2 groups with 20 and 30 items each.
|
|
@@ -179,25 +200,193 @@ export interface GroupedVirtuosoProps<D> extends Omit<VirtuosoProps<D>, 'totalCo
|
|
|
179
200
|
/**
|
|
180
201
|
* Specifies how each each item gets rendered.
|
|
181
202
|
*/
|
|
182
|
-
itemContent?: GroupItemContent<D>;
|
|
203
|
+
itemContent?: GroupItemContent<D, C>;
|
|
204
|
+
}
|
|
205
|
+
export interface TableVirtuosoProps<D, C> extends Omit<VirtuosoProps<D, C>, 'components' | 'headerFooterTag' | 'topItemCount'> {
|
|
206
|
+
/**
|
|
207
|
+
* Use the `components` property for advanced customization of the elements rendered by the table.
|
|
208
|
+
*/
|
|
209
|
+
components?: TableComponents<C>;
|
|
210
|
+
/**
|
|
211
|
+
* Set the contents of the table header.
|
|
212
|
+
*/
|
|
213
|
+
fixedHeaderContent?: FixedHeaderContent;
|
|
214
|
+
/**
|
|
215
|
+
* The total amount of items to be rendered.
|
|
216
|
+
*/
|
|
217
|
+
totalCount?: number;
|
|
218
|
+
/**
|
|
219
|
+
* The data items to be rendered. If data is set, the total count will be inferred from the length of the array.
|
|
220
|
+
*/
|
|
221
|
+
data?: readonly D[];
|
|
222
|
+
/**
|
|
223
|
+
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
224
|
+
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
225
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
226
|
+
* See the `increaseViewportBy` property for a similar behavior (equivalent to the `overscan` in `react-window`).
|
|
227
|
+
*/
|
|
228
|
+
overscan?: number | {
|
|
229
|
+
main: number;
|
|
230
|
+
reverse: number;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Set the increaseViewportBy property to artificially increase the viewport size, causing items to be rendered before outside of the viewport.
|
|
234
|
+
* The property causes the component to render more items than the necessary, but can help with slow loading content.
|
|
235
|
+
* Using `{ top?: number, bottom?: number }` lets you set the increase for each end separately.
|
|
236
|
+
*/
|
|
237
|
+
increaseViewportBy?: number | {
|
|
238
|
+
top: number;
|
|
239
|
+
bottom: number;
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Set to a value between 0 and totalCount - 1 to make the list start scrolled to that item.
|
|
243
|
+
*/
|
|
244
|
+
initialTopMostItemIndex?: number;
|
|
245
|
+
/**
|
|
246
|
+
* Set this value to offset the initial location of the list.
|
|
247
|
+
* Warning: using this property will still run a render cycle at the scrollTop: 0 list window.
|
|
248
|
+
* If possible, avoid using it and stick to `initialTopMostItemIndex` instead.
|
|
249
|
+
*/
|
|
250
|
+
initialScrollTop?: number;
|
|
251
|
+
/**
|
|
252
|
+
* Use for server-side rendering - if set, the list will render the specified amount of items
|
|
253
|
+
* regardless of the container / item size.
|
|
254
|
+
*/
|
|
255
|
+
initialItemCount?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Set the callback to specify the contents of the item.
|
|
258
|
+
*/
|
|
259
|
+
itemContent?: ItemContent<D, C>;
|
|
260
|
+
/**
|
|
261
|
+
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
262
|
+
*/
|
|
263
|
+
computeItemKey?: ComputeItemKey<D, C>;
|
|
264
|
+
/**
|
|
265
|
+
* By default, the component assumes the default item height from the first rendered item (rendering it as a "probe").
|
|
266
|
+
*
|
|
267
|
+
* If the first item turns out to be an outlier (very short or tall), the rest of the rendering will be slower,
|
|
268
|
+
* as multiple passes of rendering should happen for the list to fill the viewport.
|
|
269
|
+
*
|
|
270
|
+
* Setting `defaultItemHeight` causes the component to skip the "probe" rendering and use the property
|
|
271
|
+
* value as default height instead.
|
|
272
|
+
*/
|
|
273
|
+
defaultItemHeight?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Allows customizing the height/width calculation of `Item` elements.
|
|
276
|
+
*
|
|
277
|
+
* The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
|
|
278
|
+
*/
|
|
279
|
+
itemSize?: (el: HTMLElement, field: 'offsetHeight' | 'offsetWidth') => number;
|
|
280
|
+
/**
|
|
281
|
+
* Can be used to improve performance if the rendered items are of known size.
|
|
282
|
+
* Setting it causes the component to skip item measurements.
|
|
283
|
+
*/
|
|
284
|
+
fixedItemHeight?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Use to display placeholders if the user scrolls fast through the list.
|
|
287
|
+
*
|
|
288
|
+
* Set `components.ScrollSeekPlaceholder` to change the placeholder content.
|
|
289
|
+
*/
|
|
290
|
+
scrollSeekConfiguration?: ScrollSeekConfiguration | false;
|
|
291
|
+
/**
|
|
292
|
+
* If set to `true`, the list automatically scrolls to bottom if the total count is changed.
|
|
293
|
+
* Set to `"smooth"` for an animated scrolling.
|
|
294
|
+
*
|
|
295
|
+
* By default, `followOutput` scrolls down only if the list is already at the bottom.
|
|
296
|
+
* To implement an arbitrary logic behind that, pass a function:
|
|
297
|
+
*
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <Virtuoso
|
|
300
|
+
* followOutput={(isAtBottom: boolean) => {
|
|
301
|
+
* if (expression) {
|
|
302
|
+
* return 'smooth' // can be 'auto' or false to avoid scrolling
|
|
303
|
+
* } else {
|
|
304
|
+
* return false
|
|
305
|
+
* }
|
|
306
|
+
* }} />
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
followOutput?: FollowOutput;
|
|
310
|
+
/**
|
|
311
|
+
* Use when implementing inverse infinite scrolling - decrease the value this property
|
|
312
|
+
* in combination with `data` or `totalCount` to prepend items to the top of the list.
|
|
313
|
+
*
|
|
314
|
+
* Warning: the firstItemIndex should **be a positive number**, based on the total amount of items to be displayed.
|
|
315
|
+
*/
|
|
316
|
+
firstItemIndex?: number;
|
|
317
|
+
/**
|
|
318
|
+
* Called when the list starts/stops scrolling.
|
|
319
|
+
*/
|
|
320
|
+
isScrolling?: (isScrolling: boolean) => void;
|
|
321
|
+
/**
|
|
322
|
+
* Gets called when the user scrolls to the end of the list.
|
|
323
|
+
* Receives the last item index as an argument. Can be used to implement endless scrolling.
|
|
324
|
+
*/
|
|
325
|
+
endReached?: (index: number) => void;
|
|
326
|
+
/**
|
|
327
|
+
* Called when the user scrolls to the start of the list.
|
|
328
|
+
*/
|
|
329
|
+
startReached?: (index: number) => void;
|
|
330
|
+
/**
|
|
331
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
332
|
+
*/
|
|
333
|
+
rangeChanged?: (range: ListRange) => void;
|
|
334
|
+
/**
|
|
335
|
+
* Called with true / false when the list has reached the bottom / gets scrolled up.
|
|
336
|
+
* Can be used to load newer items, like `tail -f`.
|
|
337
|
+
*/
|
|
338
|
+
atBottomStateChange?: (atBottom: boolean) => void;
|
|
339
|
+
/**
|
|
340
|
+
* Called with `true` / `false` when the list has reached the top / gets scrolled down.
|
|
341
|
+
*/
|
|
342
|
+
atTopStateChange?: (atTop: boolean) => void;
|
|
343
|
+
/**
|
|
344
|
+
* Called when the total list height is changed due to new items or viewport resize.
|
|
345
|
+
*/
|
|
346
|
+
totalListHeightChanged?: (height: number) => void;
|
|
347
|
+
/**
|
|
348
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
349
|
+
*/
|
|
350
|
+
itemsRendered?: (items: ListItem<D>[]) => void;
|
|
351
|
+
/**
|
|
352
|
+
* Setting `alignToBottom` to `true` aligns the items to the bottom of the list if the list is shorter than the viewport.
|
|
353
|
+
* Use `followOutput` property to keep the list aligned when new items are appended.
|
|
354
|
+
*/
|
|
355
|
+
alignToBottom?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Uses the document scroller rather than wrapping the list in its own.
|
|
358
|
+
*/
|
|
359
|
+
useWindowScroll?: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Pass a reference to a scrollable parent element, so that the table won't wrap in its own.
|
|
362
|
+
*/
|
|
363
|
+
customScrollParent?: HTMLElement;
|
|
364
|
+
/**
|
|
365
|
+
* Provides access to the root DOM element
|
|
366
|
+
*/
|
|
367
|
+
scrollerRef?: (ref: HTMLElement | Window | null) => any;
|
|
368
|
+
/**
|
|
369
|
+
* By default `4`. Redefine to change how much away from the bottom the scroller can be before the list is not considered not at bottom.
|
|
370
|
+
*/
|
|
371
|
+
atBottomThreshold?: number;
|
|
183
372
|
}
|
|
184
|
-
export interface VirtuosoGridProps extends
|
|
373
|
+
export interface VirtuosoGridProps<C extends unknown = unknown> extends GridRootProps {
|
|
185
374
|
/**
|
|
186
375
|
* The total amount of items to be rendered.
|
|
187
376
|
*/
|
|
188
|
-
totalCount:
|
|
377
|
+
totalCount: number;
|
|
189
378
|
/**
|
|
190
379
|
* Set the callback to specify the contents of the item.
|
|
191
380
|
*/
|
|
192
|
-
itemContent?:
|
|
381
|
+
itemContent?: GridItemContent<C>;
|
|
193
382
|
/**
|
|
194
383
|
* Use the `components` property for advanced customization of the elements rendered by the list.
|
|
195
384
|
*/
|
|
196
|
-
components?:
|
|
385
|
+
components?: GridComponents<C>;
|
|
197
386
|
/**
|
|
198
387
|
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
199
388
|
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
200
|
-
* Setting { main: number, reverse: number } lets you extend the list in both the main and the reverse scrollable directions.
|
|
389
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
201
390
|
*/
|
|
202
391
|
overscan?: number | {
|
|
203
392
|
main: number;
|
|
@@ -206,7 +395,7 @@ export interface VirtuosoGridProps extends GridProps {
|
|
|
206
395
|
/**
|
|
207
396
|
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
208
397
|
*/
|
|
209
|
-
computeItemKey?:
|
|
398
|
+
computeItemKey?: GridComputeItemKey;
|
|
210
399
|
/**
|
|
211
400
|
* Use to display placeholders if the user scrolls fast through the list.
|
|
212
401
|
*
|
|
@@ -255,12 +444,20 @@ export interface VirtuosoGridProps extends GridProps {
|
|
|
255
444
|
* Uses the document scroller rather than wrapping the grid in its own.
|
|
256
445
|
*/
|
|
257
446
|
useWindowScroll?: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Pass a reference to a scrollable parent element, so that the grid won't wrap in its own.
|
|
449
|
+
*/
|
|
450
|
+
customScrollParent?: HTMLElement;
|
|
258
451
|
}
|
|
259
|
-
export interface VirtuosoHandle
|
|
452
|
+
export interface VirtuosoHandle {
|
|
260
453
|
/**
|
|
261
|
-
* Scrolls the component to the specified item index. See {
|
|
454
|
+
* Scrolls the component to the specified item index. See {@link IndexLocationWithAlign} for more options.
|
|
262
455
|
*/
|
|
263
456
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
457
|
+
/**
|
|
458
|
+
* Scrolls the item into view if necessary. See [the website example](http://virtuoso.dev/keyboard-navigation/) for an implementation.
|
|
459
|
+
*/
|
|
460
|
+
scrollIntoView(location: ScrollIntoViewLocation): void;
|
|
264
461
|
/**
|
|
265
462
|
* Scrolls the component to the specified location. See [ScrollToOptions (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions)
|
|
266
463
|
*/
|
|
@@ -270,21 +467,31 @@ export interface VirtuosoHandle extends ListHandle {
|
|
|
270
467
|
*/
|
|
271
468
|
scrollBy(location: ScrollToOptions): void;
|
|
272
469
|
}
|
|
273
|
-
export interface GroupedVirtuosoHandle
|
|
470
|
+
export interface GroupedVirtuosoHandle {
|
|
471
|
+
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
472
|
+
scrollTo(location: ScrollToOptions): void;
|
|
473
|
+
scrollBy(location: ScrollToOptions): void;
|
|
474
|
+
}
|
|
475
|
+
export interface VirtuosoGridHandle {
|
|
274
476
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
275
477
|
scrollTo(location: ScrollToOptions): void;
|
|
276
478
|
scrollBy(location: ScrollToOptions): void;
|
|
277
479
|
}
|
|
278
|
-
export interface
|
|
480
|
+
export interface TableVirtuosoHandle {
|
|
481
|
+
scrollIntoView(location: ScrollIntoViewLocation): void;
|
|
279
482
|
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
280
483
|
scrollTo(location: ScrollToOptions): void;
|
|
281
484
|
scrollBy(location: ScrollToOptions): void;
|
|
282
485
|
}
|
|
283
|
-
export declare const Virtuoso: <
|
|
284
|
-
ref?: ((instance: VirtuosoHandle | null) => void) |
|
|
285
|
-
}) =>
|
|
286
|
-
export declare const GroupedVirtuoso: <
|
|
287
|
-
ref?: ((instance: GroupedVirtuosoHandle | null) => void) |
|
|
288
|
-
}) =>
|
|
289
|
-
export declare const
|
|
290
|
-
|
|
486
|
+
export declare const Virtuoso: <ItemData extends unknown = any, Context extends unknown = any>(props: VirtuosoProps<ItemData, Context> & {
|
|
487
|
+
ref?: ((instance: VirtuosoHandle | null) => void) | import("react").RefObject<VirtuosoHandle> | null | undefined;
|
|
488
|
+
}) => ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
489
|
+
export declare const GroupedVirtuoso: <ItemData extends unknown = any, Context extends unknown = any>(props: GroupedVirtuosoProps<ItemData, Context> & {
|
|
490
|
+
ref?: ((instance: GroupedVirtuosoHandle | null) => void) | import("react").RefObject<GroupedVirtuosoHandle> | null | undefined;
|
|
491
|
+
}) => ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
492
|
+
export declare const TableVirtuoso: <ItemData extends unknown = any, Context extends unknown = any>(props: TableVirtuosoProps<ItemData, Context> & {
|
|
493
|
+
ref?: ((instance: TableVirtuosoHandle | null) => void) | import("react").RefObject<TableVirtuosoHandle> | null | undefined;
|
|
494
|
+
}) => ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
495
|
+
export declare const VirtuosoGrid: <Context extends unknown = any>(props: VirtuosoGridProps<Context> & {
|
|
496
|
+
ref?: ((instance: VirtuosoGridHandle | null) => void) | import("react").RefObject<VirtuosoGridHandle> | null | undefined;
|
|
497
|
+
}) => ReactElement<any, string | ((props: any) => ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var Grid_1 = require("./Grid");
|
|
4
4
|
var List_1 = require("./List");
|
|
5
|
+
var Table_1 = require("./Table");
|
|
5
6
|
exports.Virtuoso = List_1.List;
|
|
6
7
|
exports.GroupedVirtuoso = List_1.List;
|
|
8
|
+
exports.TableVirtuoso = Table_1.Table;
|
|
7
9
|
exports.VirtuosoGrid = Grid_1.Grid;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as u from '@virtuoso.dev/urx';
|
|
2
|
-
export declare const UP: "up";
|
|
3
|
-
export declare const DOWN: "down";
|
|
4
|
-
export declare type ScrollDirection = typeof UP | typeof DOWN;
|
|
5
2
|
export declare const domIOSystem: u.SystemSpec<never[], () => {
|
|
3
|
+
scrollContainerState: u.Stream<[number, number]>;
|
|
6
4
|
scrollTop: u.Stream<number>;
|
|
7
5
|
viewportHeight: u.Stream<number>;
|
|
8
6
|
headerHeight: u.StatefulStream<number>;
|
|
9
7
|
footerHeight: u.StatefulStream<number>;
|
|
8
|
+
scrollHeight: u.Stream<number>;
|
|
10
9
|
smoothScrollTargetReached: u.Stream<true>;
|
|
11
10
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
12
11
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
13
|
-
scrollDirection: u.StatefulStream<ScrollDirection>;
|
|
14
12
|
statefulScrollTop: u.StatefulStream<number>;
|
|
15
13
|
deviation: u.StatefulStream<number>;
|
|
16
14
|
scrollingInProgress: u.StatefulStream<boolean>;
|
|
@@ -2,39 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
|
|
5
|
-
exports.UP = 'up';
|
|
6
|
-
exports.DOWN = 'down';
|
|
7
5
|
exports.domIOSystem = u.system(function () {
|
|
6
|
+
var scrollContainerState = u.stream();
|
|
8
7
|
var scrollTop = u.stream();
|
|
9
8
|
var deviation = u.statefulStream(0);
|
|
10
9
|
var smoothScrollTargetReached = u.stream();
|
|
11
10
|
var statefulScrollTop = u.statefulStream(0);
|
|
12
11
|
var viewportHeight = u.stream();
|
|
12
|
+
var scrollHeight = u.stream();
|
|
13
13
|
var headerHeight = u.statefulStream(0);
|
|
14
14
|
var footerHeight = u.statefulStream(0);
|
|
15
15
|
var scrollTo = u.stream();
|
|
16
16
|
var scrollBy = u.stream();
|
|
17
17
|
var scrollingInProgress = u.statefulStream(false);
|
|
18
|
+
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
19
|
+
var _b = tslib_1.__read(_a, 1), scrollTop = _b[0];
|
|
20
|
+
return scrollTop;
|
|
21
|
+
})), scrollTop);
|
|
22
|
+
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
23
|
+
var _b = tslib_1.__read(_a, 2), scrollHeight = _b[1];
|
|
24
|
+
return scrollHeight;
|
|
25
|
+
})), scrollHeight);
|
|
18
26
|
u.connect(scrollTop, statefulScrollTop);
|
|
19
|
-
var scrollDirection = u.statefulStream(exports.DOWN);
|
|
20
|
-
u.connect(u.pipe(scrollTop, u.scan(function (acc, scrollTop) {
|
|
21
|
-
return {
|
|
22
|
-
direction: scrollTop < acc.prevScrollTop ? exports.UP : exports.DOWN,
|
|
23
|
-
prevScrollTop: scrollTop,
|
|
24
|
-
};
|
|
25
|
-
}, { direction: exports.DOWN, prevScrollTop: 0 }), u.map(function (value) { return value.direction; })), scrollDirection);
|
|
26
27
|
return {
|
|
27
28
|
// input
|
|
29
|
+
scrollContainerState: scrollContainerState,
|
|
28
30
|
scrollTop: scrollTop,
|
|
29
31
|
viewportHeight: viewportHeight,
|
|
30
32
|
headerHeight: headerHeight,
|
|
31
33
|
footerHeight: footerHeight,
|
|
34
|
+
scrollHeight: scrollHeight,
|
|
32
35
|
smoothScrollTargetReached: smoothScrollTargetReached,
|
|
33
36
|
// signals
|
|
34
37
|
scrollTo: scrollTo,
|
|
35
38
|
scrollBy: scrollBy,
|
|
36
39
|
// state
|
|
37
|
-
scrollDirection: scrollDirection,
|
|
38
40
|
statefulScrollTop: statefulScrollTop,
|
|
39
41
|
deviation: deviation,
|
|
40
42
|
scrollingInProgress: scrollingInProgress,
|