u
This commit is contained in:
@@ -14,6 +14,7 @@ import { alpha } from '@mui/material/styles';
|
|||||||
*
|
*
|
||||||
* @prop {Array} items - Wheel flips pages.
|
* @prop {Array} items - Wheel flips pages.
|
||||||
* @prop {React.ComponentType|Function} renderItem - Row renderer (component or callback).
|
* @prop {React.ComponentType|Function} renderItem - Row renderer (component or callback).
|
||||||
|
* @prop {React.ReactNode} [header] - Rendered below pagination controls and above the list items.
|
||||||
* @prop {number} [minPageSize=10] - Rows per page.
|
* @prop {number} [minPageSize=10] - Rows per page.
|
||||||
* @prop {number} [maxPageSize] - Maximum rows per page.
|
* @prop {number} [maxPageSize] - Maximum rows per page.
|
||||||
* @prop {number} [totalCount] - Total items in unfiltered dataset. When unfiltered count <= pageSize, pagination header is removed entirely. When filtering, the header height is preserved to prevent layout shift.
|
* @prop {number} [totalCount] - Total items in unfiltered dataset. When unfiltered count <= pageSize, pagination header is removed entirely. When filtering, the header height is preserved to prevent layout shift.
|
||||||
@@ -104,7 +105,8 @@ class FillSpace extends Component {
|
|||||||
prevProps.belowRef !== this.props.belowRef ||
|
prevProps.belowRef !== this.props.belowRef ||
|
||||||
prevProps.containerRef !== this.props.containerRef ||
|
prevProps.containerRef !== this.props.containerRef ||
|
||||||
prevProps.reserveBottom !== this.props.reserveBottom ||
|
prevProps.reserveBottom !== this.props.reserveBottom ||
|
||||||
prevProps.items !== this.props.items
|
prevProps.items !== this.props.items ||
|
||||||
|
prevProps.header !== this.props.header
|
||||||
) {
|
) {
|
||||||
this._observe();
|
this._observe();
|
||||||
this._viewportMeasure();
|
this._viewportMeasure();
|
||||||
@@ -126,7 +128,11 @@ class FillSpace extends Component {
|
|||||||
);
|
);
|
||||||
if (this.state.currentPage > pageCount) {
|
if (this.state.currentPage > pageCount) {
|
||||||
this.setState({ currentPage: pageCount });
|
this.setState({ currentPage: pageCount });
|
||||||
this.props.onPageChange?.(pageCount);
|
this.props.onPageChange?.(pageCount, {
|
||||||
|
pageCount,
|
||||||
|
pageSize: this.state.pageSize,
|
||||||
|
total: this.props.items.length,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -267,7 +273,7 @@ class FillSpace extends Component {
|
|||||||
const next = Math.min(Math.max(1, Number(page) || 1), pageCount);
|
const next = Math.min(Math.max(1, Number(page) || 1), pageCount);
|
||||||
if (next === this.state.currentPage) return;
|
if (next === this.state.currentPage) return;
|
||||||
this.setState({ currentPage: next });
|
this.setState({ currentPage: next });
|
||||||
onPageChange?.(next);
|
onPageChange?.(next, { pageCount, pageSize: this.state.pageSize, total });
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -289,6 +295,7 @@ class FillSpace extends Component {
|
|||||||
debug = false,
|
debug = false,
|
||||||
items,
|
items,
|
||||||
renderItem,
|
renderItem,
|
||||||
|
header,
|
||||||
sx,
|
sx,
|
||||||
...rest
|
...rest
|
||||||
} = this.props;
|
} = this.props;
|
||||||
@@ -364,6 +371,7 @@ class FillSpace extends Component {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) : null}
|
||||||
|
{header}
|
||||||
<Box
|
<Box
|
||||||
ref={(el) => {
|
ref={(el) => {
|
||||||
this.ref = el;
|
this.ref = el;
|
||||||
|
|||||||
Reference in New Issue
Block a user