Merge pull request 'добавление крестиков у поиска по столбцам' (#321) from aourora-2023_2 into test
Reviewed-on: #321
This commit is contained in:
commit
13ab6fcdbc
@ -619,6 +619,10 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const table = useMaterialReactTable(tableConfig);
|
const table = useMaterialReactTable(tableConfig);
|
||||||
|
const handleChangeShowColumnFilters = useCallback((showFilters) => {
|
||||||
|
if (!showFilters) table.setColumnFilters([]);
|
||||||
|
setShowColumnFilters(showFilters);
|
||||||
|
}, [table]);
|
||||||
const isLoadingData = columns.length > 0;
|
const isLoadingData = columns.length > 0;
|
||||||
|
|
||||||
const handleNavigateToColumn = useCallback(
|
const handleNavigateToColumn = useCallback(
|
||||||
@ -1093,7 +1097,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
searchMatchCount={searchMatches.length}
|
searchMatchCount={searchMatches.length}
|
||||||
searchMatchIndex={searchMatchIndex}
|
searchMatchIndex={searchMatchIndex}
|
||||||
sizeMult={sizeMult}
|
sizeMult={sizeMult}
|
||||||
onChangeShowColumnFilters={setShowColumnFilters}
|
onChangeShowColumnFilters={handleChangeShowColumnFilters}
|
||||||
showColumnFilters={showColumnFilters}
|
showColumnFilters={showColumnFilters}
|
||||||
onAddRow={addRow}
|
onAddRow={addRow}
|
||||||
onAddProgram={addProgram}
|
onAddProgram={addProgram}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import CloseIcon from '@mui/icons-material/Close';
|
||||||
|
import { IconButton } from '@mui/material';
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { getOrderedVisibleColumns } from '../utils/columnLayoutUtils';
|
import { getOrderedVisibleColumns } from '../utils/columnLayoutUtils';
|
||||||
import { formatDeadline } from '../utils/deadlineFormat';
|
import { formatDeadline } from '../utils/deadlineFormat';
|
||||||
@ -302,6 +304,7 @@ const FilterCell = ({ column }) => {
|
|||||||
|
|
||||||
default: // 'text'
|
default: // 'text'
|
||||||
return (
|
return (
|
||||||
|
<div style={{ position: 'relative', width: '100%' }}>
|
||||||
<input
|
<input
|
||||||
type='text'
|
type='text'
|
||||||
value={column.getFilterValue() ?? ''}
|
value={column.getFilterValue() ?? ''}
|
||||||
@ -309,13 +312,33 @@ const FilterCell = ({ column }) => {
|
|||||||
placeholder='Поиск...'
|
placeholder='Поиск...'
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: '0.25rem 0.375rem',
|
padding: '0.25rem 1.75rem 0.25rem 0.375rem',
|
||||||
fontSize: '0.6875rem',
|
fontSize: '0.6875rem',
|
||||||
border: '1px solid #ddd',
|
border: '1px solid #ddd',
|
||||||
borderRadius: '0.25rem',
|
borderRadius: '0.25rem',
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{column.getFilterValue() && (
|
||||||
|
<IconButton
|
||||||
|
aria-label='Очистить фильтр колонки'
|
||||||
|
size='small'
|
||||||
|
onMouseDown={(event) => event.preventDefault()}
|
||||||
|
onClick={() => column.setFilterValue(undefined)}
|
||||||
|
sx={{
|
||||||
|
position: 'absolute',
|
||||||
|
right: '0.25rem',
|
||||||
|
top: '50%',
|
||||||
|
transform: 'translateY(-50%)',
|
||||||
|
width: '1.25rem',
|
||||||
|
height: '1.25rem',
|
||||||
|
padding: 0,
|
||||||
|
color: '#99a1af',
|
||||||
|
}}>
|
||||||
|
<CloseIcon sx={{ fontSize: '1rem' }} />
|
||||||
|
</IconButton>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user