@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.
Files changed (183) hide show
  1. package/components/Downshift/SuggestionList/SuggestionList.d.ts +3 -3
  2. package/components/Downshift/utils/useDownshift.d.ts +1 -1
  3. package/components/Tooltip/Tooltip.js +20 -2
  4. package/components/Virtuoso/index.d.ts +1 -1
  5. package/components/Virtuoso/index.js +1 -1
  6. package/components/Virtuoso/react-virtuoso/AATree.d.ts +1 -1
  7. package/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  8. package/components/Virtuoso/react-virtuoso/TableVirtuoso.d.ts +5 -0
  9. package/components/Virtuoso/react-virtuoso/TableVirtuoso.js +217 -0
  10. package/components/Virtuoso/react-virtuoso/Virtuoso.d.ts +7696 -0
  11. package/components/Virtuoso/react-virtuoso/Virtuoso.js +317 -0
  12. package/components/Virtuoso/react-virtuoso/{Grid.d.ts → VirtuosoGrid.d.ts} +170 -72
  13. package/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +199 -0
  14. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +119 -65
  15. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  16. package/components/Virtuoso/react-virtuoso/comparators.d.ts +1 -1
  17. package/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  18. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.d.ts +194 -0
  19. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +2 -0
  20. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.d.ts +274 -0
  21. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +2 -0
  22. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.d.ts +125 -0
  23. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +2 -0
  24. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +3 -2
  25. package/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  26. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +80 -43
  27. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  28. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +57 -31
  29. package/components/Virtuoso/react-virtuoso/gridSystem.js +173 -86
  30. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +76 -67
  31. package/components/Virtuoso/react-virtuoso/groupedListSystem.js +12 -12
  32. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +6 -3
  33. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +36 -17
  34. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  35. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +3 -2
  36. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.d.ts +2 -0
  37. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +5 -0
  38. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +2 -3
  39. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +36 -51
  40. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -3
  41. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +13 -13
  42. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +17 -15
  43. package/components/Virtuoso/react-virtuoso/index.d.ts +7 -1
  44. package/components/Virtuoso/react-virtuoso/index.js +8 -1
  45. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +304 -68
  46. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +9 -31
  47. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +127 -109
  48. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  49. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +38 -22
  50. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  51. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +150 -51
  52. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +109 -59
  53. package/components/Virtuoso/react-virtuoso/listStateSystem.js +100 -52
  54. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +1691 -693
  55. package/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  56. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +1 -1
  57. package/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  58. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +1 -1
  59. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  60. package/components/Virtuoso/react-virtuoso/react-urx/index.d.ts +110 -0
  61. package/components/Virtuoso/react-virtuoso/react-urx/index.js +200 -0
  62. package/components/Virtuoso/react-virtuoso/react-urx/package.json +5 -0
  63. package/components/Virtuoso/react-virtuoso/recalcSystem.d.ts +4 -0
  64. package/components/Virtuoso/react-virtuoso/recalcSystem.js +8 -0
  65. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +144 -78
  66. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +33 -21
  67. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +12 -7
  68. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  69. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +19 -11
  70. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  71. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +7 -6
  72. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +15 -27
  73. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +20 -11
  74. package/components/Virtuoso/react-virtuoso/sizeSystem.js +182 -52
  75. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +8 -5
  76. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  77. package/components/Virtuoso/react-virtuoso/stateLoadSystem.d.ts +318 -0
  78. package/components/Virtuoso/react-virtuoso/stateLoadSystem.js +41 -0
  79. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +518 -467
  80. package/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  81. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +115 -63
  82. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  83. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +139 -73
  84. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +74 -31
  85. package/components/Virtuoso/react-virtuoso/urx/actions.d.ts +127 -0
  86. package/components/Virtuoso/react-virtuoso/urx/actions.js +98 -0
  87. package/components/Virtuoso/react-virtuoso/urx/constants.d.ts +8 -0
  88. package/components/Virtuoso/react-virtuoso/urx/constants.js +6 -0
  89. package/components/Virtuoso/react-virtuoso/urx/index.d.ts +6 -0
  90. package/components/Virtuoso/react-virtuoso/urx/index.js +9 -0
  91. package/components/Virtuoso/react-virtuoso/urx/package.json +5 -0
  92. package/components/Virtuoso/react-virtuoso/urx/pipe.d.ts +220 -0
  93. package/components/Virtuoso/react-virtuoso/urx/pipe.js +279 -0
  94. package/components/Virtuoso/react-virtuoso/urx/streams.d.ts +143 -0
  95. package/components/Virtuoso/react-virtuoso/urx/streams.js +227 -0
  96. package/components/Virtuoso/react-virtuoso/urx/system.d.ts +148 -0
  97. package/components/Virtuoso/react-virtuoso/urx/system.js +106 -0
  98. package/components/Virtuoso/react-virtuoso/urx/transformers.d.ts +71 -0
  99. package/components/Virtuoso/react-virtuoso/urx/transformers.js +106 -0
  100. package/components/Virtuoso/react-virtuoso/urx/utils.d.ts +57 -0
  101. package/components/Virtuoso/react-virtuoso/urx/utils.js +102 -0
  102. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.d.ts +1 -0
  103. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +6 -0
  104. package/components/Virtuoso/react-virtuoso/utils/context.d.ts +13 -0
  105. package/components/Virtuoso/react-virtuoso/utils/context.js +6 -0
  106. package/components/Virtuoso/react-virtuoso/utils/skipFrames.d.ts +1 -0
  107. package/components/Virtuoso/react-virtuoso/utils/skipFrames.js +11 -0
  108. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +6 -4
  109. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  110. package/components/Virtuoso/utils/isOutOfRange.d.ts +1 -1
  111. package/components/Virtuoso/utils/useHighlightScroll.d.ts +2 -2
  112. package/es6/components/Tooltip/Tooltip.js +21 -3
  113. package/es6/components/Virtuoso/index.js +1 -1
  114. package/es6/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  115. package/es6/components/Virtuoso/react-virtuoso/{Table.js → TableVirtuoso.js} +73 -52
  116. package/es6/components/Virtuoso/react-virtuoso/{List.js → Virtuoso.js} +85 -161
  117. package/es6/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +198 -0
  118. package/es6/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  119. package/es6/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  120. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +0 -0
  121. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +0 -0
  122. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +0 -0
  123. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  124. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  125. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +173 -87
  126. package/es6/components/Virtuoso/react-virtuoso/groupedListSystem.js +13 -13
  127. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +35 -16
  128. package/es6/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +2 -2
  129. package/es6/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +2 -0
  130. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +35 -50
  131. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +11 -12
  132. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +15 -14
  133. package/es6/components/Virtuoso/react-virtuoso/index.js +4 -1
  134. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +11 -33
  135. package/es6/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  136. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  137. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +101 -54
  138. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  139. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  140. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  141. package/es6/components/Virtuoso/react-virtuoso/react-urx/index.js +197 -0
  142. package/es6/components/Virtuoso/react-virtuoso/recalcSystem.js +5 -0
  143. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +34 -22
  144. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  145. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  146. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +16 -28
  147. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +180 -53
  148. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  149. package/es6/components/Virtuoso/react-virtuoso/stateLoadSystem.js +39 -0
  150. package/es6/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  151. package/es6/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  152. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +75 -32
  153. package/es6/components/Virtuoso/react-virtuoso/urx/actions.js +90 -0
  154. package/es6/components/Virtuoso/react-virtuoso/urx/constants.js +4 -0
  155. package/es6/components/Virtuoso/react-virtuoso/urx/index.js +6 -0
  156. package/es6/components/Virtuoso/react-virtuoso/urx/pipe.js +266 -0
  157. package/es6/components/Virtuoso/react-virtuoso/urx/streams.js +220 -0
  158. package/es6/components/Virtuoso/react-virtuoso/urx/system.js +102 -0
  159. package/es6/components/Virtuoso/react-virtuoso/urx/transformers.js +101 -0
  160. package/es6/components/Virtuoso/react-virtuoso/urx/utils.js +88 -0
  161. package/es6/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +3 -0
  162. package/es6/components/Virtuoso/react-virtuoso/utils/context.js +3 -0
  163. package/es6/components/Virtuoso/react-virtuoso/utils/skipFrames.js +8 -0
  164. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  165. package/es6/foundation/hooks/useForkRef/useForkRef.js +2 -1
  166. package/foundation/hooks/useForkRef/useForkRef.d.ts +2 -1
  167. package/foundation/hooks/useForkRef/useForkRef.js +1 -0
  168. package/package.json +2 -2
  169. package/components/Virtuoso/Virtuoso.d.ts +0 -1
  170. package/components/Virtuoso/Virtuoso.js +0 -4
  171. package/components/Virtuoso/react-virtuoso/Grid.js +0 -168
  172. package/components/Virtuoso/react-virtuoso/List.d.ts +0 -6749
  173. package/components/Virtuoso/react-virtuoso/List.js +0 -393
  174. package/components/Virtuoso/react-virtuoso/Table.d.ts +0 -6515
  175. package/components/Virtuoso/react-virtuoso/Table.js +0 -196
  176. package/components/Virtuoso/react-virtuoso/components.d.ts +0 -505
  177. package/components/Virtuoso/react-virtuoso/components.js +0 -9
  178. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.d.ts +0 -1
  179. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -11
  180. package/es6/components/Virtuoso/Virtuoso.js +0 -1
  181. package/es6/components/Virtuoso/react-virtuoso/Grid.js +0 -166
  182. package/es6/components/Virtuoso/react-virtuoso/components.js +0 -7
  183. package/es6/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -8
