UNPKG

@adaptabletools/adaptable-cjs

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

29 lines (28 loc) 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdaptableLoadingScreen = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const Dialog_1 = tslib_1.__importDefault(require("../../../components/Dialog")); const rebass_1 = require("rebass"); function AdaptableLoadingScreen(props) { const { showLoadingScreen, loadingScreenDelay, loadingScreenTitle, loadingScreenText } = props; const [delayElapsed, setDelayElapsed] = React.useState(typeof loadingScreenDelay === 'number' ? false : showLoadingScreen); React.useEffect(() => { if (typeof loadingScreenDelay === 'number') { const timeoutId = setTimeout(() => { setDelayElapsed(true); }, loadingScreenDelay); return () => { clearTimeout(timeoutId); }; } }, [loadingScreenDelay]); return (React.createElement(Dialog_1.default, { modal: true, isOpen: delayElapsed ? showLoadingScreen : false, onDismiss: props.onClose, showCloseButton: false, className: "ab-LoadingScreen", style: { minHeight: 'auto', } }, React.createElement(rebass_1.Box, { padding: 3 }, React.createElement("h4", null, loadingScreenTitle ?? 'Initialising Grid'), React.createElement("p", null, loadingScreenText ?? 'Retrieving your settings and setting up the grid...')))); } exports.AdaptableLoadingScreen = AdaptableLoadingScreen;