29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
const _excluded = ["error", "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 {
|
|
error
|
|
} = 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: error?.message || defaultLabel
|
|
}));
|
|
}); |