@ringcentral/juno 2.40.1 → 2.41.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/Downshift/SuggestionList/SuggestionList.d.ts +3 -3
- package/components/Downshift/utils/useDownshift.d.ts +1 -1
- package/components/Virtuoso/index.d.ts +1 -1
- package/components/Virtuoso/index.js +1 -1
- package/components/Virtuoso/react-virtuoso/AATree.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/AATree.js +60 -48
- package/components/Virtuoso/react-virtuoso/TableVirtuoso.d.ts +5 -0
- package/components/Virtuoso/react-virtuoso/TableVirtuoso.js +217 -0
- package/components/Virtuoso/react-virtuoso/Virtuoso.d.ts +7696 -0
- package/components/Virtuoso/react-virtuoso/Virtuoso.js +317 -0
- package/components/Virtuoso/react-virtuoso/{Grid.d.ts → VirtuosoGrid.d.ts} +170 -72
- package/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +199 -0
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +119 -65
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
- package/components/Virtuoso/react-virtuoso/comparators.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/comparators.js +1 -3
- package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.d.ts +194 -0
- package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +2 -0
- package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.d.ts +274 -0
- package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +2 -0
- package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.d.ts +125 -0
- package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +2 -0
- package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +3 -2
- package/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
- package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +80 -43
- package/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
- package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +57 -31
- package/components/Virtuoso/react-virtuoso/gridSystem.js +173 -86
- package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +76 -67
- package/components/Virtuoso/react-virtuoso/groupedListSystem.js +12 -12
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +6 -3
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +36 -17
- package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +3 -2
- package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.d.ts +2 -0
- package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +5 -0
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +2 -3
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +36 -51
- package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -3
- package/components/Virtuoso/react-virtuoso/hooks/useSize.js +13 -13
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +17 -15
- package/components/Virtuoso/react-virtuoso/index.d.ts +7 -1
- package/components/Virtuoso/react-virtuoso/index.js +8 -1
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +304 -68
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +9 -31
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +127 -109
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +38 -22
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
- package/components/Virtuoso/react-virtuoso/interfaces.d.ts +150 -51
- package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +109 -59
- package/components/Virtuoso/react-virtuoso/listStateSystem.js +100 -52
- package/components/Virtuoso/react-virtuoso/listSystem.d.ts +1691 -693
- package/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
- package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
- package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
- package/components/Virtuoso/react-virtuoso/react-urx/index.d.ts +110 -0
- package/components/Virtuoso/react-virtuoso/react-urx/index.js +200 -0
- package/components/Virtuoso/react-virtuoso/react-urx/package.json +5 -0
- package/components/Virtuoso/react-virtuoso/recalcSystem.d.ts +4 -0
- package/components/Virtuoso/react-virtuoso/recalcSystem.js +8 -0
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +144 -78
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +33 -21
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +12 -7
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +19 -11
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +7 -6
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +15 -27
- package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +20 -11
- package/components/Virtuoso/react-virtuoso/sizeSystem.js +182 -52
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +8 -5
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
- package/components/Virtuoso/react-virtuoso/stateLoadSystem.d.ts +318 -0
- package/components/Virtuoso/react-virtuoso/stateLoadSystem.js +41 -0
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +518 -467
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +115 -63
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +139 -73
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +74 -31
- package/components/Virtuoso/react-virtuoso/urx/actions.d.ts +127 -0
- package/components/Virtuoso/react-virtuoso/urx/actions.js +98 -0
- package/components/Virtuoso/react-virtuoso/urx/constants.d.ts +8 -0
- package/components/Virtuoso/react-virtuoso/urx/constants.js +6 -0
- package/components/Virtuoso/react-virtuoso/urx/index.d.ts +6 -0
- package/components/Virtuoso/react-virtuoso/urx/index.js +9 -0
- package/components/Virtuoso/react-virtuoso/urx/package.json +5 -0
- package/components/Virtuoso/react-virtuoso/urx/pipe.d.ts +220 -0
- package/components/Virtuoso/react-virtuoso/urx/pipe.js +279 -0
- package/components/Virtuoso/react-virtuoso/urx/streams.d.ts +143 -0
- package/components/Virtuoso/react-virtuoso/urx/streams.js +227 -0
- package/components/Virtuoso/react-virtuoso/urx/system.d.ts +148 -0
- package/components/Virtuoso/react-virtuoso/urx/system.js +106 -0
- package/components/Virtuoso/react-virtuoso/urx/transformers.d.ts +71 -0
- package/components/Virtuoso/react-virtuoso/urx/transformers.js +106 -0
- package/components/Virtuoso/react-virtuoso/urx/utils.d.ts +57 -0
- package/components/Virtuoso/react-virtuoso/urx/utils.js +102 -0
- package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +6 -0
- package/components/Virtuoso/react-virtuoso/utils/context.d.ts +13 -0
- package/components/Virtuoso/react-virtuoso/utils/context.js +6 -0
- package/components/Virtuoso/react-virtuoso/utils/skipFrames.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/skipFrames.js +11 -0
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +6 -4
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
- package/components/Virtuoso/utils/isOutOfRange.d.ts +1 -1
- package/components/Virtuoso/utils/useHighlightScroll.d.ts +2 -2
- package/es6/components/Virtuoso/index.js +1 -1
- package/es6/components/Virtuoso/react-virtuoso/AATree.js +60 -48
- package/es6/components/Virtuoso/react-virtuoso/{Table.js → TableVirtuoso.js} +73 -52
- package/es6/components/Virtuoso/react-virtuoso/{List.js → Virtuoso.js} +85 -161
- package/es6/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +198 -0
- package/es6/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
- package/es6/components/Virtuoso/react-virtuoso/comparators.js +1 -3
- package/es6/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +0 -0
- package/es6/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +0 -0
- package/es6/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +0 -0
- package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
- package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
- package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +173 -87
- package/es6/components/Virtuoso/react-virtuoso/groupedListSystem.js +13 -13
- package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +35 -16
- package/es6/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +2 -2
- package/es6/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +2 -0
- package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +35 -50
- package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +11 -12
- package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +15 -14
- package/es6/components/Virtuoso/react-virtuoso/index.js +4 -1
- package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +11 -33
- package/es6/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
- package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
- package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +101 -54
- package/es6/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
- package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
- package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
- package/es6/components/Virtuoso/react-virtuoso/react-urx/index.js +197 -0
- package/es6/components/Virtuoso/react-virtuoso/recalcSystem.js +5 -0
- package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +34 -22
- package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
- package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
- package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +16 -28
- package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +180 -53
- package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
- package/es6/components/Virtuoso/react-virtuoso/stateLoadSystem.js +39 -0
- package/es6/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
- package/es6/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
- package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +75 -32
- package/es6/components/Virtuoso/react-virtuoso/urx/actions.js +90 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/constants.js +4 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/index.js +6 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/pipe.js +266 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/streams.js +220 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/system.js +102 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/transformers.js +101 -0
- package/es6/components/Virtuoso/react-virtuoso/urx/utils.js +88 -0
- package/es6/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +3 -0
- package/es6/components/Virtuoso/react-virtuoso/utils/context.js +3 -0
- package/es6/components/Virtuoso/react-virtuoso/utils/skipFrames.js +8 -0
- package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
- package/package.json +2 -2
- package/components/Virtuoso/Virtuoso.d.ts +0 -1
- package/components/Virtuoso/Virtuoso.js +0 -4
- package/components/Virtuoso/react-virtuoso/Grid.js +0 -168
- package/components/Virtuoso/react-virtuoso/List.d.ts +0 -6749
- package/components/Virtuoso/react-virtuoso/List.js +0 -393
- package/components/Virtuoso/react-virtuoso/Table.d.ts +0 -6515
- package/components/Virtuoso/react-virtuoso/Table.js +0 -196
- package/components/Virtuoso/react-virtuoso/components.d.ts +0 -505
- package/components/Virtuoso/react-virtuoso/components.js +0 -9
- package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.d.ts +0 -1
- package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -11
- package/es6/components/Virtuoso/Virtuoso.js +0 -1
- package/es6/components/Virtuoso/react-virtuoso/Grid.js +0 -166
- package/es6/components/Virtuoso/react-virtuoso/components.js +0 -7
- package/es6/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -8
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ListRange } from './interfaces';
|
|
2
|
-
export declare function tupleComparator(prev: [
|
|
2
|
+
export declare function tupleComparator<T1, T2>(prev: [T1, T2] | undefined, current: [T1, T2]): boolean;
|
|
3
3
|
export declare function rangeComparator(prev: ListRange | undefined, next: ListRange): boolean;
|
|
@@ -5,8 +5,6 @@ function tupleComparator(prev, current) {
|
|
|
5
5
|
}
|
|
6
6
|
exports.tupleComparator = tupleComparator;
|
|
7
7
|
function rangeComparator(prev, next) {
|
|
8
|
-
return !!(prev &&
|
|
9
|
-
prev.startIndex === next.startIndex &&
|
|
10
|
-
prev.endIndex === next.endIndex);
|
|
8
|
+
return !!(prev && prev.startIndex === next.startIndex && prev.endIndex === next.endIndex);
|
|
11
9
|
}
|
|
12
10
|
exports.rangeComparator = rangeComparator;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { ComputeItemKey, FixedHeaderContent, FixedFooterContent, FlatIndexLocationWithAlign, FlatScrollIntoViewLocation, FollowOutput, ItemContent, ListItem, ListRange, ScrollSeekConfiguration, SizeFunction, TableComponents, StateSnapshot, StateCallback } from '../interfaces';
|
|
2
|
+
import type { VirtuosoProps } from './Virtuoso';
|
|
3
|
+
export interface TableVirtuosoProps<D, C> extends Omit<VirtuosoProps<D, C>, 'components' | 'headerFooterTag' | 'topItemCount'> {
|
|
4
|
+
/**
|
|
5
|
+
* Use the `components` property for advanced customization of the elements rendered by the table.
|
|
6
|
+
*/
|
|
7
|
+
components?: TableComponents<D, C>;
|
|
8
|
+
/**
|
|
9
|
+
* Set the contents of the table header.
|
|
10
|
+
*/
|
|
11
|
+
fixedHeaderContent?: FixedHeaderContent;
|
|
12
|
+
/**
|
|
13
|
+
* Set the contents of the table footer.
|
|
14
|
+
*/
|
|
15
|
+
fixedFooterContent?: FixedFooterContent;
|
|
16
|
+
/**
|
|
17
|
+
* The total amount of items to be rendered.
|
|
18
|
+
*/
|
|
19
|
+
totalCount?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The data items to be rendered. If data is set, the total count will be inferred from the length of the array.
|
|
22
|
+
*/
|
|
23
|
+
data?: readonly D[];
|
|
24
|
+
/**
|
|
25
|
+
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
26
|
+
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
27
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
28
|
+
* See the `increaseViewportBy` property for a similar behavior (equivalent to the `overscan` in `react-window`).
|
|
29
|
+
*/
|
|
30
|
+
overscan?: number | {
|
|
31
|
+
main: number;
|
|
32
|
+
reverse: number;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Set the increaseViewportBy property to artificially increase the viewport size, causing items to be rendered before outside of the viewport.
|
|
36
|
+
* The property causes the component to render more items than the necessary, but can help with slow loading content.
|
|
37
|
+
* Using `{ top?: number, bottom?: number }` lets you set the increase for each end separately.
|
|
38
|
+
*/
|
|
39
|
+
increaseViewportBy?: number | {
|
|
40
|
+
top: number;
|
|
41
|
+
bottom: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Set to a value between 0 and totalCount - 1 to make the list start scrolled to that item.
|
|
45
|
+
*/
|
|
46
|
+
initialTopMostItemIndex?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Set this value to offset the initial location of the list.
|
|
49
|
+
* Warning: using this property will still run a render cycle at the scrollTop: 0 list window.
|
|
50
|
+
* If possible, avoid using it and stick to `initialTopMostItemIndex` instead.
|
|
51
|
+
*/
|
|
52
|
+
initialScrollTop?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Use for server-side rendering - if set, the list will render the specified amount of items
|
|
55
|
+
* regardless of the container / item size.
|
|
56
|
+
*/
|
|
57
|
+
initialItemCount?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Set the callback to specify the contents of the item.
|
|
60
|
+
*/
|
|
61
|
+
itemContent?: ItemContent<D, C>;
|
|
62
|
+
/**
|
|
63
|
+
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
64
|
+
*/
|
|
65
|
+
computeItemKey?: ComputeItemKey<D, C>;
|
|
66
|
+
/**
|
|
67
|
+
* By default, the component assumes the default item height from the first rendered item (rendering it as a "probe").
|
|
68
|
+
*
|
|
69
|
+
* If the first item turns out to be an outlier (very short or tall), the rest of the rendering will be slower,
|
|
70
|
+
* as multiple passes of rendering should happen for the list to fill the viewport.
|
|
71
|
+
*
|
|
72
|
+
* Setting `defaultItemHeight` causes the component to skip the "probe" rendering and use the property
|
|
73
|
+
* value as default height instead.
|
|
74
|
+
*/
|
|
75
|
+
defaultItemHeight?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Allows customizing the height/width calculation of `Item` elements.
|
|
78
|
+
*
|
|
79
|
+
* The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
|
|
80
|
+
*/
|
|
81
|
+
itemSize?: SizeFunction;
|
|
82
|
+
/**
|
|
83
|
+
* Can be used to improve performance if the rendered items are of known size.
|
|
84
|
+
* Setting it causes the component to skip item measurements.
|
|
85
|
+
*/
|
|
86
|
+
fixedItemHeight?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Use to display placeholders if the user scrolls fast through the list.
|
|
89
|
+
*
|
|
90
|
+
* Set `components.ScrollSeekPlaceholder` to change the placeholder content.
|
|
91
|
+
*/
|
|
92
|
+
scrollSeekConfiguration?: ScrollSeekConfiguration | false;
|
|
93
|
+
/**
|
|
94
|
+
* If set to `true`, the list automatically scrolls to bottom if the total count is changed.
|
|
95
|
+
* Set to `"smooth"` for an animated scrolling.
|
|
96
|
+
*
|
|
97
|
+
* By default, `followOutput` scrolls down only if the list is already at the bottom.
|
|
98
|
+
* To implement an arbitrary logic behind that, pass a function:
|
|
99
|
+
*
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <Virtuoso
|
|
102
|
+
* followOutput={(isAtBottom: boolean) => {
|
|
103
|
+
* if (expression) {
|
|
104
|
+
* return 'smooth' // can be 'auto' or false to avoid scrolling
|
|
105
|
+
* } else {
|
|
106
|
+
* return false
|
|
107
|
+
* }
|
|
108
|
+
* }} />
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
followOutput?: FollowOutput;
|
|
112
|
+
/**
|
|
113
|
+
* Use when implementing inverse infinite scrolling - decrease the value this property
|
|
114
|
+
* in combination with `data` or `totalCount` to prepend items to the top of the list.
|
|
115
|
+
*
|
|
116
|
+
* Warning: the firstItemIndex should **be a positive number**, based on the total amount of items to be displayed.
|
|
117
|
+
*/
|
|
118
|
+
firstItemIndex?: number;
|
|
119
|
+
/**
|
|
120
|
+
* Called when the list starts/stops scrolling.
|
|
121
|
+
*/
|
|
122
|
+
isScrolling?: (isScrolling: boolean) => void;
|
|
123
|
+
/**
|
|
124
|
+
* Gets called when the user scrolls to the end of the list.
|
|
125
|
+
* Receives the last item index as an argument. Can be used to implement endless scrolling.
|
|
126
|
+
*/
|
|
127
|
+
endReached?: (index: number) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Called when the user scrolls to the start of the list.
|
|
130
|
+
*/
|
|
131
|
+
startReached?: (index: number) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
134
|
+
*/
|
|
135
|
+
rangeChanged?: (range: ListRange) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Called with true / false when the list has reached the bottom / gets scrolled up.
|
|
138
|
+
* Can be used to load newer items, like `tail -f`.
|
|
139
|
+
*/
|
|
140
|
+
atBottomStateChange?: (atBottom: boolean) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Called with `true` / `false` when the list has reached the top / gets scrolled down.
|
|
143
|
+
*/
|
|
144
|
+
atTopStateChange?: (atTop: boolean) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Called when the total list height is changed due to new items or viewport resize.
|
|
147
|
+
*/
|
|
148
|
+
totalListHeightChanged?: (height: number) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
151
|
+
*/
|
|
152
|
+
itemsRendered?: (items: ListItem<D>[]) => void;
|
|
153
|
+
/**
|
|
154
|
+
* Setting `alignToBottom` to `true` aligns the items to the bottom of the list if the list is shorter than the viewport.
|
|
155
|
+
* Use `followOutput` property to keep the list aligned when new items are appended.
|
|
156
|
+
*/
|
|
157
|
+
alignToBottom?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Uses the document scroller rather than wrapping the list in its own.
|
|
160
|
+
*/
|
|
161
|
+
useWindowScroll?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Pass a reference to a scrollable parent element, so that the table won't wrap in its own.
|
|
164
|
+
*/
|
|
165
|
+
customScrollParent?: HTMLElement;
|
|
166
|
+
/**
|
|
167
|
+
* Provides access to the root DOM element
|
|
168
|
+
*/
|
|
169
|
+
scrollerRef?: (ref: HTMLElement | Window | null) => any;
|
|
170
|
+
/**
|
|
171
|
+
* By default `0`. Redefine to change how much away from the top the scroller can be before the list is not considered not at top.
|
|
172
|
+
*/
|
|
173
|
+
atTopThreshold?: number;
|
|
174
|
+
/**
|
|
175
|
+
* 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.
|
|
176
|
+
*/
|
|
177
|
+
atBottomThreshold?: number;
|
|
178
|
+
/**
|
|
179
|
+
* pass a state obtained from the getState() method to restore the list state - this includes the previously measured item sizes and the scroll location.
|
|
180
|
+
* Notice that you should still pass the same data and totalCount properties as before, so that the list can match the data with the stored measurements.
|
|
181
|
+
* This is useful when you want to keep the list state when the component is unmounted and remounted, for example when navigating to a different page.
|
|
182
|
+
*/
|
|
183
|
+
restoreStateFrom?: StateSnapshot;
|
|
184
|
+
}
|
|
185
|
+
export interface TableVirtuosoHandle {
|
|
186
|
+
scrollIntoView(location: number | FlatScrollIntoViewLocation): void;
|
|
187
|
+
scrollToIndex(location: number | FlatIndexLocationWithAlign): void;
|
|
188
|
+
scrollTo(location: ScrollToOptions): void;
|
|
189
|
+
scrollBy(location: ScrollToOptions): void;
|
|
190
|
+
/**
|
|
191
|
+
* Obtains the internal size state of the component, so that it can be restored later. This does not include the data items.
|
|
192
|
+
*/
|
|
193
|
+
getState(stateCb: StateCallback): void;
|
|
194
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import type { Components, ComputeItemKey, FlatIndexLocationWithAlign, FlatScrollIntoViewLocation, FollowOutput, GroupContent, GroupItemContent, IndexLocationWithAlign, ItemContent, ListItem, ListRange, ListRootProps, ScrollIntoViewLocation, ScrollSeekConfiguration, SizeFunction, StateSnapshot, StateCallback } from '../interfaces';
|
|
2
|
+
import { LogLevel } from '../loggerSystem';
|
|
3
|
+
export interface VirtuosoProps<D, C> extends ListRootProps {
|
|
4
|
+
/**
|
|
5
|
+
* The total amount of items to be rendered.
|
|
6
|
+
*/
|
|
7
|
+
totalCount?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The data items to be rendered. If data is set, the total count will be inferred from the length of the array.
|
|
10
|
+
*/
|
|
11
|
+
data?: readonly D[];
|
|
12
|
+
/**
|
|
13
|
+
* Additional context available in the custom components and content callbacks
|
|
14
|
+
*/
|
|
15
|
+
context?: C;
|
|
16
|
+
/**
|
|
17
|
+
* *The property accepts pixel values.*
|
|
18
|
+
*
|
|
19
|
+
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
20
|
+
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
21
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
22
|
+
* See the `increaseViewportBy` property for a similar behavior (equivalent to the `overscan` in react-window).
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
overscan?: number | {
|
|
26
|
+
main: number;
|
|
27
|
+
reverse: number;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* *The property accepts pixel values.*
|
|
32
|
+
*
|
|
33
|
+
* Set the increaseViewportBy property to artificially increase the viewport size, causing items to be rendered before outside of the viewport.
|
|
34
|
+
* The property causes the component to render more items than the necessary, but can help with slow loading content.
|
|
35
|
+
* Using `{ top?: number, bottom?: number }` lets you set the increase for each end separately.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
increaseViewportBy?: number | {
|
|
39
|
+
top: number;
|
|
40
|
+
bottom: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Set the amount of items to remain fixed at the top of the list.
|
|
44
|
+
*
|
|
45
|
+
* For a header that scrolls away when scrolling, check the `components.Header` property.
|
|
46
|
+
*/
|
|
47
|
+
topItemCount?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Set to a value between 0 and totalCount - 1 to make the list start scrolled to that item.
|
|
50
|
+
* Pass in an object to achieve additional effects similar to `scrollToIndex`.
|
|
51
|
+
*/
|
|
52
|
+
initialTopMostItemIndex?: number | IndexLocationWithAlign;
|
|
53
|
+
/**
|
|
54
|
+
* Set this value to offset the initial location of the list.
|
|
55
|
+
* Warning: using this property will still run a render cycle at the scrollTop: 0 list window.
|
|
56
|
+
* If possible, avoid using it and stick to `initialTopMostItemIndex` instead.
|
|
57
|
+
*/
|
|
58
|
+
initialScrollTop?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Use for server-side rendering - if set, the list will render the specified amount of items
|
|
61
|
+
* regardless of the container / item size.
|
|
62
|
+
*/
|
|
63
|
+
initialItemCount?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Use the `components` property for advanced customization of the elements rendered by the list.
|
|
66
|
+
*/
|
|
67
|
+
components?: Components<D, C>;
|
|
68
|
+
/**
|
|
69
|
+
* Set the callback to specify the contents of the item.
|
|
70
|
+
*/
|
|
71
|
+
itemContent?: ItemContent<D, C>;
|
|
72
|
+
/**
|
|
73
|
+
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
74
|
+
*/
|
|
75
|
+
computeItemKey?: ComputeItemKey<D, C>;
|
|
76
|
+
/**
|
|
77
|
+
* By default, the component assumes the default item height from the first rendered item (rendering it as a "probe").
|
|
78
|
+
*
|
|
79
|
+
* If the first item turns out to be an outlier (very short or tall), the rest of the rendering will be slower,
|
|
80
|
+
* as multiple passes of rendering should happen for the list to fill the viewport.
|
|
81
|
+
*
|
|
82
|
+
* Setting `defaultItemHeight` causes the component to skip the "probe" rendering and use the property
|
|
83
|
+
* value as default height instead.
|
|
84
|
+
*/
|
|
85
|
+
defaultItemHeight?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Allows customizing the height/width calculation of `Item` elements.
|
|
88
|
+
*
|
|
89
|
+
* The default implementation reads `el.getBoundingClientRect().height` and `el.getBoundingClientRect().width`.
|
|
90
|
+
*/
|
|
91
|
+
itemSize?: SizeFunction;
|
|
92
|
+
/**
|
|
93
|
+
* Can be used to improve performance if the rendered items are of known size.
|
|
94
|
+
* Setting it causes the component to skip item measurements.
|
|
95
|
+
*/
|
|
96
|
+
fixedItemHeight?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Use to display placeholders if the user scrolls fast through the list.
|
|
99
|
+
*
|
|
100
|
+
* Set `components.ScrollSeekPlaceholder` to change the placeholder content.
|
|
101
|
+
*/
|
|
102
|
+
scrollSeekConfiguration?: ScrollSeekConfiguration | false;
|
|
103
|
+
/**
|
|
104
|
+
* If set to `true`, the list automatically scrolls to bottom if the total count is changed.
|
|
105
|
+
* Set to `"smooth"` for an animated scrolling.
|
|
106
|
+
*
|
|
107
|
+
* By default, `followOutput` scrolls down only if the list is already at the bottom.
|
|
108
|
+
* To implement an arbitrary logic behind that, pass a function:
|
|
109
|
+
*
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <Virtuoso
|
|
112
|
+
* followOutput={(isAtBottom: boolean) => {
|
|
113
|
+
* if (expression) {
|
|
114
|
+
* return 'smooth' // can be 'auto' or false to avoid scrolling
|
|
115
|
+
* } else {
|
|
116
|
+
* return false
|
|
117
|
+
* }
|
|
118
|
+
* }} />
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
followOutput?: FollowOutput;
|
|
122
|
+
/**
|
|
123
|
+
* Set to customize the wrapper tag for the header and footer components (default is `div`).
|
|
124
|
+
*/
|
|
125
|
+
headerFooterTag?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Use when implementing inverse infinite scrolling - decrease the value this property
|
|
128
|
+
* in combination with `data` or `totalCount` to prepend items to the top of the list.
|
|
129
|
+
*
|
|
130
|
+
* Warning: the firstItemIndex should **be a positive number**, based on the total amount of items to be displayed.
|
|
131
|
+
*/
|
|
132
|
+
firstItemIndex?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Called when the list starts/stops scrolling.
|
|
135
|
+
*/
|
|
136
|
+
isScrolling?: (isScrolling: boolean) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Gets called when the user scrolls to the end of the list.
|
|
139
|
+
* Receives the last item index as an argument. Can be used to implement endless scrolling.
|
|
140
|
+
*/
|
|
141
|
+
endReached?: (index: number) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Called when the user scrolls to the start of the list.
|
|
144
|
+
*/
|
|
145
|
+
startReached?: (index: number) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
148
|
+
*/
|
|
149
|
+
rangeChanged?: (range: ListRange) => void;
|
|
150
|
+
/**
|
|
151
|
+
* Called with true / false when the list has reached the bottom / gets scrolled up.
|
|
152
|
+
* Can be used to load newer items, like `tail -f`.
|
|
153
|
+
*/
|
|
154
|
+
atBottomStateChange?: (atBottom: boolean) => void;
|
|
155
|
+
/**
|
|
156
|
+
* Called with `true` / `false` when the list has reached the top / gets scrolled down.
|
|
157
|
+
*/
|
|
158
|
+
atTopStateChange?: (atTop: boolean) => void;
|
|
159
|
+
/**
|
|
160
|
+
* Called when the total list height is changed due to new items or viewport resize.
|
|
161
|
+
*/
|
|
162
|
+
totalListHeightChanged?: (height: number) => void;
|
|
163
|
+
/**
|
|
164
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
165
|
+
*/
|
|
166
|
+
itemsRendered?: (items: ListItem<D>[]) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Setting `alignToBottom` to `true` aligns the items to the bottom of the list if the list is shorter than the viewport.
|
|
169
|
+
* Use `followOutput` property to keep the list aligned when new items are appended.
|
|
170
|
+
*/
|
|
171
|
+
alignToBottom?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Uses the document scroller rather than wrapping the list in its own.
|
|
174
|
+
*/
|
|
175
|
+
useWindowScroll?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Pass a reference to a scrollable parent element, so that the list won't wrap in its own.
|
|
178
|
+
*/
|
|
179
|
+
customScrollParent?: HTMLElement;
|
|
180
|
+
/**
|
|
181
|
+
* Provides access to the root DOM element
|
|
182
|
+
*/
|
|
183
|
+
scrollerRef?: (ref: HTMLElement | Window | null) => any;
|
|
184
|
+
/**
|
|
185
|
+
* *The property accepts pixel values.*
|
|
186
|
+
*
|
|
187
|
+
* By default `0`. Redefine to change how much away from the top the scroller can be before the list is not considered not at top.
|
|
188
|
+
*/
|
|
189
|
+
atTopThreshold?: number;
|
|
190
|
+
/**
|
|
191
|
+
* *The property accepts pixel values.*
|
|
192
|
+
*
|
|
193
|
+
* 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.
|
|
194
|
+
*/
|
|
195
|
+
atBottomThreshold?: number;
|
|
196
|
+
/**
|
|
197
|
+
* set to LogLevel.DEBUG to enable various diagnostics in the console, the most useful being the item measurement reports.
|
|
198
|
+
*
|
|
199
|
+
* Ensure that you have "all levels" enabled in the browser console too see the messages.
|
|
200
|
+
*/
|
|
201
|
+
logLevel?: LogLevel;
|
|
202
|
+
/**
|
|
203
|
+
* pass a state obtained from the getState() method to restore the list state - this includes the previously measured item sizes and the scroll location.
|
|
204
|
+
* Notice that you should still pass the same data and totalCount properties as before, so that the list can match the data with the stored measurements.
|
|
205
|
+
* This is useful when you want to keep the list state when the component is unmounted and remounted, for example when navigating to a different page.
|
|
206
|
+
*/
|
|
207
|
+
restoreStateFrom?: StateSnapshot;
|
|
208
|
+
}
|
|
209
|
+
export interface GroupedVirtuosoProps<D, C> extends Omit<VirtuosoProps<D, C>, 'totalCount' | 'itemContent'> {
|
|
210
|
+
/**
|
|
211
|
+
* Specifies the amount of items in each group (and, actually, how many groups are there).
|
|
212
|
+
* For example, passing [20, 30] will display 2 groups with 20 and 30 items each.
|
|
213
|
+
*/
|
|
214
|
+
groupCounts?: number[];
|
|
215
|
+
/**
|
|
216
|
+
* Specifies how each each group header gets rendered. The callback receives the zero-based index of the group.
|
|
217
|
+
*/
|
|
218
|
+
groupContent?: GroupContent<C>;
|
|
219
|
+
/**
|
|
220
|
+
* Specifies how each each item gets rendered.
|
|
221
|
+
*/
|
|
222
|
+
itemContent?: GroupItemContent<D, C>;
|
|
223
|
+
/**
|
|
224
|
+
* Use when implementing inverse infinite scrolling, decrease the value this property
|
|
225
|
+
* in combination with a change in `groupCounts` to prepend groups items to the top of the list.
|
|
226
|
+
* Both new groups and extending the top group is supported.
|
|
227
|
+
*
|
|
228
|
+
* The delta of the firstItemIndex should equal the amount of new items introduced, without the group themselves.
|
|
229
|
+
* As an example, if you prepend 2 groups with 20 and 30 items each, the firstItemIndex should be decreased with 50.
|
|
230
|
+
*
|
|
231
|
+
* You can also prepend more items to the first group, for example:
|
|
232
|
+
* \{ groupCounts: [20, 30], firstItemIndex: 1000 \} can become \{ groupCounts: [10, 30, 30], firstItemIndex: 980 \}
|
|
233
|
+
*
|
|
234
|
+
* Warning: the firstItemIndex should **be a positive number**, based on the total amount of items to be displayed.
|
|
235
|
+
*/
|
|
236
|
+
firstItemIndex?: number;
|
|
237
|
+
}
|
|
238
|
+
export interface VirtuosoHandle {
|
|
239
|
+
/**
|
|
240
|
+
* Scrolls the component to the specified item index. See {@link IndexLocationWithAlign} for more options.
|
|
241
|
+
*/
|
|
242
|
+
scrollToIndex(location: number | FlatIndexLocationWithAlign): void;
|
|
243
|
+
/**
|
|
244
|
+
* Scrolls the item into view if necessary. See [the website example](http://virtuoso.dev/keyboard-navigation/) for an implementation.
|
|
245
|
+
*/
|
|
246
|
+
scrollIntoView(location: FlatScrollIntoViewLocation): void;
|
|
247
|
+
/**
|
|
248
|
+
* Scrolls the component to the specified location. See [ScrollToOptions (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions)
|
|
249
|
+
*/
|
|
250
|
+
scrollTo(location: ScrollToOptions): void;
|
|
251
|
+
/**
|
|
252
|
+
* Scrolls the component with the specified amount. See [ScrollToOptions (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/ScrollToOptions)
|
|
253
|
+
*/
|
|
254
|
+
scrollBy(location: ScrollToOptions): void;
|
|
255
|
+
/**
|
|
256
|
+
* Use this with combination with follow output if you have images loading in the list. Listen to the image loading and call the method.
|
|
257
|
+
*/
|
|
258
|
+
autoscrollToBottom(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Obtains the internal size state of the component, so that it can be restored later. This does not include the data items.
|
|
261
|
+
*/
|
|
262
|
+
getState(stateCb: StateCallback): void;
|
|
263
|
+
}
|
|
264
|
+
export interface GroupedVirtuosoHandle {
|
|
265
|
+
scrollToIndex(location: number | IndexLocationWithAlign): void;
|
|
266
|
+
scrollIntoView(location: number | ScrollIntoViewLocation): void;
|
|
267
|
+
scrollTo(location: ScrollToOptions): void;
|
|
268
|
+
scrollBy(location: ScrollToOptions): void;
|
|
269
|
+
autoscrollToBottom(): void;
|
|
270
|
+
/**
|
|
271
|
+
* Obtains the internal size state of the component, so that it can be restored later. This does not include the data items.
|
|
272
|
+
*/
|
|
273
|
+
getState(stateCb: StateCallback): void;
|
|
274
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { GridComponents, GridComputeItemKey, GridIndexLocation, GridItemContent, GridRootProps, ListRange, ScrollSeekConfiguration } from '../interfaces';
|
|
2
|
+
import { LogLevel } from '../loggerSystem';
|
|
3
|
+
export interface Gap {
|
|
4
|
+
row: number;
|
|
5
|
+
column: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ElementDimensions {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
}
|
|
11
|
+
export interface GridStateSnapshot {
|
|
12
|
+
viewport: ElementDimensions;
|
|
13
|
+
item: ElementDimensions;
|
|
14
|
+
gap: Gap;
|
|
15
|
+
scrollTop: number;
|
|
16
|
+
}
|
|
17
|
+
export interface VirtuosoGridProps<D, C = unknown> extends GridRootProps {
|
|
18
|
+
/**
|
|
19
|
+
* The total amount of items to be rendered.
|
|
20
|
+
*/
|
|
21
|
+
totalCount?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The data items to be rendered. If data is set, the total count will be inferred from the length of the array.
|
|
24
|
+
*/
|
|
25
|
+
data?: readonly D[];
|
|
26
|
+
/**
|
|
27
|
+
* Additional context available in the custom components and content callbacks
|
|
28
|
+
*/
|
|
29
|
+
context?: C;
|
|
30
|
+
/**
|
|
31
|
+
* Use for server-side rendering - if set, the list will render the specified amount of items
|
|
32
|
+
* regardless of the container / item size.
|
|
33
|
+
*/
|
|
34
|
+
initialItemCount?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Set the callback to specify the contents of the item.
|
|
37
|
+
*/
|
|
38
|
+
itemContent?: GridItemContent<D, C>;
|
|
39
|
+
/**
|
|
40
|
+
* Use the `components` property for advanced customization of the elements rendered by the list.
|
|
41
|
+
*/
|
|
42
|
+
components?: GridComponents<C>;
|
|
43
|
+
/**
|
|
44
|
+
* Set the overscan property to make the component "chunk" the rendering of new items on scroll.
|
|
45
|
+
* The property causes the component to render more items than the necessary, but reduces the re-renders on scroll.
|
|
46
|
+
* Setting `{ main: number, reverse: number }` lets you extend the list in both the main and the reverse scrollable directions.
|
|
47
|
+
*/
|
|
48
|
+
overscan?: number | {
|
|
49
|
+
main: number;
|
|
50
|
+
reverse: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* If specified, the component will use the function to generate the `key` property for each list item.
|
|
54
|
+
*/
|
|
55
|
+
computeItemKey?: GridComputeItemKey<D, C>;
|
|
56
|
+
/**
|
|
57
|
+
* Use to display placeholders if the user scrolls fast through the list.
|
|
58
|
+
*
|
|
59
|
+
* Set `components.ScrollSeekPlaceholder` to change the placeholder content.
|
|
60
|
+
*/
|
|
61
|
+
scrollSeekConfiguration?: ScrollSeekConfiguration | false;
|
|
62
|
+
/**
|
|
63
|
+
* Called when the list starts/stops scrolling.
|
|
64
|
+
*/
|
|
65
|
+
isScrolling?: (isScrolling: boolean) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Gets called when the user scrolls to the end of the list.
|
|
68
|
+
* Receives the last item index as an argument. Can be used to implement endless scrolling.
|
|
69
|
+
*/
|
|
70
|
+
endReached?: (index: number) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Called when the user scrolls to the start of the list.
|
|
73
|
+
*/
|
|
74
|
+
startReached?: (index: number) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Called with the new set of items each time the list items are rendered due to scrolling.
|
|
77
|
+
*/
|
|
78
|
+
rangeChanged?: (range: ListRange) => void;
|
|
79
|
+
/**
|
|
80
|
+
* reports when the grid state changes. The reported value can be stored and passed back to `restoreStateFrom` to restore the grid to the same state.
|
|
81
|
+
*/
|
|
82
|
+
stateChanged?: (state: GridStateSnapshot) => void;
|
|
83
|
+
restoreStateFrom?: GridStateSnapshot | undefined | null;
|
|
84
|
+
/**
|
|
85
|
+
* Called with true / false when the list has reached the bottom / gets scrolled up.
|
|
86
|
+
* Can be used to load newer items, like `tail -f`.
|
|
87
|
+
*/
|
|
88
|
+
atBottomStateChange?: (atBottom: boolean) => void;
|
|
89
|
+
/**
|
|
90
|
+
* Called with `true` / `false` when the list has reached the top / gets scrolled down.
|
|
91
|
+
*/
|
|
92
|
+
atTopStateChange?: (atTop: boolean) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Provides access to the root DOM element
|
|
95
|
+
*/
|
|
96
|
+
scrollerRef?: (ref: HTMLElement | null) => any;
|
|
97
|
+
/**
|
|
98
|
+
* Sets the className for the list DOM element
|
|
99
|
+
*/
|
|
100
|
+
listClassName?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Sets the grid items' className
|
|
103
|
+
*/
|
|
104
|
+
itemClassName?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Uses the document scroller rather than wrapping the grid in its own.
|
|
107
|
+
*/
|
|
108
|
+
useWindowScroll?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Pass a reference to a scrollable parent element, so that the grid won't wrap in its own.
|
|
111
|
+
*/
|
|
112
|
+
customScrollParent?: HTMLElement;
|
|
113
|
+
/**
|
|
114
|
+
* set to LogLevel.DEBUG to enable various diagnostics in the console, the most useful being the item measurement reports.
|
|
115
|
+
*
|
|
116
|
+
* Ensure that you have "all levels" enabled in the browser console too see the messages.
|
|
117
|
+
*/
|
|
118
|
+
logLevel?: LogLevel;
|
|
119
|
+
initialTopMostItemIndex?: GridIndexLocation;
|
|
120
|
+
}
|
|
121
|
+
export interface VirtuosoGridHandle {
|
|
122
|
+
scrollToIndex(location: GridIndexLocation): void;
|
|
123
|
+
scrollTo(location: ScrollToOptions): void;
|
|
124
|
+
scrollBy(location: ScrollToOptions): void;
|
|
125
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import * as u from '
|
|
1
|
+
import * as u from './urx';
|
|
2
2
|
import { ScrollContainerState } from './interfaces';
|
|
3
3
|
export declare const domIOSystem: u.SystemSpec<never[], () => {
|
|
4
4
|
scrollContainerState: u.Stream<ScrollContainerState>;
|
|
5
5
|
scrollTop: u.Stream<number>;
|
|
6
6
|
viewportHeight: u.Stream<number>;
|
|
7
7
|
headerHeight: u.StatefulStream<number>;
|
|
8
|
+
fixedHeaderHeight: u.StatefulStream<number>;
|
|
9
|
+
fixedFooterHeight: u.StatefulStream<number>;
|
|
8
10
|
footerHeight: u.StatefulStream<number>;
|
|
9
11
|
scrollHeight: u.Stream<number>;
|
|
10
12
|
smoothScrollTargetReached: u.Stream<true>;
|
|
11
|
-
react18ConcurrentRendering: u.StatefulStream<boolean>;
|
|
12
13
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
13
14
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
14
15
|
statefulScrollTop: u.StatefulStream<number>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var u = tslib_1.__importStar(require("
|
|
4
|
+
var u = tslib_1.__importStar(require("./urx"));
|
|
5
5
|
exports.domIOSystem = u.system(function () {
|
|
6
6
|
var scrollContainerState = u.stream();
|
|
7
7
|
var scrollTop = u.stream();
|
|
@@ -11,11 +11,12 @@ exports.domIOSystem = u.system(function () {
|
|
|
11
11
|
var viewportHeight = u.stream();
|
|
12
12
|
var scrollHeight = u.stream();
|
|
13
13
|
var headerHeight = u.statefulStream(0);
|
|
14
|
+
var fixedHeaderHeight = u.statefulStream(0);
|
|
15
|
+
var fixedFooterHeight = u.statefulStream(0);
|
|
14
16
|
var footerHeight = u.statefulStream(0);
|
|
15
17
|
var scrollTo = u.stream();
|
|
16
18
|
var scrollBy = u.stream();
|
|
17
19
|
var scrollingInProgress = u.statefulStream(false);
|
|
18
|
-
var react18ConcurrentRendering = u.statefulStream(false);
|
|
19
20
|
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
20
21
|
var scrollTop = _a.scrollTop;
|
|
21
22
|
return scrollTop;
|
|
@@ -31,10 +32,11 @@ exports.domIOSystem = u.system(function () {
|
|
|
31
32
|
scrollTop: scrollTop,
|
|
32
33
|
viewportHeight: viewportHeight,
|
|
33
34
|
headerHeight: headerHeight,
|
|
35
|
+
fixedHeaderHeight: fixedHeaderHeight,
|
|
36
|
+
fixedFooterHeight: fixedFooterHeight,
|
|
34
37
|
footerHeight: footerHeight,
|
|
35
38
|
scrollHeight: scrollHeight,
|
|
36
39
|
smoothScrollTargetReached: smoothScrollTargetReached,
|
|
37
|
-
react18ConcurrentRendering: react18ConcurrentRendering,
|
|
38
40
|
// signals
|
|
39
41
|
scrollTo: scrollTo,
|
|
40
42
|
scrollBy: scrollBy,
|