@ringcentral/juno 2.4.0 → 2.5.0-beta.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 +74 -2
- package/components/Downshift/SuggestionList/SuggestionList.js +4 -1
- 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/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/index.js +1 -1
- package/es6/foundation/isWebKit154.js +57 -0
- package/es6/foundation/theme/ThemeProvider.js +4 -4
- package/foundation/index.d.ts +1 -1
- package/foundation/index.js +1 -1
- package/foundation/isWebKit154.d.ts +20 -0
- package/foundation/isWebKit154.js +59 -0
- package/foundation/theme/ThemeProvider.d.ts +6 -0
- package/foundation/theme/ThemeProvider.js +4 -4
- package/package.json +2 -2
- package/es6/foundation/isSafari154.js +0 -50
- package/foundation/isSafari154.d.ts +0 -15
- package/foundation/isSafari154.js +0 -52
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
/* eslint-disable no-console */
|
|
5
6
|
var React = tslib_1.__importStar(require("react"));
|
|
6
7
|
var react_1 = require("react");
|
|
7
|
-
/* eslint-disable no-console */
|
|
8
8
|
var react_urx_1 = require("@virtuoso.dev/react-urx");
|
|
9
9
|
var urx_1 = require("@virtuoso.dev/urx");
|
|
10
|
-
var foundation_1 = require("../../../foundation");
|
|
11
10
|
var useChangedChildSizes_1 = tslib_1.__importDefault(require("./hooks/useChangedChildSizes"));
|
|
12
11
|
var useIsomorphicLayoutEffect_1 = tslib_1.__importDefault(require("./hooks/useIsomorphicLayoutEffect"));
|
|
13
12
|
var useScrollTop_1 = tslib_1.__importDefault(require("./hooks/useScrollTop"));
|
|
14
13
|
var useSize_1 = tslib_1.__importDefault(require("./hooks/useSize"));
|
|
15
14
|
var useWindowViewportRect_1 = tslib_1.__importDefault(require("./hooks/useWindowViewportRect"));
|
|
16
15
|
var listSystem_1 = require("./listSystem");
|
|
16
|
+
var correctItemSize_1 = require("./utils/correctItemSize");
|
|
17
17
|
var positionStickyCssValue_1 = require("./utils/positionStickyCssValue");
|
|
18
18
|
function identity(value) {
|
|
19
19
|
return value;
|
|
@@ -21,6 +21,7 @@ function identity(value) {
|
|
|
21
21
|
exports.identity = identity;
|
|
22
22
|
var listComponentPropsSystem = urx_1.system(function () {
|
|
23
23
|
var itemContent = urx_1.statefulStream(function (index) { return "Item " + index; });
|
|
24
|
+
var context = urx_1.statefulStream(null);
|
|
24
25
|
var groupContent = urx_1.statefulStream(function (index) { return "Group " + index; });
|
|
25
26
|
var components = urx_1.statefulStream({});
|
|
26
27
|
var computeItemKey = urx_1.statefulStream(identity);
|
|
@@ -31,6 +32,7 @@ var listComponentPropsSystem = urx_1.system(function () {
|
|
|
31
32
|
return urx_1.statefulStreamFromEmitter(urx_1.pipe(components, urx_1.map(function (components) { return components[propName]; }), urx_1.distinctUntilChanged()), defaultValue);
|
|
32
33
|
};
|
|
33
34
|
return {
|
|
35
|
+
context: context,
|
|
34
36
|
itemContent: itemContent,
|
|
35
37
|
groupContent: groupContent,
|
|
36
38
|
components: components,
|
|
@@ -119,17 +121,30 @@ var DefaultScrollSeekPlaceholder = function (_a) {
|
|
|
119
121
|
var height = _a.height;
|
|
120
122
|
return (React.createElement("div", { style: { height: height } }));
|
|
121
123
|
};
|
|
122
|
-
var GROUP_STYLE = {
|
|
124
|
+
var GROUP_STYLE = {
|
|
125
|
+
position: positionStickyCssValue_1.positionStickyCssValue(),
|
|
126
|
+
zIndex: 1,
|
|
127
|
+
overflowAnchor: 'none',
|
|
128
|
+
};
|
|
123
129
|
exports.Items = React.memo(function VirtuosoItems(_a) {
|
|
124
130
|
var _b = _a.showTopList, showTopList = _b === void 0 ? false : _b;
|
|
125
131
|
var listState = exports.useEmitterValue('listState');
|
|
126
132
|
var deviation = exports.useEmitterValue('deviation');
|
|
127
133
|
var sizeRanges = exports.usePublisher('sizeRanges');
|
|
134
|
+
var useWindowScroll = exports.useEmitterValue('useWindowScroll');
|
|
135
|
+
var customScrollParent = exports.useEmitterValue('customScrollParent');
|
|
136
|
+
var windowScrollContainerStateCallback = exports.usePublisher('windowScrollContainerState');
|
|
137
|
+
var _scrollContainerStateCallback = exports.usePublisher('scrollContainerState');
|
|
138
|
+
var scrollContainerStateCallback = customScrollParent || useWindowScroll
|
|
139
|
+
? windowScrollContainerStateCallback
|
|
140
|
+
: _scrollContainerStateCallback;
|
|
128
141
|
var itemContent = exports.useEmitterValue('itemContent');
|
|
142
|
+
var context = exports.useEmitterValue('context');
|
|
129
143
|
var groupContent = exports.useEmitterValue('groupContent');
|
|
130
144
|
var trackItemSizes = exports.useEmitterValue('trackItemSizes');
|
|
131
145
|
var itemSize = exports.useEmitterValue('itemSize');
|
|
132
|
-
var
|
|
146
|
+
var log = exports.useEmitterValue('log');
|
|
147
|
+
var ref = useChangedChildSizes_1.default(sizeRanges, itemSize, trackItemSizes, showTopList ? urx_1.noop : scrollContainerStateCallback, log, customScrollParent);
|
|
133
148
|
var EmptyPlaceholder = exports.useEmitterValue('EmptyPlaceholder');
|
|
134
149
|
var ScrollSeekPlaceholder = exports.useEmitterValue('ScrollSeekPlaceholder') || DefaultScrollSeekPlaceholder;
|
|
135
150
|
var ListComponent = exports.useEmitterValue('ListComponent');
|
|
@@ -139,8 +154,8 @@ exports.Items = React.memo(function VirtuosoItems(_a) {
|
|
|
139
154
|
var isSeeking = exports.useEmitterValue('isSeeking');
|
|
140
155
|
var hasGroups = exports.useEmitterValue('groupIndices').length > 0;
|
|
141
156
|
var paddingTopAddition = exports.useEmitterValue('paddingTopAddition');
|
|
142
|
-
var
|
|
143
|
-
|
|
157
|
+
var firstItemIndex = exports.useEmitterValue('firstItemIndex');
|
|
158
|
+
var statefulTotalCount = exports.useEmitterValue('statefulTotalCount');
|
|
144
159
|
var containerStyle = showTopList
|
|
145
160
|
? {}
|
|
146
161
|
: {
|
|
@@ -149,40 +164,23 @@ exports.Items = React.memo(function VirtuosoItems(_a) {
|
|
|
149
164
|
paddingBottom: listState.offsetBottom,
|
|
150
165
|
marginTop: deviation,
|
|
151
166
|
};
|
|
152
|
-
if (!showTopList &&
|
|
153
|
-
|
|
154
|
-
EmptyPlaceholder &&
|
|
155
|
-
scrolledToInitialItem) {
|
|
156
|
-
return react_1.createElement(EmptyPlaceholder);
|
|
167
|
+
if (!showTopList && statefulTotalCount === 0 && EmptyPlaceholder) {
|
|
168
|
+
return react_1.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
|
|
157
169
|
}
|
|
158
|
-
return react_1.createElement(ListComponent, { ref: ref, style: containerStyle
|
|
170
|
+
return react_1.createElement(ListComponent, tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(ListComponent, context)), { ref: ref, style: containerStyle, 'data-test-id': showTopList
|
|
171
|
+
? 'virtuoso-top-item-list'
|
|
172
|
+
: 'virtuoso-item-list' }), (showTopList ? listState.topItems : listState.items).map(function (item) {
|
|
159
173
|
var index = item.originalIndex;
|
|
160
|
-
var key = computeItemKey(index);
|
|
174
|
+
var key = computeItemKey(index + firstItemIndex, item.data, context);
|
|
161
175
|
if (isSeeking) {
|
|
162
|
-
return react_1.createElement(ScrollSeekPlaceholder, {
|
|
163
|
-
key: key,
|
|
164
|
-
index: item.index,
|
|
165
|
-
height: item.size,
|
|
166
|
-
});
|
|
176
|
+
return react_1.createElement(ScrollSeekPlaceholder, tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }), (item.type === 'group' ? {} : { groupIndex: item.groupIndex })));
|
|
167
177
|
}
|
|
168
178
|
if (item.type === 'group') {
|
|
169
|
-
return react_1.createElement(GroupComponent, {
|
|
170
|
-
key: key,
|
|
171
|
-
'data-index': index,
|
|
172
|
-
'data-known-size': item.size,
|
|
173
|
-
'data-item-index': item.index,
|
|
174
|
-
style: GROUP_STYLE,
|
|
175
|
-
}, groupContent(item.index));
|
|
179
|
+
return react_1.createElement(GroupComponent, tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(GroupComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: GROUP_STYLE }), groupContent(item.index));
|
|
176
180
|
}
|
|
177
|
-
return react_1.createElement(ItemComponent, {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
'data-known-size': item.size,
|
|
181
|
-
'data-item-index': item.index,
|
|
182
|
-
'data-item-group-index': item.groupIndex,
|
|
183
|
-
}, hasGroups
|
|
184
|
-
? itemContent(item.index, item.groupIndex, item.data)
|
|
185
|
-
: itemContent(item.index, item.data));
|
|
181
|
+
return react_1.createElement(ItemComponent, tslib_1.__assign(tslib_1.__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, 'data-item-group-index': item.groupIndex, style: { overflowAnchor: 'none' } }), hasGroups
|
|
182
|
+
? itemContent(item.index, item.groupIndex, item.data, context)
|
|
183
|
+
: itemContent(item.index, item.data, context));
|
|
186
184
|
}));
|
|
187
185
|
});
|
|
188
186
|
exports.scrollerStyle = {
|
|
@@ -203,58 +201,73 @@ var topItemListStyle = {
|
|
|
203
201
|
position: positionStickyCssValue_1.positionStickyCssValue(),
|
|
204
202
|
top: 0,
|
|
205
203
|
};
|
|
204
|
+
function contextPropIfNotDomElement(element, context) {
|
|
205
|
+
if (typeof element === 'string') {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
return { context: context };
|
|
209
|
+
}
|
|
210
|
+
exports.contextPropIfNotDomElement = contextPropIfNotDomElement;
|
|
206
211
|
var Header = React.memo(function VirtuosoHeader() {
|
|
207
212
|
var Header = exports.useEmitterValue('HeaderComponent');
|
|
208
213
|
var headerHeight = exports.usePublisher('headerHeight');
|
|
209
214
|
var headerFooterTag = exports.useEmitterValue('headerFooterTag');
|
|
210
|
-
var ref = useSize_1.default(function (el) { return headerHeight(el
|
|
215
|
+
var ref = useSize_1.default(function (el) { return headerHeight(correctItemSize_1.correctItemSize(el, 'height')); });
|
|
216
|
+
var context = exports.useEmitterValue('context');
|
|
211
217
|
return Header
|
|
212
|
-
? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Header))
|
|
218
|
+
? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Header, contextPropIfNotDomElement(Header, context)))
|
|
213
219
|
: null;
|
|
214
220
|
});
|
|
215
221
|
var Footer = React.memo(function VirtuosoFooter() {
|
|
216
222
|
var Footer = exports.useEmitterValue('FooterComponent');
|
|
217
223
|
var footerHeight = exports.usePublisher('footerHeight');
|
|
218
224
|
var headerFooterTag = exports.useEmitterValue('headerFooterTag');
|
|
219
|
-
var ref = useSize_1.default(function (el) { return footerHeight(el
|
|
225
|
+
var ref = useSize_1.default(function (el) { return footerHeight(correctItemSize_1.correctItemSize(el, 'height')); });
|
|
226
|
+
var context = exports.useEmitterValue('context');
|
|
220
227
|
return Footer
|
|
221
|
-
? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Footer))
|
|
228
|
+
? react_1.createElement(headerFooterTag, { ref: ref }, react_1.createElement(Footer, contextPropIfNotDomElement(Footer, context)))
|
|
222
229
|
: null;
|
|
223
230
|
});
|
|
224
231
|
function buildScroller(_a) {
|
|
225
|
-
var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue
|
|
232
|
+
var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue;
|
|
226
233
|
var Scroller = React.memo(function VirtuosoScroller(_a) {
|
|
227
234
|
var style = _a.style, children = _a.children, props = tslib_1.__rest(_a, ["style", "children"]);
|
|
228
|
-
var
|
|
235
|
+
var scrollContainerStateCallback = usePublisher('scrollContainerState');
|
|
229
236
|
var ScrollerComponent = useEmitterValue('ScrollerComponent');
|
|
230
237
|
var smoothScrollTargetReached = usePublisher('smoothScrollTargetReached');
|
|
231
238
|
var scrollerRefCallback = useEmitterValue('scrollerRef');
|
|
232
|
-
var
|
|
239
|
+
var context = useEmitterValue('context');
|
|
240
|
+
var _b = useScrollTop_1.default(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, scrollerRefCallback), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
|
|
233
241
|
useEmitter('scrollTo', scrollToCallback);
|
|
234
242
|
useEmitter('scrollBy', scrollByCallback);
|
|
235
|
-
return react_1.createElement(ScrollerComponent, tslib_1.__assign({ ref: scrollerRef, style: tslib_1.__assign(tslib_1.__assign({}, exports.scrollerStyle), style), tabIndex: 0 }, props), children);
|
|
243
|
+
return react_1.createElement(ScrollerComponent, tslib_1.__assign(tslib_1.__assign({ ref: scrollerRef, style: tslib_1.__assign(tslib_1.__assign({}, exports.scrollerStyle), style), 'data-test-id': 'virtuoso-scroller', 'data-virtuoso-scroller': true, tabIndex: 0 }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
|
|
236
244
|
});
|
|
237
245
|
return Scroller;
|
|
238
246
|
}
|
|
239
247
|
exports.buildScroller = buildScroller;
|
|
240
248
|
function buildWindowScroller(_a) {
|
|
241
|
-
var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue
|
|
249
|
+
var usePublisher = _a.usePublisher, useEmitter = _a.useEmitter, useEmitterValue = _a.useEmitterValue;
|
|
242
250
|
var Scroller = React.memo(function VirtuosoWindowScroller(_a) {
|
|
243
251
|
var style = _a.style, children = _a.children, props = tslib_1.__rest(_a, ["style", "children"]);
|
|
244
|
-
var
|
|
252
|
+
var scrollContainerStateCallback = usePublisher('windowScrollContainerState');
|
|
245
253
|
var ScrollerComponent = useEmitterValue('ScrollerComponent');
|
|
246
254
|
var smoothScrollTargetReached = usePublisher('smoothScrollTargetReached');
|
|
247
255
|
var totalListHeight = useEmitterValue('totalListHeight');
|
|
248
|
-
var
|
|
256
|
+
var deviation = useEmitterValue('deviation');
|
|
257
|
+
var customScrollParent = useEmitterValue('customScrollParent');
|
|
258
|
+
var context = useEmitterValue('context');
|
|
259
|
+
var _b = useScrollTop_1.default(scrollContainerStateCallback, smoothScrollTargetReached, ScrollerComponent, urx_1.noop, customScrollParent), scrollerRef = _b.scrollerRef, scrollByCallback = _b.scrollByCallback, scrollToCallback = _b.scrollToCallback;
|
|
249
260
|
useIsomorphicLayoutEffect_1.default(function () {
|
|
250
|
-
scrollerRef.current = window;
|
|
261
|
+
scrollerRef.current = customScrollParent ? customScrollParent : window;
|
|
251
262
|
return function () {
|
|
252
263
|
scrollerRef.current = null;
|
|
253
264
|
};
|
|
254
|
-
}, [scrollerRef]);
|
|
265
|
+
}, [scrollerRef, customScrollParent]);
|
|
255
266
|
useEmitter('windowScrollTo', scrollToCallback);
|
|
256
267
|
useEmitter('scrollBy', scrollByCallback);
|
|
257
|
-
return react_1.createElement(ScrollerComponent, tslib_1.__assign({ style: tslib_1.__assign(tslib_1.__assign({ position: 'relative' }, style), (totalListHeight !== 0
|
|
268
|
+
return react_1.createElement(ScrollerComponent, tslib_1.__assign(tslib_1.__assign({ style: tslib_1.__assign(tslib_1.__assign({ position: 'relative' }, style), (totalListHeight !== 0
|
|
269
|
+
? { height: totalListHeight + deviation }
|
|
270
|
+
: {})), 'data-virtuoso-scroller': true }, props), contextPropIfNotDomElement(ScrollerComponent, context)), children);
|
|
258
271
|
});
|
|
259
272
|
return Scroller;
|
|
260
273
|
}
|
|
@@ -262,31 +275,30 @@ exports.buildWindowScroller = buildWindowScroller;
|
|
|
262
275
|
var Viewport = function (_a) {
|
|
263
276
|
var children = _a.children;
|
|
264
277
|
var viewportHeight = exports.usePublisher('viewportHeight');
|
|
265
|
-
var viewportRef = useSize_1.default(urx_1.compose(viewportHeight,
|
|
266
|
-
return (React.createElement("div", { style: exports.viewportStyle, ref: viewportRef }, children));
|
|
278
|
+
var viewportRef = useSize_1.default(urx_1.compose(viewportHeight, function (el) { return correctItemSize_1.correctItemSize(el, 'height'); }));
|
|
279
|
+
return (React.createElement("div", { style: exports.viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children));
|
|
267
280
|
};
|
|
268
281
|
var WindowViewport = function (_a) {
|
|
269
282
|
var children = _a.children;
|
|
270
283
|
var windowViewportRect = exports.usePublisher('windowViewportRect');
|
|
271
|
-
var
|
|
272
|
-
var viewportRef = useWindowViewportRect_1.default(windowViewportRect,
|
|
273
|
-
return (React.createElement("div", { ref: viewportRef, style: exports.viewportStyle }, children));
|
|
284
|
+
var customScrollParent = exports.useEmitterValue('customScrollParent');
|
|
285
|
+
var viewportRef = useWindowViewportRect_1.default(windowViewportRect, customScrollParent);
|
|
286
|
+
return (React.createElement("div", { ref: viewportRef, style: exports.viewportStyle, "data-viewport-type": "window" }, children));
|
|
274
287
|
};
|
|
275
288
|
var TopItemListContainer = function (_a) {
|
|
276
289
|
var children = _a.children;
|
|
277
290
|
var TopItemList = exports.useEmitterValue('TopItemListComponent');
|
|
278
291
|
var headerHeight = exports.useEmitterValue('headerHeight');
|
|
279
292
|
var style = tslib_1.__assign(tslib_1.__assign({}, topItemListStyle), { marginTop: headerHeight + "px" });
|
|
280
|
-
|
|
293
|
+
var context = exports.useEmitterValue('context');
|
|
294
|
+
return react_1.createElement(TopItemList || 'div', { style: style, context: context }, children);
|
|
281
295
|
};
|
|
282
296
|
var ListRoot = React.memo(function VirtuosoRoot(props) {
|
|
283
297
|
var useWindowScroll = exports.useEmitterValue('useWindowScroll');
|
|
284
298
|
var showTopList = exports.useEmitterValue('topItemsIndexes').length > 0;
|
|
285
|
-
var
|
|
286
|
-
var TheScroller =
|
|
287
|
-
|
|
288
|
-
}, [externalWindow, useWindowScroll]);
|
|
289
|
-
var TheViewport = useWindowScroll ? WindowViewport : Viewport;
|
|
299
|
+
var customScrollParent = exports.useEmitterValue('customScrollParent');
|
|
300
|
+
var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
|
|
301
|
+
var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
|
|
290
302
|
return (React.createElement(TheScroller, tslib_1.__assign({}, props),
|
|
291
303
|
React.createElement(TheViewport, null,
|
|
292
304
|
React.createElement(Header, null),
|
|
@@ -298,16 +310,19 @@ var ListRoot = React.memo(function VirtuosoRoot(props) {
|
|
|
298
310
|
exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
|
|
299
311
|
required: {},
|
|
300
312
|
optional: {
|
|
313
|
+
context: 'context',
|
|
301
314
|
followOutput: 'followOutput',
|
|
302
315
|
firstItemIndex: 'firstItemIndex',
|
|
303
316
|
itemContent: 'itemContent',
|
|
304
317
|
groupContent: 'groupContent',
|
|
305
318
|
overscan: 'overscan',
|
|
319
|
+
increaseViewportBy: 'increaseViewportBy',
|
|
306
320
|
totalCount: 'totalCount',
|
|
307
321
|
topItemCount: 'topItemCount',
|
|
308
322
|
initialTopMostItemIndex: 'initialTopMostItemIndex',
|
|
309
323
|
components: 'components',
|
|
310
324
|
groupCounts: 'groupCounts',
|
|
325
|
+
atBottomThreshold: 'atBottomThreshold',
|
|
311
326
|
computeItemKey: 'computeItemKey',
|
|
312
327
|
defaultItemHeight: 'defaultItemHeight',
|
|
313
328
|
fixedItemHeight: 'fixedItemHeight',
|
|
@@ -319,7 +334,9 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
|
|
|
319
334
|
initialScrollTop: 'initialScrollTop',
|
|
320
335
|
alignToBottom: 'alignToBottom',
|
|
321
336
|
useWindowScroll: 'useWindowScroll',
|
|
337
|
+
customScrollParent: 'customScrollParent',
|
|
322
338
|
scrollerRef: 'scrollerRef',
|
|
339
|
+
logLevel: 'logLevel',
|
|
323
340
|
// deprecated
|
|
324
341
|
item: 'item',
|
|
325
342
|
group: 'group',
|
|
@@ -340,6 +357,7 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
|
|
|
340
357
|
},
|
|
341
358
|
methods: {
|
|
342
359
|
scrollToIndex: 'scrollToIndex',
|
|
360
|
+
scrollIntoView: 'scrollIntoView',
|
|
343
361
|
scrollTo: 'scrollTo',
|
|
344
362
|
scrollBy: 'scrollBy',
|
|
345
363
|
adjustForPrependedItems: 'adjustForPrependedItems',
|
|
@@ -356,14 +374,9 @@ exports.List = (_a = react_urx_1.systemToComponent(combinedSystem, {
|
|
|
356
374
|
groupIndices: 'groupIndices',
|
|
357
375
|
},
|
|
358
376
|
}, ListRoot), _a.Component), exports.usePublisher = _a.usePublisher, exports.useEmitterValue = _a.useEmitterValue, exports.useEmitter = _a.useEmitter;
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
useEmitterValue: exports.useEmitterValue,
|
|
366
|
-
useEmitter: exports.useEmitter,
|
|
367
|
-
window: window,
|
|
368
|
-
});
|
|
369
|
-
};
|
|
377
|
+
var Scroller = buildScroller({ usePublisher: exports.usePublisher, useEmitterValue: exports.useEmitterValue, useEmitter: exports.useEmitter });
|
|
378
|
+
var WindowScroller = buildWindowScroller({
|
|
379
|
+
usePublisher: exports.usePublisher,
|
|
380
|
+
useEmitterValue: exports.useEmitterValue,
|
|
381
|
+
useEmitter: exports.useEmitter,
|
|
382
|
+
});
|