UNPKG

@mui/x-data-grid

Version:

The community edition of the data grid component (MUI X).

29 lines (28 loc) 1.2 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["message", "hasError", "errorInfo"]; import * as React from 'react'; import { useGridApiContext } from '../hooks/utils/useGridApiContext'; import { GridOverlay } from './containers/GridOverlay'; import { useGridSelector } from '../hooks/utils/useGridSelector'; import { gridDensityRowHeightSelector } from '../hooks/features/density/densitySelector'; import { jsx as _jsx } from "react/jsx-runtime"; // TODO v6: rename to GridErrorOverlay export const ErrorOverlay = /*#__PURE__*/React.forwardRef(function ErrorOverlay(props, ref) { const { message } = props, other = _objectWithoutPropertiesLoose(props, _excluded); const apiRef = useGridApiContext(); const defaultLabel = apiRef.current.getLocaleText('errorOverlayDefaultLabel'); const rowHeight = useGridSelector(apiRef, gridDensityRowHeightSelector); return /*#__PURE__*/_jsx(GridOverlay, _extends({ ref: ref, sx: { width: '100%', minHeight: 2 * rowHeight } }, other, { children: message || defaultLabel })); });