@ringcentral/juno 2.40.1 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) 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/Virtuoso/index.d.ts +1 -1
  4. package/components/Virtuoso/index.js +1 -1
  5. package/components/Virtuoso/react-virtuoso/AATree.d.ts +1 -1
  6. package/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  7. package/components/Virtuoso/react-virtuoso/TableVirtuoso.d.ts +5 -0
  8. package/components/Virtuoso/react-virtuoso/TableVirtuoso.js +217 -0
  9. package/components/Virtuoso/react-virtuoso/Virtuoso.d.ts +7696 -0
  10. package/components/Virtuoso/react-virtuoso/Virtuoso.js +317 -0
  11. package/components/Virtuoso/react-virtuoso/{Grid.d.ts → VirtuosoGrid.d.ts} +170 -72
  12. package/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +199 -0
  13. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +119 -65
  14. package/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  15. package/components/Virtuoso/react-virtuoso/comparators.d.ts +1 -1
  16. package/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  17. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.d.ts +194 -0
  18. package/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +2 -0
  19. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.d.ts +274 -0
  20. package/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +2 -0
  21. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.d.ts +125 -0
  22. package/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +2 -0
  23. package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +3 -2
  24. package/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  25. package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +80 -43
  26. package/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  27. package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +57 -31
  28. package/components/Virtuoso/react-virtuoso/gridSystem.js +173 -86
  29. package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +76 -67
  30. package/components/Virtuoso/react-virtuoso/groupedListSystem.js +12 -12
  31. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +6 -3
  32. package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +36 -17
  33. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  34. package/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +3 -2
  35. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.d.ts +2 -0
  36. package/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +5 -0
  37. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +2 -3
  38. package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +36 -51
  39. package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -3
  40. package/components/Virtuoso/react-virtuoso/hooks/useSize.js +13 -13
  41. package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +17 -15
  42. package/components/Virtuoso/react-virtuoso/index.d.ts +7 -1
  43. package/components/Virtuoso/react-virtuoso/index.js +8 -1
  44. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +304 -68
  45. package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +9 -31
  46. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +127 -109
  47. package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  48. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +38 -22
  49. package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  50. package/components/Virtuoso/react-virtuoso/interfaces.d.ts +150 -51
  51. package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +109 -59
  52. package/components/Virtuoso/react-virtuoso/listStateSystem.js +100 -52
  53. package/components/Virtuoso/react-virtuoso/listSystem.d.ts +1691 -693
  54. package/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  55. package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +1 -1
  56. package/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  57. package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +1 -1
  58. package/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  59. package/components/Virtuoso/react-virtuoso/react-urx/index.d.ts +110 -0
  60. package/components/Virtuoso/react-virtuoso/react-urx/index.js +200 -0
  61. package/components/Virtuoso/react-virtuoso/react-urx/package.json +5 -0
  62. package/components/Virtuoso/react-virtuoso/recalcSystem.d.ts +4 -0
  63. package/components/Virtuoso/react-virtuoso/recalcSystem.js +8 -0
  64. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +144 -78
  65. package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +33 -21
  66. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +12 -7
  67. package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  68. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +19 -11
  69. package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  70. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +7 -6
  71. package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +15 -27
  72. package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +20 -11
  73. package/components/Virtuoso/react-virtuoso/sizeSystem.js +182 -52
  74. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +8 -5
  75. package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  76. package/components/Virtuoso/react-virtuoso/stateLoadSystem.d.ts +318 -0
  77. package/components/Virtuoso/react-virtuoso/stateLoadSystem.js +41 -0
  78. package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +518 -467
  79. package/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  80. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +115 -63
  81. package/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  82. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +139 -73
  83. package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +74 -31
  84. package/components/Virtuoso/react-virtuoso/urx/actions.d.ts +127 -0
  85. package/components/Virtuoso/react-virtuoso/urx/actions.js +98 -0
  86. package/components/Virtuoso/react-virtuoso/urx/constants.d.ts +8 -0
  87. package/components/Virtuoso/react-virtuoso/urx/constants.js +6 -0
  88. package/components/Virtuoso/react-virtuoso/urx/index.d.ts +6 -0
  89. package/components/Virtuoso/react-virtuoso/urx/index.js +9 -0
  90. package/components/Virtuoso/react-virtuoso/urx/package.json +5 -0
  91. package/components/Virtuoso/react-virtuoso/urx/pipe.d.ts +220 -0
  92. package/components/Virtuoso/react-virtuoso/urx/pipe.js +279 -0
  93. package/components/Virtuoso/react-virtuoso/urx/streams.d.ts +143 -0
  94. package/components/Virtuoso/react-virtuoso/urx/streams.js +227 -0
  95. package/components/Virtuoso/react-virtuoso/urx/system.d.ts +148 -0
  96. package/components/Virtuoso/react-virtuoso/urx/system.js +106 -0
  97. package/components/Virtuoso/react-virtuoso/urx/transformers.d.ts +71 -0
  98. package/components/Virtuoso/react-virtuoso/urx/transformers.js +106 -0
  99. package/components/Virtuoso/react-virtuoso/urx/utils.d.ts +57 -0
  100. package/components/Virtuoso/react-virtuoso/urx/utils.js +102 -0
  101. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.d.ts +1 -0
  102. package/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +6 -0
  103. package/components/Virtuoso/react-virtuoso/utils/context.d.ts +13 -0
  104. package/components/Virtuoso/react-virtuoso/utils/context.js +6 -0
  105. package/components/Virtuoso/react-virtuoso/utils/skipFrames.d.ts +1 -0
  106. package/components/Virtuoso/react-virtuoso/utils/skipFrames.js +11 -0
  107. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +6 -4
  108. package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  109. package/components/Virtuoso/utils/isOutOfRange.d.ts +1 -1
  110. package/components/Virtuoso/utils/useHighlightScroll.d.ts +2 -2
  111. package/es6/components/Virtuoso/index.js +1 -1
  112. package/es6/components/Virtuoso/react-virtuoso/AATree.js +60 -48
  113. package/es6/components/Virtuoso/react-virtuoso/{Table.js → TableVirtuoso.js} +73 -52
  114. package/es6/components/Virtuoso/react-virtuoso/{List.js → Virtuoso.js} +85 -161
  115. package/es6/components/Virtuoso/react-virtuoso/VirtuosoGrid.js +198 -0
  116. package/es6/components/Virtuoso/react-virtuoso/alignToBottomSystem.js +3 -3
  117. package/es6/components/Virtuoso/react-virtuoso/comparators.js +1 -3
  118. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/TableVirtuoso.js +0 -0
  119. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/Virtuoso.js +0 -0
  120. package/es6/components/Virtuoso/react-virtuoso/component-interfaces/VirtuosoGrid.js +0 -0
  121. package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +5 -3
  122. package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +21 -19
  123. package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +173 -87
  124. package/es6/components/Virtuoso/react-virtuoso/groupedListSystem.js +13 -13
  125. package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +35 -16
  126. package/es6/components/Virtuoso/react-virtuoso/hooks/useIsomorphicLayoutEffect.js +2 -2
  127. package/es6/components/Virtuoso/react-virtuoso/hooks/useRcPortalWindowContext.js +2 -0
  128. package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +35 -50
  129. package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +11 -12
  130. package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +15 -14
  131. package/es6/components/Virtuoso/react-virtuoso/index.js +4 -1
  132. package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +11 -33
  133. package/es6/components/Virtuoso/react-virtuoso/initialScrollTopSystem.js +7 -7
  134. package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +13 -20
  135. package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +101 -54
  136. package/es6/components/Virtuoso/react-virtuoso/listSystem.js +15 -16
  137. package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +2 -4
  138. package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +3 -4
  139. package/es6/components/Virtuoso/react-virtuoso/react-urx/index.js +197 -0
  140. package/es6/components/Virtuoso/react-virtuoso/recalcSystem.js +5 -0
  141. package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +34 -22
  142. package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +7 -10
  143. package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +11 -23
  144. package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +16 -28
  145. package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +180 -53
  146. package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +32 -23
  147. package/es6/components/Virtuoso/react-virtuoso/stateLoadSystem.js +39 -0
  148. package/es6/components/Virtuoso/react-virtuoso/topItemCountSystem.js +5 -5
  149. package/es6/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +6 -13
  150. package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +75 -32
  151. package/es6/components/Virtuoso/react-virtuoso/urx/actions.js +90 -0
  152. package/es6/components/Virtuoso/react-virtuoso/urx/constants.js +4 -0
  153. package/es6/components/Virtuoso/react-virtuoso/urx/index.js +6 -0
  154. package/es6/components/Virtuoso/react-virtuoso/urx/pipe.js +266 -0
  155. package/es6/components/Virtuoso/react-virtuoso/urx/streams.js +220 -0
  156. package/es6/components/Virtuoso/react-virtuoso/urx/system.js +102 -0
  157. package/es6/components/Virtuoso/react-virtuoso/urx/transformers.js +101 -0
  158. package/es6/components/Virtuoso/react-virtuoso/urx/utils.js +88 -0
  159. package/es6/components/Virtuoso/react-virtuoso/utils/approximatelyEqual.js +3 -0
  160. package/es6/components/Virtuoso/react-virtuoso/utils/context.js +3 -0
  161. package/es6/components/Virtuoso/react-virtuoso/utils/skipFrames.js +8 -0
  162. package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +1 -1
  163. package/package.json +2 -2
  164. package/components/Virtuoso/Virtuoso.d.ts +0 -1
  165. package/components/Virtuoso/Virtuoso.js +0 -4
  166. package/components/Virtuoso/react-virtuoso/Grid.js +0 -168
  167. package/components/Virtuoso/react-virtuoso/List.d.ts +0 -6749
  168. package/components/Virtuoso/react-virtuoso/List.js +0 -393
  169. package/components/Virtuoso/react-virtuoso/Table.d.ts +0 -6515
  170. package/components/Virtuoso/react-virtuoso/Table.js +0 -196
  171. package/components/Virtuoso/react-virtuoso/components.d.ts +0 -505
  172. package/components/Virtuoso/react-virtuoso/components.js +0 -9
  173. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.d.ts +0 -1
  174. package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -11
  175. package/es6/components/Virtuoso/Virtuoso.js +0 -1
  176. package/es6/components/Virtuoso/react-virtuoso/Grid.js +0 -166
  177. package/es6/components/Virtuoso/react-virtuoso/components.js +0 -7
  178. package/es6/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +0 -8
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
4
+ var u = tslib_1.__importStar(require("./urx"));
5
5
  var domIOSystem_1 = require("./domIOSystem");
