diff --git a/src/components/GridNoRowsOverlay.tsx b/src/components/GridNoRowsOverlay.tsx index f5c74415..3e6b0e88 100644 --- a/src/components/GridNoRowsOverlay.tsx +++ b/src/components/GridNoRowsOverlay.tsx @@ -1,7 +1,12 @@ import { LuiStatusSpinner } from "@linzjs/lui"; +import { ForwardedRef, forwardRef } from "react"; -const GridLoadingOverlayComponent = (props: { headerRowHeight: number }) => ( +const GridLoadingOverlayComponentFr = ( + props: { headerRowHeight: number }, + externalRef: ForwardedRef, +) => (
(
); +const GridLoadingOverlayComponent = forwardRef(GridLoadingOverlayComponentFr); + export interface GridNoRowsOverlayProps { loading: boolean; rowCount: number | undefined | null; @@ -28,10 +35,17 @@ export interface GridNoRowsOverlayProps { headerRowHeight: number; } -export const GridNoRowsOverlay = (props: GridNoRowsOverlayProps) => { - if (props.loading) return ; - if (props.rowCount === 0) return
{props.noRowsOverlayText ?? "There are currently no rows"}
; - if (props.filteredRowCount === 0) - return
{props.noRowsMatchingOverlayText ?? "All rows have been filtered"}
; - return ; +export const GridNoRowsOverlayFr = (props: GridNoRowsOverlayProps, externalRef: ForwardedRef) => { + if (props.loading) { + return ; + } + if (props.rowCount === 0) { + return
{props.noRowsOverlayText ?? "There are currently no rows"}
; + } + if (props.filteredRowCount === 0) { + return
{props.noRowsMatchingOverlayText ?? "All rows have been filtered"}
; + } + return
; }; + +export const GridNoRowsOverlay = forwardRef(GridNoRowsOverlayFr);