u
This commit is contained in:
@@ -22,6 +22,7 @@ import { alpha } from '@mui/material/styles';
|
|||||||
* @prop {number} [unfilteredTotal] - Total items in unfiltered dataset. When unfilteredTotal > pageSize, pagination space is reserved even if current filtered count <= pageSize, preventing layout shift.
|
* @prop {number} [unfilteredTotal] - Total items in unfiltered dataset. When unfilteredTotal > pageSize, pagination space is reserved even if current filtered count <= pageSize, preventing layout shift.
|
||||||
* @prop {number} [unfilteredCount] - Alias for unfilteredTotal.
|
* @prop {number} [unfilteredCount] - Alias for unfilteredTotal.
|
||||||
* @prop {(page: number) => void} [onPageChange] - Called on page change.
|
* @prop {(page: number) => void} [onPageChange] - Called on page change.
|
||||||
|
* @prop {boolean} [disableWheel=false] - When true, disables mouse wheel page flipping and lets the outer page scroll.
|
||||||
* @prop {boolean} [virtualScrollbar=false] - Shows a synchronized scrollbar alongside pagination controls.
|
* @prop {boolean} [virtualScrollbar=false] - Shows a synchronized scrollbar alongside pagination controls.
|
||||||
* @prop {boolean} [reserveScrollbar] - Reserves raceway space even when items do not overflow (defaults to true when virtualScrollbar is true).
|
* @prop {boolean} [reserveScrollbar] - Reserves raceway space even when items do not overflow (defaults to true when virtualScrollbar is true).
|
||||||
* @prop {boolean} [debug=false] - Dashed outline for layout debugging.
|
* @prop {boolean} [debug=false] - Dashed outline for layout debugging.
|
||||||
@@ -382,6 +383,7 @@ class FillSpace extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_handleWheel = (event) => {
|
_handleWheel = (event) => {
|
||||||
|
if (this.props.disableWheel) return;
|
||||||
const { items, totalCount } = this.props;
|
const { items, totalCount } = this.props;
|
||||||
if (!Array.isArray(items)) return;
|
if (!Array.isArray(items)) return;
|
||||||
if (this.ref && event.target && !this.ref.contains(event.target)) return;
|
if (this.ref && event.target && !this.ref.contains(event.target)) return;
|
||||||
@@ -437,6 +439,7 @@ class FillSpace extends Component {
|
|||||||
listRef,
|
listRef,
|
||||||
onPageChange,
|
onPageChange,
|
||||||
onWheel,
|
onWheel,
|
||||||
|
disableWheel = false,
|
||||||
virtualScrollbar = false,
|
virtualScrollbar = false,
|
||||||
reserveScrollbar,
|
reserveScrollbar,
|
||||||
racewayMarginBottom,
|
racewayMarginBottom,
|
||||||
@@ -570,7 +573,9 @@ class FillSpace extends Component {
|
|||||||
this.ref = el;
|
this.ref = el;
|
||||||
}}
|
}}
|
||||||
onWheel={(e) => {
|
onWheel={(e) => {
|
||||||
this._handleWheel(e);
|
if (!disableWheel) {
|
||||||
|
this._handleWheel(e);
|
||||||
|
}
|
||||||
onWheel?.(e);
|
onWheel?.(e);
|
||||||
}}
|
}}
|
||||||
{...rest}
|
{...rest}
|
||||||
@@ -580,9 +585,8 @@ class FillSpace extends Component {
|
|||||||
height: viewportHeight ?? 'auto',
|
height: viewportHeight ?? 'auto',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
// Keep wheel ticks from scrolling the page behind the list.
|
// Keep wheel ticks from scrolling the page behind the list unless disableWheel is true.
|
||||||
// (No preventDefault needed — React wheel is passive.)
|
overscrollBehavior: disableWheel ? 'auto' : 'contain',
|
||||||
overscrollBehavior: 'contain',
|
|
||||||
},
|
},
|
||||||
debug
|
debug
|
||||||
? (theme) => ({
|
? (theme) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user