@ringcentral/juno 2.40.0 → 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/Tooltip/Tooltip.js +20 -2
- 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/Tooltip/Tooltip.js +21 -3
- 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/es6/foundation/hooks/useForkRef/useForkRef.js +2 -1
- package/foundation/hooks/useForkRef/useForkRef.d.ts +2 -1
- package/foundation/hooks/useForkRef/useForkRef.js +1 -0
- 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,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
|
var comparators_1 = require("./comparators");
|
|
6
6
|
var domIOSystem_1 = require("./domIOSystem");
|
|
7
7
|
var propsReadySystem_1 = require("./propsReadySystem");
|
|
@@ -9,7 +9,10 @@ var scrollSeekSystem_1 = require("./scrollSeekSystem");
|
|
|
9
9
|
var scrollToIndexSystem_1 = require("./scrollToIndexSystem");
|
|
10
10
|
var sizeRangeSystem_1 = require("./sizeRangeSystem");
|
|
11
11
|
var stateFlagsSystem_1 = require("./stateFlagsSystem");
|
|
12
|
+
var loggerSystem_1 = require("./loggerSystem");
|
|
12
13
|
var windowScrollerSystem_1 = require("./windowScrollerSystem");
|
|
14
|
+
var initialTopMostItemIndexSystem_1 = require("./initialTopMostItemIndexSystem");
|
|
15
|
+
var skipFrames_1 = require("./utils/skipFrames");
|
|
13
16
|
var INITIAL_GRID_STATE = {
|
|
14
17
|
items: [],
|
|
15
18
|
offsetBottom: 0,
|
|
@@ -29,86 +32,161 @@ var PROBE_GRID_STATE = {
|
|
|
29
32
|
itemWidth: 0,
|
|
30
33
|
};
|
|
31
34
|
var round = Math.round, ceil = Math.ceil, floor = Math.floor, min = Math.min, max = Math.max;
|
|
32
|
-
function
|
|
33
|
-
return
|
|
35
|
+
function buildProbeGridState(items) {
|
|
36
|
+
return tslib_1.__assign(tslib_1.__assign({}, PROBE_GRID_STATE), { items: items });
|
|
37
|
+
}
|
|
38
|
+
function buildItems(startIndex, endIndex, data) {
|
|
39
|
+
return Array.from({ length: endIndex - startIndex + 1 }).map(function (_, i) {
|
|
40
|
+
var dataItem = data === null ? null : data[i + startIndex];
|
|
41
|
+
return { index: i + startIndex, data: dataItem };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function gapComparator(prev, next) {
|
|
45
|
+
return prev && prev.column === next.column && prev.row === next.row;
|
|
46
|
+
}
|
|
47
|
+
function dimensionComparator(prev, next) {
|
|
48
|
+
return prev && prev.width === next.width && prev.height === next.height;
|
|
34
49
|
}
|
|
35
50
|
exports.gridSystem = u.system(function (_a) {
|
|
36
|
-
var _b = tslib_1.__read(_a,
|
|
51
|
+
var _b = tslib_1.__read(_a, 7), _c = _b[0], overscan = _c.overscan, visibleRange = _c.visibleRange, listBoundary = _c.listBoundary, _d = _b[1], scrollTop = _d.scrollTop, viewportHeight = _d.viewportHeight, scrollBy = _d.scrollBy, scrollTo = _d.scrollTo, smoothScrollTargetReached = _d.smoothScrollTargetReached, scrollContainerState = _d.scrollContainerState, footerHeight = _d.footerHeight, headerHeight = _d.headerHeight, stateFlags = _b[2], scrollSeek = _b[3], _e = _b[4], propsReady = _e.propsReady, didMount = _e.didMount, _f = _b[5], windowViewportRect = _f.windowViewportRect, useWindowScroll = _f.useWindowScroll, customScrollParent = _f.customScrollParent, windowScrollContainerState = _f.windowScrollContainerState, windowScrollTo = _f.windowScrollTo, log = _b[6];
|
|
37
52
|
var totalCount = u.statefulStream(0);
|
|
38
53
|
var initialItemCount = u.statefulStream(0);
|
|
39
54
|
var gridState = u.statefulStream(INITIAL_GRID_STATE);
|
|
40
|
-
var viewportDimensions = u.statefulStream({
|
|
41
|
-
|
|
42
|
-
width: 0,
|
|
43
|
-
});
|
|
44
|
-
var itemDimensions = u.statefulStream({
|
|
45
|
-
height: 0,
|
|
46
|
-
width: 0,
|
|
47
|
-
});
|
|
55
|
+
var viewportDimensions = u.statefulStream({ height: 0, width: 0 });
|
|
56
|
+
var itemDimensions = u.statefulStream({ height: 0, width: 0 });
|
|
48
57
|
var scrollToIndex = u.stream();
|
|
49
58
|
var scrollHeight = u.stream();
|
|
50
59
|
var deviation = u.statefulStream(0);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
var data = u.statefulStream(null);
|
|
61
|
+
var gap = u.statefulStream({ row: 0, column: 0 });
|
|
62
|
+
var stateChanged = u.stream();
|
|
63
|
+
var restoreStateFrom = u.stream();
|
|
64
|
+
var stateRestoreInProgress = u.statefulStream(false);
|
|
65
|
+
var initialTopMostItemIndex = u.statefulStream(0);
|
|
66
|
+
var scrolledToInitialItem = u.statefulStream(true);
|
|
67
|
+
var scrollScheduled = u.statefulStream(false);
|
|
68
|
+
u.subscribe(u.pipe(didMount, u.withLatestFrom(initialTopMostItemIndex), u.filter(function (_a) {
|
|
69
|
+
var _b = tslib_1.__read(_a, 2), _ = _b[0], location = _b[1];
|
|
70
|
+
return !!location;
|
|
71
|
+
})), function () {
|
|
72
|
+
// console.log('block rendering')
|
|
73
|
+
u.publish(scrolledToInitialItem, false);
|
|
74
|
+
// topmost item index takes precedence over initial item count
|
|
75
|
+
u.publish(initialItemCount, 0);
|
|
76
|
+
});
|
|
77
|
+
u.subscribe(u.pipe(u.combineLatest(didMount, scrolledToInitialItem, itemDimensions, viewportDimensions, initialTopMostItemIndex, scrollScheduled), u.filter(function (_a) {
|
|
78
|
+
var _b = tslib_1.__read(_a, 6), didMount = _b[0], scrolledToInitialItem = _b[1], itemDimensions = _b[2], viewportDimensions = _b[3], scrollScheduled = _b[5];
|
|
79
|
+
return didMount && !scrolledToInitialItem && itemDimensions.height !== 0 && viewportDimensions.height !== 0 && !scrollScheduled;
|
|
80
|
+
})), function (_a) {
|
|
81
|
+
var _b = tslib_1.__read(_a, 5), initialTopMostItemIndex = _b[4];
|
|
82
|
+
u.publish(scrollScheduled, true);
|
|
83
|
+
skipFrames_1.skipFrames(1, function () {
|
|
84
|
+
u.publish(scrollToIndex, initialTopMostItemIndex);
|
|
85
|
+
});
|
|
86
|
+
u.handleNext(u.pipe(scrollTop), function () {
|
|
87
|
+
// this refreshes the sizeRangeSystem start/endOffset
|
|
88
|
+
u.publish(listBoundary, [0, 0]);
|
|
89
|
+
// console.log('resume rendering')
|
|
90
|
+
u.publish(scrolledToInitialItem, true);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
// state snapshot takes precedence over initial item count
|
|
94
|
+
u.connect(u.pipe(restoreStateFrom, u.filter(function (value) { return value !== undefined && value !== null && value.scrollTop > 0; }), u.mapTo(0)), initialItemCount);
|
|
95
|
+
u.subscribe(u.pipe(didMount, u.withLatestFrom(restoreStateFrom), u.filter(function (_a) {
|
|
96
|
+
var _b = tslib_1.__read(_a, 2), snapshot = _b[1];
|
|
97
|
+
return snapshot !== undefined && snapshot !== null;
|
|
98
|
+
})), function (_a) {
|
|
99
|
+
var _b = tslib_1.__read(_a, 2), snapshot = _b[1];
|
|
100
|
+
if (!snapshot) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
u.publish(viewportDimensions, snapshot.viewport), u.publish(itemDimensions, snapshot === null || snapshot === void 0 ? void 0 : snapshot.item);
|
|
104
|
+
u.publish(gap, snapshot.gap);
|
|
105
|
+
if (snapshot.scrollTop > 0) {
|
|
106
|
+
u.publish(stateRestoreInProgress, true);
|
|
107
|
+
u.handleNext(u.pipe(scrollTop, u.skip(1)), function (_value) {
|
|
108
|
+
u.publish(stateRestoreInProgress, false);
|
|
109
|
+
});
|
|
110
|
+
u.publish(scrollTo, { top: snapshot.scrollTop });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
u.connect(u.pipe(viewportDimensions, u.map(function (_a) {
|
|
114
|
+
var height = _a.height;
|
|
115
|
+
return height;
|
|
116
|
+
})), viewportHeight);
|
|
117
|
+
u.connect(u.pipe(u.combineLatest(u.duc(viewportDimensions, dimensionComparator), u.duc(itemDimensions, dimensionComparator), u.duc(gap, function (prev, next) { return prev && prev.column === next.column && prev.row === next.row; }), u.duc(scrollTop)), u.map(function (_a) {
|
|
118
|
+
var _b = tslib_1.__read(_a, 4), viewport = _b[0], item = _b[1], gap = _b[2], scrollTop = _b[3];
|
|
119
|
+
return ({
|
|
120
|
+
viewport: viewport,
|
|
121
|
+
item: item,
|
|
122
|
+
gap: gap,
|
|
123
|
+
scrollTop: scrollTop,
|
|
124
|
+
});
|
|
125
|
+
})), stateChanged);
|
|
126
|
+
u.connect(u.pipe(u.combineLatest(u.duc(totalCount), visibleRange, u.duc(gap, gapComparator), u.duc(itemDimensions, dimensionComparator), u.duc(viewportDimensions, dimensionComparator), u.duc(data), u.duc(initialItemCount), u.duc(stateRestoreInProgress), u.duc(scrolledToInitialItem), u.duc(initialTopMostItemIndex)), u.filter(function (_a) {
|
|
127
|
+
var _b = tslib_1.__read(_a, 8), stateRestoreInProgress = _b[7];
|
|
128
|
+
return !stateRestoreInProgress;
|
|
54
129
|
}), u.map(function (_a) {
|
|
55
|
-
var _b = tslib_1.__read(_a,
|
|
56
|
-
|
|
57
|
-
items: buildItems(0, count - 1),
|
|
58
|
-
top: 0,
|
|
59
|
-
bottom: 0,
|
|
60
|
-
offsetBottom: 0,
|
|
61
|
-
offsetTop: 0,
|
|
62
|
-
itemHeight: 0,
|
|
63
|
-
itemWidth: 0,
|
|
64
|
-
};
|
|
65
|
-
})), gridState);
|
|
66
|
-
u.connect(u.pipe(u.combineLatest(u.duc(totalCount), visibleRange, u.duc(itemDimensions, function (prev, next) {
|
|
67
|
-
return prev && prev.width === next.width && prev.height === next.height;
|
|
68
|
-
})), u.withLatestFrom(viewportDimensions), u.map(function (_a) {
|
|
69
|
-
var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 3), totalCount = _c[0], _d = tslib_1.__read(_c[1], 2), startOffset = _d[0], endOffset = _d[1], item = _c[2], viewport = _b[1];
|
|
130
|
+
var _b = tslib_1.__read(_a, 10), totalCount = _b[0], _c = tslib_1.__read(_b[1], 2), startOffset = _c[0], endOffset = _c[1], gap = _b[2], item = _b[3], viewport = _b[4], data = _b[5], initialItemCount = _b[6], scrolledToInitialItem = _b[8], initialTopMostItemIndex = _b[9];
|
|
131
|
+
var rowGap = gap.row, columnGap = gap.column;
|
|
70
132
|
var itemHeight = item.height, itemWidth = item.width;
|
|
71
133
|
var viewportWidth = viewport.width;
|
|
72
|
-
|
|
134
|
+
// don't wipeout the already rendered state if there's an initial item count
|
|
135
|
+
if (initialItemCount === 0 && (totalCount === 0 || viewportWidth === 0)) {
|
|
73
136
|
return INITIAL_GRID_STATE;
|
|
74
137
|
}
|
|
75
138
|
if (itemWidth === 0) {
|
|
76
|
-
|
|
139
|
+
var startIndex_1 = initialTopMostItemIndexSystem_1.getInitialTopMostItemIndexNumber(initialTopMostItemIndex, totalCount);
|
|
140
|
+
// if the initial item count is set, we don't render the items from the initial item count.
|
|
141
|
+
var endIndex_1 = startIndex_1 === 0 ? Math.max(initialItemCount - 1, 0) : startIndex_1;
|
|
142
|
+
return buildProbeGridState(buildItems(startIndex_1, endIndex_1, data));
|
|
143
|
+
}
|
|
144
|
+
var perRow = itemsPerRow(viewportWidth, itemWidth, columnGap);
|
|
145
|
+
var startIndex;
|
|
146
|
+
var endIndex;
|
|
147
|
+
// render empty items until the scroller reaches the initial item
|
|
148
|
+
if (!scrolledToInitialItem) {
|
|
149
|
+
startIndex = 0;
|
|
150
|
+
endIndex = -1;
|
|
151
|
+
}
|
|
152
|
+
// we know the dimensions from a restored state, but the offsets are not calculated yet
|
|
153
|
+
else if (startOffset === 0 && endOffset === 0 && initialItemCount > 0) {
|
|
154
|
+
startIndex = 0;
|
|
155
|
+
endIndex = initialItemCount - 1;
|
|
77
156
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
var
|
|
157
|
+
else {
|
|
158
|
+
startIndex = perRow * floor((startOffset + rowGap) / (itemHeight + rowGap));
|
|
159
|
+
endIndex = perRow * ceil((endOffset + rowGap) / (itemHeight + rowGap)) - 1;
|
|
160
|
+
endIndex = min(totalCount - 1, max(endIndex, perRow - 1));
|
|
161
|
+
startIndex = min(endIndex, max(0, startIndex));
|
|
162
|
+
}
|
|
163
|
+
var items = buildItems(startIndex, endIndex, data);
|
|
164
|
+
var _d = gridLayout(viewport, gap, item, items), top = _d.top, bottom = _d.bottom;
|
|
165
|
+
var rowCount = ceil(totalCount / perRow);
|
|
166
|
+
var totalHeight = rowCount * itemHeight + (rowCount - 1) * rowGap;
|
|
86
167
|
var offsetBottom = totalHeight - bottom;
|
|
87
|
-
return {
|
|
88
|
-
items: items,
|
|
89
|
-
offsetTop: top,
|
|
90
|
-
offsetBottom: offsetBottom,
|
|
91
|
-
top: top,
|
|
92
|
-
bottom: bottom,
|
|
93
|
-
itemHeight: itemHeight,
|
|
94
|
-
itemWidth: itemWidth,
|
|
95
|
-
};
|
|
168
|
+
return { items: items, offsetTop: top, offsetBottom: offsetBottom, top: top, bottom: bottom, itemHeight: itemHeight, itemWidth: itemWidth };
|
|
96
169
|
})), gridState);
|
|
97
|
-
u.connect(u.pipe(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var _b = tslib_1.__read(_a,
|
|
103
|
-
var _c = gridLayout(viewportDimensions,
|
|
170
|
+
u.connect(u.pipe(data, u.filter(function (data) { return data !== null; }), u.map(function (data) { return data.length; })), totalCount);
|
|
171
|
+
u.connect(u.pipe(u.combineLatest(viewportDimensions, itemDimensions, gridState, gap), u.filter(function (_a) {
|
|
172
|
+
var _b = tslib_1.__read(_a, 3), viewportDimensions = _b[0], itemDimensions = _b[1], items = _b[2].items;
|
|
173
|
+
return items.length > 0 && itemDimensions.height !== 0 && viewportDimensions.height !== 0;
|
|
174
|
+
}), u.map(function (_a) {
|
|
175
|
+
var _b = tslib_1.__read(_a, 4), viewportDimensions = _b[0], itemDimensions = _b[1], items = _b[2].items, gap = _b[3];
|
|
176
|
+
var _c = gridLayout(viewportDimensions, gap, itemDimensions, items), top = _c.top, bottom = _c.bottom;
|
|
104
177
|
return [top, bottom];
|
|
105
178
|
}), u.distinctUntilChanged(comparators_1.tupleComparator)), listBoundary);
|
|
179
|
+
var hasScrolled = u.statefulStream(false);
|
|
180
|
+
u.connect(u.pipe(scrollTop, u.withLatestFrom(hasScrolled), u.map(function (_a) {
|
|
181
|
+
var _b = tslib_1.__read(_a, 2), scrollTop = _b[0], hasScrolled = _b[1];
|
|
182
|
+
return hasScrolled || scrollTop !== 0;
|
|
183
|
+
})), hasScrolled);
|
|
106
184
|
var endReached = u.streamFromEmitter(u.pipe(u.duc(gridState), u.filter(function (_a) {
|
|
107
185
|
var items = _a.items;
|
|
108
186
|
return items.length > 0;
|
|
109
|
-
}), u.withLatestFrom(totalCount), u.filter(function (_a) {
|
|
110
|
-
var _b = tslib_1.__read(_a,
|
|
111
|
-
return items[items.length - 1].index === totalCount - 1;
|
|
187
|
+
}), u.withLatestFrom(totalCount, hasScrolled), u.filter(function (_a) {
|
|
188
|
+
var _b = tslib_1.__read(_a, 3), items = _b[0].items, totalCount = _b[1], hasScrolled = _b[2];
|
|
189
|
+
return hasScrolled && items[items.length - 1].index === totalCount - 1;
|
|
112
190
|
}), u.map(function (_a) {
|
|
113
191
|
var _b = tslib_1.__read(_a, 2), totalCount = _b[1];
|
|
114
192
|
return totalCount - 1;
|
|
@@ -116,20 +194,22 @@ exports.gridSystem = u.system(function (_a) {
|
|
|
116
194
|
var startReached = u.streamFromEmitter(u.pipe(u.duc(gridState), u.filter(function (_a) {
|
|
117
195
|
var items = _a.items;
|
|
118
196
|
return items.length > 0 && items[0].index === 0;
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
197
|
+
}),
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
199
|
+
u.mapTo(0), u.distinctUntilChanged()));
|
|
200
|
+
var rangeChanged = u.streamFromEmitter(u.pipe(u.duc(gridState), u.withLatestFrom(stateRestoreInProgress), u.filter(function (_a) {
|
|
201
|
+
var _b = tslib_1.__read(_a, 2), items = _b[0].items, stateRestoreInProgress = _b[1];
|
|
202
|
+
return items.length > 0 && !stateRestoreInProgress;
|
|
123
203
|
}), u.map(function (_a) {
|
|
124
|
-
var items =
|
|
204
|
+
var _b = tslib_1.__read(_a, 1), items = _b[0].items;
|
|
125
205
|
return {
|
|
126
206
|
startIndex: items[0].index,
|
|
127
207
|
endIndex: items[items.length - 1].index,
|
|
128
208
|
};
|
|
129
|
-
}), u.distinctUntilChanged(comparators_1.rangeComparator)));
|
|
209
|
+
}), u.distinctUntilChanged(comparators_1.rangeComparator), u.throttleTime(0)));
|
|
130
210
|
u.connect(rangeChanged, scrollSeek.scrollSeekRangeChanged);
|
|
131
|
-
u.connect(u.pipe(scrollToIndex, u.withLatestFrom(viewportDimensions, itemDimensions, totalCount), u.map(function (_a) {
|
|
132
|
-
var _b = tslib_1.__read(_a,
|
|
211
|
+
u.connect(u.pipe(scrollToIndex, u.withLatestFrom(viewportDimensions, itemDimensions, totalCount, gap), u.map(function (_a) {
|
|
212
|
+
var _b = tslib_1.__read(_a, 5), location = _b[0], viewportDimensions = _b[1], itemDimensions = _b[2], totalCount = _b[3], gap = _b[4];
|
|
133
213
|
var normalLocation = scrollToIndexSystem_1.normalizeIndexLocation(location);
|
|
134
214
|
var align = normalLocation.align, behavior = normalLocation.behavior, offset = normalLocation.offset;
|
|
135
215
|
var index = normalLocation.index;
|
|
@@ -137,12 +217,12 @@ exports.gridSystem = u.system(function (_a) {
|
|
|
137
217
|
index = totalCount - 1;
|
|
138
218
|
}
|
|
139
219
|
index = max(0, index, min(totalCount - 1, index));
|
|
140
|
-
var top = itemTop(
|
|
220
|
+
var top = itemTop(viewportDimensions, gap, itemDimensions, index);
|
|
141
221
|
if (align === 'end') {
|
|
142
|
-
top = round(top -
|
|
222
|
+
top = round(top - viewportDimensions.height + itemDimensions.height);
|
|
143
223
|
}
|
|
144
224
|
else if (align === 'center') {
|
|
145
|
-
top = round(top -
|
|
225
|
+
top = round(top - viewportDimensions.height / 2 + itemDimensions.height / 2);
|
|
146
226
|
}
|
|
147
227
|
if (offset) {
|
|
148
228
|
top += offset;
|
|
@@ -152,12 +232,10 @@ exports.gridSystem = u.system(function (_a) {
|
|
|
152
232
|
var totalListHeight = u.statefulStreamFromEmitter(u.pipe(gridState, u.map(function (gridState) {
|
|
153
233
|
return gridState.offsetBottom + gridState.bottom;
|
|
154
234
|
})), 0);
|
|
155
|
-
u.connect(u.pipe(windowViewportRect, u.map(function (viewportInfo) { return ({
|
|
156
|
-
|
|
157
|
-
height: viewportInfo.visibleHeight,
|
|
158
|
-
}); })), viewportDimensions);
|
|
159
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({
|
|
235
|
+
u.connect(u.pipe(windowViewportRect, u.map(function (viewportInfo) { return ({ width: viewportInfo.visibleWidth, height: viewportInfo.visibleHeight }); })), viewportDimensions);
|
|
236
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({
|
|
160
237
|
// input
|
|
238
|
+
data: data,
|
|
161
239
|
totalCount: totalCount,
|
|
162
240
|
viewportDimensions: viewportDimensions,
|
|
163
241
|
itemDimensions: itemDimensions,
|
|
@@ -175,27 +253,36 @@ exports.gridSystem = u.system(function (_a) {
|
|
|
175
253
|
windowScrollContainerState: windowScrollContainerState,
|
|
176
254
|
deviation: deviation,
|
|
177
255
|
scrollContainerState: scrollContainerState,
|
|
178
|
-
|
|
256
|
+
footerHeight: footerHeight,
|
|
257
|
+
headerHeight: headerHeight,
|
|
258
|
+
initialItemCount: initialItemCount,
|
|
259
|
+
gap: gap,
|
|
260
|
+
restoreStateFrom: restoreStateFrom }, scrollSeek), { initialTopMostItemIndex: initialTopMostItemIndex,
|
|
179
261
|
// output
|
|
180
262
|
gridState: gridState,
|
|
181
263
|
totalListHeight: totalListHeight }), stateFlags), { startReached: startReached,
|
|
182
264
|
endReached: endReached,
|
|
183
265
|
rangeChanged: rangeChanged,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
266
|
+
stateChanged: stateChanged,
|
|
267
|
+
propsReady: propsReady,
|
|
268
|
+
stateRestoreInProgress: stateRestoreInProgress }), log);
|
|
269
|
+
}, u.tup(sizeRangeSystem_1.sizeRangeSystem, domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem, scrollSeekSystem_1.scrollSeekSystem, propsReadySystem_1.propsReadySystem, windowScrollerSystem_1.windowScrollerSystem, loggerSystem_1.loggerSystem));
|
|
270
|
+
function gridLayout(viewport, gap, item, items) {
|
|
187
271
|
var itemHeight = item.height;
|
|
188
272
|
if (itemHeight === undefined || items.length === 0) {
|
|
189
273
|
return { top: 0, bottom: 0 };
|
|
190
274
|
}
|
|
191
|
-
var top = itemTop(viewport, item, items[0].index);
|
|
192
|
-
var bottom = itemTop(viewport, item, items[items.length - 1].index) + itemHeight;
|
|
275
|
+
var top = itemTop(viewport, gap, item, items[0].index);
|
|
276
|
+
var bottom = itemTop(viewport, gap, item, items[items.length - 1].index) + itemHeight;
|
|
193
277
|
return { top: top, bottom: bottom };
|
|
194
278
|
}
|
|
195
|
-
function itemTop(viewport, item, index) {
|
|
196
|
-
var perRow = itemsPerRow(viewport.width, item.width);
|
|
197
|
-
|
|
279
|
+
function itemTop(viewport, gap, item, index) {
|
|
280
|
+
var perRow = itemsPerRow(viewport.width, item.width, gap.column);
|
|
281
|
+
var rowCount = floor(index / perRow);
|
|
282
|
+
var top = rowCount * item.height + max(0, rowCount - 1) * gap.row;
|
|
283
|
+
return top > 0 ? top + gap.row : top;
|
|
198
284
|
}
|
|
199
|
-
function itemsPerRow(viewportWidth, itemWidth) {
|
|
200
|
-
return max(1, floor(viewportWidth / itemWidth));
|
|
285
|
+
function itemsPerRow(viewportWidth, itemWidth, gap) {
|
|
286
|
+
return max(1, floor((viewportWidth + gap) / (floor(itemWidth) + gap)));
|
|
201
287
|
}
|
|
288
|
+
exports.itemsPerRow = itemsPerRow;
|
|
@@ -1,77 +1,86 @@
|
|
|
1
|
+
import * as u from './urx';
|
|
1
2
|
export interface GroupIndexesAndCount {
|
|
2
3
|
totalCount: number;
|
|
3
4
|
groupIndices: number[];
|
|
4
5
|
}
|
|
5
6
|
export declare function groupCountsToIndicesAndCount(counts: number[]): GroupIndexesAndCount;
|
|
6
|
-
export declare const groupedListSystem:
|
|
7
|
-
log:
|
|
8
|
-
logLevel:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export declare const groupedListSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
|
|
8
|
+
log: u.StatefulStream<import("./loggerSystem").Log>;
|
|
9
|
+
logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
|
|
10
|
+
}>, u.SystemSpec<never[], () => {
|
|
11
|
+
recalcInProgress: u.StatefulStream<boolean>;
|
|
12
|
+
}>], ([{ log }, { recalcInProgress }]: [{
|
|
13
|
+
log: u.StatefulStream<import("./loggerSystem").Log>;
|
|
14
|
+
logLevel: u.StatefulStream<import("./loggerSystem").LogLevel>;
|
|
15
|
+
}, {
|
|
16
|
+
recalcInProgress: u.StatefulStream<boolean>;
|
|
12
17
|
}]) => {
|
|
13
|
-
data:
|
|
14
|
-
totalCount:
|
|
15
|
-
sizeRanges:
|
|
16
|
-
groupIndices:
|
|
17
|
-
defaultItemSize:
|
|
18
|
-
fixedItemSize:
|
|
19
|
-
unshiftWith:
|
|
20
|
-
shiftWith:
|
|
21
|
-
shiftWithOffset:
|
|
22
|
-
beforeUnshiftWith:
|
|
23
|
-
firstItemIndex:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
data: u.StatefulStream<import("./sizeSystem").Data>;
|
|
19
|
+
totalCount: u.Stream<number>;
|
|
20
|
+
sizeRanges: u.Stream<import("./interfaces").SizeRange[]>;
|
|
21
|
+
groupIndices: u.StatefulStream<number[]>;
|
|
22
|
+
defaultItemSize: u.StatefulStream<number | undefined>;
|
|
23
|
+
fixedItemSize: u.StatefulStream<number | undefined>;
|
|
24
|
+
unshiftWith: u.Stream<number>;
|
|
25
|
+
shiftWith: u.Stream<number>;
|
|
26
|
+
shiftWithOffset: u.Stream<number>;
|
|
27
|
+
beforeUnshiftWith: u.Stream<number>;
|
|
28
|
+
firstItemIndex: u.StatefulStream<number>;
|
|
29
|
+
gap: u.StatefulStream<number>;
|
|
30
|
+
sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
|
|
31
|
+
listRefresh: u.Stream<boolean>;
|
|
32
|
+
statefulTotalCount: u.StatefulStream<number>;
|
|
33
|
+
trackItemSizes: u.StatefulStream<boolean>;
|
|
34
|
+
itemSize: u.StatefulStream<import("./interfaces").SizeFunction>;
|
|
35
|
+
}>, u.SystemSpec<never[], () => {
|
|
36
|
+
scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
|
|
37
|
+
scrollTop: u.Stream<number>;
|
|
38
|
+
viewportHeight: u.Stream<number>;
|
|
39
|
+
headerHeight: u.StatefulStream<number>;
|
|
40
|
+
fixedHeaderHeight: u.StatefulStream<number>;
|
|
41
|
+
fixedFooterHeight: u.StatefulStream<number>;
|
|
42
|
+
footerHeight: u.StatefulStream<number>;
|
|
43
|
+
scrollHeight: u.Stream<number>;
|
|
44
|
+
smoothScrollTargetReached: u.Stream<true>;
|
|
45
|
+
scrollTo: u.Stream<ScrollToOptions>;
|
|
46
|
+
scrollBy: u.Stream<ScrollToOptions>;
|
|
47
|
+
statefulScrollTop: u.StatefulStream<number>;
|
|
48
|
+
deviation: u.StatefulStream<number>;
|
|
49
|
+
scrollingInProgress: u.StatefulStream<boolean>;
|
|
43
50
|
}>], ([{ totalCount, groupIndices, sizes }, { scrollTop, headerHeight }]: [{
|
|
44
|
-
data:
|
|
45
|
-
totalCount:
|
|
46
|
-
sizeRanges:
|
|
47
|
-
groupIndices:
|
|
48
|
-
defaultItemSize:
|
|
49
|
-
fixedItemSize:
|
|
50
|
-
unshiftWith:
|
|
51
|
-
shiftWith:
|
|
52
|
-
shiftWithOffset:
|
|
53
|
-
beforeUnshiftWith:
|
|
54
|
-
firstItemIndex:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
data: u.StatefulStream<import("./sizeSystem").Data>;
|
|
52
|
+
totalCount: u.Stream<number>;
|
|
53
|
+
sizeRanges: u.Stream<import("./interfaces").SizeRange[]>;
|
|
54
|
+
groupIndices: u.StatefulStream<number[]>;
|
|
55
|
+
defaultItemSize: u.StatefulStream<number | undefined>;
|
|
56
|
+
fixedItemSize: u.StatefulStream<number | undefined>;
|
|
57
|
+
unshiftWith: u.Stream<number>;
|
|
58
|
+
shiftWith: u.Stream<number>;
|
|
59
|
+
shiftWithOffset: u.Stream<number>;
|
|
60
|
+
beforeUnshiftWith: u.Stream<number>;
|
|
61
|
+
firstItemIndex: u.StatefulStream<number>;
|
|
62
|
+
gap: u.StatefulStream<number>;
|
|
63
|
+
sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
|
|
64
|
+
listRefresh: u.Stream<boolean>;
|
|
65
|
+
statefulTotalCount: u.StatefulStream<number>;
|
|
66
|
+
trackItemSizes: u.StatefulStream<boolean>;
|
|
67
|
+
itemSize: u.StatefulStream<import("./interfaces").SizeFunction>;
|
|
60
68
|
}, {
|
|
61
|
-
scrollContainerState:
|
|
62
|
-
scrollTop:
|
|
63
|
-
viewportHeight:
|
|
64
|
-
headerHeight:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
|
|
70
|
+
scrollTop: u.Stream<number>;
|
|
71
|
+
viewportHeight: u.Stream<number>;
|
|
72
|
+
headerHeight: u.StatefulStream<number>;
|
|
73
|
+
fixedHeaderHeight: u.StatefulStream<number>;
|
|
74
|
+
fixedFooterHeight: u.StatefulStream<number>;
|
|
75
|
+
footerHeight: u.StatefulStream<number>;
|
|
76
|
+
scrollHeight: u.Stream<number>;
|
|
77
|
+
smoothScrollTargetReached: u.Stream<true>;
|
|
78
|
+
scrollTo: u.Stream<ScrollToOptions>;
|
|
79
|
+
scrollBy: u.Stream<ScrollToOptions>;
|
|
80
|
+
statefulScrollTop: u.StatefulStream<number>;
|
|
81
|
+
deviation: u.StatefulStream<number>;
|
|
82
|
+
scrollingInProgress: u.StatefulStream<boolean>;
|
|
74
83
|
}]) => {
|
|
75
|
-
groupCounts:
|
|
76
|
-
topItemsIndexes:
|
|
84
|
+
groupCounts: u.Stream<number[]>;
|
|
85
|
+
topItemsIndexes: u.Stream<[number]>;
|
|
77
86
|
}>;
|
|
@@ -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
|
|
4
|
+
var u = tslib_1.__importStar(require("./urx"));
|
|
5
5
|
var AATree_1 = require("./AATree");
|
|
6
6
|
var domIOSystem_1 = require("./domIOSystem");
|
|
7
7
|
var sizeSystem_1 = require("./sizeSystem");
|
|
@@ -16,19 +16,19 @@ function groupCountsToIndicesAndCount(counts) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
exports.groupCountsToIndicesAndCount = groupCountsToIndicesAndCount;
|
|
19
|
-
exports.groupedListSystem =
|
|
19
|
+
exports.groupedListSystem = u.system(function (_a) {
|
|
20
20
|
var _b = tslib_1.__read(_a, 2), _c = _b[0], totalCount = _c.totalCount, groupIndices = _c.groupIndices, sizes = _c.sizes, _d = _b[1], scrollTop = _d.scrollTop, headerHeight = _d.headerHeight;
|
|
21
|
-
var groupCounts =
|
|
22
|
-
var topItemsIndexes =
|
|
23
|
-
var groupIndicesAndCount =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var _b = tslib_1.__read(_a, 2), sizes = _b[1];
|
|
21
|
+
var groupCounts = u.stream();
|
|
22
|
+
var topItemsIndexes = u.stream();
|
|
23
|
+
var groupIndicesAndCount = u.streamFromEmitter(u.pipe(groupCounts, u.map(groupCountsToIndicesAndCount)));
|
|
24
|
+
u.connect(u.pipe(groupIndicesAndCount, u.map(function (value) { return value.totalCount; })), totalCount);
|
|
25
|
+
u.connect(u.pipe(groupIndicesAndCount, u.map(function (value) { return value.groupIndices; })), groupIndices);
|
|
26
|
+
u.connect(u.pipe(u.combineLatest(scrollTop, sizes, headerHeight), u.filter(function (_a) {
|
|
27
|
+
var _b = tslib_1.__read(_a, 2), _ = _b[0], sizes = _b[1];
|
|
28
28
|
return sizeSystem_1.hasGroups(sizes);
|
|
29
|
-
}),
|
|
29
|
+
}), u.map(function (_a) {
|
|
30
30
|
var _b = tslib_1.__read(_a, 3), scrollTop = _b[0], state = _b[1], headerHeight = _b[2];
|
|
31
31
|
return AATree_1.findMaxKeyValue(state.groupOffsetTree, Math.max(scrollTop - headerHeight, 0), 'v')[0];
|
|
32
|
-
}),
|
|
32
|
+
}), u.distinctUntilChanged(), u.map(function (index) { return [index]; })), topItemsIndexes);
|
|
33
33
|
return { groupCounts: groupCounts, topItemsIndexes: topItemsIndexes };
|
|
34
|
-
},
|
|
34
|
+
}, u.tup(sizeSystem_1.sizeSystem, domIOSystem_1.domIOSystem));
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Log } from '../loggerSystem';
|
|
3
|
-
import { SizeFunction,
|
|
4
|
-
export default function useChangedListContentsSizes(callback: (ranges: SizeRange[]) => void, itemSize: SizeFunction, enabled: boolean, scrollContainerStateCallback: (state: ScrollContainerState) => void, log: Log,
|
|
3
|
+
import { SizeRange, SizeFunction, ScrollContainerState } from '../interfaces';
|
|
4
|
+
export default function useChangedListContentsSizes(callback: (ranges: SizeRange[]) => void, itemSize: SizeFunction, enabled: boolean, scrollContainerStateCallback: (state: ScrollContainerState) => void, log: Log, gap?: (gap: number) => void, customScrollParent?: HTMLElement): {
|
|
5
|
+
ref: React.MutableRefObject<HTMLElement | null>;
|
|
6
|
+
callbackRef: (_el: HTMLElement | null) => void;
|
|
7
|
+
};
|