@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
|
@@ -5,41 +5,41 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
|
|
6
6
|
var domIOSystem_1 = require("./domIOSystem");
|
|
7
7
|
var listStateSystem_1 = require("./listStateSystem");
|
|
8
|
+
var loggerSystem_1 = require("./loggerSystem");
|
|
8
9
|
var sizeSystem_1 = require("./sizeSystem");
|
|
9
10
|
var stateFlagsSystem_1 = require("./stateFlagsSystem");
|
|
10
11
|
/**
|
|
11
12
|
* Fixes upward scrolling by calculating and compensation from changed item heights, using scrollBy.
|
|
12
13
|
*/
|
|
13
14
|
exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
14
|
-
var _b = tslib_1.__read(_a,
|
|
15
|
-
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _c = tslib_1.__read(_a, 2), prevItems = _c[1];
|
|
23
|
-
var items = _b.items;
|
|
15
|
+
var _b = tslib_1.__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;
|
|
16
|
+
var deviationOffset = u.streamFromEmitter(u.pipe(listState, u.withLatestFrom(lastJumpDueToItemResize), u.scan(function (_a,
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
_b) {
|
|
19
|
+
var _c = tslib_1.__read(_a, 3), prevItems = _c[1], prevTotalCount = _c[2];
|
|
20
|
+
var
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
_d = tslib_1.__read(_b, 2), _e = _d[0], items = _e.items, totalCount = _e.totalCount, lastJumpDueToItemResize = _d[1];
|
|
24
23
|
var newDev = 0;
|
|
25
|
-
if (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
newDev = items[0].size - prevItems[0].size;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
24
|
+
if (prevTotalCount === totalCount) {
|
|
25
|
+
if (prevItems.length > 0 && items.length > 0) {
|
|
26
|
+
var firstItemIndex = items[0].originalIndex;
|
|
27
|
+
var prevFirstItemIndex = prevItems[0].originalIndex;
|
|
28
|
+
var atStart = firstItemIndex === 0 && prevFirstItemIndex === 0;
|
|
29
|
+
var onlyItem = items.length === 1;
|
|
30
|
+
if (!atStart) {
|
|
35
31
|
var _loop_1 = function (index) {
|
|
36
32
|
var item = items[index];
|
|
37
33
|
var prevItem = prevItems.find(function (pItem) { return pItem.originalIndex === item.originalIndex; });
|
|
38
34
|
if (!prevItem) {
|
|
39
35
|
return "continue";
|
|
40
36
|
}
|
|
41
|
-
if (item.offset !== prevItem.offset) {
|
|
42
|
-
newDev =
|
|
37
|
+
if (item.offset !== prevItem.offset || onlyItem) {
|
|
38
|
+
newDev =
|
|
39
|
+
item.offset -
|
|
40
|
+
prevItem.offset +
|
|
41
|
+
item.size -
|
|
42
|
+
prevItem.size;
|
|
43
43
|
return "break";
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -50,13 +50,21 @@ exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
+
if (newDev !== 0) {
|
|
54
|
+
newDev += lastJumpDueToItemResize;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
|
-
return [newDev, items];
|
|
55
|
-
}, [0, []]), u.filter(function (_a) {
|
|
57
|
+
return [newDev, items, totalCount];
|
|
58
|
+
}, [0, [], 0]), u.filter(function (_a) {
|
|
56
59
|
var _b = tslib_1.__read(_a, 1), amount = _b[0];
|
|
57
60
|
return amount !== 0;
|
|
61
|
+
}), u.withLatestFrom(scrollTop, scrollDirection, scrollingInProgress, log, isAtBottom, atBottomState), u.filter(function (_a) {
|
|
62
|
+
var _b = tslib_1.__read(_a, 4), scrollTop = _b[1], scrollDirection = _b[2], scrollingInProgress = _b[3];
|
|
63
|
+
// console.log({ amount, scrollTop, scrollDirection, scrollingInProgress, isAtBottom, atBottomState })
|
|
64
|
+
return (!scrollingInProgress && scrollTop !== 0 && scrollDirection === stateFlagsSystem_1.UP); // && (isAtBottom ? amount > 0 : true)
|
|
58
65
|
}), u.map(function (_a) {
|
|
59
|
-
var _b = tslib_1.__read(_a, 1), amount =
|
|
66
|
+
var _b = tslib_1.__read(_a, 5), _c = tslib_1.__read(_b[0], 1), amount = _c[0], log = _b[4];
|
|
67
|
+
log('Upward scrolling compensation', { amount: amount }, loggerSystem_1.LogLevel.DEBUG);
|
|
60
68
|
return amount;
|
|
61
69
|
})));
|
|
62
70
|
u.connect(u.pipe(deviationOffset, u.withLatestFrom(deviation), u.map(function (_a) {
|
|
@@ -81,9 +89,12 @@ exports.upwardScrollFixSystem = u.system(function (_a) {
|
|
|
81
89
|
u.publish(scrollBy, { top: -offset, behavior: 'auto' });
|
|
82
90
|
}
|
|
83
91
|
});
|
|
92
|
+
u.connect(u.pipe(shiftWithOffset, u.map(function (offset) {
|
|
93
|
+
return { top: -offset };
|
|
94
|
+
})), scrollBy);
|
|
84
95
|
u.connect(u.pipe(beforeUnshiftWith, u.withLatestFrom(sizes), u.map(function (_a) {
|
|
85
96
|
var _b = tslib_1.__read(_a, 2), offset = _b[0], lastSize = _b[1].lastSize;
|
|
86
97
|
return offset * lastSize;
|
|
87
98
|
})), deviationOffset);
|
|
88
99
|
return { deviation: deviation };
|
|
89
|
-
}, u.tup(domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem, listStateSystem_1.listStateSystem, sizeSystem_1.sizeSystem));
|
|
100
|
+
}, u.tup(domIOSystem_1.domIOSystem, stateFlagsSystem_1.stateFlagsSystem, listStateSystem_1.listStateSystem, sizeSystem_1.sizeSystem, loggerSystem_1.loggerSystem));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function correctItemSize(el: HTMLElement, dimension: 'height' | 'width'): number;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import * as u from '@virtuoso.dev/urx';
|
|
2
2
|
import { WindowViewportInfo } from './interfaces';
|
|
3
3
|
export declare const windowScrollerSystem: u.SystemSpec<[u.SystemSpec<never[], () => {
|
|
4
|
+
scrollContainerState: u.Stream<[number, number]>;
|
|
4
5
|
scrollTop: u.Stream<number>;
|
|
5
6
|
viewportHeight: u.Stream<number>;
|
|
6
7
|
headerHeight: u.StatefulStream<number>;
|
|
7
8
|
footerHeight: u.StatefulStream<number>;
|
|
9
|
+
scrollHeight: u.Stream<number>;
|
|
8
10
|
smoothScrollTargetReached: u.Stream<true>;
|
|
9
11
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
10
12
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
11
|
-
scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
|
|
12
13
|
statefulScrollTop: u.StatefulStream<number>;
|
|
13
14
|
deviation: u.StatefulStream<number>;
|
|
14
15
|
scrollingInProgress: u.StatefulStream<boolean>;
|
|
15
|
-
}>], ([{
|
|
16
|
+
}>], ([{ scrollTo, scrollContainerState }]: [{
|
|
17
|
+
scrollContainerState: u.Stream<[number, number]>;
|
|
16
18
|
scrollTop: u.Stream<number>;
|
|
17
19
|
viewportHeight: u.Stream<number>;
|
|
18
20
|
headerHeight: u.StatefulStream<number>;
|
|
19
21
|
footerHeight: u.StatefulStream<number>;
|
|
22
|
+
scrollHeight: u.Stream<number>;
|
|
20
23
|
smoothScrollTargetReached: u.Stream<true>;
|
|
21
24
|
scrollTo: u.Stream<ScrollToOptions>;
|
|
22
25
|
scrollBy: u.Stream<ScrollToOptions>;
|
|
23
|
-
scrollDirection: u.StatefulStream<import("./domIOSystem").ScrollDirection>;
|
|
24
26
|
statefulScrollTop: u.StatefulStream<number>;
|
|
25
27
|
deviation: u.StatefulStream<number>;
|
|
26
28
|
scrollingInProgress: u.StatefulStream<boolean>;
|
|
27
29
|
}]) => {
|
|
28
30
|
useWindowScroll: u.StatefulStream<boolean>;
|
|
29
|
-
|
|
31
|
+
customScrollParent: u.StatefulStream<HTMLElement | undefined>;
|
|
32
|
+
windowScrollContainerState: u.Stream<[number, number]>;
|
|
30
33
|
windowViewportRect: u.Stream<WindowViewportInfo>;
|
|
31
34
|
windowScrollTo: u.Stream<ScrollToOptions>;
|
|
32
35
|
}>;
|
|
@@ -4,15 +4,16 @@ var tslib_1 = require("tslib");
|
|
|
4
4
|
var u = tslib_1.__importStar(require("@virtuoso.dev/urx"));
|
|
5
5
|
var domIOSystem_1 = require("./domIOSystem");
|
|
6
6
|
exports.windowScrollerSystem = u.system(function (_a) {
|
|
7
|
-
var _b = tslib_1.__read(_a, 1), _c = _b[0],
|
|
7
|
+
var _b = tslib_1.__read(_a, 1), _c = _b[0], scrollTo = _c.scrollTo, scrollContainerState = _c.scrollContainerState;
|
|
8
|
+
var windowScrollContainerState = u.stream();
|
|
8
9
|
var windowViewportRect = u.stream();
|
|
9
|
-
var windowScrollTop = u.stream();
|
|
10
10
|
var windowScrollTo = u.stream();
|
|
11
11
|
var useWindowScroll = u.statefulStream(false);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
var customScrollParent = u.statefulStream(undefined);
|
|
13
|
+
u.connect(u.pipe(u.combineLatest(windowScrollContainerState, windowViewportRect), u.map(function (_a) {
|
|
14
|
+
var _b = tslib_1.__read(_a, 2), _c = tslib_1.__read(_b[0], 2), windowScrollTop = _c[0], scrollHeight = _c[1], offsetTop = _b[1].offsetTop;
|
|
15
|
+
return [Math.max(0, windowScrollTop - offsetTop), scrollHeight];
|
|
16
|
+
})), scrollContainerState);
|
|
16
17
|
u.connect(u.pipe(scrollTo, u.withLatestFrom(windowViewportRect), u.map(function (_a) {
|
|
17
18
|
var _b = tslib_1.__read(_a, 2), scrollTo = _b[0], offsetTop = _b[1].offsetTop;
|
|
18
19
|
return tslib_1.__assign(tslib_1.__assign({}, scrollTo), { top: scrollTo.top + offsetTop });
|
|
@@ -20,8 +21,9 @@ exports.windowScrollerSystem = u.system(function (_a) {
|
|
|
20
21
|
return {
|
|
21
22
|
// config
|
|
22
23
|
useWindowScroll: useWindowScroll,
|
|
24
|
+
customScrollParent: customScrollParent,
|
|
23
25
|
// input
|
|
24
|
-
|
|
26
|
+
windowScrollContainerState: windowScrollContainerState,
|
|
25
27
|
windowViewportRect: windowViewportRect,
|
|
26
28
|
// signals
|
|
27
29
|
windowScrollTo: windowScrollTo,
|
|
@@ -6,7 +6,7 @@ import { TableCellStyle } from './styles';
|
|
|
6
6
|
import { RcTableCellClasses } from './utils';
|
|
7
7
|
import { RcButtonBase } from '../../Buttons';
|
|
8
8
|
import { RcIcon } from '../../Icon';
|
|
9
|
-
import { JumpToLatest as
|
|
9
|
+
import { JumpToLatest as DescSortIcon, JumpToUnread as AscSortIcon, } from '@ringcentral/juno-icon';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import { RcTableContext } from '../context';
|
|
12
12
|
var _RcTableCell = forwardRef(function (props, ref) {
|
|
@@ -21,7 +21,7 @@ var _RcTableCell = forwardRef(function (props, ref) {
|
|
|
21
21
|
_a[classes.activeSort] = activeSort,
|
|
22
22
|
_a)) },
|
|
23
23
|
childrenProp,
|
|
24
|
-
React.createElement(RcIcon, { size: "small", className: classes.sortIcon, symbol: sortDirection === 'asc' ?
|
|
24
|
+
React.createElement(RcIcon, { size: "small", className: classes.sortIcon, symbol: sortDirection === 'asc' ? AscSortIcon : DescSortIcon })));
|
|
25
25
|
}
|
|
26
26
|
return childrenProp;
|
|
27
27
|
}, [activeSort, childrenProp, classes, sortDirection]);
|
|
@@ -2,12 +2,14 @@ import { __makeTemplateObject } from "tslib";
|
|
|
2
2
|
import { css, fakeBorder, focusVisible, palette2, px, spacing, typography, } from '../../../../foundation';
|
|
3
3
|
import { RcTableCellClasses } from '../utils';
|
|
4
4
|
var SizeMap = {
|
|
5
|
+
xlarge: 64,
|
|
5
6
|
large: 56,
|
|
6
7
|
medium: 48,
|
|
7
8
|
small: 40,
|
|
8
9
|
};
|
|
10
|
+
var HeadTypography = typography('caption2');
|
|
9
11
|
export var TableCellStyle = function (prop) {
|
|
10
12
|
var size = prop.size, sortDirection = prop.sortDirection;
|
|
11
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "], ["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "])), spacing(0, 2), RcTableCellClasses.paddingCheckbox, spacing(0, 0, 0, 2), RcTableCellClasses.paddingNone, RcTableCellClasses.head,
|
|
13
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n ", "\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "], ["\n box-sizing: border-box;\n padding: ", ";\n min-width: 96px;\n\n &.", " {\n min-width: unset;\n padding: ", ";\n }\n\n &.", " {\n padding: unset;\n }\n\n &.", " {\n ", "\n height: 40px;\n border-bottom: 1px solid ", ";\n color: ", ";\n background-color: ", ";\n\n padding: ", ";\n\n .", " {\n opacity: 0;\n padding: ", ";\n }\n\n .", " {\n color: ", ";\n\n .", " {\n opacity: 1;\n color: ", ";\n }\n }\n\n .", " {\n ", /** cover user agent stylesheet */ "\n display: inline-flex;\n justify-content: flex-start;\n flex-direction: inherit;\n align-items: center;\n\n height: 100%;\n width: 100%;\n padding: ", ";\n\n ", " {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n\n .", " {\n opacity: 1;\n }\n }\n\n ", " {\n ", "\n background-color: ", ";\n }\n }\n }\n\n &.", " {\n ", "\n color: ", ";\n\n padding: ", ";\n height: ", ";\n }\n "])), spacing(0, 2), RcTableCellClasses.paddingCheckbox, spacing(0, 0, 0, 2), RcTableCellClasses.paddingNone, RcTableCellClasses.head, HeadTypography, palette2('neutral', 'l02'), palette2('neutral', 'f05'), palette2('neutral', 'b02'), Boolean(sortDirection) && 'unset', RcTableCellClasses.sortIcon, spacing(0, 2), RcTableCellClasses.activeSort, palette2('interactive', 'f01'), RcTableCellClasses.sortIcon, palette2('neutral', 'f04'), RcTableCellClasses.sortButton, HeadTypography /** cover user agent stylesheet */, spacing(0, 2), RcTableCellClasses.sortIcon, palette2('neutral', 'f04'), palette2('neutral', 'b03'), RcTableCellClasses.sortIcon, focusVisible, fakeBorder({ color: palette2('interactive', 'f01') }), palette2('neutral', 'b03'), RcTableCellClasses.body, typography('body1'), palette2('neutral', 'f06'), size === 'auto' && spacing(3, 2), size !== 'auto' && px(SizeMap[size]));
|
|
12
14
|
};
|
|
13
15
|
var templateObject_1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef, useMemo, useRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { combineClasses, combineProps, styled, useEventCallback, useForkRef, useRcPortalWindowContext, useThemeProps, } from '../../foundation';
|
|
4
|
+
import { combineClasses, combineProps, styled, useEventCallback, useForceUpdate, useForkRef, useRcPortalWindowContext, useSleep, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { RcPopover } from '../Popover';
|
|
6
6
|
import { VirtualizedMenuStyle } from './styles';
|
|
7
7
|
import { RcVirtualizedMenuClasses } from './utils';
|
|
@@ -48,6 +48,17 @@ var _RcVirtualizedMenu = forwardRef(function (inProps, ref) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
var forceUpdate = useForceUpdate();
|
|
52
|
+
var sleep = useSleep().sleep;
|
|
53
|
+
// TODO: fix that when that work
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
if (open) {
|
|
56
|
+
sleep(200).then(function () {
|
|
57
|
+
forceUpdate();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
}, [open]);
|
|
51
62
|
return (React.createElement(RcPopover, __assign({ ref: handleRef, container: document.body, classes: PopoverClasses, onClose: onClose, open: open, transitionDuration: transitionDuration, PaperProps: PaperProps, TransitionProps: TransitionProps }, rest),
|
|
52
63
|
React.createElement(RcVirtualizedMenuList, __assign({ position: "unset", action: menuListActionRef, autoFocus: autoFocus, autoFocusItem: autoFocusItem, maxHeight: maxHeight, variant: variant, onKeyDown: handleListKeyDown }, MenuListProps, { className: clsx(classes.list, MenuListProps.className) }), children)));
|
|
53
64
|
});
|
|
@@ -161,8 +161,12 @@ var _RcVirtualizedMenuList = forwardRef(function (inProps, ref) {
|
|
|
161
161
|
},
|
|
162
162
|
}); });
|
|
163
163
|
var components = useMemo(function () { return ({
|
|
164
|
-
Header: disablePadding
|
|
165
|
-
|
|
164
|
+
Header: disablePadding
|
|
165
|
+
? undefined
|
|
166
|
+
: StyledMenuListPadding,
|
|
167
|
+
Footer: disablePadding
|
|
168
|
+
? undefined
|
|
169
|
+
: StyledMenuListPadding,
|
|
166
170
|
List: React.forwardRef(function (_a, listRef) {
|
|
167
171
|
var children = _a.children, listRest = __rest(_a, ["children"]);
|
|
168
172
|
var toRef = useForkRef(handleRef, listRef);
|
|
@@ -132,22 +132,22 @@ function adjust(node) {
|
|
|
132
132
|
}
|
|
133
133
|
throw new Error('Unexpected empty nodes');
|
|
134
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
|
+
}
|
|
135
150
|
else {
|
|
136
|
-
if (isSingle(node)) {
|
|
137
|
-
return split(clone(node, { lvl: lvl - 1 }));
|
|
138
|
-
}
|
|
139
|
-
if (!empty(r) && !empty(r.l)) {
|
|
140
|
-
var rl = r.l;
|
|
141
|
-
var rlvl = isSingle(rl) ? r.lvl - 1 : r.lvl;
|
|
142
|
-
return clone(rl, {
|
|
143
|
-
l: clone(node, {
|
|
144
|
-
r: rl.l,
|
|
145
|
-
lvl: lvl - 1,
|
|
146
|
-
}),
|
|
147
|
-
r: split(clone(r, { l: rl.r, lvl: rlvl })),
|
|
148
|
-
lvl: rl.lvl + 1,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
151
|
throw new Error('Unexpected empty nodes');
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { createElement } from 'react';
|
|
4
5
|
import { systemToComponent } from '@virtuoso.dev/react-urx';
|
|
@@ -6,10 +7,11 @@ import * as u from '@virtuoso.dev/urx';
|
|
|
6
7
|
import { gridSystem } from './gridSystem';
|
|
7
8
|
import useSize from './hooks/useSize';
|
|
8
9
|
import useWindowViewportRectRef from './hooks/useWindowViewportRect';
|
|
9
|
-
import { addDeprecatedAlias, buildScroller, buildWindowScroller, identity, viewportStyle, } from './List';
|
|
10
|
+
import { addDeprecatedAlias, buildScroller, buildWindowScroller, contextPropIfNotDomElement, identity, viewportStyle, } from './List';
|
|
10
11
|
var gridComponentPropsSystem = u.system(function () {
|
|
11
12
|
var itemContent = u.statefulStream(function (index) { return "Item " + index; });
|
|
12
13
|
var components = u.statefulStream({});
|
|
14
|
+
var context = u.statefulStream(null);
|
|
13
15
|
var itemClassName = u.statefulStream('virtuoso-grid-item');
|
|
14
16
|
var listClassName = u.statefulStream('virtuoso-grid-list');
|
|
15
17
|
var computeItemKey = u.statefulStream(identity);
|
|
@@ -19,6 +21,7 @@ var gridComponentPropsSystem = u.system(function () {
|
|
|
19
21
|
return u.statefulStreamFromEmitter(u.pipe(components, u.map(function (components) { return components[propName]; }), u.distinctUntilChanged()), defaultValue);
|
|
20
22
|
};
|
|
21
23
|
return {
|
|
24
|
+
context: context,
|
|
22
25
|
itemContent: itemContent,
|
|
23
26
|
components: components,
|
|
24
27
|
computeItemKey: computeItemKey,
|
|
@@ -45,7 +48,6 @@ var combinedSystem = u.system(function (_a) {
|
|
|
45
48
|
u.connect(u.pipe(stream, u.withLatestFrom(gridComponentPropsSystem.components), u.map(function (_a) {
|
|
46
49
|
var _b;
|
|
47
50
|
var _c = __read(_a, 2), comp = _c[0], components = _c[1];
|
|
48
|
-
// eslint-disable-next-line no-console
|
|
49
51
|
console.warn("react-virtuoso: " + propName + " property is deprecated. Pass components." + componentName + " instead.");
|
|
50
52
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
51
53
|
return __assign(__assign({}, components), (_b = {}, _b[componentName] = comp, _b));
|
|
@@ -53,7 +55,6 @@ var combinedSystem = u.system(function (_a) {
|
|
|
53
55
|
}
|
|
54
56
|
u.subscribe(deprecatedProps.scrollSeek, function (_a) {
|
|
55
57
|
var placeholder = _a.placeholder, config = __rest(_a, ["placeholder"]);
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
58
|
console.warn("react-virtuoso: scrollSeek property is deprecated. Pass scrollSeekConfiguration and specify the placeholder in components.ScrollSeekPlaceholder instead.");
|
|
58
59
|
u.publish(gridComponentPropsSystem.components, __assign(__assign({}, u.getValue(gridComponentPropsSystem.components)), {
|
|
59
60
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -72,58 +73,51 @@ var GridItems = React.memo(function GridItems() {
|
|
|
72
73
|
var itemContent = useEmitterValue('itemContent');
|
|
73
74
|
var computeItemKey = useEmitterValue('computeItemKey');
|
|
74
75
|
var isSeeking = useEmitterValue('isSeeking');
|
|
76
|
+
var scrollHeightCallback = usePublisher('scrollHeight');
|
|
75
77
|
var ItemComponent = useEmitterValue('ItemComponent');
|
|
76
78
|
var ListComponent = useEmitterValue('ListComponent');
|
|
77
79
|
var ScrollSeekPlaceholder = useEmitterValue('ScrollSeekPlaceholder');
|
|
80
|
+
var context = useEmitterValue('context');
|
|
78
81
|
var itemDimensions = usePublisher('itemDimensions');
|
|
79
82
|
var listRef = useSize(function (el) {
|
|
83
|
+
var scrollHeight = el.parentElement.parentElement.scrollHeight;
|
|
84
|
+
scrollHeightCallback(scrollHeight);
|
|
80
85
|
var firstItem = el.firstChild;
|
|
81
86
|
if (firstItem) {
|
|
82
|
-
itemDimensions(
|
|
83
|
-
width: firstItem.offsetWidth,
|
|
84
|
-
height: firstItem.offsetHeight,
|
|
85
|
-
});
|
|
87
|
+
itemDimensions(firstItem.getBoundingClientRect());
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
|
-
return createElement(ListComponent, {
|
|
89
|
-
ref: listRef,
|
|
90
|
-
className: listClassName,
|
|
91
|
-
style: {
|
|
90
|
+
return createElement(ListComponent, __assign(__assign({ ref: listRef, className: listClassName }, contextPropIfNotDomElement(ListComponent, context)), { style: {
|
|
92
91
|
paddingTop: gridState.offsetTop,
|
|
93
92
|
paddingBottom: gridState.offsetBottom,
|
|
94
|
-
},
|
|
95
|
-
}, gridState.items.map(function (item) {
|
|
93
|
+
} }), gridState.items.map(function (item) {
|
|
96
94
|
var key = computeItemKey(item.index);
|
|
97
95
|
return isSeeking
|
|
98
|
-
? createElement(ScrollSeekPlaceholder, {
|
|
99
|
-
|
|
100
|
-
style: { height: gridState.itemHeight, width: gridState.itemWidth },
|
|
101
|
-
})
|
|
102
|
-
: createElement(ItemComponent, { className: itemClassName, 'data-index': item.index, key: key }, itemContent(item.index));
|
|
96
|
+
? createElement(ScrollSeekPlaceholder, __assign(__assign({ key: key }, contextPropIfNotDomElement(ScrollSeekPlaceholder, context)), { index: item.index, height: gridState.itemHeight, width: gridState.itemWidth }))
|
|
97
|
+
: createElement(ItemComponent, __assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { className: itemClassName, 'data-index': item.index, key: key }), itemContent(item.index, context));
|
|
103
98
|
}));
|
|
104
99
|
});
|
|
105
100
|
var Viewport = function (_a) {
|
|
106
101
|
var children = _a.children;
|
|
107
102
|
var viewportDimensions = usePublisher('viewportDimensions');
|
|
108
103
|
var viewportRef = useSize(function (el) {
|
|
109
|
-
viewportDimensions(
|
|
110
|
-
width: el.offsetWidth,
|
|
111
|
-
height: el.offsetHeight,
|
|
112
|
-
});
|
|
104
|
+
viewportDimensions(el.getBoundingClientRect());
|
|
113
105
|
});
|
|
114
106
|
return (React.createElement("div", { style: viewportStyle, ref: viewportRef }, children));
|
|
115
107
|
};
|
|
116
108
|
var WindowViewport = function (_a) {
|
|
117
109
|
var children = _a.children;
|
|
118
110
|
var windowViewportRect = usePublisher('windowViewportRect');
|
|
119
|
-
var
|
|
111
|
+
var customScrollParent = useEmitterValue('customScrollParent');
|
|
112
|
+
var viewportRef = useWindowViewportRectRef(windowViewportRect, customScrollParent);
|
|
120
113
|
return (React.createElement("div", { ref: viewportRef, style: viewportStyle }, children));
|
|
121
114
|
};
|
|
122
115
|
var GridRoot = React.memo(function GridRoot(_a) {
|
|
123
116
|
var props = __rest(_a, []);
|
|
124
117
|
var useWindowScroll = useEmitterValue('useWindowScroll');
|
|
125
|
-
var
|
|
126
|
-
var
|
|
118
|
+
var customScrollParent = useEmitterValue('customScrollParent');
|
|
119
|
+
var TheScroller = customScrollParent || useWindowScroll ? WindowScroller : Scroller;
|
|
120
|
+
var TheViewport = customScrollParent || useWindowScroll ? WindowViewport : Viewport;
|
|
127
121
|
return (React.createElement(TheScroller, __assign({}, props),
|
|
128
122
|
React.createElement(TheViewport, null,
|
|
129
123
|
React.createElement(GridItems, null))));
|
|
@@ -140,6 +134,7 @@ var _a = systemToComponent(combinedSystem, {
|
|
|
140
134
|
listClassName: 'listClassName',
|
|
141
135
|
itemClassName: 'itemClassName',
|
|
142
136
|
useWindowScroll: 'useWindowScroll',
|
|
137
|
+
customScrollParent: 'customScrollParent',
|
|
143
138
|
scrollerRef: 'scrollerRef',
|
|
144
139
|
// deprecated
|
|
145
140
|
item: 'item',
|