[AURORA-1060] - добавлен лоадер для таблицы
This commit is contained in:
parent
43703866aa
commit
a47d2e58d0
@ -22,9 +22,10 @@ import {
|
|||||||
} from './constants/tableConfig';
|
} from './constants/tableConfig';
|
||||||
import { useRealtime } from './contexts/RealtimeContext';
|
import { useRealtime } from './contexts/RealtimeContext';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
import { CircularProgress } from '@mui/material';
|
||||||
|
|
||||||
const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
||||||
const { data, setData } = useRealtimeData(formId, sheetName, direction);
|
const { data, setData, isLoading: isTableLoading } = useRealtimeData(formId, sheetName, direction);
|
||||||
const [globalFilter, setGlobalFilter] = useState('');
|
const [globalFilter, setGlobalFilter] = useState('');
|
||||||
const [showColumnFilters, setShowColumnFilters] = useState(false);
|
const [showColumnFilters, setShowColumnFilters] = useState(false);
|
||||||
const [selectedColumn, setSelectedColumn] = useState();
|
const [selectedColumn, setSelectedColumn] = useState();
|
||||||
@ -149,7 +150,8 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
columnVisibility,
|
columnVisibility,
|
||||||
globalFilter,
|
globalFilter,
|
||||||
showColumnFilters,
|
showColumnFilters,
|
||||||
rowSelection
|
rowSelection,
|
||||||
|
isLoading: isTableLoading,
|
||||||
},
|
},
|
||||||
initialState: {
|
initialState: {
|
||||||
expanded: true
|
expanded: true
|
||||||
@ -196,6 +198,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
containerRef,
|
containerRef,
|
||||||
tableMeta,
|
tableMeta,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
|
isTableLoading,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -234,10 +237,6 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
setRowSelection({});
|
setRowSelection({});
|
||||||
}, [rowSelection, table])
|
}, [rowSelection, table])
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
return <div>Загрузка...</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SettingsPanel
|
<SettingsPanel
|
||||||
@ -269,6 +268,22 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
>
|
>
|
||||||
<MaterialReactTable table={table} />
|
<MaterialReactTable table={table} />
|
||||||
|
|
||||||
|
{isTableLoading && (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
inset: 0,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
background: 'rgba(255, 255, 255, 0.6)',
|
||||||
|
zIndex: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircularProgress />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{headerPortalRef.current &&
|
{headerPortalRef.current &&
|
||||||
createPortal(
|
createPortal(
|
||||||
<TableHead
|
<TableHead
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user