@ringcentral/juno 2.9.0 → 2.12.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/Dialer/DialPad/DialPad.d.ts +3 -3
- package/components/Dialer/DialPad/DialPad.js +3 -4
- package/components/Dialer/DialPadButton/DialPadButton.d.ts +3 -1
- package/components/Dialer/DialPadButton/DialPadButton.js +3 -3
- package/components/Dialog/Dialog.js +4 -2
- package/components/Downshift/SuggestionList/SuggestionList.d.ts +3 -3
- package/components/Drawer/Drawer.js +8 -2
- package/components/Forms/TextField/TextField.d.ts +2 -2
- package/components/Forms/TextField/TextField.js +19 -4
- package/components/PortalHost/context/HasPortalParentContext.d.ts +3 -0
- package/components/PortalHost/context/HasPortalParentContext.js +9 -0
- package/components/PortalHost/context/index.d.ts +1 -0
- package/components/PortalHost/context/index.js +1 -0
- package/components/PortalHost/index.d.ts +1 -0
- package/components/PortalHost/index.js +2 -0
- package/components/PortalHost/utils/usePortalManagerWithID.js +5 -4
- package/components/Snackbar/Snackbar.js +3 -1
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +17 -13
- package/components/VirtualizedMenu/VirtualizedMenu.js +4 -12
- package/components/Virtuoso/react-virtuoso/Grid.d.ts +28 -18
- package/components/Virtuoso/react-virtuoso/List.d.ts +487 -183
- package/components/Virtuoso/react-virtuoso/List.js +13 -2
- package/components/Virtuoso/react-virtuoso/Table.d.ts +434 -172
- package/components/Virtuoso/react-virtuoso/Table.js +14 -2
- package/components/Virtuoso/react-virtuoso/alignToBottomSystem.d.ts +32 -16
- package/components/Virtuoso/react-virtuoso/components.d.ts +8 -0
- package/components/Virtuoso/react-virtuoso/domIOSystem.d.ts +3 -1
- package/components/Virtuoso/react-virtuoso/domIOSystem.js +4 -2
- package/components/Virtuoso/react-virtuoso/followOutputSystem.d.ts +20 -10
- package/components/Virtuoso/react-virtuoso/followOutputSystem.js +1 -0
- package/components/Virtuoso/react-virtuoso/gridSystem.d.ts +24 -14
- package/components/Virtuoso/react-virtuoso/groupedListSystem.d.ts +4 -2
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.d.ts +2 -1
- package/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +5 -10
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.d.ts +2 -1
- package/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +16 -7
- package/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +2 -2
- package/components/Virtuoso/react-virtuoso/initialItemCountSystem.d.ts +24 -12
- package/components/Virtuoso/react-virtuoso/initialScrollTopSystem.d.ts +32 -16
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.d.ts +8 -4
- package/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +1 -1
- package/components/Virtuoso/react-virtuoso/interfaces.d.ts +22 -5
- package/components/Virtuoso/react-virtuoso/listStateSystem.d.ts +24 -12
- package/components/Virtuoso/react-virtuoso/listSystem.d.ts +287 -146
- package/components/Virtuoso/react-virtuoso/scrollIntoViewSystem.d.ts +32 -16
- package/components/Virtuoso/react-virtuoso/scrollSeekSystem.d.ts +4 -2
- package/components/Virtuoso/react-virtuoso/scrollToIndexSystem.d.ts +4 -2
- package/components/Virtuoso/react-virtuoso/sizeRangeSystem.d.ts +4 -2
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.d.ts +4 -2
- package/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +5 -4
- package/components/Virtuoso/react-virtuoso/topItemCountSystem.d.ts +24 -12
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.d.ts +28 -14
- package/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +4 -0
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.d.ts +32 -16
- package/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +12 -35
- package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.d.ts +1 -0
- package/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +7 -0
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.d.ts +6 -4
- package/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +6 -2
- package/components/Virtuoso/utils/useHighlightScroll.js +1 -2
- package/es6/components/Dialer/DialPad/DialPad.js +4 -5
- package/es6/components/Dialer/DialPadButton/DialPadButton.js +3 -3
- package/es6/components/Dialog/Dialog.js +4 -2
- package/es6/components/Drawer/Drawer.js +8 -2
- package/es6/components/Forms/TextField/TextField.js +20 -5
- package/es6/components/PortalHost/context/HasPortalParentContext.js +6 -0
- package/es6/components/PortalHost/context/index.js +1 -0
- package/es6/components/PortalHost/index.js +1 -0
- package/es6/components/PortalHost/utils/usePortalManagerWithID.js +5 -4
- package/es6/components/Snackbar/Snackbar.js +3 -1
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +17 -13
- package/es6/components/VirtualizedMenu/VirtualizedMenu.js +6 -14
- package/es6/components/Virtuoso/react-virtuoso/List.js +14 -3
- package/es6/components/Virtuoso/react-virtuoso/Table.js +14 -2
- package/es6/components/Virtuoso/react-virtuoso/domIOSystem.js +4 -3
- package/es6/components/Virtuoso/react-virtuoso/followOutputSystem.js +1 -0
- package/es6/components/Virtuoso/react-virtuoso/hooks/useChangedChildSizes.js +5 -10
- package/es6/components/Virtuoso/react-virtuoso/hooks/useScrollTop.js +16 -7
- package/es6/components/Virtuoso/react-virtuoso/hooks/useWindowViewportRect.js +2 -2
- package/es6/components/Virtuoso/react-virtuoso/initialTopMostItemIndexSystem.js +1 -1
- package/es6/components/Virtuoso/react-virtuoso/stateFlagsSystem.js +5 -4
- package/es6/components/Virtuoso/react-virtuoso/totalListHeightSystem.js +4 -0
- package/es6/components/Virtuoso/react-virtuoso/upwardScrollFixSystem.js +12 -35
- package/es6/components/Virtuoso/react-virtuoso/utils/conditionalFlushSync.js +4 -0
- package/es6/components/Virtuoso/react-virtuoso/windowScrollerSystem.js +6 -2
- package/es6/components/Virtuoso/utils/useHighlightScroll.js +1 -2
- package/es6/foundation/theme/createTheme.js +1 -1
- package/foundation/theme/ThemeHandler.d.ts +1 -1
- package/foundation/theme/ThemeSwitcherProvider/ThemeSwitcherProvider.d.ts +2 -2
- package/foundation/theme/theme.type.d.ts +2 -2
- package/foundation/typings/deepPartial.d.ts +1 -3
- package/foundation/utils/deepmerge.d.ts +3 -2
- package/package.json +3 -2
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __read, __rest, __values } from "tslib";
|
|
2
2
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, } from 'react';
|
|
3
|
-
import { styled,
|
|
3
|
+
import { styled, useEventCallback, useForkRef, useKeyboardMoveFocus, useOnlyOneFocusable, useThemeProps, } from '../../../foundation';
|
|
4
4
|
import { RcIconButtonClasses } from '../../Buttons/IconButton/utils';
|
|
5
5
|
import { RcVisuallyHidden } from '../../VisuallyHidden';
|
|
6
6
|
import { RcDialPadButton } from '../DialPadButton';
|
|
7
7
|
import { useRcDialerContext } from '../utils';
|
|
8
8
|
import { DialPadStyle } from './styles';
|
|
9
9
|
import { ACCEPTABLE_KEYS, DIALER_PAD_ICONS, DIALER_PAD_PLUS, useKeyAudio, } from './utils';
|
|
10
|
-
var DEBOUNCE_TIME = 30;
|
|
11
10
|
var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
12
11
|
var props = useThemeProps({ props: inProps, name: 'RcDialPad' });
|
|
13
12
|
var sounds = props.sounds, volume = props.volume, autoSize = props.autoSize, muted = props.muted, classes = props.classes, onChangeProp = props.onChange, longPressDelay = props.longPressDelay, action = props.action, persistBgTime = props.persistBgTime, control = props.control, getDialPadButtonProps = props.getDialPadButtonProps, _a = props.externalWindow, externalWindow = _a === void 0 ? window : _a, divProps = __rest(props, ["sounds", "volume", "autoSize", "muted", "classes", "onChange", "longPressDelay", "action", "persistBgTime", "control", "getDialPadButtonProps", "externalWindow"]);
|
|
@@ -61,7 +60,7 @@ var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
|
61
60
|
(_a = onInsertRef === null || onInsertRef === void 0 ? void 0 : onInsertRef.current) === null || _a === void 0 ? void 0 : _a.call(onInsertRef, value, reason);
|
|
62
61
|
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(value, reason);
|
|
63
62
|
};
|
|
64
|
-
var handleKeyboardEffect =
|
|
63
|
+
var handleKeyboardEffect = useEventCallback(function (value, isKeyup) {
|
|
65
64
|
var _a, _b;
|
|
66
65
|
if (isKeyup) {
|
|
67
66
|
handleChange(value, 'customKeyboard');
|
|
@@ -72,7 +71,7 @@ var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
|
72
71
|
(_b = hiddenRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
}
|
|
74
|
+
});
|
|
76
75
|
var handleKeyEffect = useEventCallback(function (value, reason) {
|
|
77
76
|
handleChange(value, reason);
|
|
78
77
|
});
|
|
@@ -106,7 +105,7 @@ var _RcDialPad = forwardRef(function (inProps, ref) {
|
|
|
106
105
|
var ariaLabelArr = additionLabel
|
|
107
106
|
? [key, additionLabel]
|
|
108
107
|
: [key];
|
|
109
|
-
return (React.createElement(RcDialPadButton, __assign({ classes: classes, symbol: symbol, key: key, value: key, onKeyEffect: handleKeyEffect }, getItemProps(index), { "aria-label": ariaLabelArr.join(','), onKeyDown: onKeyFocusedIndexHandle }, (_b = {}, _b[dialButtonKey] = key, _b), getDialPadButtonProps === null || getDialPadButtonProps === void 0 ? void 0 : getDialPadButtonProps(key), (key === '0'
|
|
108
|
+
return (React.createElement(RcDialPadButton, __assign({ classes: classes, symbol: symbol, key: key, value: key, onKeyEffect: handleKeyEffect, externalWindow: externalWindow }, getItemProps(index), { "aria-label": ariaLabelArr.join(','), onKeyDown: onKeyFocusedIndexHandle }, (_b = {}, _b[dialButtonKey] = key, _b), getDialPadButtonProps === null || getDialPadButtonProps === void 0 ? void 0 : getDialPadButtonProps(key), (key === '0'
|
|
110
109
|
? {
|
|
111
110
|
longPressValue: DIALER_PAD_PLUS,
|
|
112
111
|
longPressDelay: longPressDelay,
|
|
@@ -4,9 +4,9 @@ import { styled, useLongPress } from '../../../foundation';
|
|
|
4
4
|
import { RcIconButton } from '../../Buttons';
|
|
5
5
|
import { buttonWrapperStyle } from './styles';
|
|
6
6
|
var _RcDialPadButton = function (props) {
|
|
7
|
-
var value = props.value, longPressValue = props.longPressValue, longPressDelay = props.longPressDelay, onKeyEffect = props.onKeyEffect, rest = __rest(props, ["value", "longPressValue", "longPressDelay", "onKeyEffect"]);
|
|
7
|
+
var value = props.value, longPressValue = props.longPressValue, longPressDelay = props.longPressDelay, onKeyEffect = props.onKeyEffect, _a = props.externalWindow, externalWindow = _a === void 0 ? window : _a, rest = __rest(props, ["value", "longPressValue", "longPressDelay", "onKeyEffect", "externalWindow"]);
|
|
8
8
|
var isPressEvent = typeof longPressDelay === 'number' && typeof longPressValue === 'string';
|
|
9
|
-
var
|
|
9
|
+
var _b = useLongPress({
|
|
10
10
|
onTap: function (e, reason) {
|
|
11
11
|
onKeyEffect(value, reason);
|
|
12
12
|
},
|
|
@@ -15,7 +15,7 @@ var _RcDialPadButton = function (props) {
|
|
|
15
15
|
onKeyEffect(longPressValue, reason);
|
|
16
16
|
}
|
|
17
17
|
: undefined,
|
|
18
|
-
}, rest, { delay: longPressDelay }), ref =
|
|
18
|
+
}, rest, { delay: longPressDelay, externalWindow: externalWindow }), ref = _b.ref, events = __rest(_b, ["ref"]);
|
|
19
19
|
return (React.createElement(RcIconButton, __assign({ ref: ref, variant: "round", stretchIcon: true }, rest, events)));
|
|
20
20
|
};
|
|
21
21
|
var RcDialPadButton = styled(_RcDialPadButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), buttonWrapperStyle);
|
|
@@ -6,6 +6,7 @@ import { useUnmountPortalHandler } from '../PortalHost';
|
|
|
6
6
|
import { DialogStyle } from './styles';
|
|
7
7
|
import { RcDialogClasses } from './utils';
|
|
8
8
|
import { RcDialogContext } from './utils/DialogContext';
|
|
9
|
+
import { HasPortalParentProvider } from '../PortalHost/context/HasPortalParentContext';
|
|
9
10
|
var _RcDialog = forwardRef(function (inProps, ref) {
|
|
10
11
|
var props = useThemeProps({ props: inProps, name: 'RcDialog' });
|
|
11
12
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -42,8 +43,9 @@ var _RcDialog = forwardRef(function (inProps, ref) {
|
|
|
42
43
|
var TransitionProps = __assign(__assign({
|
|
43
44
|
// TODO: remove after upgrade to mui v5
|
|
44
45
|
role: 'presentation' }, TransitionPropsProp), { onExited: onExited });
|
|
45
|
-
return (React.createElement(
|
|
46
|
-
React.createElement(
|
|
46
|
+
return (React.createElement(HasPortalParentProvider, null,
|
|
47
|
+
React.createElement(MuiDialog, __assign({ ref: ref, fullWidth: fullWidth, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body, maxWidth: maxWidth, fullScreen: size === 'fullScreen' ? true : undefined, classes: classes, TransitionProps: TransitionProps }, rest),
|
|
48
|
+
React.createElement(RcDialogContext.Provider, { value: contextValue }, children))));
|
|
47
49
|
});
|
|
48
50
|
var RcDialog = styled(_RcDialog)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DialogStyle);
|
|
49
51
|
RcDialog.defaultProps = {};
|
|
@@ -4,9 +4,11 @@ import MuiDrawer from '@material-ui/core/Drawer';
|
|
|
4
4
|
import { combineClasses, combineProps, styled, useRcPortalWindowContext, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { DrawerStyle } from './styles';
|
|
6
6
|
import { RcDrawerClasses } from './utils';
|
|
7
|
+
import { usePortalManagerWithID, useUnmountPortalHandler } from '../PortalHost';
|
|
8
|
+
import { HasPortalParentProvider } from '../PortalHost/context/HasPortalParentContext';
|
|
7
9
|
var _RcDrawer = forwardRef(function (inProps, ref) {
|
|
8
10
|
var props = useThemeProps({ props: inProps, name: 'RcDrawer' });
|
|
9
|
-
var inlinePaper = props.inlinePaper, radius = props.radius, classesProp = props.classes, children = props.children, PaperPropsProp = props.PaperProps, onClose = props.onClose, rest = __rest(props, ["inlinePaper", "radius", "classes", "children", "PaperProps", "onClose"]);
|
|
11
|
+
var inlinePaper = props.inlinePaper, radius = props.radius, classesProp = props.classes, children = props.children, PaperPropsProp = props.PaperProps, onClose = props.onClose, SlidePropsProp = props.SlideProps, rest = __rest(props, ["inlinePaper", "radius", "classes", "children", "PaperProps", "onClose", "SlideProps"]);
|
|
10
12
|
var externalWindow = useRcPortalWindowContext().externalWindow;
|
|
11
13
|
var PaperProps = useMemo(function () {
|
|
12
14
|
var _a;
|
|
@@ -23,7 +25,11 @@ var _RcDrawer = forwardRef(function (inProps, ref) {
|
|
|
23
25
|
_a), PaperPropsProp);
|
|
24
26
|
}, [PaperPropsProp, inlinePaper, onClose]);
|
|
25
27
|
var classes = useMemo(function () { return combineClasses(RcDrawerClasses, classesProp); }, [classesProp]);
|
|
26
|
-
|
|
28
|
+
var onExited = useUnmountPortalHandler(SlidePropsProp === null || SlidePropsProp === void 0 ? void 0 : SlidePropsProp.onExited);
|
|
29
|
+
var managerWithID = usePortalManagerWithID();
|
|
30
|
+
var SlideProps = __assign(__assign(__assign({}, SlidePropsProp), { onExited: onExited }), (managerWithID ? { appear: true } : {}));
|
|
31
|
+
return (React.createElement(HasPortalParentProvider, null,
|
|
32
|
+
React.createElement(MuiDrawer, __assign({}, rest, { ref: ref, container: externalWindow === null || externalWindow === void 0 ? void 0 : externalWindow.document.body, classes: classes, onClose: onClose, PaperProps: PaperProps, SlideProps: SlideProps }), children)));
|
|
27
33
|
});
|
|
28
34
|
var RcDrawer = styled(_RcDrawer)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), DrawerStyle);
|
|
29
35
|
RcDrawer.defaultProps = {
|
|
@@ -2,11 +2,12 @@ import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
|
2
2
|
import React, { forwardRef, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import MuiTextField from '@material-ui/core/TextField';
|
|
4
4
|
import { DeleteCircle } from '@ringcentral/juno-icon';
|
|
5
|
-
import { clearReactReferencesInNode, combineClasses, combineProps, styled, useDeprecatedCheck, useEventCallback, useForkRef, useThemeProps, } from '../../../foundation';
|
|
5
|
+
import { clearReactReferencesInNode, combineClasses, combineProps, styled, useControlled, useDeprecatedCheck, useEventCallback, useForkRef, useThemeProps, } from '../../../foundation';
|
|
6
6
|
import { useRcFormContext } from '../Form/Form/FormContext';
|
|
7
7
|
import { ClearIconButton, TextFieldStyle } from './styles';
|
|
8
8
|
import { RcOutlineTextFieldIconSizes, RcOutlineTextFieldInputClasses, RcTextFieldClasses, RcTextFieldFormHelperTextClasses, RcTextFieldInputClasses, RcTextFieldInputLabelClasses, } from './utils';
|
|
9
9
|
var combineOutlineClasses = combineClasses(RcTextFieldInputClasses, RcOutlineTextFieldInputClasses);
|
|
10
|
+
var displayName = 'RcTextField';
|
|
10
11
|
var _RcTextField = forwardRef(function (inProps, ref) {
|
|
11
12
|
var props = useThemeProps({ props: inProps, name: 'RcTextField' });
|
|
12
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -38,7 +39,9 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
38
39
|
// TODO: remove when remove focusOnMount
|
|
39
40
|
_a = props.autoFocus,
|
|
40
41
|
// TODO: remove when remove focusOnMount
|
|
41
|
-
autoFocusProp = _a === void 0 ? focusOnMount : _a, InputPropsProp = props.InputProps, error = props.error, helperText = props.helperText,
|
|
42
|
+
autoFocusProp = _a === void 0 ? focusOnMount : _a, InputPropsProp = props.InputProps, error = props.error, helperText = props.helperText,
|
|
43
|
+
// no need assign to MuiTextField
|
|
44
|
+
defaultValue = props.defaultValue, inputRefProp = props.inputRef, _b = props.autoSelect, autoSelect = _b === void 0 ? selectOnMount : _b, autoFocusDelay = props.autoFocusDelay, clearLabel = props.clearLabel, clearButtonProps = props.clearButtonProps, clearBtn = props.clearBtn, validate = props.validate, onChange = props.onChange, onBlur = props.onBlur, onFocus = props.onFocus, onClear = props.onClear, id = props.id,
|
|
42
45
|
// #region outline pick props
|
|
43
46
|
variant = props.variant, radius = props.radius, size = props.size, align = props.align, textVariant = props.textVariant, gutterBottom = props.gutterBottom, color = props.color,
|
|
44
47
|
// #endregion
|
|
@@ -161,10 +164,22 @@ var _RcTextField = forwardRef(function (inProps, ref) {
|
|
|
161
164
|
};
|
|
162
165
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
166
|
}, []);
|
|
164
|
-
return (React.createElement(MuiTextField, __assign({}, rest, events, { id: id, value: valueProp, onChange: onChange,
|
|
167
|
+
return (React.createElement(MuiTextField, __assign({}, rest, events, { id: id, value: valueProp, onChange: onChange, error: validate ? !!validateMessage : error, helperText: validateMessage || helperText, classes: classes, FormHelperTextProps: FormHelperTextProps, InputLabelProps: InputLabelProps, InputProps: InputProps, inputRef: inputRef, ref: ref })));
|
|
165
168
|
});
|
|
166
169
|
/** @release */
|
|
167
|
-
var RcTextField = styled(_RcTextField)(
|
|
170
|
+
var RcTextField = styled(_RcTextField).attrs(function (_a) {
|
|
171
|
+
var _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, valueProp = _a.value, onChangeProp = _a.onChange, rest = __rest(_a, ["defaultValue", "value", "onChange"]);
|
|
172
|
+
var _c = __read(useControlled({
|
|
173
|
+
default: defaultValue,
|
|
174
|
+
controlled: valueProp,
|
|
175
|
+
name: displayName,
|
|
176
|
+
}), 2), value = _c[0], setValue = _c[1];
|
|
177
|
+
var onChange = function (event) {
|
|
178
|
+
onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(event);
|
|
179
|
+
setValue(event.target.value);
|
|
180
|
+
};
|
|
181
|
+
return __assign(__assign({}, rest), { value: value, onChange: onChange });
|
|
182
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), TextFieldStyle);
|
|
168
183
|
RcTextField.defaultProps = {
|
|
169
184
|
clearBtn: true,
|
|
170
185
|
variant: 'standard',
|
|
@@ -172,6 +187,6 @@ RcTextField.defaultProps = {
|
|
|
172
187
|
size: 'medium',
|
|
173
188
|
textVariant: 'subheading1',
|
|
174
189
|
};
|
|
175
|
-
RcTextField.displayName =
|
|
190
|
+
RcTextField.displayName = displayName;
|
|
176
191
|
export { RcOutlineTextFieldIconSizes, RcTextField };
|
|
177
192
|
var templateObject_1;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { createContext } from 'react';
|
|
2
|
+
export var HasPortalParentContext = createContext(false);
|
|
3
|
+
export var HasPortalParentProvider = function (_a) {
|
|
4
|
+
var children = _a.children;
|
|
5
|
+
return (React.createElement(HasPortalParentContext.Provider, { value: true }, children));
|
|
6
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { PortalIDContext, PortalManagerContext } from '../context';
|
|
3
|
+
import { HasPortalParentContext } from '../context/HasPortalParentContext';
|
|
3
4
|
export var usePortalManagerWithID = function () {
|
|
4
5
|
var manager = useContext(PortalManagerContext);
|
|
5
6
|
var id = useContext(PortalIDContext);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
7
|
+
var hasPortalParent = useContext(HasPortalParentContext);
|
|
8
|
+
if (hasPortalParent || !manager || id === undefined)
|
|
9
|
+
return undefined;
|
|
10
|
+
return { manager: manager, id: id };
|
|
10
11
|
};
|
|
@@ -7,13 +7,15 @@ import { useUnmountPortalHandler } from '../PortalHost';
|
|
|
7
7
|
import { RcSnackbarContent } from './SnackbarContent';
|
|
8
8
|
import { SnackbarStyle } from './styles';
|
|
9
9
|
import { RcSnackbarClasses } from './utils';
|
|
10
|
+
import { HasPortalParentProvider } from '../PortalHost/context/HasPortalParentContext';
|
|
10
11
|
var _RcSnackbar = forwardRef(function (inProps, ref) {
|
|
11
12
|
var props = useThemeProps({ props: inProps, name: 'RcSnackbar' });
|
|
12
13
|
var classesProp = props.classes, size = props.size, type = props.type, message = props.message, action = props.action, ContentProps = props.ContentProps, children = props.children, TransitionPropsProp = props.TransitionProps, rest = __rest(props, ["classes", "size", "type", "message", "action", "ContentProps", "children", "TransitionProps"]);
|
|
13
14
|
var classes = useMemo(function () { return combineClasses(RcSnackbarClasses, classesProp); }, [classesProp]);
|
|
14
15
|
var onExited = useUnmountPortalHandler(TransitionPropsProp === null || TransitionPropsProp === void 0 ? void 0 : TransitionPropsProp.onExited);
|
|
15
16
|
var TransitionProps = __assign(__assign({}, TransitionPropsProp), { onExited: onExited });
|
|
16
|
-
return (React.createElement(
|
|
17
|
+
return (React.createElement(HasPortalParentProvider, null,
|
|
18
|
+
React.createElement(MuiSnackbar, __assign({ ref: ref, classes: classes, TransitionProps: TransitionProps }, rest), children || (React.createElement(RcSnackbarContent, __assign({ size: size, type: type, message: message, action: action }, ContentProps))))));
|
|
17
19
|
});
|
|
18
20
|
var RcSnackbar = styled(_RcSnackbar)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), SnackbarStyle);
|
|
19
21
|
RcSnackbar.defaultProps = {
|
|
@@ -78,18 +78,14 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
78
78
|
tabRefsMapRef.current = tabRefs_1;
|
|
79
79
|
tabsTabChildRef.current = tabsTabDefaultChild_1;
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
useEffect(function () {
|
|
83
|
-
if (childrenProp === prevChildrenProp) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
81
|
+
var updateAllTabsSize = function () {
|
|
86
82
|
var tabRefsMap = tabRefsMapRef.current;
|
|
83
|
+
var allTabsSize = __assign({}, DEFAULT_SIZE);
|
|
87
84
|
if (tabRefsMap && tabRefsMap.size !== 0) {
|
|
88
|
-
var allTabsSize_1 = __assign({}, DEFAULT_SIZE);
|
|
89
85
|
tabRefsMap.forEach(function (value, key) {
|
|
90
86
|
var _a = getDomBoundingClientSize(value.ref.current), width = _a.width, height = _a.height;
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
allTabsSize.width += width;
|
|
88
|
+
allTabsSize.height += height;
|
|
93
89
|
var newRef = {
|
|
94
90
|
ref: value.ref,
|
|
95
91
|
size: { width: width, height: height },
|
|
@@ -98,8 +94,16 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
98
94
|
};
|
|
99
95
|
tabRefsMap.set(key, newRef);
|
|
100
96
|
});
|
|
101
|
-
allTabsSizeRef.current =
|
|
97
|
+
allTabsSizeRef.current = allTabsSize;
|
|
98
|
+
}
|
|
99
|
+
return allTabsSize;
|
|
100
|
+
};
|
|
101
|
+
// get real render size when render
|
|
102
|
+
useEffect(function () {
|
|
103
|
+
if (childrenProp === prevChildrenProp) {
|
|
104
|
+
return;
|
|
102
105
|
}
|
|
106
|
+
updateAllTabsSize();
|
|
103
107
|
var moreElm = moreTabRef === null || moreTabRef === void 0 ? void 0 : moreTabRef.current;
|
|
104
108
|
if (moreElm) {
|
|
105
109
|
var size = getDomBoundingClientSize(moreElm);
|
|
@@ -130,12 +134,12 @@ var _MoreMenuTabs = forwardRef(function (props, ref) {
|
|
|
130
134
|
}
|
|
131
135
|
};
|
|
132
136
|
var computeWhetherToUseMoreMode = function (tabsSize, allTabsSize) {
|
|
133
|
-
if (
|
|
134
|
-
allTabsSize.height === 0 ||
|
|
135
|
-
tabsSize.width === 0 ||
|
|
136
|
-
tabsSize.height === 0) {
|
|
137
|
+
if (tabsSize.width === 0 || tabsSize.height === 0) {
|
|
137
138
|
return false;
|
|
138
139
|
}
|
|
140
|
+
if (allTabsSize.width === 0 || allTabsSize.height === 0) {
|
|
141
|
+
allTabsSize = updateAllTabsSize();
|
|
142
|
+
}
|
|
139
143
|
if (!isVertical) {
|
|
140
144
|
return allTabsSize.width > tabsSize.width;
|
|
141
145
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef,
|
|
2
|
+
import React, { forwardRef, useMemo, useRef } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { combineClasses, combineProps, styled, useEventCallback,
|
|
4
|
+
import { combineClasses, combineProps, styled, useEventCallback, useForkRef, useRcPortalWindowContext, useThemeProps, } from '../../foundation';
|
|
5
5
|
import { RcPopover } from '../Popover';
|
|
6
|
+
import { RcFade } from '../Transitions';
|
|
6
7
|
import { VirtualizedMenuStyle } from './styles';
|
|
7
8
|
import { RcVirtualizedMenuClasses } from './utils';
|
|
8
9
|
import { RcVirtualizedMenuList, } from './VirtualizedMenuList';
|
|
@@ -48,18 +49,9 @@ var _RcVirtualizedMenu = forwardRef(function (inProps, ref) {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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]);
|
|
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
|
+
return (React.createElement(RcPopover, __assign({ ref: handleRef, container: document.body, classes: PopoverClasses, onClose: onClose, open: open,
|
|
53
|
+
// FIXME: workaround for virtualized menu height incorrect issue
|
|
54
|
+
TransitionComponent: RcFade, transitionDuration: transitionDuration, PaperProps: PaperProps, TransitionProps: TransitionProps }, rest),
|
|
63
55
|
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)));
|
|
64
56
|
});
|
|
65
57
|
var RcVirtualizedMenu = styled(_RcVirtualizedMenu)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), VirtualizedMenuStyle);
|
|
@@ -2,7 +2,7 @@ var _a;
|
|
|
2
2
|
import { __assign, __read, __rest } from "tslib";
|
|
3
3
|
/* eslint-disable no-console */
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { createElement } from 'react';
|
|
5
|
+
import { createElement, } from 'react';
|
|
6
6
|
import { systemToComponent } from '@virtuoso.dev/react-urx';
|
|
7
7
|
import { compose, connect, distinctUntilChanged, getValue, map, noop, pipe, publish, statefulStream, statefulStreamFromEmitter, stream, subscribe, system, tup, withLatestFrom, } from '@virtuoso.dev/urx';
|
|
8
8
|
import useChangedListContentsSizes from './hooks/useChangedChildSizes';
|
|
@@ -11,6 +11,7 @@ import useScrollTop from './hooks/useScrollTop';
|
|
|
11
11
|
import useSize from './hooks/useSize';
|
|
12
12
|
import useWindowViewportRectRef from './hooks/useWindowViewportRect';
|
|
13
13
|
import { listSystem } from './listSystem';
|
|
14
|
+
import conditionalFlushSync from './utils/conditionalFlushSync';
|
|
14
15
|
import { correctItemSize } from './utils/correctItemSize';
|
|
15
16
|
import { positionStickyCssValue } from './utils/positionStickyCssValue';
|
|
16
17
|
export function identity(value) {
|
|
@@ -122,10 +123,19 @@ var GROUP_STYLE = {
|
|
|
122
123
|
zIndex: 1,
|
|
123
124
|
overflowAnchor: 'none',
|
|
124
125
|
};
|
|
126
|
+
var ITEM_STYLE = { overflowAnchor: 'none' };
|
|
125
127
|
export var Items = React.memo(function VirtuosoItems(_a) {
|
|
126
128
|
var _b = _a.showTopList, showTopList = _b === void 0 ? false : _b;
|
|
127
129
|
var listState = useEmitterValue('listState');
|
|
128
|
-
var
|
|
130
|
+
var _c = __read(React.useState(0), 2), deviation = _c[0], setDeviation = _c[1];
|
|
131
|
+
var react18ConcurrentRendering = useEmitterValue('react18ConcurrentRendering');
|
|
132
|
+
useEmitter('deviation', function (value) {
|
|
133
|
+
if (deviation !== value) {
|
|
134
|
+
conditionalFlushSync(react18ConcurrentRendering)(function () {
|
|
135
|
+
return setDeviation(value);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
});
|
|
129
139
|
var sizeRanges = usePublisher('sizeRanges');
|
|
130
140
|
var useWindowScroll = useEmitterValue('useWindowScroll');
|
|
131
141
|
var customScrollParent = useEmitterValue('customScrollParent');
|
|
@@ -174,7 +184,7 @@ export var Items = React.memo(function VirtuosoItems(_a) {
|
|
|
174
184
|
if (item.type === 'group') {
|
|
175
185
|
return createElement(GroupComponent, __assign(__assign({}, contextPropIfNotDomElement(GroupComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, style: GROUP_STYLE }), groupContent(item.index));
|
|
176
186
|
}
|
|
177
|
-
return createElement(ItemComponent, __assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, 'data-item-group-index': item.groupIndex, style:
|
|
187
|
+
return createElement(ItemComponent, __assign(__assign({}, contextPropIfNotDomElement(ItemComponent, context)), { key: key, 'data-index': index, 'data-known-size': item.size, 'data-item-index': item.index, 'data-item-group-index': item.groupIndex, style: ITEM_STYLE }), hasGroups
|
|
178
188
|
? itemContent(item.index, item.groupIndex, item.data, context)
|
|
179
189
|
: itemContent(item.index, item.data, context));
|
|
180
190
|
}));
|
|
@@ -330,6 +340,7 @@ export var List = (_a = systemToComponent(combinedSystem, {
|
|
|
330
340
|
customScrollParent: 'customScrollParent',
|
|
331
341
|
scrollerRef: 'scrollerRef',
|
|
332
342
|
logLevel: 'logLevel',
|
|
343
|
+
react18ConcurrentRendering: 'react18ConcurrentRendering',
|
|
333
344
|
// deprecated
|
|
334
345
|
item: 'item',
|
|
335
346
|
group: 'group',
|
|
@@ -9,6 +9,7 @@ import useSize from './hooks/useSize';
|
|
|
9
9
|
import useWindowViewportRectRef from './hooks/useWindowViewportRect';
|
|
10
10
|
import { buildScroller, buildWindowScroller, contextPropIfNotDomElement, identity, viewportStyle, } from './List';
|
|
11
11
|
import { listSystem } from './listSystem';
|
|
12
|
+
import conditionalFlushSync from './utils/conditionalFlushSync';
|
|
12
13
|
import { correctItemSize } from './utils/correctItemSize';
|
|
13
14
|
var tableComponentPropsSystem = system(function () {
|
|
14
15
|
var itemContent = statefulStream(function (index) { return React.createElement("td", null,
|
|
@@ -37,6 +38,7 @@ var tableComponentPropsSystem = system(function () {
|
|
|
37
38
|
ScrollerComponent: distinctProp('Scroller', 'div'),
|
|
38
39
|
EmptyPlaceholder: distinctProp('EmptyPlaceholder'),
|
|
39
40
|
ScrollSeekPlaceholder: distinctProp('ScrollSeekPlaceholder'),
|
|
41
|
+
FillerRow: distinctProp('FillerRow'),
|
|
40
42
|
};
|
|
41
43
|
});
|
|
42
44
|
var combinedSystem = system(function (_a) {
|
|
@@ -48,14 +50,22 @@ var DefaultScrollSeekPlaceholder = function (_a) {
|
|
|
48
50
|
return (React.createElement("tr", null,
|
|
49
51
|
React.createElement("td", { style: { height: height } })));
|
|
50
52
|
};
|
|
51
|
-
var
|
|
53
|
+
var DefaultFillerRow = function (_a) {
|
|
52
54
|
var height = _a.height;
|
|
53
55
|
return (React.createElement("tr", null,
|
|
54
56
|
React.createElement("td", { style: { height: height, padding: 0, border: 0 } })));
|
|
55
57
|
};
|
|
56
58
|
export var Items = React.memo(function VirtuosoItems() {
|
|
57
59
|
var listState = useEmitterValue('listState');
|
|
58
|
-
var
|
|
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
|
+
});
|
|
59
69
|
var sizeRanges = usePublisher('sizeRanges');
|
|
60
70
|
var useWindowScroll = useEmitterValue('useWindowScroll');
|
|
61
71
|
var customScrollParent = useEmitterValue('customScrollParent');
|
|
@@ -71,6 +81,7 @@ export var Items = React.memo(function VirtuosoItems() {
|
|
|
71
81
|
var ref = useChangedListContentsSizes(sizeRanges, itemSize, trackItemSizes, scrollContainerStateCallback, log, customScrollParent);
|
|
72
82
|
var EmptyPlaceholder = useEmitterValue('EmptyPlaceholder');
|
|
73
83
|
var ScrollSeekPlaceholder = useEmitterValue('ScrollSeekPlaceholder') || DefaultScrollSeekPlaceholder;
|
|
84
|
+
var FillerRow = useEmitterValue('FillerRow') || DefaultFillerRow;
|
|
74
85
|
var TableBodyComponent = useEmitterValue('TableBodyComponent');
|
|
75
86
|
var TableRowComponent = useEmitterValue('TableRowComponent');
|
|
76
87
|
var computeItemKey = useEmitterValue('computeItemKey');
|
|
@@ -155,6 +166,7 @@ export var Table = (_a = systemToComponent(combinedSystem, {
|
|
|
155
166
|
customScrollParent: 'customScrollParent',
|
|
156
167
|
scrollerRef: 'scrollerRef',
|
|
157
168
|
logLevel: 'logLevel',
|
|
169
|
+
react18ConcurrentRendering: 'react18ConcurrentRendering',
|
|
158
170
|
},
|
|
159
171
|
methods: {
|
|
160
172
|
scrollToIndex: 'scrollToIndex',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __read } from "tslib";
|
|
2
1
|
import * as u from '@virtuoso.dev/urx';
|
|
3
2
|
export var domIOSystem = u.system(function () {
|
|
4
3
|
var scrollContainerState = u.stream();
|
|
@@ -13,12 +12,13 @@ export var domIOSystem = u.system(function () {
|
|
|
13
12
|
var scrollTo = u.stream();
|
|
14
13
|
var scrollBy = u.stream();
|
|
15
14
|
var scrollingInProgress = u.statefulStream(false);
|
|
15
|
+
var react18ConcurrentRendering = u.statefulStream(false);
|
|
16
16
|
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
17
|
-
var
|
|
17
|
+
var scrollTop = _a.scrollTop;
|
|
18
18
|
return scrollTop;
|
|
19
19
|
})), scrollTop);
|
|
20
20
|
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
21
|
-
var
|
|
21
|
+
var scrollHeight = _a.scrollHeight;
|
|
22
22
|
return scrollHeight;
|
|
23
23
|
})), scrollHeight);
|
|
24
24
|
u.connect(scrollTop, statefulScrollTop);
|
|
@@ -31,6 +31,7 @@ export var domIOSystem = u.system(function () {
|
|
|
31
31
|
footerHeight: footerHeight,
|
|
32
32
|
scrollHeight: scrollHeight,
|
|
33
33
|
smoothScrollTargetReached: smoothScrollTargetReached,
|
|
34
|
+
react18ConcurrentRendering: react18ConcurrentRendering,
|
|
34
35
|
// signals
|
|
35
36
|
scrollTo: scrollTo,
|
|
36
37
|
scrollBy: scrollBy,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-continue */
|
|
2
1
|
import { useRcPortalWindowContext } from '../../../../foundation';
|
|
3
2
|
import { LogLevel } from '../loggerSystem';
|
|
4
3
|
import useSize from './useSize';
|
|
@@ -17,15 +16,11 @@ export default function useChangedListContentsSizes(callback, itemSize, enabled,
|
|
|
17
16
|
? externalWindow.pageYOffset ||
|
|
18
17
|
externalWindow.document.documentElement.scrollTop
|
|
19
18
|
: scrollableElement.scrollTop;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
: scrollContainerStateCallback([
|
|
26
|
-
Math.max(scrollTop, 0),
|
|
27
|
-
scrollableElement.scrollHeight,
|
|
28
|
-
]);
|
|
19
|
+
scrollContainerStateCallback({
|
|
20
|
+
scrollTop: Math.max(scrollTop, 0),
|
|
21
|
+
scrollHeight: (customScrollParent !== null && customScrollParent !== void 0 ? customScrollParent : scrollableElement).scrollHeight,
|
|
22
|
+
viewportHeight: (customScrollParent !== null && customScrollParent !== void 0 ? customScrollParent : scrollableElement).offsetHeight,
|
|
23
|
+
});
|
|
29
24
|
if (ranges !== null) {
|
|
30
25
|
callback(ranges);
|
|
31
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import * as u from '@virtuoso.dev/urx';
|
|
3
|
-
import { correctItemSize } from '../utils/correctItemSize';
|
|
4
3
|
import { useRcPortalWindowContext } from '../../../../foundation';
|
|
4
|
+
import { correctItemSize } from '../utils/correctItemSize';
|
|
5
5
|
function approximatelyEqual(num1, num2) {
|
|
6
6
|
return Math.abs(num1 - num2) < 1.01;
|
|
7
7
|
}
|
|
@@ -21,7 +21,14 @@ export default function useScrollTop(scrollContainerStateCallback, smoothScrollT
|
|
|
21
21
|
var scrollHeight = el === externalWindow
|
|
22
22
|
? externalWindow.document.documentElement.scrollHeight
|
|
23
23
|
: el.scrollHeight;
|
|
24
|
-
|
|
24
|
+
var viewportHeight = el === externalWindow
|
|
25
|
+
? externalWindow.innerHeight
|
|
26
|
+
: el.offsetHeight;
|
|
27
|
+
scrollContainerStateCallback({
|
|
28
|
+
scrollTop: Math.max(scrollTop, 0),
|
|
29
|
+
scrollHeight: scrollHeight,
|
|
30
|
+
viewportHeight: viewportHeight,
|
|
31
|
+
});
|
|
25
32
|
if (scrollTopTarget.current !== null) {
|
|
26
33
|
if (scrollTop === scrollTopTarget.current ||
|
|
27
34
|
scrollTop <= 0 ||
|
|
@@ -66,7 +73,7 @@ export default function useScrollTop(scrollContainerStateCallback, smoothScrollT
|
|
|
66
73
|
if (scrollerElement === externalWindow) {
|
|
67
74
|
// this is not a mistake
|
|
68
75
|
scrollHeight = Math.max(correctItemSize(externalWindow.document.documentElement, 'height'), externalWindow.document.documentElement.scrollHeight);
|
|
69
|
-
offsetHeight = externalWindow.
|
|
76
|
+
offsetHeight = externalWindow.innerHeight;
|
|
70
77
|
scrollTop = externalWindow.document.documentElement.scrollTop;
|
|
71
78
|
}
|
|
72
79
|
else {
|
|
@@ -81,7 +88,11 @@ export default function useScrollTop(scrollContainerStateCallback, smoothScrollT
|
|
|
81
88
|
// scroller is already at this location
|
|
82
89
|
if (approximatelyEqual(offsetHeight, scrollHeight) ||
|
|
83
90
|
location.top === scrollTop) {
|
|
84
|
-
scrollContainerStateCallback(
|
|
91
|
+
scrollContainerStateCallback({
|
|
92
|
+
scrollTop: scrollTop,
|
|
93
|
+
scrollHeight: scrollHeight,
|
|
94
|
+
viewportHeight: offsetHeight,
|
|
95
|
+
});
|
|
85
96
|
if (isSmooth) {
|
|
86
97
|
smoothScrollTargetReached(true);
|
|
87
98
|
}
|
|
@@ -104,9 +115,7 @@ export default function useScrollTop(scrollContainerStateCallback, smoothScrollT
|
|
|
104
115
|
scrollerElement.scrollTo(location);
|
|
105
116
|
}
|
|
106
117
|
function scrollByCallback(location) {
|
|
107
|
-
|
|
108
|
-
scrollerRef.current.scrollBy(location);
|
|
109
|
-
}
|
|
118
|
+
scrollerRef.current.scrollBy(location);
|
|
110
119
|
}
|
|
111
120
|
return { scrollerRef: scrollerRef, scrollByCallback: scrollByCallback, scrollToCallback: scrollToCallback };
|
|
112
121
|
}
|
|
@@ -10,8 +10,8 @@ export default function useWindowViewportRectRef(callback, customScrollParent) {
|
|
|
10
10
|
}
|
|
11
11
|
var rect = element.getBoundingClientRect();
|
|
12
12
|
var visibleWidth = rect.width;
|
|
13
|
-
var
|
|
14
|
-
var offsetTop;
|
|
13
|
+
// eslint-disable-next-line one-var
|
|
14
|
+
var visibleHeight, offsetTop;
|
|
15
15
|
if (customScrollParent) {
|
|
16
16
|
var customScrollParentRect = customScrollParent.getBoundingClientRect();
|
|
17
17
|
var deltaTop = rect.top - customScrollParentRect.top;
|
|
@@ -21,7 +21,7 @@ export var initialTopMostItemIndexSystem = u.system(function (_a) {
|
|
|
21
21
|
u.connect(u.pipe(didMount, u.withLatestFrom(initialTopMostItemIndex),
|
|
22
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
23
|
u.filter(function (_a) {
|
|
24
|
-
var _b = __read(_a, 2), location = _b[1];
|
|
24
|
+
var _b = __read(_a, 2), _ = _b[0], location = _b[1];
|
|
25
25
|
return !!location;
|
|
26
26
|
}), u.mapTo(false)), scrolledToInitialItem);
|
|
27
27
|
u.subscribe(u.pipe(u.combineLatest(listRefresh, didMount), u.withLatestFrom(scrolledToInitialItem, sizes, defaultItemSize), u.filter(function (_a) {
|
|
@@ -29,7 +29,7 @@ export var stateFlagsSystem = u.system(function (_a) {
|
|
|
29
29
|
u.connect(u.pipe(u.duc(scrollTop), u.map(function (top) { return top === 0; }), u.distinctUntilChanged()), isAtTop);
|
|
30
30
|
u.connect(isAtTop, atTopStateChange);
|
|
31
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 =
|
|
32
|
+
var _b = __read(_a, 5), _c = _b[0], scrollTop = _c.scrollTop, scrollHeight = _c.scrollHeight, viewportHeight = _b[1], _headerHeight = _b[2], _footerHeight = _b[3], atBottomThreshold = _b[4];
|
|
33
33
|
var isAtBottom = scrollTop + viewportHeight - scrollHeight > -atBottomThreshold;
|
|
34
34
|
var state = {
|
|
35
35
|
viewportHeight: viewportHeight,
|
|
@@ -78,9 +78,10 @@ export var stateFlagsSystem = u.system(function (_a) {
|
|
|
78
78
|
return prev && prev.atBottom === next.atBottom;
|
|
79
79
|
})));
|
|
80
80
|
var lastJumpDueToItemResize = u.statefulStreamFromEmitter(u.pipe(scrollContainerState, u.scan(function (current, _a) {
|
|
81
|
-
var
|
|
81
|
+
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, viewportHeight = _a.viewportHeight;
|
|
82
82
|
if (current.scrollHeight !== scrollHeight) {
|
|
83
|
-
|
|
83
|
+
var atBottom = scrollTop === scrollHeight - viewportHeight;
|
|
84
|
+
if (current.scrollTop !== scrollTop && atBottom) {
|
|
84
85
|
return {
|
|
85
86
|
scrollHeight: scrollHeight,
|
|
86
87
|
scrollTop: scrollTop,
|
|
@@ -106,7 +107,7 @@ export var stateFlagsSystem = u.system(function (_a) {
|
|
|
106
107
|
u.connect(u.pipe(isAtBottom, u.throttleTime(50)), atBottomStateChange);
|
|
107
108
|
var scrollDirection = u.statefulStream(DOWN);
|
|
108
109
|
u.connect(u.pipe(scrollContainerState, u.map(function (_a) {
|
|
109
|
-
var
|
|
110
|
+
var scrollTop = _a.scrollTop;
|
|
110
111
|
return scrollTop;
|
|
111
112
|
}), u.distinctUntilChanged(), u.scan(function (acc, scrollTop) {
|
|
112
113
|
// if things change while compensating for items, ignore,
|
|
@@ -7,6 +7,10 @@ export var totalListHeightSystem = u.system(function (_a) {
|
|
|
7
7
|
var totalListHeightChanged = u.stream();
|
|
8
8
|
var totalListHeight = u.statefulStreamFromEmitter(u.pipe(u.combineLatest(footerHeight, headerHeight, listState), u.map(function (_a) {
|
|
9
9
|
var _b = __read(_a, 3), footerHeight = _b[0], headerHeight = _b[1], listState = _b[2];
|
|
10
|
+
// FIXME: this footerHeight, headerHeight calculate is not correct, should find where to apply totalListHeightSystem
|
|
11
|
+
// console.log('-------- [totalListHeightSystem Log] --------');
|
|
12
|
+
// console.log(footerHeight, headerHeight, listState);
|
|
13
|
+
// console.log('---------------- [Log End] ----------------');
|
|
10
14
|
return (footerHeight +
|
|
11
15
|
headerHeight +
|
|
12
16
|
listState.offsetBottom +
|