6
6
  exports.windowScrollerSystem = u.system(function (_a) {
7
7
  var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTo = _c.scrollTo, scrollContainerState = _c.scrollContainerState;
@@ -1,2 +1,2 @@
1
- import { ListRange } from '../Virtuoso';
1
+ import { ListRange } from '../react-virtuoso';
2
2
  export declare function isOutOfRange(focusedIndex: number, range: ListRange): boolean;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { IndexLocationWithAlign, ListItem } from 'react-virtuoso';
2
+ import { FlatIndexLocationWithAlign, ListItem } from '../react-virtuoso';
3
3
  declare type UseHighlightScrollParams = {
4
4
  /** function to call to scroll to target index */
5
- scrollToIndex: (location: IndexLocationWithAlign) => void;
5
+ scrollToIndex: (location: FlatIndexLocationWithAlign) => void;
6
6
  /** that scroll container height ref */
7
7
  containerHeighRef: React.MutableRefObject<number>;
8
8
  };
@@ -1,2 +1,2 @@
1
- export * from './Virtuoso';
1
+ export * from './react-virtuoso';
2
2
  export * from './utils';
@@ -19,16 +19,20 @@ export function remove(node, key) {
19
19
  if (empty(l)) {
20
20
  return r;
21
21
  }
22
- if (empty(r)) {
22
+ else if (empty(r)) {
23
23
  return l;
24
24
  }
25
- var _a = __read(last(l), 2), lastKey = _a[0], lastValue = _a[1];
26
- return adjust(clone(node, { k: lastKey, v: lastValue, l: deleteLast(l) }));
25
+ else {
26
+ var _a = __read(last(l), 2), lastKey = _a[0], lastValue = _a[1];
27
+ return adjust(clone(node, { k: lastKey, v: lastValue, l: deleteLast(l) }));
28
+ }
27
29
  }
28
- if (key < k) {
30
+ else if (key < k) {
29
31
  return adjust(clone(node, { l: remove(l, key) }));
30
32
  }
31
- return adjust(clone(node, { r: remove(r, key) }));
33
+ else {
34
+ return adjust(clone(node, { r: remove(r, key) }));
35
+ }
32
36
  }
33
37
  export function find(node, key) {
34
38
  if (empty(node)) {
@@ -37,25 +41,29 @@ export function find(node, key) {
37
41
  if (key === node.k) {
38
42
  return node.v;
39
43
  }
40
- if (key < node.k) {
44
+ else if (key < node.k) {
41
45
  return find(node.l, key);
42
46
  }
43
- return find(node.r, key);
47
+ else {
48
+ return find(node.r, key);
49
+ }
44
50
  }
45
51
  export function findMaxKeyValue(node, value, field) {
46
52
  if (field === void 0) { field = 'k'; }
47
53
  if (empty(node)) {
48
54
  return [-Infinity, undefined];
49
55
  }
50
- if (node[field] === value) {
56
+ if (Number(node[field]) === value) {
51
57
  return [node.k, node.v];
52
58
  }
53
- if (node[field] < value) {
59
+ if (Number(node[field]) < value) {
54
60
  var r = findMaxKeyValue(node.r, value, field);
55
61
  if (r[0] === -Infinity) {
56
62
  return [node.k, node.v];
57
63
  }
58
- return r;
64
+ else {
65
+ return r;
66
+ }
59
67
  }
60
68
  return findMaxKeyValue(node.l, value, field);
61
69
  }
@@ -66,10 +74,12 @@ export function insert(node, k, v) {
66
74
  if (k === node.k) {
67
75
  return clone(node, { k: k, v: v });
68
76
  }
69
- if (k < node.k) {
77
+ else if (k < node.k) {
70
78
  return rebalance(clone(node, { l: insert(node.l, k, v) }));
71
79
  }
72
- return rebalance(clone(node, { r: insert(node.r, k, v) }));
80
+ else {
81
+ return rebalance(clone(node, { r: insert(node.r, k, v) }));
82
+ }
73
83
  }
74
84
  export function walkWithin(node, start, end) {
75
85
  if (empty(node)) {
@@ -98,9 +108,7 @@ function last(node) {
98
108
  return empty(node.r) ? [node.k, node.v] : last(node.r);
99
109
  }
100
110
  function deleteLast(node) {
101
- return empty(node.r)
102
- ? node.l
103
- : adjust(clone(node, { r: deleteLast(node.r) }));
111
+ return empty(node.r) ? node.l : adjust(clone(node, { r: deleteLast(node.r) }));
104
112
  }
105
113
  function clone(node, args) {
106
114
  return newAANode(args.k !== undefined ? args.k : node.k, args.v !== undefined ? args.v : node.v, args.lvl !== undefined ? args.lvl : node.lvl, args.l !== undefined ? args.l : node.l, args.r !== undefined ? args.r : node.r);
@@ -116,39 +124,47 @@ function adjust(node) {
116
124
  if (r.lvl >= lvl - 1 && l.lvl >= lvl - 1) {
117
125
  return node;
118
126
  }
119
- if (lvl > r.lvl + 1) {
127
+ else if (lvl > r.lvl + 1) {
120
128
  if (isSingle(l)) {
121
129
  return skew(clone(node, { lvl: lvl - 1 }));
122
130
  }
123
- if (!empty(l) && !empty(l.r)) {
124
- return clone(l.r, {
125
- l: clone(l, { r: l.r.l }),
126
- r: clone(node, {
127
- l: l.r.r,
128
- lvl: lvl - 1,
129
- }),
130
- lvl: lvl,
131
- });
131
+ else {
132
+ if (!empty(l) && !empty(l.r)) {
133
+ return clone(l.r, {
134
+ l: clone(l, { r: l.r.l }),
135
+ r: clone(node, {
136
+ l: l.r.r,
137
+ lvl: lvl - 1,
138
+ }),
139
+ lvl: lvl,
140
+ });
141
+ }
142
+ else {
143
+ throw new Error('Unexpected empty nodes');
144
+ }
132
145
  }
133
- throw new Error('Unexpected empty nodes');
134
- }
135
- else if (isSingle(node)) {
136
- return split(clone(node, { lvl: lvl - 1 }));
137
- }
138
- else if (!empty(r) && !empty(r.l)) {
139
- var rl = r.l;
140
- var rlvl = isSingle(rl) ? r.lvl - 1 : r.lvl;
141
- return clone(rl, {
142
- l: clone(node, {
143
- r: rl.l,
144
- lvl: lvl - 1,
145
- }),
146
- r: split(clone(r, { l: rl.r, lvl: rlvl })),
147
- lvl: rl.lvl + 1,
148
- });
149
146
  }
150
147
  else {
151
- throw new Error('Unexpected empty nodes');
148
+ if (isSingle(node)) {
149
+ return split(clone(node, { lvl: lvl - 1 }));
150
+ }
151
+ else {
152
+ if (!empty(r) && !empty(r.l)) {
153
+ var rl = r.l;
154
+ var rlvl = isSingle(rl) ? r.lvl - 1 : r.lvl;
155
+ return clone(rl, {
156
+ l: clone(node, {
157
+ r: rl.l,
158
+ lvl: lvl - 1,
159
+ }),
160
+ r: split(clone(r, { l: rl.r, lvl: rlvl })),
161
+ lvl: rl.lvl + 1,
162
+ });
163
+ }
164
+ else {
165
+ throw new Error('Unexpected empty nodes');
166
+ }
167
+ }
152
168
  }
153
169
  }
154
170
  export function keys(node) {
@@ -191,13 +207,9 @@ function toRanges(nodes) {
191
207
  }
192
208
  function split(node) {
193
209
  var r = node.r, lvl = node.lvl;
194
- return !empty(r) && !empty(r.r) && r.lvl === lvl && r.r.lvl === lvl
195
- ? clone(r, { l: clone(node, { r: r.l }), lvl: lvl + 1 })
196
- : node;
210
+ return !empty(r) && !empty(r.r) && r.lvl === lvl && r.r.lvl === lvl ? clone(r, { l: clone(node, { r: r.l }), lvl: lvl + 1 }) : node;
197
211
  }
198
212
  function skew(node) {
199
213
  var l = node.l;
200
- return !empty(l) && l.lvl === node.lvl
201
- ? clone(l, { r: clone(node, { l: l.r }) })
202
- : node;
214
+ return !empty(l) && l.lvl === node.lvl ? clone(l, { r: clone(node, { l: l.r }) }) : node;
203
215
  }
@@ -1,38 +1,39 @@
1
- var _a;
2
1
  import { __assign, __read, __spread } from "tslib";
3
- import * as React from 'react';
4
- import { createElement } from 'react';
5
- import { systemToComponent } from '@virtuoso.dev/react-urx';
6
- import { compose, distinctUntilChanged, map, noop, pipe, statefulStream, statefulStreamFromEmitter, system, tup, } from '@virtuoso.dev/urx';
2
+ import { systemToComponent } from './react-urx';
3
+ import * as u from './urx';
4
+ import React from 'react';
7
5
  import useChangedListContentsSizes from './hooks/useChangedChildSizes';
8
- import useSize from './hooks/useSize';
9
- import useWindowViewportRectRef from './hooks/useWindowViewportRect';
10
- import { buildScroller, buildWindowScroller, contextPropIfNotDomElement, identity, viewportStyle, } from './List';
11
6
  import { listSystem } from './listSystem';
12
- import conditionalFlushSync from './utils/conditionalFlushSync';
7
+ import { identity, buildScroller, buildWindowScroller, viewportStyle, contextPropIfNotDomElement, itemPropIfNotDomElement, } from './Virtuoso';
8
+ import useSize from './hooks/useSize';
13
9
  import { correctItemSize } from './utils/correctItemSize';
14
- var tableComponentPropsSystem = system(function () {
15
- var itemContent = statefulStream(function (index) { return React.createElement("td", null,
10
+ import useWindowViewportRectRef from './hooks/useWindowViewportRect';
11
+ import { VirtuosoMockContext } from './utils/context';
12
+ var tableComponentPropsSystem = /*#__PURE__*/ u.system(function () {
13
+ var itemContent = u.statefulStream(function (index) { return React.createElement("td", null,
16
14
  "Item $",
17
15
  index); });
18
- var context = statefulStream(null);
19
- var fixedHeaderContent = statefulStream(null);
20
- var components = statefulStream({});
21
- var computeItemKey = statefulStream(identity);
22
- var scrollerRef = statefulStream(noop);
16
+ var context = u.statefulStream(null);
17
+ var fixedHeaderContent = u.statefulStream(null);
18
+ var fixedFooterContent = u.statefulStream(null);
19
+ var components = u.statefulStream({});
20
+ var computeItemKey = u.statefulStream(identity);
21
+ var scrollerRef = u.statefulStream(u.noop);
23
22
  var distinctProp = function (propName, defaultValue) {
24
23
  if (defaultValue === void 0) { defaultValue = null; }
25
- return statefulStreamFromEmitter(pipe(components, map(function (components) { return components[propName]; }), distinctUntilChanged()), defaultValue);
24
+ return u.statefulStreamFromEmitter(u.pipe(components, u.map(function (components) { return components[propName]; }), u.distinctUntilChanged()), defaultValue);
26
25
  };
27
26
  return {
28
27
  context: context,
29
28
  itemContent: itemContent,
30
29
  fixedHeaderContent: fixedHeaderContent,
30
+ fixedFooterContent: fixedFooterContent,
31
31
  components: components,
32
32
  computeItemKey: computeItemKey,
33
33
  scrollerRef: scrollerRef,
34
34
  TableComponent: distinctProp('Table', 'table'),
35
35
  TableHeadComponent: distinctProp('TableHead', 'thead'),
36
+ TableFooterComponent: distinctProp('TableFoot', 'tfoot'),
36
37
  TableBodyComponent: distinctProp('TableBody', 'tbody'),
37
38
  TableRowComponent: distinctProp('TableRow', 'tr'),
38
39
  ScrollerComponent: distinctProp('Scroller', 'div'),
@@ -41,10 +42,10 @@ var tableComponentPropsSystem = system(function () {
41
42
  FillerRow: distinctProp('FillerRow'),
42
43
  };
43
44
  });
44
- var combinedSystem = system(function (_a) {
45
+ var combinedSystem = /*#__PURE__*/ u.system(function (_a) {
45
46
  var _b = __read(_a, 2), listSystem = _b[0], propsSystem = _b[1];
46
47
  return __assign(__assign({}, listSystem), propsSystem);
47
- }, tup(listSystem, tableComponentPropsSystem));
48
+ }, u.tup(listSystem, tableComponentPropsSystem));
48
49
  var DefaultScrollSeekPlaceholder = function (_a) {
49
50
  var height = _a.height;
50
51
  return (React.createElement("tr", null,
@@ -55,30 +56,27 @@ var DefaultFillerRow = function (_a) {
55
56
  return (React.createElement("tr", null,
56
57
  React.createElement("td", { style: { height: height, padding: 0, border: 0 } })));
57
58
  };
58
- export var Items = React.memo(function VirtuosoItems() {
59
+ var ITEM_STYLE = { overflowAnchor: 'none' };
60
+ var Items = /*#__PURE__*/ React.memo(function VirtuosoItems() {
59
61
  var listState = useEmitterValue('listState');
60
- var _a = __read(React.useState(0), 2), deviation = _a[0], setDeviation = _a[1];
61
- var react18ConcurrentRendering = useEmitterValue('react18ConcurrentRendering');
62
- useEmitter('deviation', function (value) {
63
- if (deviation !== value) {
64
- conditionalFlushSync(react18ConcurrentRendering)(function () {
65
- return setDeviation(value);
66
- });
67
- }
68
- });
69
62
  var sizeRanges = usePublisher('sizeRanges');
70
63
  var useWindowScroll = useEmitterValue('useWindowScroll');
71
64
  var customScrollParent = useEmitterValue('customScrollParent');
72
65
  var windowScrollContainerStateCallback = usePublisher('windowScrollContainerState');
73
66
  var _scrollContainerStateCallback = usePublisher('scrollContainerState');
74
- var scrollContainerStateCallback = customScrollParent || useWindowScroll
75
- ? windowScrollContainerStateCallback
76
- : _scrollContainerStateCallback;
67
+ var scrollContainerStateCallback = customScrollParent || useWindowScroll ? windowScrollContainerStateCallback : _scrollContainerStateCallback;
77
68
  var itemContent = useEmitterValue('itemContent');
78
69
  var trackItemSizes = useEmitterValue('trackItemSizes');
79
70
  var itemSize = useEmitterValue('itemSize');
80
71
  var log = useEmitterValue('log');
81
- var ref = useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, scrollContainerStateCallback, log, customScrollParent);
72
+ var _a = useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, scrollContainerStateCallback, log, undefined, customScrollParent), callbackRef = _a.callbackRef, ref = _a.ref;
73
+ var _b = __read(React.useState(0), 2), deviation = _b[0], setDeviation = _b[1];
74
+ useEmitter('deviation', function (value) {
75
+ if (deviation !== value) {
76
+ ref.current.style.marginTop = value + "px";
77
+ setDeviation(value);
78
+ }
79
+ });
82
80
  var EmptyPlaceholder = useEmitterValue('EmptyPlaceholder');
83
81
  var ScrollSeekPlaceholder = useEmitterValue('ScrollSeekPlaceholder') || DefaultScrollSeekPlaceholder;
84
82
  var FillerRow = useEmitterValue('FillerRow') || DefaultFillerRow;
@@ -91,60 +89,85 @@ export var Items = React.memo(function VirtuosoItems() {
91
89
  var statefulTotalCount = useEmitterValue('statefulTotalCount');
92
90
  var context = useEmitterValue('context');
93
91
  if (statefulTotalCount === 0 && EmptyPlaceholder) {
94
- return createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
92
+ return React.createElement(EmptyPlaceholder, contextPropIfNotDomElement(EmptyPlaceholder, context));
95
93
  }
96
94
  var paddingTop = listState.offsetTop + paddingTopAddition + deviation;
97
95
  var paddingBottom = listState.offsetBottom;
98
- var paddingTopEl = paddingTop > 0 ? React.createElement(FillerRow, { height: paddingTop, key: "padding-top" }) : null;
99
- var paddingBottomEl = paddingBottom > 0 ? (React.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom" })) : null;
96
+ var paddingTopEl = paddingTop > 0 ? React.createElement(FillerRow, { height: paddingTop, key: "padding-top", context: context }) : null;
97
+ var paddingBottomEl = paddingBottom > 0 ? React.createElement(FillerRow, { height: paddingBottom, key: "padding-bottom", context: context }) : null;
100
98
  var items = listState.items.map(function (item) {
101
99
  var index = item.originalIndex;
102
100
  var key = computeItemKey(index + firstItemIndex, item.data, context);
103
101
  if (isSeeking) {
104
- return createElement(ScrollSeekPlaceholder, __assign(__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }));
102
+ return React.createElement(ScrollSeekPlaceholder, __assign(__assign({}, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { key: key, index: item.index, height: item.size, type: item.type || 'item' }));
105
103
  }
106
- return createElement(TableRowComponent, __assign(__assign({}, contextPropIfNotDomElement(TableRowComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: { overflowAnchor: 'none' } }), itemContent(item.index, item.data, context));
104
+ return React.createElement(TableRowComponent, __assign(__assign(__assign({}, contextPropIfNotDomElement(TableRowComponent, context)), itemPropIfNotDomElement(TableRowComponent, item.data)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: ITEM_STYLE }), itemContent(item.index, item.data, context));
107
105
  });
108
- return createElement(TableBodyComponent, __assign({ ref: ref, 'data-test-id': 'virtuoso-item-list' }, contextPropIfNotDomElement(TableBodyComponent, context)), __spread([paddingTopEl], items, [paddingBottomEl]));
106
+ return React.createElement(TableBodyComponent, __assign({ ref: callbackRef, 'data-test-id': 'virtuoso-item-list' }, contextPropIfNotDomElement(TableBodyComponent, context)), __spread([paddingTopEl], items, [paddingBottomEl]));
109
107
  });
110
108
  var Viewport = function (_a) {
111
109
  var children = _a.children;
110
+ var ctx = React.useContext(VirtuosoMockContext);
112
111
  var viewportHeight = usePublisher('viewportHeight');
113
- var viewportRef = useSize(compose(viewportHeight, function (el) { return correctItemSize(el, 'height'); }));
112
+ var fixedItemHeight = usePublisher('fixedItemHeight');
113
+ var viewportRef = useSize(u.compose(viewportHeight, function (el) { return correctItemSize(el, 'height'); }));
114
+ React.useEffect(function () {
115
+ if (ctx) {
116
+ viewportHeight(ctx.viewportHeight);
117
+ fixedItemHeight(ctx.itemHeight);
118
+ }
119
+ }, [ctx, viewportHeight, fixedItemHeight]);
114
120
  return (React.createElement("div", { style: viewportStyle, ref: viewportRef, "data-viewport-type": "element" }, children));
115
121
  };
116
122
  var WindowViewport = function (_a) {
117
123
  var children = _a.children;
124
+ var ctx = React.useContext(VirtuosoMockContext);
118
125
  var windowViewportRect = usePublisher('windowViewportRect');
126
+ var fixedItemHeight = usePublisher('fixedItemHeight');
119
127
  var customScrollParent = useEmitterValue('customScrollParent');
120
128
  var viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
129
+ React.useEffect(function () {
130
+ if (ctx) {
131
+ fixedItemHeight(ctx.itemHeight);
132
+ windowViewportRect({ offsetTop: 0, visibleHeight: ctx.viewportHeight, visibleWidth: 100 });
133
+ }
134
+ }, [ctx, windowViewportRect, fixedItemHeight]);
121
135
  return (React.createElement("div", { ref: viewportRef, style: viewportStyle, "data-viewport-type": "window" }, children));
122
136
  };
123
137
  var TableRoot = React.memo(function TableVirtuosoRoot(props) {
124
138
  var useWindowScroll = useEmitterValue('useWindowScroll');
125
139
  var customScrollParent = useEmitterValue('customScrollParent');
126
140
  var fixedHeaderHeight = usePublisher('fixedHeaderHeight');
141
+ var fixedFooterHeight = usePublisher('fixedFooterHeight');
127
142
  var fixedHeaderContent = useEmitterValue('fixedHeaderContent');
143
+ var fixedFooterContent = useEmitterValue('fixedFooterContent');
128
144
  var context = useEmitterValue('context');
129
- var theadRef = useSize(compose(fixedHeaderHeight, function (el) { return correctItemSize(el, 'height'); }));
145
+ var theadRef = useSize(u.compose(fixedHeaderHeight, function (el) { return correctItemSize(el, 'height'); }));
146
+ var tfootRef = useSize(u.compose(fixedFooterHeight, function (el) { return correctItemSize(el, 'height'); }));
130
147
  var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
131
148
  var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
132
149
  var TheTable = useEmitterValue('TableComponent');
133
150
  var TheTHead = useEmitterValue('TableHeadComponent');
151
+ var TheTFoot = useEmitterValue('TableFooterComponent');
134
152
  var theHead = fixedHeaderContent
135
- ? React.createElement(TheTHead, __assign({ key: 'TableHead', style: { zIndex: 1, position: 'sticky', top: 0 }, ref: theadRef }, contextPropIfNotDomElement(TheTHead, context)), fixedHeaderContent())
153
+ ? React.createElement(TheTHead, __assign({ key: 'TableHead', style: { zIndex: 2, position: 'sticky', top: 0 }, ref: theadRef }, contextPropIfNotDomElement(TheTHead, context)), fixedHeaderContent())
154
+ : null;
155
+ var theFoot = fixedFooterContent
156
+ ? React.createElement(TheTFoot, __assign({ key: 'TableFoot', style: { zIndex: 1, position: 'sticky', bottom: 0 }, ref: tfootRef }, contextPropIfNotDomElement(TheTFoot, context)), fixedFooterContent())
136
157
  : null;
137
158
  return (React.createElement(TheScroller, __assign({}, props),
138
- React.createElement(TheViewport, null, React.createElement(TheTable, __assign({ style: { borderSpacing: 0 } }, contextPropIfNotDomElement(TheTable, context)), [theHead, React.createElement(Items, { key: "TableBody" })]))));
159
+ React.createElement(TheViewport, null, React.createElement(TheTable, __assign({ style: { borderSpacing: 0, overflowAnchor: 'none' } }, contextPropIfNotDomElement(TheTable, context)), [theHead, React.createElement(Items, { key: "TableBody" }), theFoot]))));
139
160
  });
140
- export var Table = (_a = systemToComponent(combinedSystem, {
161
+ var _a = systemToComponent(combinedSystem, {
141
162
  required: {},
142
163
  optional: {
164
+ restoreStateFrom: 'restoreStateFrom',
143
165
  context: 'context',
144
166
  followOutput: 'followOutput',
145
167
  firstItemIndex: 'firstItemIndex',
146
168
  itemContent: 'itemContent',
147
169
  fixedHeaderContent: 'fixedHeaderContent',
170
+ fixedFooterContent: 'fixedFooterContent',
148
171
  overscan: 'overscan',
149
172
  increaseViewportBy: 'increaseViewportBy',
150
173
  totalCount: 'totalCount',
@@ -153,6 +176,7 @@ export var Table = (_a = systemToComponent(combinedSystem, {
153
176
  components: 'components',
154
177
  groupCounts: 'groupCounts',
155
178
  atBottomThreshold: 'atBottomThreshold',
179
+ atTopThreshold: 'atTopThreshold',
156
180
  computeItemKey: 'computeItemKey',
157
181
  defaultItemHeight: 'defaultItemHeight',
158
182
  fixedItemHeight: 'fixedItemHeight',
@@ -166,13 +190,13 @@ export var Table = (_a = systemToComponent(combinedSystem, {
166
190
  customScrollParent: 'customScrollParent',
167
191
  scrollerRef: 'scrollerRef',
168
192
  logLevel: 'logLevel',
169
- react18ConcurrentRendering: 'react18ConcurrentRendering',
170
193
  },
171
194
  methods: {
172
195
  scrollToIndex: 'scrollToIndex',
173
196
  scrollIntoView: 'scrollIntoView',
174
197
  scrollTo: 'scrollTo',
175
198
  scrollBy: 'scrollBy',
199
+ getState: 'getState',
176
200
  },
177
201
  events: {
178
202
  isScrolling: 'isScrolling',
@@ -185,10 +209,7 @@ export var Table = (_a = systemToComponent(combinedSystem, {
185
209
  itemsRendered: 'itemsRendered',
186
210
  groupIndices: 'groupIndices',
187
211
  },
188
- }, TableRoot), _a.Component), usePublisher = _a.usePublisher, useEmitterValue = _a.useEmitterValue, useEmitter = _a.useEmitter;
189
- var Scroller = buildScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
190
- var WindowScroller = buildWindowScroller({
191
- usePublisher: usePublisher,
192
- useEmitterValue: useEmitterValue,
193
- useEmitter: useEmitter,
194
- });
212
+ }, TableRoot), Table = _a.Component, usePublisher = _a.usePublisher, useEmitterValue = _a.useEmitterValue, useEmitter = _a.useEmitter;
213
+ var Scroller = /*#__PURE__*/ buildScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
214
+ var WindowScroller = /*#__PURE__*/ buildWindowScroller({ usePublisher: usePublisher, useEmitterValue: useEmitterValue, useEmitter: useEmitter });
215
+ export var TableVirtuoso = Table;