@@ -1,35 +1,47 @@
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("@virtuoso.dev/urx"));
4
+ var u = tslib_1.__importStar(require("./urx"));
5
5
  var AATree_1 = require("./AATree");
6
6
  var domIOSystem_1 = require("./domIOSystem");
7
- var listStateSystem_1 = require("./listStateSystem");
7
+ var sizeSystem_1 = require("./sizeSystem");
8
8
  var loggerSystem_1 = require("./loggerSystem");
9
9
  var scrollToIndexSystem_1 = require("./scrollToIndexSystem");
10
- var sizeSystem_1 = require("./sizeSystem");
10
+ var listStateSystem_1 = require("./listStateSystem");
11
+ var defaultCalculateViewLocation = function (_a) {
12
+ var itemTop = _a.itemTop, itemBottom = _a.itemBottom, viewportTop = _a.viewportTop, viewportBottom = _a.viewportBottom, _b = _a.locationParams, behavior = _b.behavior, align = _b.align, rest = tslib_1.__rest(_b, ["behavior", "align"]);
13
+ if (itemTop < viewportTop) {
14
+ return tslib_1.__assign(tslib_1.__assign({}, rest), { behavior: behavior, align: align !== null && align !== void 0 ? align : 'start' });
15
+ }
16
+ if (itemBottom > viewportBottom) {
17
+ return tslib_1.__assign(tslib_1.__assign({}, rest), { behavior: behavior, align: align !== null && align !== void 0 ? align : 'end' });
18
+ }
19
+ return null;
20
+ };
11
21
  exports.scrollIntoViewSystem = u.system(function (_a) {
12
- var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, _d = _b[1], scrollTop = _d.scrollTop, viewportHeight = _d.viewportHeight, headerHeight = _d.headerHeight, scrollingInProgress = _d.scrollingInProgress, scrollToIndex = _b[2].scrollToIndex;
22
+ var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, gap = _c.gap, _d = _b[1], scrollTop = _d.scrollTop, viewportHeight = _d.viewportHeight, headerHeight = _d.headerHeight, fixedHeaderHeight = _d.fixedHeaderHeight, fixedFooterHeight = _d.fixedFooterHeight, scrollingInProgress = _d.scrollingInProgress, scrollToIndex = _b[2].scrollToIndex;
13
23
  var scrollIntoView = u.stream();
14
- u.connect(u.pipe(scrollIntoView, u.withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, scrollTop), u.map(function (_a) {
15
- var _b = tslib_1.__read(_a, 6), _c = _b[0], index = _c.index, _d = _c.behavior, behavior = _d === void 0 ? 'auto' : _d, done = _c.done, sizes = _b[1], viewportHeight = _b[2], totalCount = _b[3], headerHeight = _b[4], scrollTop = _b[5];
16
- var lastIndex = totalCount - 1;
17
- var location = null;
18
- index = sizeSystem_1.originalIndexFromItemIndex(index, sizes);
19
- index = Math.max(0, index, Math.min(lastIndex, index));
20
- var itemTop = sizeSystem_1.offsetOf(index, sizes.offsetTree) + headerHeight;
21
- if (itemTop < scrollTop) {
22
- location = { index: index, behavior: behavior, align: 'start' };
23
- }
24
- else {
25
- var itemBottom = itemTop + AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1];
26
- if (itemBottom > scrollTop + viewportHeight) {
27
- location = { index: index, behavior: behavior, align: 'end' };
28
- }
29
- }
24
+ u.connect(u.pipe(scrollIntoView, u.withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollTop), u.withLatestFrom(gap), u.map(function (_a) {
25
+ var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 8), viewLocation = _c[0], sizes = _c[1], viewportHeight = _c[2], totalCount = _c[3], headerHeight = _c[4], fixedHeaderHeight = _c[5], fixedFooterHeight = _c[6], scrollTop = _c[7], gap = _b[1];
26
+ var done = viewLocation.done, behavior = viewLocation.behavior, align = viewLocation.align, _d = viewLocation.calculateViewLocation, calculateViewLocation = _d === void 0 ? defaultCalculateViewLocation : _d, rest = tslib_1.__rest(viewLocation, ["done", "behavior", "align", "calculateViewLocation"]);
27
+ var actualIndex = sizeSystem_1.originalIndexFromLocation(viewLocation, sizes, totalCount - 1);
28
+ var itemTop = sizeSystem_1.offsetOf(actualIndex, sizes.offsetTree, gap) + headerHeight + fixedHeaderHeight;
29
+ var itemBottom = itemTop + AATree_1.findMaxKeyValue(sizes.sizeTree, actualIndex)[1];
30
+ var viewportTop = scrollTop + fixedHeaderHeight;
31
+ var viewportBottom = scrollTop + viewportHeight - fixedFooterHeight;
32
+ var location = calculateViewLocation({
33
+ itemTop: itemTop,
34
+ itemBottom: itemBottom,
35
+ viewportTop: viewportTop,
36
+ viewportBottom: viewportBottom,
37
+ locationParams: tslib_1.__assign({ behavior: behavior, align: align }, rest),
38
+ });
30
39
  if (location) {
31
40
  done &&
32
- u.handleNext(u.pipe(scrollingInProgress, u.skip(1), u.filter(function (value) { return value === false; })), done);
41
+ u.handleNext(u.pipe(scrollingInProgress, u.filter(function (value) { return value === false; }),
42
+ // skips the initial publish of false, and the cleanup call.
43
+ // but if scrollingInProgress is true, we skip the initial publish.
44
+ u.skip(u.getValue(scrollingInProgress) ? 1 : 2)), done);
33
45
  }
34
46
  else {
35
47
  done && done();
@@ -1,35 +1,38 @@
1
- import * as u from '@virtuoso.dev/urx';
2
- import { ListRange, ScrollSeekConfiguration } from './interfaces';
1
+ import * as u from './urx';
2
+ import { ListRange } from './interfaces';
3
+ import { ScrollSeekConfiguration } from './interfaces';
3
4
  export declare const scrollSeekSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
4
5
  scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
5
6
  scrollTop: u.Stream<number>;
6
7
  viewportHeight: u.Stream<number>;
7
8
  headerHeight: u.StatefulStream<number>;
9
+ fixedHeaderHeight: u.StatefulStream<number>;
10
+ fixedFooterHeight: u.StatefulStream<number>;
8
11
  footerHeight: u.StatefulStream<number>;
9
12
  scrollHeight: u.Stream<number>;
10
13
  smoothScrollTargetReached: u.Stream<true>;
11
- react18ConcurrentRendering: u.StatefulStream<boolean>;
12
14
  scrollTo: u.Stream<ScrollToOptions>;
13
15
  scrollBy: u.Stream<ScrollToOptions>;
14
16
  statefulScrollTop: u.StatefulStream<number>;
15
17
  deviation: u.StatefulStream<number>;
16
18
  scrollingInProgress: u.StatefulStream<boolean>;
17
- }>], ([{ scrollContainerState, scrollTop, viewportHeight, headerHeight, footerHeight, scrollBy, },]: [{
19
+ }>], ([{ scrollContainerState, scrollTop, viewportHeight, headerHeight, footerHeight, scrollBy }]: [{
18
20
  scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
19
21
  scrollTop: u.Stream<number>;
20
22
  viewportHeight: u.Stream<number>;
21
23
  headerHeight: u.StatefulStream<number>;
24
+ fixedHeaderHeight: u.StatefulStream<number>;
25
+ fixedFooterHeight: u.StatefulStream<number>;
22
26
  footerHeight: u.StatefulStream<number>;
23
27
  scrollHeight: u.Stream<number>;
24
28
  smoothScrollTargetReached: u.Stream<true>;
25
- react18ConcurrentRendering: u.StatefulStream<boolean>;
26
29
  scrollTo: u.Stream<ScrollToOptions>;
27
30
  scrollBy: u.Stream<ScrollToOptions>;
28
31
  statefulScrollTop: u.StatefulStream<number>;
29
32
  deviation: u.StatefulStream<number>;
30
33
  scrollingInProgress: u.StatefulStream<boolean>;
31
34
  }]) => {
32
- isScrolling: u.Stream<boolean>;
35
+ isScrolling: u.StatefulStream<boolean>;
33
36
  isAtTop: u.StatefulStream<boolean>;
34
37
  isAtBottom: u.StatefulStream<boolean>;
35
38
  atBottomState: u.Stream<import("./stateFlagsSystem").AtBottomState>;
@@ -37,10 +40,11 @@ export declare const scrollSeekSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<
37
40
  atBottomStateChange: u.Stream<boolean>;
38
41
  scrollDirection: u.StatefulStream<import("./stateFlagsSystem").ScrollDirection>;
39
42
  atBottomThreshold: u.StatefulStream<number>;
43
+ atTopThreshold: u.StatefulStream<number>;
40
44
  scrollVelocity: u.StatefulStream<number>;
41
45
  lastJumpDueToItemResize: u.StatefulStream<number>;
42
46
  }>], ([{ scrollVelocity }]: [{
43
- isScrolling: u.Stream<boolean>;
47
+ isScrolling: u.StatefulStream<boolean>;
44
48
  isAtTop: u.StatefulStream<boolean>;
45
49
  isAtBottom: u.StatefulStream<boolean>;
46
50
  atBottomState: u.Stream<import("./stateFlagsSystem").AtBottomState>;
@@ -48,6 +52,7 @@ export declare const scrollSeekSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<
48
52
  atBottomStateChange: u.Stream<boolean>;
49
53
  scrollDirection: u.StatefulStream<import("./stateFlagsSystem").ScrollDirection>;
50
54
  atBottomThreshold: u.StatefulStream<number>;
55
+ atTopThreshold: u.StatefulStream<number>;
51
56
  scrollVelocity: u.StatefulStream<number>;
52
57
  lastJumpDueToItemResize: u.StatefulStream<number>;
53
58
  }]) => {
@@ -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("@virtuoso.dev/urx"));
4
+ var u = tslib_1.__importStar(require("./urx"));
5
5
  var stateFlagsSystem_1 = require("./stateFlagsSystem");
6
6
  exports.scrollSeekSystem = u.system(function (_a) {
7
7
  var _b = tslib_1.__read(_a, 1), scrollVelocity = _b[0].scrollVelocity;
@@ -9,7 +9,7 @@ exports.scrollSeekSystem = u.system(function (_a) {
9
9
  var rangeChanged = u.stream();
10
10
  var scrollSeekConfiguration = u.statefulStream(false);
11
11
  u.connect(u.pipe(scrollVelocity, u.withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged), u.filter(function (_a) {
12
- var _b = tslib_1.__read(_a, 2), config = _b[1];
12
+ var _b = tslib_1.__read(_a, 2), _ = _b[0], config = _b[1];
13
13
  return !!config;
14
14
  }), u.map(function (_a) {
15
15
  var _b = tslib_1.__read(_a, 4), speed = _b[0], config = _b[1], isSeeking = _b[2], range = _b[3];
@@ -19,8 +19,10 @@ exports.scrollSeekSystem = u.system(function (_a) {
19
19
  return false;
20
20
  }
21
21
  }
22
- else if (enter(speed, range)) {
23
- return true;
22
+ else {
23
+ if (enter(speed, range)) {
24
+ return true;
25
+ }
24
26
  }
25
27
  return isSeeking;
26
28
  }), u.distinctUntilChanged()), isSeeking);
@@ -28,10 +30,5 @@ exports.scrollSeekSystem = u.system(function (_a) {
28
30
  var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 3), isSeeking = _c[0], velocity = _c[1], range = _c[2], config = _b[1];
29
31
  return isSeeking && config && config.change && config.change(velocity, range);
30
32
  });
31
- return {
32
- isSeeking: isSeeking,
33
- scrollSeekConfiguration: scrollSeekConfiguration,
34
- scrollVelocity: scrollVelocity,
35
- scrollSeekRangeChanged: rangeChanged,
36
- };
33
+ return { isSeeking: isSeeking, scrollSeekConfiguration: scrollSeekConfiguration, scrollVelocity: scrollVelocity, scrollSeekRangeChanged: rangeChanged };
37
34
  }, u.tup(stateFlagsSystem_1.stateFlagsSystem), { singleton: true });
@@ -1,18 +1,22 @@
1
- import * as u from '@virtuoso.dev/urx';
1
+ import * as u from './urx';
2
2
  import { IndexLocationWithAlign } from './interfaces';
3
3
  import { LogLevel } from './loggerSystem';
4
4
  export declare type IndexLocation = number | IndexLocationWithAlign;
5
- export declare function normalizeIndexLocation(location: IndexLocation): Required<IndexLocationWithAlign>;
5
+ export declare function normalizeIndexLocation(location: IndexLocation): IndexLocationWithAlign;
6
6
  export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSpec<never[], () => {
7
7
  log: u.StatefulStream<import("./loggerSystem").Log>;
8
8
  logLevel: u.StatefulStream<LogLevel>;
9
- }>], ([{ log }]: [{
9
+ }>, u.SystemSpec<never[], () => {
10
+ recalcInProgress: u.StatefulStream<boolean>;
11
+ }>], ([{ log }, { recalcInProgress }]: [{
10
12
  log: u.StatefulStream<import("./loggerSystem").Log>;
11
13
  logLevel: u.StatefulStream<LogLevel>;
14
+ }, {
15
+ recalcInProgress: u.StatefulStream<boolean>;
12
16
  }]) => {
13
17
  data: u.StatefulStream<import("./sizeSystem").Data>;
14
18
  totalCount: u.Stream<number>;
15
- sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
19
+ sizeRanges: u.Stream<import("./interfaces").SizeRange[]>;
16
20
  groupIndices: u.StatefulStream<number[]>;
17
21
  defaultItemSize: u.StatefulStream<number | undefined>;
18
22
  fixedItemSize: u.StatefulStream<number | undefined>;
@@ -21,20 +25,22 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSp
21
25
  shiftWithOffset: u.Stream<number>;
22
26
  beforeUnshiftWith: u.Stream<number>;
23
27
  firstItemIndex: u.StatefulStream<number>;
28
+ gap: u.StatefulStream<number>;
24
29
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
25
30
  listRefresh: u.Stream<boolean>;
26
31
  statefulTotalCount: u.StatefulStream<number>;
27
32
  trackItemSizes: u.StatefulStream<boolean>;
28
- itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
33
+ itemSize: u.StatefulStream<import("./interfaces").SizeFunction>;
29
34
  }>, u.SystemSpec<never[], () => {
30
35
  scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
31
36
  scrollTop: u.Stream<number>;
32
37
  viewportHeight: u.Stream<number>;
33
38
  headerHeight: u.StatefulStream<number>;
39
+ fixedHeaderHeight: u.StatefulStream<number>;
40
+ fixedFooterHeight: u.StatefulStream<number>;
34
41
  footerHeight: u.StatefulStream<number>;
35
42
  scrollHeight: u.Stream<number>;
36
43
  smoothScrollTargetReached: u.Stream<true>;
37
- react18ConcurrentRendering: u.StatefulStream<boolean>;
38
44
  scrollTo: u.Stream<ScrollToOptions>;
39
45
  scrollBy: u.Stream<ScrollToOptions>;
40
46
  statefulScrollTop: u.StatefulStream<number>;
@@ -43,10 +49,10 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSp
43
49
  }>, u.SystemSpec<never[], () => {
44
50
  log: u.StatefulStream<import("./loggerSystem").Log>;
45
51
  logLevel: u.StatefulStream<LogLevel>;
46
- }>], ([{ sizes, totalCount, listRefresh }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, }, { log },]: [{
52
+ }>], ([{ sizes, totalCount, listRefresh, gap }, { scrollingInProgress, viewportHeight, scrollTo, smoothScrollTargetReached, headerHeight, footerHeight, fixedHeaderHeight, fixedFooterHeight, }, { log },]: [{
47
53
  data: u.StatefulStream<import("./sizeSystem").Data>;
48
54
  totalCount: u.Stream<number>;
49
- sizeRanges: u.Stream<import("./sizeSystem").SizeRange[]>;
55
+ sizeRanges: u.Stream<import("./interfaces").SizeRange[]>;
50
56
  groupIndices: u.StatefulStream<number[]>;
51
57
  defaultItemSize: u.StatefulStream<number | undefined>;
52
58
  fixedItemSize: u.StatefulStream<number | undefined>;
@@ -55,20 +61,22 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSp
55
61
  shiftWithOffset: u.Stream<number>;
56
62
  beforeUnshiftWith: u.Stream<number>;
57
63
  firstItemIndex: u.StatefulStream<number>;
64
+ gap: u.StatefulStream<number>;
58
65
  sizes: u.StatefulStream<import("./sizeSystem").SizeState>;
59
66
  listRefresh: u.Stream<boolean>;
60
67
  statefulTotalCount: u.StatefulStream<number>;
61
68
  trackItemSizes: u.StatefulStream<boolean>;
62
- itemSize: u.StatefulStream<import("./sizeSystem").SizeFunction>;
69
+ itemSize: u.StatefulStream<import("./interfaces").SizeFunction>;
63
70
  }, {
64
71
  scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
65
72
  scrollTop: u.Stream<number>;
66
73
  viewportHeight: u.Stream<number>;
67
74
  headerHeight: u.StatefulStream<number>;
75
+ fixedHeaderHeight: u.StatefulStream<number>;
76
+ fixedFooterHeight: u.StatefulStream<number>;
68
77
  footerHeight: u.StatefulStream<number>;
69
78
  scrollHeight: u.Stream<number>;
70
79
  smoothScrollTargetReached: u.Stream<true>;
71
- react18ConcurrentRendering: u.StatefulStream<boolean>;
72
80
  scrollTo: u.Stream<ScrollToOptions>;
73
81
  scrollBy: u.Stream<ScrollToOptions>;
74
82
  statefulScrollTop: u.StatefulStream<number>;
@@ -78,6 +86,6 @@ export declare const scrollToIndexSystem: u.SystemSpec<[u.SystemSpec<[u.SystemSp
78
86
  log: u.StatefulStream<import("./loggerSystem").Log>;
79
87
  logLevel: u.StatefulStream<LogLevel>;
80
88
  }]) => {
81
- scrollToIndex: u.Stream<number | IndexLocationWithAlign>;
89
+ scrollToIndex: u.Stream<number | import("./interfaces").FlatIndexLocationWithAlign | import("./interfaces").GroupIndexLocationWithAlign>;
82
90
  topListHeight: u.StatefulStream<number>;
83
91
  }>;
@@ -2,13 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
4
  /* eslint-disable @typescript-eslint/no-unsafe-call */
5
- var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
5
+ var u = tslib_1.__importStar(require("./urx"));
6
6
  var AATree_1 = require("./AATree");
7
7
  var domIOSystem_1 = require("./domIOSystem");
8
- var loggerSystem_1 = require("./loggerSystem");
9
8
  var sizeSystem_1 = require("./sizeSystem");
10
- var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== 'undefined' &&
11
- 'scrollBehavior' in document.documentElement.style;
9
+ var loggerSystem_1 = require("./loggerSystem");
10
+ var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== 'undefined' && 'scrollBehavior' in document.documentElement.style;
12
11
  function normalizeIndexLocation(location) {
13
12
  var result = typeof location === 'number' ? { index: location } : location;
14
13
  if (!result.align) {
@@ -24,7 +23,7 @@ function normalizeIndexLocation(location) {
24
23
  }
25
24
  exports.normalizeIndexLocation = normalizeIndexLocation;
26
25
  exports.scrollToIndexSystem = u.system(function (_a) {
27
- var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, listRefresh = _c.listRefresh, _d = _b[1], scrollingInProgress = _d.scrollingInProgress, viewportHeight = _d.viewportHeight, scrollTo = _d.scrollTo, smoothScrollTargetReached = _d.smoothScrollTargetReached, headerHeight = _d.headerHeight, footerHeight = _d.footerHeight, log = _b[2].log;
26
+ var _b = tslib_1.__read(_a, 3), _c = _b[0], sizes = _c.sizes, totalCount = _c.totalCount, listRefresh = _c.listRefresh, gap = _c.gap, _d = _b[1], scrollingInProgress = _d.scrollingInProgress, viewportHeight = _d.viewportHeight, scrollTo = _d.scrollTo, smoothScrollTargetReached = _d.smoothScrollTargetReached, headerHeight = _d.headerHeight, footerHeight = _d.footerHeight, fixedHeaderHeight = _d.fixedHeaderHeight, fixedFooterHeight = _d.fixedFooterHeight, log = _b[2].log;
28
27
  var scrollToIndex = u.stream();
29
28
  var topListHeight = u.statefulStream(0);
30
29
  var unsubscribeNextListRefresh = null;
@@ -45,32 +44,21 @@ exports.scrollToIndexSystem = u.system(function (_a) {
45
44
  }
46
45
  u.publish(scrollingInProgress, false);
47
46
  }
48
- u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), u.map(function (_a) {
49
- var _b = tslib_1.__read(_a, 8), location = _b[0], sizes = _b[1], viewportHeight = _b[2], totalCount = _b[3], topListHeight = _b[4], headerHeight = _b[5], footerHeight = _b[6], log = _b[7];
47
+ u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), u.withLatestFrom(gap, fixedHeaderHeight, fixedFooterHeight), u.map(function (_a) {
48
+ var _b = tslib_1.__read(_a, 4), _c = tslib_1.__read(_b[0], 8), location = _c[0], sizes = _c[1], viewportHeight = _c[2], totalCount = _c[3], topListHeight = _c[4], headerHeight = _c[5], footerHeight = _c[6], log = _c[7], gap = _b[1], fixedHeaderHeight = _b[2], fixedFooterHeight = _b[3];
50
49
  var normalLocation = normalizeIndexLocation(location);
51
50
  var align = normalLocation.align, behavior = normalLocation.behavior, offset = normalLocation.offset;
52
51
  var lastIndex = totalCount - 1;
53
- var index = normalLocation.index;
54
- if (index === 'LAST') {
55
- index = lastIndex;
56
- }
57
- index = sizeSystem_1.originalIndexFromItemIndex(index, sizes);
58
- index = Math.max(0, index, Math.min(lastIndex, index));
59
- var top = sizeSystem_1.offsetOf(index, sizes.offsetTree) + headerHeight;
52
+ var index = sizeSystem_1.originalIndexFromLocation(normalLocation, sizes, lastIndex);
53
+ var top = sizeSystem_1.offsetOf(index, sizes.offsetTree, gap) + headerHeight;
60
54
  if (align === 'end') {
61
- top =
62
- top -
63
- viewportHeight +
64
- AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1];
55
+ top += fixedHeaderHeight + AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1] - viewportHeight + fixedFooterHeight;
65
56
  if (index === lastIndex) {
66
57
  top += footerHeight;
67
58
  }
68
59
  }
69
60
  else if (align === 'center') {
70
- top =
71
- top -
72
- viewportHeight / 2 +
73
- AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1] / 2;
61
+ top += (fixedHeaderHeight + AATree_1.findMaxKeyValue(sizes.sizeTree, index)[1] - viewportHeight + fixedFooterHeight) / 2;
74
62
  }
75
63
  else {
76
64
  top -= topListHeight;
@@ -99,7 +87,7 @@ exports.scrollToIndexSystem = u.system(function (_a) {
99
87
  });
100
88
  }
101
89
  else {
102
- unsubscribeNextListRefresh = u.handleNext(u.pipe(listRefresh, watchChangesFor(50)), retry);
90
+ unsubscribeNextListRefresh = u.handleNext(u.pipe(listRefresh, watchChangesFor(150)), retry);
103
91
  }
104
92
  // if the scroll jump is too small, the list won't get rerendered.
105
93
  // clean this listener
@@ -1,5 +1,5 @@
1
- import * as u from '@virtuoso.dev/urx';
2
- import { DOWN, ScrollDirection, UP } from './stateFlagsSystem';
1
+ import * as u from './urx';
2
+ import { UP, DOWN, ScrollDirection } from './stateFlagsSystem';
3
3
  export declare type NumberTuple = [number, number];
4
4
  export declare type Overscan = number | {
5
5
  main: number;
@@ -19,24 +19,26 @@ export declare const sizeRangeSystem: u.SystemSpec<[u.SystemSpec<never[], () =>
19
19
  scrollTop: u.Stream<number>;
20
20
  viewportHeight: u.Stream<number>;
21
21
  headerHeight: u.StatefulStream<number>;
22
+ fixedHeaderHeight: u.StatefulStream<number>;
23
+ fixedFooterHeight: u.StatefulStream<number>;
22
24
  footerHeight: u.StatefulStream<number>;
23
25
  scrollHeight: u.Stream<number>;
24
26
  smoothScrollTargetReached: u.Stream<true>;
25
- react18ConcurrentRendering: u.StatefulStream<boolean>;
26
27
  scrollTo: u.Stream<ScrollToOptions>;
27
28
  scrollBy: u.Stream<ScrollToOptions>;
28
29
  statefulScrollTop: u.StatefulStream<number>;
29
30
  deviation: u.StatefulStream<number>;
30
31
  scrollingInProgress: u.StatefulStream<boolean>;
31
- }>], ([{ scrollTop, viewportHeight, deviation, headerHeight }]: [{
32
+ }>], ([{ scrollTop, viewportHeight, deviation, headerHeight, fixedHeaderHeight }]: [{
32
33
  scrollContainerState: u.Stream<import("./interfaces").ScrollContainerState>;
33
34
  scrollTop: u.Stream<number>;
34
35
  viewportHeight: u.Stream<number>;
35
36
  headerHeight: u.StatefulStream<number>;
37
+ fixedHeaderHeight: u.StatefulStream<number>;
38
+ fixedFooterHeight: u.StatefulStream<number>;
36
39
  footerHeight: u.StatefulStream<number>;
37
40
  scrollHeight: u.Stream<number>;
38
41
  smoothScrollTargetReached: u.Stream<true>;
39
- react18ConcurrentRendering: u.StatefulStream<boolean>;
40
42
  scrollTo: u.Stream<ScrollToOptions>;
41
43
  scrollBy: u.Stream<ScrollToOptions>;
42
44
  statefulScrollTop: u.StatefulStream<number>;
@@ -46,7 +48,6 @@ export declare const sizeRangeSystem: u.SystemSpec<[u.SystemSpec<never[], () =>
46
48
  listBoundary: u.Stream<NumberTuple>;
47
49
  overscan: u.StatefulStream<Overscan>;
48
50
  topListHeight: u.StatefulStream<number>;
49
- fixedHeaderHeight: u.StatefulStream<number>;
50
51
  increaseViewportBy: u.StatefulStream<ViewportIncrease>;
51
52
  visibleRange: u.StatefulStream<NumberTuple>;
52
53
  }>;
@@ -1,40 +1,38 @@
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("@virtuoso.dev/urx"));
5
- var comparators_1 = require("./comparators");
4
+ var u = tslib_1.__importStar(require("./urx"));
6
5
  var domIOSystem_1 = require("./domIOSystem");
7
6
  var stateFlagsSystem_1 = require("./stateFlagsSystem");
7
+ var comparators_1 = require("./comparators");
8
8
  exports.TOP = 'top';
9
9
  exports.BOTTOM = 'bottom';
10
10
  exports.NONE = 'none';
11
11
  function getOverscan(overscan, end, direction) {
12
12
  if (typeof overscan === 'number') {
13
- return (direction === stateFlagsSystem_1.UP && end === exports.TOP) ||
14
- (direction === stateFlagsSystem_1.DOWN && end === exports.BOTTOM)
15
- ? overscan
16
- : 0;
13
+ return (direction === stateFlagsSystem_1.UP && end === exports.TOP) || (direction === stateFlagsSystem_1.DOWN && end === exports.BOTTOM) ? overscan : 0;
17
14
  }
18
- if (direction === stateFlagsSystem_1.UP) {
19
- return end === exports.TOP ? overscan.main : overscan.reverse;
15
+ else {
16
+ if (direction === stateFlagsSystem_1.UP) {
17
+ return end === exports.TOP ? overscan.main : overscan.reverse;
18
+ }
19
+ else {
20
+ return end === exports.BOTTOM ? overscan.main : overscan.reverse;
21
+ }
20
22
  }
21
- return end === exports.BOTTOM ? overscan.main : overscan.reverse;
22
23
  }
23
24
  exports.getOverscan = getOverscan;
24
25
  function getViewportIncrease(value, end) {
25
26
  return typeof value === 'number' ? value : value[end] || 0;
26
27
  }
27
28
  exports.sizeRangeSystem = u.system(function (_a) {
28
- var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, deviation = _c.deviation, headerHeight = _c.headerHeight;
29
+ var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, deviation = _c.deviation, headerHeight = _c.headerHeight, fixedHeaderHeight = _c.fixedHeaderHeight;
29
30
  var listBoundary = u.stream();
30
31
  var topListHeight = u.statefulStream(0);
31
- var fixedHeaderHeight = u.statefulStream(0);
32
32
  var increaseViewportBy = u.statefulStream(0);
33
33
  var overscan = u.statefulStream(0);
34
34
  var visibleRange = u.statefulStreamFromEmitter(u.pipe(u.combineLatest(u.duc(scrollTop), u.duc(viewportHeight), u.duc(headerHeight), u.duc(listBoundary, comparators_1.tupleComparator), u.duc(overscan), u.duc(topListHeight), u.duc(fixedHeaderHeight), u.duc(deviation), u.duc(increaseViewportBy)), u.map(function (_a) {
35
- var _b = tslib_1.__read(_a, 9), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2],
36
- // @ts-ignore
37
- _c = tslib_1.__read(_b[3], 2), listTop = _c[0], listBottom = _c[1], overscan = _b[4], topListHeight = _b[5], fixedHeaderHeight = _b[6], deviation = _b[7], increaseViewportBy = _b[8];
35
+ var _b = tslib_1.__read(_a, 9), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2], _c = tslib_1.__read(_b[3], 2), listTop = _c[0], listBottom = _c[1], overscan = _b[4], topListHeight = _b[5], fixedHeaderHeight = _b[6], deviation = _b[7], increaseViewportBy = _b[8];
38
36
  var top = scrollTop - deviation;
39
37
  var stickyHeaderHeight = topListHeight + fixedHeaderHeight;
40
38
  var headerVisible = Math.max(headerHeight - top, 0);
@@ -45,24 +43,15 @@ exports.sizeRangeSystem = u.system(function (_a) {
45
43
  listTop += headerHeight + fixedHeaderHeight;
46
44
  listBottom += headerHeight + fixedHeaderHeight;
47
45
  listBottom -= deviation;
48
- // console.log({ listTop, scrollTop, stickyHeaderHeight, topViewportAddition })
49
- if (listTop >
50
- scrollTop + stickyHeaderHeight - topViewportAddition) {
46
+ if (listTop > scrollTop + stickyHeaderHeight - topViewportAddition) {
51
47
  direction = stateFlagsSystem_1.UP;
52
48
  }
53
- if (listBottom <
54
- scrollTop -
55
- headerVisible +
56
- viewportHeight +
57
- bottomViewportAddition) {
49
+ if (listBottom < scrollTop - headerVisible + viewportHeight + bottomViewportAddition) {
58
50
  direction = stateFlagsSystem_1.DOWN;
59
51
  }
60
52
  if (direction !== exports.NONE) {
61
53
  return [
62
- Math.max(top -
63
- headerHeight -
64
- getOverscan(overscan, exports.TOP, direction) -
65
- topViewportAddition, 0),
54
+ Math.max(top - headerHeight - getOverscan(overscan, exports.TOP, direction) - topViewportAddition, 0),
66
55
  top -
67
56
  headerVisible -
68
57
  fixedHeaderHeight +
@@ -78,7 +67,6 @@ exports.sizeRangeSystem = u.system(function (_a) {
78
67
  listBoundary: listBoundary,
79
68
  overscan: overscan,
80
69
  topListHeight: topListHeight,
81
- fixedHeaderHeight: fixedHeaderHeight,
82
70
  increaseViewportBy: increaseViewportBy,
83
71
  // output
84
72
  visibleRange: visibleRange,
@@ -1,11 +1,7 @@
1
- import * as u from '@virtuoso.dev/urx';
1
+ import * as u from './urx';
2
2
  import { AANode } from './AATree';
3
3
  import { Log, LogLevel } from './loggerSystem';
4
- export interface SizeRange {
5
- startIndex: number;
6
- endIndex: number;
7
- size: number;
8
- }
4
+ import { SizeFunction, SizeRange } from './interfaces';
9
5
  export declare type Data = readonly unknown[] | undefined;
10
6
  export declare function insertRanges(sizeTree: AANode<number>, ranges: SizeRange[]): readonly [AANode<number>, number];
11
7
  export interface OffsetPoint {
@@ -34,18 +30,30 @@ export declare function rangesWithinOffsets(tree: Array<OffsetPoint>, startOffse
34
30
  index: number;
35
31
  };
36
32
  }>;
37
- export declare function sizeStateReducer(state: SizeState, [ranges, groupIndices, log]: [SizeRange[], number[], Log]): SizeState;
38
- export declare function offsetOf(index: number, tree: Array<OffsetPoint>): number;
33
+ export declare function sizeStateReducer(state: SizeState, [ranges, groupIndices, log, gap]: [SizeRange[], number[], Log, number]): SizeState;
34
+ export declare function offsetOf(index: number, tree: Array<OffsetPoint>, gap: number): number;
35
+ export declare type FlatOrGroupedLocation = {
36
+ index: number | 'LAST';
37
+ } | {
38
+ groupIndex: number;
39
+ };
40
+ export declare function isGroupLocation(location: FlatOrGroupedLocation): location is {
41
+ groupIndex: number;
42
+ };
43
+ export declare function originalIndexFromLocation(location: FlatOrGroupedLocation, sizes: SizeState, lastIndex: number): number;
39
44
  export declare function originalIndexFromItemIndex(itemIndex: number, sizes: SizeState): number;
40
45
  export declare function hasGroups(sizes: SizeState): boolean;
41
- /** Calculates the height of `el`, which will be the `Item` element in the DOM. */
42
- export declare type SizeFunction = (el: HTMLElement, field: 'offsetHeight' | 'offsetWidth') => number;
46
+ export declare function sizeTreeToRanges(sizeTree: AANode<number>): SizeRange[];
43
47
  export declare const sizeSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
44
48
  log: u.StatefulStream<Log>;
45
49
  logLevel: u.StatefulStream<LogLevel>;
46
- }>], ([{ log }]: [{
50
+ }>, u.SystemSpec<never[], () => {
51
+ recalcInProgress: u.StatefulStream<boolean>;
52
+ }>], ([{ log }, { recalcInProgress }]: [{
47
53
  log: u.StatefulStream<Log>;
48
54
  logLevel: u.StatefulStream<LogLevel>;
55
+ }, {
56
+ recalcInProgress: u.StatefulStream<boolean>;
49
57
  }]) => {
50
58
  data: u.StatefulStream<Data>;
51
59
  totalCount: u.Stream<number>;
@@ -58,6 +66,7 @@ export declare const sizeSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
58
66
  shiftWithOffset: u.Stream<number>;
59
67
  beforeUnshiftWith: u.Stream<number>;
60
68
  firstItemIndex: u.StatefulStream<number>;
69
+ gap: u.StatefulStream<number>;
61
70
  sizes: u.StatefulStream<SizeState>;
62
71
  listRefresh: u.Stream<boolean>;
63
72
  statefulTotalCount: u.StatefulStream<number>;