@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,16 +1,12 @@
1
1
  import { __assign, __read, __rest } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
3
- import { alignToBottomSystem } from './alignToBottomSystem';
2
+ import * as u from './urx';
4
3
  import { domIOSystem } from './domIOSystem';
5
4
  import { followOutputSystem } from './followOutputSystem';
6
5
  import { groupedListSystem } from './groupedListSystem';
7
6
  import { initialItemCountSystem } from './initialItemCountSystem';
8
- import { initialScrollTopSystem } from './initialScrollTopSystem';
9
7
  import { initialTopMostItemIndexSystem } from './initialTopMostItemIndexSystem';
10
8
  import { listStateSystem } from './listStateSystem';
11
- import { loggerSystem } from './loggerSystem';
12
9
  import { propsReadySystem } from './propsReadySystem';
13
- import { scrollIntoViewSystem } from './scrollIntoViewSystem';
14
10
  import { scrollSeekSystem } from './scrollSeekSystem';
15
11
  import { scrollToIndexSystem } from './scrollToIndexSystem';
16
12
  import { sizeRangeSystem } from './sizeRangeSystem';
@@ -18,18 +14,21 @@ import { sizeSystem } from './sizeSystem';
18
14
  import { topItemCountSystem } from './topItemCountSystem';
19
15
  import { totalListHeightSystem } from './totalListHeightSystem';
20
16
  import { upwardScrollFixSystem } from './upwardScrollFixSystem';
17
+ import { initialScrollTopSystem } from './initialScrollTopSystem';
18
+ import { alignToBottomSystem } from './alignToBottomSystem';
21
19
  import { windowScrollerSystem } from './windowScrollerSystem';
