UNPKG

@sap-ux/ui-components

Version:

SAP UI Components Library

62 lines 1.58 kB
import React from 'react'; import { List } from 'react-virtualized'; export { defaultCellRangeRenderer, CellMeasurerCache } from 'react-virtualized'; /** * UIVirtualList component. * based on https://github.com/bvaughn/react-virtualized/tree/master/source/List. * * @exports * @class UIVirtualList * @extends {React.Component<ListProps, {}>} */ export class UIVirtualList extends React.Component { /** * Initializes component properties. * * @param {CellMeasurerProps} props */ constructor(props) { super(props); this.listRef = React.createRef(); } forceListUpdate() { if (this.listRef.current) { this.listRef.current.forceUpdate(); } } /** * Scrolls to the row based on index. * * @param index */ scrollToRow(index) { if (this.listRef.current) { this.listRef.current.scrollToRow(index); } } /** * Method to compute row height. * * @param {number} index */ recomputeRowHeights(index) { if (this.listRef.current) { this.listRef.current.recomputeRowHeights(index); } } /** * Method returns state of component isScrolling. * * @returns {boolean} */ isScrolling() { return !!this.listRef.current?.Grid?.state.isScrolling; } /** * @returns {JSX.Element} */ render() { return (React.createElement(List, { ref: this.listRef, ...this.props }, this.props.children)); } } //# sourceMappingURL=UIVirtualList.js.map