@ringcentral/juno 2.4.2 → 2.5.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +74 -2
- package/components/Grid/Grid.d.ts +1 -1
- package/components/Pagination/Pagination/Pagination.d.ts +1 -1
- package/components/Stepper/StepButton/StepButton.d.ts +1 -1
- package/components/Stepper/StepLabel/StepLabel.d.ts +1 -1
- package/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/components/Table/types.d.ts +1 -1
- package/components/TablePagination/TablePagination.d.ts +1 -1
- package/components/VirtualizedMenu/VirtualizedMenu.js +11 -0
- package/components/VirtualizedMenu/VirtualizedMenuList.js +6 -2
- package/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/components/Virtuoso/react-virtuoso/Grid.d.ts +193 -106
- package/components/Virtuoso/react-virtuoso/Grid.js +19 -24
- package/components/Virtuoso/react-virtuoso/List.d.ts +2664 -596
- package/components/Virtuoso/react-virtuoso/List.js +83 -70
- package/components/Virtuoso/react-virtuoso/Table.d.ts +6253 -0
- package/components/Virtuoso/react-virtuoso/Table.js +184 -0
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +153 -37
- package/components/Virtuoso/react-virtuoso/components.d.ts +248 -41
- package/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +2 -4
- package/components/Virtuoso/react-virtuoso/domIOSystem.js +12 -10
- package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +146 -27
- package/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +67 -52
- package/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +17 -3
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +32 -7
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/components/Virtuoso/react-virtuoso/hooks/useSize.d.ts +2 -2
- package/components/Virtuoso/react-virtuoso/hooks/useSize.js +26 -28
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.d.ts +1 -1
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/components/Virtuoso/react-virtuoso/index.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/index.js +2 -0
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +165 -35
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +160 -38
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +54 -12
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +26 -10
- package/components/Virtuoso/react-virtuoso/interfaces.d.ts +134 -28
- package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +141 -32
- package/components/Virtuoso/react-virtuoso/listStateSystem.js +1 -2
- package/components/Virtuoso/react-virtuoso/listSystem.d.ts +2123 -407
- package/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/components/Virtuoso/react-virtuoso/loggerSystem.d.ts +17 -0
- package/components/Virtuoso/react-virtuoso/loggerSystem.js +37 -0
- package/components/Virtuoso/react-virtuoso/propsReadySystem.d.ts +8 -1
- package/components/Virtuoso/react-virtuoso/propsReadySystem.js +8 -2
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +641 -0
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +42 -0
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +52 -67
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +26 -5
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +11 -4
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +44 -15
- package/components/Virtuoso/react-virtuoso/sizeSystem.d.ts +12 -2
- package/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +17 -5
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +145 -33
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +149 -35
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +183 -42
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +37 -26
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +6 -0
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +7 -4
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/es6/components/Table/TableCell/TableCell.js +2 -2
- package/es6/components/Table/TableCell/styles/TableCellStyle.js +3 -1
- package/es6/components/VirtualizedMenu/VirtualizedMenu.js +13 -2
- package/es6/components/VirtualizedMenu/VirtualizedMenuList.js +6 -2
- package/es6/components/Virtuoso/react-virtuoso/AATree.js +15 -15
- package/es6/components/Virtuoso/react-virtuoso/Grid.js +20 -25
- package/es6/components/Virtuoso/react-virtuoso/List.js +84 -72
- package/es6/components/Virtuoso/react-virtuoso/Table.js +182 -0
- package/es6/components/Virtuoso/react-virtuoso/components.js +2 -0
- package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +13 -10
- package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +28 -15
- package/es6/components/Virtuoso/react-virtuoso/gridSystem.js +17 -15
- package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +31 -6
- package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +40 -26
- package/es6/components/Virtuoso/react-virtuoso/hooks/useSize.js +27 -29
- package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +32 -12
- package/es6/components/Virtuoso/react-virtuoso/index.js +1 -0
- package/es6/components/Virtuoso/react-virtuoso/initialItemCountSystem.js +1 -8
- package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +25 -10
- package/es6/components/Virtuoso/react-virtuoso/listStateSystem.js +2 -3
- package/es6/components/Virtuoso/react-virtuoso/listSystem.js +10 -7
- package/es6/components/Virtuoso/react-virtuoso/loggerSystem.js +34 -0
- package/es6/components/Virtuoso/react-virtuoso/propsReadySystem.js +9 -2
- package/es6/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.js +40 -0
- package/es6/components/Virtuoso/react-virtuoso/scrollSeekSystem.js +11 -25
- package/es6/components/Virtuoso/react-virtuoso/scrollToIndexSystem.js +37 -13
- package/es6/components/Virtuoso/react-virtuoso/sizeRangeSystem.js +39 -11
- package/es6/components/Virtuoso/react-virtuoso/sizeSystem.js +109 -52
- package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +87 -18
- package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +39 -28
- package/es6/components/Virtuoso/react-virtuoso/utils/correctItemSize.js +3 -0
- package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +9 -7
- package/package.json +2 -2
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
3
|
import * as u from '@virtuoso.dev/urx';
|
|
3
4
|
import { domIOSystem } from './domIOSystem';
|
|
5
|
+
export var UP = 'up';
|
|
6
|
+
export var DOWN = 'down';
|
|
7
|
+
export var NONE = 'none';
|
|
4
8
|
var INITIAL_BOTTOM_STATE = {
|
|
5
9
|
atBottom: false,
|
|
6
10
|
notAtBottomBecause: 'NOT_SHOWING_LAST_ITEM',
|
|
@@ -8,42 +12,54 @@ var INITIAL_BOTTOM_STATE = {
|
|
|
8
12
|
offsetBottom: 0,
|
|
9
13
|
scrollTop: 0,
|
|
10
14
|
viewportHeight: 0,
|
|
11
|
-
|
|
15
|
+
scrollHeight: 0,
|
|
12
16
|
},
|
|
13
17
|
};
|
|
14
18
|
export var stateFlagsSystem = u.system(function (_a) {
|
|
15
|
-
var _b = __read(_a, 1), _c = _b[0], scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight;
|
|
19
|
+
var _b = __read(_a, 1), _c = _b[0], scrollContainerState = _c.scrollContainerState, scrollTop = _c.scrollTop, viewportHeight = _c.viewportHeight, headerHeight = _c.headerHeight, footerHeight = _c.footerHeight, scrollBy = _c.scrollBy;
|
|
16
20
|
var isAtBottom = u.statefulStream(false);
|
|
17
21
|
var isAtTop = u.statefulStream(true);
|
|
18
22
|
var atBottomStateChange = u.stream();
|
|
19
23
|
var atTopStateChange = u.stream();
|
|
20
|
-
var
|
|
24
|
+
var atBottomThreshold = u.statefulStream(4);
|
|
21
25
|
// skip 1 to avoid an initial on/off flick
|
|
22
26
|
var isScrolling = u.streamFromEmitter(u.pipe(u.merge(u.pipe(u.duc(scrollTop), u.skip(1), u.mapTo(true)), u.pipe(u.duc(scrollTop), u.skip(1), u.mapTo(false), u.debounceTime(100))), u.distinctUntilChanged()));
|
|
27
|
+
var isScrollingBy = u.statefulStreamFromEmitter(u.pipe(u.merge(u.pipe(scrollBy, u.mapTo(true)), u.pipe(scrollBy, u.mapTo(false), u.debounceTime(200))), u.distinctUntilChanged()), false);
|
|
28
|
+
// u.subscribe(isScrollingBy, (isScrollingBy) => console.log({ isScrollingBy }))
|
|
23
29
|
u.connect(u.pipe(u.duc(scrollTop), u.map(function (top) { return top === 0; }), u.distinctUntilChanged()), isAtTop);
|
|
24
30
|
u.connect(isAtTop, atTopStateChange);
|
|
25
|
-
var atBottomState = u.streamFromEmitter(u.pipe(u.combineLatest(
|
|
26
|
-
var _b = __read(_a,
|
|
27
|
-
var isAtBottom =
|
|
31
|
+
var atBottomState = u.streamFromEmitter(u.pipe(u.combineLatest(scrollContainerState, u.duc(viewportHeight), u.duc(headerHeight), u.duc(footerHeight), u.duc(atBottomThreshold)), u.scan(function (current, _a) {
|
|
32
|
+
var _b = __read(_a, 5), _c = __read(_b[0], 2), scrollTop = _c[0], scrollHeight = _c[1], viewportHeight = _b[1], _headerHeight = _b[2], _footerHeight = _b[3], atBottomThreshold = _b[4];
|
|
33
|
+
var isAtBottom = scrollTop + viewportHeight - scrollHeight > -atBottomThreshold;
|
|
28
34
|
var state = {
|
|
29
35
|
viewportHeight: viewportHeight,
|
|
30
36
|
scrollTop: scrollTop,
|
|
31
|
-
|
|
32
|
-
totalHeight: bottom + offsetBottom,
|
|
37
|
+
scrollHeight: scrollHeight,
|
|
33
38
|
};
|
|
34
39
|
if (isAtBottom) {
|
|
40
|
+
var atBottomBecause = void 0;
|
|
41
|
+
var scrollTopDelta = void 0;
|
|
42
|
+
if (scrollTop > current.state.scrollTop) {
|
|
43
|
+
atBottomBecause = 'SCROLLED_DOWN';
|
|
44
|
+
scrollTopDelta = current.state.scrollTop - scrollTop;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
atBottomBecause = 'SIZE_DECREASED';
|
|
48
|
+
scrollTopDelta =
|
|
49
|
+
current.state.scrollTop - scrollTop ||
|
|
50
|
+
current.scrollTopDelta;
|
|
51
|
+
}
|
|
35
52
|
return {
|
|
36
53
|
atBottom: true,
|
|
37
54
|
state: state,
|
|
55
|
+
atBottomBecause: atBottomBecause,
|
|
56
|
+
scrollTopDelta: scrollTopDelta,
|
|
38
57
|
};
|
|
39
58
|
}
|
|
40
59
|
var notAtBottomBecause;
|
|
41
|
-
if (state.
|
|
60
|
+
if (state.scrollHeight > current.state.scrollHeight) {
|
|
42
61
|
notAtBottomBecause = 'SIZE_INCREASED';
|
|
43
62
|
}
|
|
44
|
-
else if (offsetBottom !== 0) {
|
|
45
|
-
notAtBottomBecause = 'NOT_SHOWING_LAST_ITEM';
|
|
46
|
-
}
|
|
47
63
|
else if (viewportHeight < current.state.viewportHeight) {
|
|
48
64
|
notAtBottomBecause = 'VIEWPORT_HEIGHT_DECREASING';
|
|
49
65
|
}
|
|
@@ -59,14 +75,64 @@ export var stateFlagsSystem = u.system(function (_a) {
|
|
|
59
75
|
state: state,
|
|
60
76
|
};
|
|
61
77
|
}, INITIAL_BOTTOM_STATE), u.distinctUntilChanged(function (prev, next) {
|
|
62
|
-
// prev && console.log(prev.atBottom, next.atBottom)
|
|
63
78
|
return prev && prev.atBottom === next.atBottom;
|
|
64
79
|
})));
|
|
80
|
+
var lastJumpDueToItemResize = u.statefulStreamFromEmitter(u.pipe(scrollContainerState, u.scan(function (current, _a) {
|
|
81
|
+
var _b = __read(_a, 2), scrollTop = _b[0], scrollHeight = _b[1];
|
|
82
|
+
if (current.scrollHeight !== scrollHeight) {
|
|
83
|
+
if (current.scrollTop !== scrollTop) {
|
|
84
|
+
return {
|
|
85
|
+
scrollHeight: scrollHeight,
|
|
86
|
+
scrollTop: scrollTop,
|
|
87
|
+
jump: current.scrollTop - scrollTop,
|
|
88
|
+
changed: true,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
scrollHeight: scrollHeight,
|
|
93
|
+
scrollTop: scrollTop,
|
|
94
|
+
jump: 0,
|
|
95
|
+
changed: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
scrollTop: scrollTop,
|
|
100
|
+
scrollHeight: scrollHeight,
|
|
101
|
+
jump: 0,
|
|
102
|
+
changed: false,
|
|
103
|
+
};
|
|
104
|
+
}, { scrollHeight: 0, jump: 0, scrollTop: 0, changed: false }), u.filter(function (value) { return value.changed; }), u.map(function (value) { return value.jump; })), 0);
|
|
65
105
|
u.connect(u.pipe(atBottomState, u.map(function (state) { return state.atBottom; })), isAtBottom);
|
|
66
|
-
u.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
106
|
+
u.connect(u.pipe(isAtBottom, u.throttleTime(50)), atBottomStateChange);
|
|
107
|
+
var scrollDirection = u.statefulStream(DOWN);
|
|
108
|
+
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
109
|
+
var _b = __read(_a, 1), scrollTop = _b[0];
|
|
110
|
+
return scrollTop;
|
|
111
|
+
}), u.distinctUntilChanged(), u.scan(function (acc, scrollTop) {
|
|
112
|
+
// if things change while compensating for items, ignore,
|
|
113
|
+
// but store the new scrollTop
|
|
114
|
+
if (u.getValue(isScrollingBy)) {
|
|
115
|
+
return { direction: acc.direction, prevScrollTop: scrollTop };
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
direction: scrollTop < acc.prevScrollTop ? UP : DOWN,
|
|
119
|
+
prevScrollTop: scrollTop,
|
|
120
|
+
};
|
|
121
|
+
}, { direction: DOWN, prevScrollTop: 0 }), u.map(function (value) { return value.direction; })), scrollDirection);
|
|
122
|
+
u.connect(u.pipe(scrollContainerState, u.throttleTime(50), u.mapTo(NONE)), scrollDirection);
|
|
123
|
+
var scrollVelocity = u.statefulStream(0);
|
|
124
|
+
u.connect(u.pipe(isScrolling, u.filter(function (value) { return !value; }), u.mapTo(0)), scrollVelocity);
|
|
125
|
+
u.connect(u.pipe(scrollTop, u.throttleTime(100), u.withLatestFrom(isScrolling), u.filter(function (_a) {
|
|
126
|
+
var _b = __read(_a, 2), _ = _b[0], isScrolling = _b[1];
|
|
127
|
+
return !!isScrolling;
|
|
128
|
+
}), u.scan(function (_a, _b) {
|
|
129
|
+
var _c = __read(_a, 2), _ = _c[0], prev = _c[1];
|
|
130
|
+
var _d = __read(_b, 1), next = _d[0];
|
|
131
|
+
return [prev, next];
|
|
132
|
+
}, [0, 0]), u.map(function (_a) {
|
|
133
|
+
var _b = __read(_a, 2), prev = _b[0], next = _b[1];
|
|
134
|
+
return next - prev;
|
|
135
|
+
})), scrollVelocity);
|
|
70
136
|
return {
|
|
71
137
|
isScrolling: isScrolling,
|
|
72
138
|
isAtTop: isAtTop,
|
|
@@ -74,6 +140,9 @@ export var stateFlagsSystem = u.system(function (_a) {
|
|
|
74
140
|
atBottomState: atBottomState,
|
|
75
141
|
atTopStateChange: atTopStateChange,
|
|
76
142
|
atBottomStateChange: atBottomStateChange,
|
|
77
|
-
|
|
143
|
+
scrollDirection: scrollDirection,
|
|
144
|
+
atBottomThreshold: atBottomThreshold,
|
|
145
|
+
scrollVelocity: scrollVelocity,
|
|
146
|
+
lastJumpDueToItemResize: lastJumpDueToItemResize,
|
|
78
147
|
};
|
|
79
148
|
}, u.tup(domIOSystem));
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
2
|
/* eslint-disable no-continue */
|
|
3
3
|
import * as u from '@virtuoso.dev/urx';
|
|
4
|
-
import { domIOSystem
|
|
4
|
+
import { domIOSystem } from './domIOSystem';
|
|
5
5
|
import { listStateSystem } from './listStateSystem';
|
|
6
|
+
import { loggerSystem, LogLevel } from './loggerSystem';
|
|
6
7
|
import { sizeSystem } from './sizeSystem';
|
|
7
|
-
import { stateFlagsSystem } from './stateFlagsSystem';
|
|
8
|
+
import { stateFlagsSystem, UP } from './stateFlagsSystem';
|
|
8
9
|
/**
|
|
9
10
|
* Fixes upward scrolling by calculating and compensation from changed item heights, using scrollBy.
|
|
10
11
|
*/
|
|
11
12
|
export var upwardScrollFixSystem = u.system(function (_a) {
|
|
12
|
-
var _b = __read(_a,
|
|
13
|
-
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _c = __read(_a, 2), prevItems = _c[1];
|
|
21
|
-
var items = _b.items;
|
|
13
|
+
var _b = __read(_a, 5), _c = _b[0], scrollBy = _c.scrollBy, scrollTop = _c.scrollTop, deviation = _c.deviation, scrollingInProgress = _c.scrollingInProgress, _d = _b[1], isScrolling = _d.isScrolling, isAtBottom = _d.isAtBottom, atBottomState = _d.atBottomState, scrollDirection = _d.scrollDirection, lastJumpDueToItemResize = _d.lastJumpDueToItemResize, listState = _b[2].listState, _e = _b[3], beforeUnshiftWith = _e.beforeUnshiftWith, shiftWithOffset = _e.shiftWithOffset, sizes = _e.sizes, log = _b[4].log;
|
|
14
|
+
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(lastJumpDueToItemResize), u.scan(function (_a,
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
_b) {
|
|
17
|
+
var _c = __read(_a, 3), prevItems = _c[1], prevTotalCount = _c[2];
|
|
18
|
+
var
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
_d = __read(_b, 2), _e = _d[0], items = _e.items, totalCount = _e.totalCount, lastJumpDueToItemResize = _d[1];
|
|
22
21
|
var newDev = 0;
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
newDev = items[0].size - prevItems[0].size;
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
22
|
+
if (prevTotalCount === totalCount) {
|
|
23
|
+
if (prevItems.length > 0 && items.length > 0) {
|
|
24
|
+
var firstItemIndex = items[0].originalIndex;
|
|
25
|
+
var prevFirstItemIndex = prevItems[0].originalIndex;
|
|
26
|
+
var atStart = firstItemIndex === 0 && prevFirstItemIndex === 0;
|
|
27
|
+
var onlyItem = items.length === 1;
|
|
28
|
+
if (!atStart) {
|
|
33
29
|
var _loop_1 = function (index) {
|
|
34
30
|
var item = items[index];
|
|
35
31
|
var prevItem = prevItems.find(function (pItem) { return pItem.originalIndex === item.originalIndex; });
|
|
36
32
|
if (!prevItem) {
|
|
37
33
|
return "continue";
|
|
38
34
|
}
|
|
39
|
-
if (item.offset !== prevItem.offset) {
|
|
40
|
-
newDev =
|
|
35
|
+
if (item.offset !== prevItem.offset || onlyItem) {
|
|
36
|
+
newDev =
|
|
37
|
+
item.offset -
|
|
38
|
+
prevItem.offset +
|
|
39
|
+
item.size -
|
|
40
|
+
prevItem.size;
|
|
41
41
|
return "break";
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -48,13 +48,21 @@ export var upwardScrollFixSystem = u.system(function (_a) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
if (newDev !== 0) {
|
|
52
|
+
newDev += lastJumpDueToItemResize;
|
|
53
|
+
}
|
|
51
54
|
}
|
|
52
|
-
return [newDev, items];
|
|
53
|
-
}, [0, []]), u.filter(function (_a) {
|
|
55
|
+
return [newDev, items, totalCount];
|
|
56
|
+
}, [0, [], 0]), u.filter(function (_a) {
|
|
54
57
|
var _b = __read(_a, 1), amount = _b[0];
|
|
55
58
|
return amount !== 0;
|
|
59
|
+
}), u.withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, log, isAtBottom, atBottomState), u.filter(function (_a) {
|
|
60
|
+
var _b = __read(_a, 4), scrollTop = _b[1], scrollDirection = _b[2], scrollingInProgress = _b[3];
|
|
61
|
+
// console.log({ amount, scrollTop, scrollDirection, scrollingInProgress, isAtBottom, atBottomState })
|
|
62
|
+
return (!scrollingInProgress && scrollTop !== 0 && scrollDirection === UP); // && (isAtBottom ? amount > 0 : true)
|
|
56
63
|
}), u.map(function (_a) {
|
|
57
|
-
var _b = __read(_a, 1), amount =
|
|
64
|
+
var _b = __read(_a, 5), _c = __read(_b[0], 1), amount = _c[0], log = _b[4];
|
|
65
|
+
log('Upward scrolling compensation', { amount: amount }, LogLevel.DEBUG);
|
|
58
66
|
return amount;
|
|
59
67
|
})));
|
|
60
68
|
u.connect(u.pipe(deviationOffset, u.withLatestFrom(deviation), u.map(function (_a) {
|
|
@@ -79,9 +87,12 @@ export var upwardScrollFixSystem = u.system(function (_a) {
|
|
|
79
87
|
u.publish(scrollBy, { top: -offset, behavior: 'auto' });
|
|
80
88
|
}
|
|
81
89
|
});
|
|
90
|
+
u.connect(u.pipe(shiftWithOffset, u.map(function (offset) {
|
|
91
|
+
return { top: -offset };
|
|
92
|
+
})), scrollBy);
|
|
82
93
|
u.connect(u.pipe(beforeUnshiftWith, u.withLatestFrom(sizes), u.map(function (_a) {
|
|
83
94
|
var _b = __read(_a, 2), offset = _b[0], lastSize = _b[1].lastSize;
|
|
84
95
|
return offset * lastSize;
|
|
85
96
|
})), deviationOffset);
|
|
86
97
|
return { deviation: deviation };
|
|
87
|
-
}, u.tup(domIOSystem, stateFlagsSystem, listStateSystem, sizeSystem));
|
|
98
|
+
}, u.tup(domIOSystem, stateFlagsSystem, listStateSystem, sizeSystem, loggerSystem));
|
|
@@ -2,15 +2,16 @@ import { __assign, __read } from "tslib";
|
|
|
2
2
|
import * as u from '@virtuoso.dev/urx';
|
|
3
3
|
import { domIOSystem } from './domIOSystem';
|
|
4
4
|
export var windowScrollerSystem = u.system(function (_a) {
|
|
5
|
-
var _b = __read(_a, 1), _c = _b[0],
|
|
5
|
+
var _b = __read(_a, 1), _c = _b[0], scrollTo = _c.scrollTo, scrollContainerState = _c.scrollContainerState;
|
|
6
|
+
var windowScrollContainerState = u.stream();
|
|
6
7
|
var windowViewportRect = u.stream();
|
|
7
|
-
var windowScrollTop = u.stream();
|
|
8
8
|
var windowScrollTo = u.stream();
|
|
9
9
|
var useWindowScroll = u.statefulStream(false);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var customScrollParent = u.statefulStream(undefined);
|
|
11
|
+
u.connect(u.pipe(u.combineLatest(windowScrollContainerState, windowViewportRect), u.map(function (_a) {
|
|
12
|
+
var _b = __read(_a, 2), _c = __read(_b[0], 2), windowScrollTop = _c[0], scrollHeight = _c[1], offsetTop = _b[1].offsetTop;
|
|
13
|
+
return [Math.max(0, windowScrollTop - offsetTop), scrollHeight];
|
|
14
|
+
})), scrollContainerState);
|
|
14
15
|
u.connect(u.pipe(scrollTo, u.withLatestFrom(windowViewportRect), u.map(function (_a) {
|
|
15
16
|
var _b = __read(_a, 2), scrollTo = _b[0], offsetTop = _b[1].offsetTop;
|
|
16
17
|
return __assign(__assign({}, scrollTo), { top: scrollTo.top + offsetTop });
|
|
@@ -18,8 +19,9 @@ export var windowScrollerSystem = u.system(function (_a) {
|
|
|
18
19
|
return {
|
|
19
20
|
// config
|
|
20
21
|
useWindowScroll: useWindowScroll,
|
|
22
|
+
customScrollParent: customScrollParent,
|
|
21
23
|
// input
|
|
22
|
-
|
|
24
|
+
windowScrollContainerState: windowScrollContainerState,
|
|
23
25
|
windowViewportRect: windowViewportRect,
|
|
24
26
|
// signals
|
|
25
27
|
windowScrollTo: windowScrollTo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ringcentral/juno",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0-beta.0",
|
|
4
4
|
"author": "RingCentral",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"focus-visible": "^5.1.0",
|
|
28
28
|
"lodash": "^4.17.21",
|
|
29
29
|
"react-beautiful-dnd": "^13.0.0",
|
|
30
|
-
"react-virtuoso": "^
|
|
30
|
+
"react-virtuoso": "^2.8.3",
|
|
31
31
|
"resize-observer-polyfill": "^1.5.1",
|
|
32
32
|
"typeface-lato": "^0.0.75",
|
|
33
33
|
"tslib": ">=2.0.0"
|