22
- // workaround the growing list of systems below
23
- // fix this with 4.1 recursive conditional types
20
+ import { loggerSystem } from './loggerSystem';
21
+ import { scrollIntoViewSystem } from './scrollIntoViewSystem';
22
+ import { stateLoadSystem } from './stateLoadSystem';
24
23
  var featureGroup1System = u.system(function (_a) {
25
- var _b = __read(_a, 9), sizeRange = _b[0], initialItemCount = _b[1], propsReady = _b[2], scrollSeek = _b[3], totalListHeight = _b[4], initialScrollTopSystem = _b[5], alignToBottom = _b[6], windowScroller = _b[7], scrollIntoView = _b[8];
26
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, sizeRange), initialItemCount), propsReady), scrollSeek), totalListHeight), initialScrollTopSystem), alignToBottom), windowScroller), scrollIntoView);
27
- }, u.tup(sizeRangeSystem, initialItemCountSystem, propsReadySystem, scrollSeekSystem, totalListHeightSystem, initialScrollTopSystem, alignToBottomSystem, windowScrollerSystem, scrollIntoViewSystem));
24
+ var _b = __read(_a, 10), sizeRange = _b[0], initialItemCount = _b[1], propsReady = _b[2], scrollSeek = _b[3], totalListHeight = _b[4], initialScrollTopSystem = _b[5], alignToBottom = _b[6], windowScroller = _b[7], scrollIntoView = _b[8], logger = _b[9];
25
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, sizeRange), initialItemCount), propsReady), scrollSeek), totalListHeight), initialScrollTopSystem), alignToBottom), windowScroller), scrollIntoView), logger);
26
+ }, u.tup(sizeRangeSystem, initialItemCountSystem, propsReadySystem, scrollSeekSystem, totalListHeightSystem, initialScrollTopSystem, alignToBottomSystem, windowScrollerSystem, scrollIntoViewSystem, loggerSystem));
28
27
  export var listSystem = u.system(function (_a) {
29
- var _b = _a, _c = __read(_b, 11), _d = _c[0], totalCount = _d.totalCount, sizeRanges = _d.sizeRanges, fixedItemSize = _d.fixedItemSize, defaultItemSize = _d.defaultItemSize, trackItemSizes = _d.trackItemSizes, itemSize = _d.itemSize, data = _d.data, firstItemIndex = _d.firstItemIndex, groupIndices = _d.groupIndices, statefulTotalCount = _d.statefulTotalCount, _e = _c[1], initialTopMostItemIndex = _e.initialTopMostItemIndex, scrolledToInitialItem = _e.scrolledToInitialItem, domIO = _c[2], followOutput = _c[3], _f = _c[4], scrollToIndex = _c[5].scrollToIndex, topItemCount = _c[7].topItemCount, groupCounts = _c[8].groupCounts, featureGroup1 = _c[9], log = _c[10], listState = _f.listState, topItemsIndexes = _f.topItemsIndexes, flags = __rest(_f, ["listState", "topItemsIndexes"]);
28
+ var _b = _a, _c = __read(_b, 11), _d = _c[0], totalCount = _d.totalCount, sizeRanges = _d.sizeRanges, fixedItemSize = _d.fixedItemSize, defaultItemSize = _d.defaultItemSize, trackItemSizes = _d.trackItemSizes, itemSize = _d.itemSize, data = _d.data, firstItemIndex = _d.firstItemIndex, groupIndices = _d.groupIndices, statefulTotalCount = _d.statefulTotalCount, gap = _d.gap, sizes = _d.sizes, _e = _c[1], initialTopMostItemIndex = _e.initialTopMostItemIndex, scrolledToInitialItem = _e.scrolledToInitialItem, domIO = _c[2], stateLoad = _c[3], followOutput = _c[4], _f = _c[5], scrollToIndex = _c[6].scrollToIndex, _ = _c[7], topItemCount = _c[8].topItemCount, groupCounts = _c[9].groupCounts, featureGroup1 = _c[10], listState = _f.listState, topItemsIndexes = _f.topItemsIndexes, flags = __rest(_f, ["listState", "topItemsIndexes"]);
30
29
  u.connect(flags.rangeChanged, featureGroup1.scrollSeekRangeChanged);
31
- u.connect(u.pipe(featureGroup1.windowViewportRect, u.map(u.prop('visibleHeight'))), domIO.viewportHeight);
32
- return __assign(__assign(__assign(__assign(__assign(__assign({
30
+ u.connect(u.pipe(featureGroup1.windowViewportRect, u.map(function (value) { return value.visibleHeight; })), domIO.viewportHeight);
31
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign({
33
32
  // input
34
33
  totalCount: totalCount,
35
34
  data: data,
@@ -39,12 +38,12 @@ export var listSystem = u.system(function (_a) {
39
38
  scrolledToInitialItem: scrolledToInitialItem,
40
39
  topItemsIndexes: topItemsIndexes,
41
40
  topItemCount: topItemCount,
42
- groupCounts: groupCounts, fixedItemHeight: fixedItemSize, defaultItemHeight: defaultItemSize }, followOutput), {
41
+ groupCounts: groupCounts, fixedItemHeight: fixedItemSize, defaultItemHeight: defaultItemSize, gap: gap }, followOutput), {
43
42
  // output
44
43
  statefulTotalCount: statefulTotalCount,
45
44
  listState: listState,
46
45
  scrollToIndex: scrollToIndex,
47
46
  trackItemSizes: trackItemSizes,
48
47
  itemSize: itemSize,
49
- groupIndices: groupIndices }), flags), featureGroup1), domIO), log);
50
- }, u.tup(sizeSystem, initialTopMostItemIndexSystem, domIOSystem, followOutputSystem, listStateSystem, scrollToIndexSystem, upwardScrollFixSystem, topItemCountSystem, groupedListSystem, featureGroup1System, loggerSystem));
48
+ groupIndices: groupIndices }), flags), featureGroup1), domIO), { sizes: sizes }), stateLoad);
49
+ }, u.tup(sizeSystem, initialTopMostItemIndexSystem, domIOSystem, stateLoadSystem, followOutputSystem, listStateSystem, scrollToIndexSystem, upwardScrollFixSystem, topItemCountSystem, groupedListSystem, featureGroup1System));
@@ -1,5 +1,5 @@
1
1
  var _a;
2
- import * as u from '@virtuoso.dev/urx';
2
+ import * as u from './urx';
3
3
  export var LogLevel;
4
4
  (function (LogLevel) {
5
5
  LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
@@ -13,9 +13,7 @@ var CONSOLE_METHOD_MAP = (_a = {},
13
13
  _a[LogLevel.WARN] = 'warn',
14
14
  _a[LogLevel.ERROR] = 'error',
15
15
  _a);
16
- var getGlobalThis = function () {
17
- return typeof globalThis === 'undefined' ? window : globalThis;
18
- };
16
+ var getGlobalThis = function () { return (typeof globalThis === 'undefined' ? window : globalThis); };
19
17
  export var loggerSystem = u.system(function () {
20
18
  var logLevel = u.statefulStream(LogLevel.ERROR);
21
19
  var log = u.statefulStream(function (label, message, level) {
@@ -1,13 +1,12 @@
1
1
  import { __read } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
3
- import { getValue, tup } from '@virtuoso.dev/urx';
2
+ import * as u from './urx';
4
3
  import { loggerSystem, LogLevel } from './loggerSystem';
5
4
  export var propsReadySystem = u.system(function (_a) {
6
5
  var _b = __read(_a, 1), log = _b[0].log;
7
6
  var propsReady = u.statefulStream(false);
8
7
  var didMount = u.streamFromEmitter(u.pipe(propsReady, u.filter(function (ready) { return ready; }), u.distinctUntilChanged()));
9
8
  u.subscribe(propsReady, function (value) {
10
- value && getValue(log)('props updated', {}, LogLevel.DEBUG);
9
+ value && u.getValue(log)('props updated', {}, LogLevel.DEBUG);
11
10
  });
12
11
  return { propsReady: propsReady, didMount: didMount };
13
- }, tup(loggerSystem), { singleton: true });
12
+ }, u.tup(loggerSystem), { singleton: true });
@@ -0,0 +1,197 @@
1
+ import { __read, __rest, __spread, __values } from "tslib";
2
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-argument */
5
+ /**
6
+ * `@virtuoso.dev/react-urx` exports the [[systemToComponent]] function.
7
+ * It wraps urx systems in to UI **logic provider components**,
8
+ * mapping the system input and output streams to the component input / output points.
9
+ *
10
+ * ### Simple System wrapped as React Component
11
+ *
12
+ * ```tsx
13
+ * const sys = system(() => {
14
+ * const foo = statefulStream(42)
15
+ * return { foo }
16
+ * })
17
+ *
18
+ * const { Component: MyComponent, useEmitterValue } = systemToComponent(sys, {
19
+ * required: { fooProp: 'foo' },
20
+ * })
21
+ *
22
+ * const Child = () => {
23
+ * const foo = useEmitterValue('foo')
24
+ * return <div>{foo}</div>
25
+ * }
26
+ *
27
+ * const App = () => {
28
+ * return <Comp fooProp={42}><Child /><Comp>
29
+ * }
30
+ * ```
31
+ *
32
+ * @packageDocumentation
33
+ */
34
+ import React from 'react';
35
+ import * as u from '../urx';
36
+ /** @internal */
37
+ function omit(keys, obj) {
38
+ var result = {};
39
+ var index = {};
40
+ var idx = 0;
41
+ var len = keys.length;
42
+ while (idx < len) {
43
+ index[keys[idx]] = 1;
44
+ idx += 1;
45
+ }
46
+ for (var prop in obj) {
47
+ if (!index.hasOwnProperty(prop)) {
48
+ result[prop] = obj[prop];
49
+ }
50
+ }
51
+ return result;
52
+ }
53
+ var useIsomorphicLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect;
54
+ /**
55
+ * Converts a system spec to React component by mapping the system streams to component properties, events and methods. Returns hooks for querying and modifying
56
+ * the system streams from the component's child components.
57
+ * @param systemSpec The return value from a [[system]] call.
58
+ * @param map The streams to props / events / methods mapping Check [[SystemPropsMap]] for more details.
59
+ * @param Root The optional React component to render. By default, the resulting component renders nothing, acting as a logical wrapper for its children.
60
+ * @returns an object containing the following:
61
+ * - `Component`: the React component.
62
+ * - `useEmitterValue`: a hook that lets child components use values emitted from the specified output stream.
63
+ * - `useEmitter`: a hook that calls the provided callback whenever the specified stream emits a value.
64
+ * - `usePublisher`: a hook which lets child components publish values to the specified stream.
65
+ * <hr />
66
+ */
67
+ export function systemToComponent(systemSpec, map, Root) {
68
+ var requiredPropNames = Object.keys(map.required || {});
69
+ var optionalPropNames = Object.keys(map.optional || {});
70
+ var methodNames = Object.keys(map.methods || {});
71
+ var eventNames = Object.keys(map.events || {});
72
+ var Context = React.createContext({});
73
+ function applyPropsToSystem(system, props) {
74
+ var e_1, _a, e_2, _b;
75
+ if (system['propsReady']) {
76
+ u.publish(system['propsReady'], false);
77
+ }
78
+ try {
79
+ for (var requiredPropNames_1 = __values(requiredPropNames), requiredPropNames_1_1 = requiredPropNames_1.next(); !requiredPropNames_1_1.done; requiredPropNames_1_1 = requiredPropNames_1.next()) {
80
+ var requiredPropName = requiredPropNames_1_1.value;
81
+ var stream = system[map.required[requiredPropName]];
82
+ u.publish(stream, props[requiredPropName]);
83
+ }
84
+ }
85
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
86
+ finally {
87
+ try {
88
+ if (requiredPropNames_1_1 && !requiredPropNames_1_1.done && (_a = requiredPropNames_1.return)) _a.call(requiredPropNames_1);
89
+ }
90
+ finally { if (e_1) throw e_1.error; }
91
+ }
92
+ try {
93
+ for (var optionalPropNames_1 = __values(optionalPropNames), optionalPropNames_1_1 = optionalPropNames_1.next(); !optionalPropNames_1_1.done; optionalPropNames_1_1 = optionalPropNames_1.next()) {
94
+ var optionalPropName = optionalPropNames_1_1.value;
95
+ if (optionalPropName in props) {
96
+ var stream = system[map.optional[optionalPropName]];
97
+ u.publish(stream, props[optionalPropName]);
98
+ }
99
+ }
100
+ }
101
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
102
+ finally {
103
+ try {
104
+ if (optionalPropNames_1_1 && !optionalPropNames_1_1.done && (_b = optionalPropNames_1.return)) _b.call(optionalPropNames_1);
105
+ }
106
+ finally { if (e_2) throw e_2.error; }
107
+ }
108
+ if (system['propsReady']) {
109
+ u.publish(system['propsReady'], true);
110
+ }
111
+ }
112
+ function buildMethods(system) {
113
+ return methodNames.reduce(function (acc, methodName) {
114
+ ;
115
+ acc[methodName] = function (value) {
116
+ var stream = system[map.methods[methodName]];
117
+ u.publish(stream, value);
118
+ };
119
+ return acc;
120
+ }, {});
121
+ }
122
+ function buildEventHandlers(system) {
123
+ return eventNames.reduce(function (handlers, eventName) {
124
+ handlers[eventName] = u.eventHandler(system[map.events[eventName]]);
125
+ return handlers;
126
+ }, {});
127
+ }
128
+ /**
129
+ * A React component generated from an urx system
130
+ */
131
+ // eslint-disable-next-line react/display-name
132
+ var Component = React.forwardRef(function (propsWithChildren, ref) {
133
+ var _a = propsWithChildren, children = _a.children, props = __rest(_a, ["children"]);
134
+ var _b = __read(React.useState(function () {
135
+ return u.tap(u.init(systemSpec), function (system) { return applyPropsToSystem(system, props); });
136
+ }), 1), system = _b[0];
137
+ var _c = __read(React.useState(u.curry1to0(buildEventHandlers, system)), 1), handlers = _c[0];
138
+ useIsomorphicLayoutEffect(function () {
139
+ var e_3, _a;
140
+ try {
141
+ for (var eventNames_1 = __values(eventNames), eventNames_1_1 = eventNames_1.next(); !eventNames_1_1.done; eventNames_1_1 = eventNames_1.next()) {
142
+ var eventName = eventNames_1_1.value;
143
+ if (eventName in props) {
144
+ u.subscribe(handlers[eventName], props[eventName]);
145
+ }
146
+ }
147
+ }
148
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
149
+ finally {
150
+ try {
151
+ if (eventNames_1_1 && !eventNames_1_1.done && (_a = eventNames_1.return)) _a.call(eventNames_1);
152
+ }
153
+ finally { if (e_3) throw e_3.error; }
154
+ }
155
+ return function () {
156
+ Object.values(handlers).map(u.reset);
157
+ };
158
+ }, [props, handlers, system]);
159
+ useIsomorphicLayoutEffect(function () {
160
+ applyPropsToSystem(system, props);
161
+ });
162
+ React.useImperativeHandle(ref, u.always(buildMethods(system)));
163
+ return React.createElement(Context.Provider, { value: system }, Root
164
+ ? React.createElement(Root, omit(__spread(requiredPropNames, optionalPropNames, eventNames), props), children)
165
+ : children);
166
+ });
167
+ var usePublisher = function (key) {
168
+ return React.useCallback(u.curry2to1(u.publish, React.useContext(Context)[key]), [key]);
169
+ };
170
+ /**
171
+ * Returns the value emitted from the stream.
172
+ */
173
+ var useEmitterValue = function (key) {
174
+ var system = React.useContext(Context);
175
+ var source = system[key];
176
+ var _a = __read(React.useState(u.curry1to0(u.getValue, source)), 2), value = _a[0], setValue = _a[1];
177
+ useIsomorphicLayoutEffect(function () {
178
+ return u.subscribe(source, function (next) {
179
+ if (next !== value) {
180
+ setValue(u.always(next));
181
+ }
182
+ });
183
+ }, [source, value]);
184
+ return value;
185
+ };
186
+ var useEmitter = function (key, callback) {
187
+ var context = React.useContext(Context);
188
+ var source = context[key];
189
+ useIsomorphicLayoutEffect(function () { return u.subscribe(source, callback); }, [callback, source]);
190
+ };
191
+ return {
192
+ Component: Component,
193
+ usePublisher: usePublisher,
194
+ useEmitterValue: useEmitterValue,
195
+ useEmitter: useEmitter,
196
+ };
197
+ }
@@ -0,0 +1,5 @@
1
+ import * as u from './urx';
2
+ export var recalcSystem = u.system(function () {
3
+ var recalcInProgress = u.statefulStream(false);
4
+ return { recalcInProgress: recalcInProgress };
5
+ }, [], { singleton: true });
@@ -1,33 +1,45 @@
1
- import { __read } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
1
+ import { __assign, __read, __rest } from "tslib";
2
+ import * as u from './urx';
3
3
  import { findMaxKeyValue } from './AATree';
4
4
  import { domIOSystem } from './domIOSystem';
5
- import { listStateSystem } from './listStateSystem';
5
+ import { offsetOf, originalIndexFromLocation, sizeSystem } from './sizeSystem';
6
6
  import { loggerSystem } from './loggerSystem';
7
7
  import { scrollToIndexSystem } from './scrollToIndexSystem';
8
- import { offsetOf, originalIndexFromItemIndex, sizeSystem } from './sizeSystem';
8
+ import { listStateSystem } from './listStateSystem';
9
+ var defaultCalculateViewLocation = function (_a) {
10
+ var itemTop = _a.itemTop, itemBottom = _a.itemBottom, viewportTop = _a.viewportTop, viewportBottom = _a.viewportBottom, _b = _a.locationParams, behavior = _b.behavior, align = _b.align, rest = __rest(_b, ["behavior", "align"]);
11
+ if (itemTop < viewportTop) {
12
+ return __assign(__assign({}, rest), { behavior: behavior, align: align !== null && align !== void 0 ? align : 'start' });
13
+ }
14
+ if (itemBottom > viewportBottom) {
15
+ return __assign(__assign({}, rest), { behavior: behavior, align: align !== null && align !== void 0 ? align : 'end' });
16
+ }
17
+ return null;
18
+ };
9
19
  export var scrollIntoViewSystem = u.system(function (_a) {
10
- var _b = __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;
20
+ var _b = __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;
11
21
  var scrollIntoView = u.stream();
12
- u.connect(u.pipe(scrollIntoView, u.withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, scrollTop), u.map(function (_a) {
13
- var _b = __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];
14
- var lastIndex = totalCount - 1;
15
- var location = null;
16
- index = originalIndexFromItemIndex(index, sizes);
17
- index = Math.max(0, index, Math.min(lastIndex, index));
18
- var itemTop = offsetOf(index, sizes.offsetTree) + headerHeight;
19
- if (itemTop < scrollTop) {
20
- location = { index: index, behavior: behavior, align: 'start' };
21
- }
22
- else {
23
- var itemBottom = itemTop + findMaxKeyValue(sizes.sizeTree, index)[1];
24
- if (itemBottom > scrollTop + viewportHeight) {
25
- location = { index: index, behavior: behavior, align: 'end' };
26
- }
27
- }
22
+ u.connect(u.pipe(scrollIntoView, u.withLatestFrom(sizes, viewportHeight, totalCount, headerHeight, fixedHeaderHeight, fixedFooterHeight, scrollTop), u.withLatestFrom(gap), u.map(function (_a) {
23
+ var _b = __read(_a, 2), _c = __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];
24
+ var done = viewLocation.done, behavior = viewLocation.behavior, align = viewLocation.align, _d = viewLocation.calculateViewLocation, calculateViewLocation = _d === void 0 ? defaultCalculateViewLocation : _d, rest = __rest(viewLocation, ["done", "behavior", "align", "calculateViewLocation"]);
25
+ var actualIndex = originalIndexFromLocation(viewLocation, sizes, totalCount - 1);
26
+ var itemTop = offsetOf(actualIndex, sizes.offsetTree, gap) + headerHeight + fixedHeaderHeight;
27
+ var itemBottom = itemTop + findMaxKeyValue(sizes.sizeTree, actualIndex)[1];
28
+ var viewportTop = scrollTop + fixedHeaderHeight;
29
+ var viewportBottom = scrollTop + viewportHeight - fixedFooterHeight;
30
+ var location = calculateViewLocation({
31
+ itemTop: itemTop,
32
+ itemBottom: itemBottom,
33
+ viewportTop: viewportTop,
34
+ viewportBottom: viewportBottom,
35
+ locationParams: __assign({ behavior: behavior, align: align }, rest),
36
+ });
28
37
  if (location) {
29
38
  done &&
30
- u.handleNext(u.pipe(scrollingInProgress, u.skip(1), u.filter(function (value) { return value === false; })), done);
39
+ u.handleNext(u.pipe(scrollingInProgress, u.filter(function (value) { return value === false; }),
40
+ // skips the initial publish of false, and the cleanup call.
41
+ // but if scrollingInProgress is true, we skip the initial publish.
42
+ u.skip(u.getValue(scrollingInProgress) ? 1 : 2)), done);
31
43
  }
32
44
  else {
33
45
  done && done();
@@ -1,5 +1,5 @@
1
1
  import { __read } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
2
+ import * as u from './urx';
3
3
  import { stateFlagsSystem } from './stateFlagsSystem';
4
4
  export var scrollSeekSystem = u.system(function (_a) {
5
5
  var _b = __read(_a, 1), scrollVelocity = _b[0].scrollVelocity;
@@ -7,7 +7,7 @@ export var scrollSeekSystem = u.system(function (_a) {
7
7
  var rangeChanged = u.stream();
8
8
  var scrollSeekConfiguration = u.statefulStream(false);
9
9
  u.connect(u.pipe(scrollVelocity, u.withLatestFrom(scrollSeekConfiguration, isSeeking, rangeChanged), u.filter(function (_a) {
10
- var _b = __read(_a, 2), config = _b[1];
10
+ var _b = __read(_a, 2), _ = _b[0], config = _b[1];
11
11
  return !!config;
12
12
  }), u.map(function (_a) {
13
13
  var _b = __read(_a, 4), speed = _b[0], config = _b[1], isSeeking = _b[2], range = _b[3];
@@ -17,8 +17,10 @@ export var scrollSeekSystem = u.system(function (_a) {
17
17
  return false;
18
18
  }
19
19
  }
20
- else if (enter(speed, range)) {
21
- return true;
20
+ else {
21
+ if (enter(speed, range)) {
22
+ return true;
23
+ }
22
24
  }
23
25
  return isSeeking;
24
26
  }), u.distinctUntilChanged()), isSeeking);
@@ -26,10 +28,5 @@ export var scrollSeekSystem = u.system(function (_a) {
26
28
  var _b = __read(_a, 2), _c = __read(_b[0], 3), isSeeking = _c[0], velocity = _c[1], range = _c[2], config = _b[1];
27
29
  return isSeeking && config && config.change && config.change(velocity, range);
28
30
  });
29
- return {
30
- isSeeking: isSeeking,
31
- scrollSeekConfiguration: scrollSeekConfiguration,
32
- scrollVelocity: scrollVelocity,
33
- scrollSeekRangeChanged: rangeChanged,
34
- };
31
+ return { isSeeking: isSeeking, scrollSeekConfiguration: scrollSeekConfiguration, scrollVelocity: scrollVelocity, scrollSeekRangeChanged: rangeChanged };
35
32
  }, u.tup(stateFlagsSystem), { singleton: true });
@@ -1,12 +1,11 @@
1
1
  import { __read } from "tslib";
2
2
  /* eslint-disable @typescript-eslint/no-unsafe-call */
3
- import * as u from '@virtuoso.dev/urx';
3
+ import * as u from './urx';
4
4
  import { findMaxKeyValue } from './AATree';
5
5
  import { domIOSystem } from './domIOSystem';
6
+ import { offsetOf, originalIndexFromLocation, sizeSystem } from './sizeSystem';
6
7
  import { loggerSystem, LogLevel } from './loggerSystem';
7
- import { offsetOf, originalIndexFromItemIndex, sizeSystem } from './sizeSystem';
8
- var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== 'undefined' &&
9
- 'scrollBehavior' in document.documentElement.style;
8
+ var SUPPORTS_SCROLL_TO_OPTIONS = typeof document !== 'undefined' && 'scrollBehavior' in document.documentElement.style;
10
9
  export function normalizeIndexLocation(location) {
11
10
  var result = typeof location === 'number' ? { index: location } : location;
12
11
  if (!result.align) {
@@ -21,7 +20,7 @@ export function normalizeIndexLocation(location) {
21
20
  return result;
22
21
  }
23
22
  export var scrollToIndexSystem = u.system(function (_a) {
24
- var _b = __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;
23
+ var _b = __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;
25
24
  var scrollToIndex = u.stream();
26
25
  var topListHeight = u.statefulStream(0);
27
26
  var unsubscribeNextListRefresh = null;
@@ -42,32 +41,21 @@ export var scrollToIndexSystem = u.system(function (_a) {
42
41
  }
43
42
  u.publish(scrollingInProgress, false);
44
43
  }
45
- u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), u.map(function (_a) {
46
- var _b = __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];
44
+ u.connect(u.pipe(scrollToIndex, u.withLatestFrom(sizes, viewportHeight, totalCount, topListHeight, headerHeight, footerHeight, log), u.withLatestFrom(gap, fixedHeaderHeight, fixedFooterHeight), u.map(function (_a) {
45
+ var _b = __read(_a, 4), _c = __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];
47
46
  var normalLocation = normalizeIndexLocation(location);
48
47
  var align = normalLocation.align, behavior = normalLocation.behavior, offset = normalLocation.offset;
49
48
  var lastIndex = totalCount - 1;
50
- var index = normalLocation.index;
51
- if (index === 'LAST') {
52
- index = lastIndex;
53
- }
54
- index = originalIndexFromItemIndex(index, sizes);
55
- index = Math.max(0, index, Math.min(lastIndex, index));
56
- var top = offsetOf(index, sizes.offsetTree) + headerHeight;
49
+ var index = originalIndexFromLocation(normalLocation, sizes, lastIndex);
50
+ var top = offsetOf(index, sizes.offsetTree, gap) + headerHeight;
57
51
  if (align === 'end') {
58
- top =
59
- top -
60
- viewportHeight +
61
- findMaxKeyValue(sizes.sizeTree, index)[1];
52
+ top += fixedHeaderHeight + findMaxKeyValue(sizes.sizeTree, index)[1] - viewportHeight + fixedFooterHeight;
62
53
  if (index === lastIndex) {
63
54
  top += footerHeight;
64
55
  }
65
56
  }
66
57
  else if (align === 'center') {
67
- top =
68
- top -
69
- viewportHeight / 2 +
70
- findMaxKeyValue(sizes.sizeTree, index)[1] / 2;
58
+ top += (fixedHeaderHeight + findMaxKeyValue(sizes.sizeTree, index)[1] - viewportHeight + fixedFooterHeight) / 2;
71
59
  }
72
60
  else {
73
61
  top -= topListHeight;
@@ -96,7 +84,7 @@ export var scrollToIndexSystem = u.system(function (_a) {
96
84
  });
97
85
  }
98
86
  else {
99
- unsubscribeNextListRefresh = u.handleNext(u.pipe(listRefresh, watchChangesFor(50)), retry);
87
+ unsubscribeNextListRefresh = u.handleNext(u.pipe(listRefresh, watchChangesFor(150)), retry);
100
88
  }
101
89
  // if the scroll jump is too small, the list won't get rerendered.
102
90
  // clean this listener
@@ -1,37 +1,35 @@
1
1
  import { __read } from "tslib";
2
- import * as u from '@virtuoso.dev/urx';
3
- import { tupleComparator } from './comparators';
2
+ import * as u from './urx';
4
3
  import { domIOSystem } from './domIOSystem';
5
- import { DOWN, UP } from './stateFlagsSystem';
4
+ import { UP, DOWN } from './stateFlagsSystem';
5
+ import { tupleComparator } from './comparators';
6
6
  export var TOP = 'top';
7
7
  export var BOTTOM = 'bottom';
8
8
  export var NONE = 'none';
9
9
  export function getOverscan(overscan, end, direction) {
10
10
  if (typeof overscan === 'number') {
11
- return (direction === UP && end === TOP) ||
12
- (direction === DOWN && end === BOTTOM)
13
- ? overscan
14
- : 0;
11
+ return (direction === UP && end === TOP) || (direction === DOWN && end === BOTTOM) ? overscan : 0;
15
12
  }
16
- if (direction === UP) {
17
- return end === TOP ? overscan.main : overscan.reverse;
13
+ else {
14
+ if (direction === UP) {
15
+ return end === TOP ? overscan.main : overscan.reverse;
16
+ }
17
+ else {
18
+ return end === BOTTOM ? overscan.main : overscan.reverse;
19
+ }
18
20
  }
19
- return end === BOTTOM ? overscan.main : overscan.reverse;
20
21
  }
21
22
  function getViewportIncrease(value, end) {
22
23
  return typeof value === 'number' ? value : value[end] || 0;
23
24
  }
24
25
  export var sizeRangeSystem = u.system(function (_a) {
25
- var _b = __read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, deviation = _c.deviation, headerHeight = _c.headerHeight;
26
+ var _b = __read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, deviation = _c.deviation, headerHeight = _c.headerHeight, fixedHeaderHeight = _c.fixedHeaderHeight;
26
27
  var listBoundary = u.stream();
27
28
  var topListHeight = u.statefulStream(0);
28
- var fixedHeaderHeight = u.statefulStream(0);
29
29
  var increaseViewportBy = u.statefulStream(0);
30
30
  var overscan = u.statefulStream(0);
31
31
  var visibleRange = u.statefulStreamFromEmitter(u.pipe(u.combineLatest(u.duc(scrollTop), u.duc(viewportHeight), u.duc(headerHeight), u.duc(listBoundary, tupleComparator), u.duc(overscan), u.duc(topListHeight), u.duc(fixedHeaderHeight), u.duc(deviation), u.duc(increaseViewportBy)), u.map(function (_a) {
32
- var _b = __read(_a, 9), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2],
33
- // @ts-ignore
34
- _c = __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];
32
+ var _b = __read(_a, 9), scrollTop = _b[0], viewportHeight = _b[1], headerHeight = _b[2], _c = __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
33
  var top = scrollTop - deviation;
36
34
  var stickyHeaderHeight = topListHeight + fixedHeaderHeight;
37
35
  var headerVisible = Math.max(headerHeight - top, 0);
@@ -42,24 +40,15 @@ export var sizeRangeSystem = u.system(function (_a) {
42
40
  listTop += headerHeight + fixedHeaderHeight;
43
41
  listBottom += headerHeight + fixedHeaderHeight;
44
42
  listBottom -= deviation;
45
- // console.log({ listTop, scrollTop, stickyHeaderHeight, topViewportAddition })
46
- if (listTop >
47
- scrollTop + stickyHeaderHeight - topViewportAddition) {
43
+ if (listTop > scrollTop + stickyHeaderHeight - topViewportAddition) {
48
44
  direction = UP;
49
45
  }
50
- if (listBottom <
51
- scrollTop -
52
- headerVisible +
53
- viewportHeight +
54
- bottomViewportAddition) {
46
+ if (listBottom < scrollTop - headerVisible + viewportHeight + bottomViewportAddition) {
55
47
  direction = DOWN;
56
48
  }
57
49
  if (direction !== NONE) {
58
50
  return [
59
- Math.max(top -
60
- headerHeight -
61
- getOverscan(overscan, TOP, direction) -
62
- topViewportAddition, 0),
51
+ Math.max(top - headerHeight - getOverscan(overscan, TOP, direction) - topViewportAddition, 0),
63
52
  top -
64
53
  headerVisible -
65
54
  fixedHeaderHeight +
@@ -75,7 +64,6 @@ export var sizeRangeSystem = u.system(function (_a) {
75
64
  listBoundary: listBoundary,
76
65
  overscan: overscan,
77
66
  topListHeight: topListHeight,
78
- fixedHeaderHeight: fixedHeaderHeight,
79
67
  increaseViewportBy: increaseViewportBy,
80
68
  // output
81
69
  visibleRange: visibleRange,