иконки новые
This commit is contained in:
parent
cf42e23fcb
commit
e11661a26b
@ -49,6 +49,8 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
||||
const { errors: validationErrors, isCellInvalid } = useValidationRules(
|
||||
data,
|
||||
columnsConfig?.columns,
|
||||
formType,
|
||||
sheetName,
|
||||
);
|
||||
|
||||
const [expanded, setExpanded] = useState(true);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Divider, IconButton, Stack, Tooltip } from '@mui/material';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { FORM_TYPE_OPTIONS } from '../../../constants/constants';
|
||||
import { exportSheet, exportSheetProject } from '../../../utils/exportFile';
|
||||
import { ExportDefaultButton } from '../../common/Buttons/ButtonsActions';
|
||||
@ -7,7 +7,6 @@ import CollapsibleTree from '../../common/CollapsibleTree';
|
||||
import SearchComponent from '../../common/SearchComponent';
|
||||
import {
|
||||
AddLine,
|
||||
AllStageColumns,
|
||||
CurrentStageColumns,
|
||||
HiddenExpenseItems,
|
||||
Minus,
|
||||
@ -17,7 +16,6 @@ import {
|
||||
Project,
|
||||
RemoveLine,
|
||||
Search,
|
||||
VisibleExpenseItems,
|
||||
} from '../../common/icons/icons';
|
||||
import { GroupByObject } from './GroupByObject/GroupByObject';
|
||||
import { Panel } from './SettingPanel.style';
|
||||
@ -104,23 +102,21 @@ const SettingPanel = ({
|
||||
await exportSheet(formId, sheetName, direction);
|
||||
setIsExporting(false);
|
||||
};
|
||||
const leafColumns = useMemo(() => collectLeafColumns({ columns }), [columns]);
|
||||
const stageColumnIds = useMemo(() => new Set([...stageColumnsHiddenFromPicker, ...columnsCurStage]), [columnsCurStage]);
|
||||
const showOnlyCurrentStageColumns = useMemo(() => {
|
||||
if (!columnsCurStage?.length || !leafColumns.length) return false;
|
||||
return leafColumns.every((column) => stageColumnIds.has(column.id) ? columnVisibility[column.id] !== false : columnVisibility[column.id] === false);
|
||||
}, [columnVisibility, columnsCurStage, leafColumns, stageColumnIds]);
|
||||
|
||||
// Переключение между столбцами текущего этапа и всеми столбцами.
|
||||
const handleToggleCurrentStageColumns = useCallback(() => {
|
||||
// Обработчик скрытия всех столбцов кроме текущего этапа
|
||||
const handleShowOnlyCurrentStageColumns = useCallback(() => {
|
||||
if (!columnsCurStage || columnsCurStage.length === 0) {
|
||||
console.warn('Нет столбцов для текущего этапа');
|
||||
return;
|
||||
}
|
||||
for (const column of leafColumns) {
|
||||
onToggleColumnVisibility(column, showOnlyCurrentStageColumns || stageColumnIds.has(column.id));
|
||||
//колонки которые не относятся не к какому этапу
|
||||
const allColumnVisible = [...stageColumnsHiddenFromPicker, ...columnsCurStage];
|
||||
const leafCols = collectLeafColumns({ columns: columns });
|
||||
for (const col of leafCols) {
|
||||
const isColCurStage = allColumnVisible.includes(col.id);
|
||||
onToggleColumnVisibility(col, isColCurStage || (!isColCurStage ^ columnVisibility[col.id]));
|
||||
}
|
||||
}, [columnsCurStage, leafColumns, onToggleColumnVisibility, showOnlyCurrentStageColumns, stageColumnIds]);
|
||||
|
||||
}, [columnsCurStage, columns, onToggleColumnVisibility, columnVisibility]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -186,9 +182,9 @@ const SettingPanel = ({
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<Tooltip title={showOnlyDepth2 ? 'Показать статьи расходов' : 'Скрыть статьи расходов'}>
|
||||
<IconButton onClick={onToggleDepthVisibility} variant='outlined' data-active={showOnlyDepth2} sx={controlSx}>
|
||||
{showOnlyDepth2 ? <VisibleExpenseItems /> : <HiddenExpenseItems />}
|
||||
<Tooltip title='Скрыть статьи расходов'>
|
||||
<IconButton onClick={onToggleDepthVisibility} variant='outlined' sx={controlSx}>
|
||||
<HiddenExpenseItems />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</GroupByObject>
|
||||
@ -200,16 +196,15 @@ const SettingPanel = ({
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
<Tooltip title={showOnlyCurrentStageColumns ? 'Показать все столбцы' : 'Скрыть все столбцы кроме текущих'}>
|
||||
<Tooltip title='Скрыть все столбцы кроме текущих'>
|
||||
<IconButton
|
||||
variant='outlined'
|
||||
sx={controlSx}
|
||||
color='success'
|
||||
data-active={showOnlyCurrentStageColumns}
|
||||
onClick={handleToggleCurrentStageColumns}
|
||||
onClick={handleShowOnlyCurrentStageColumns}
|
||||
disabled={!columnsCurStage || columnsCurStage.length === 0}
|
||||
>
|
||||
{showOnlyCurrentStageColumns ? <AllStageColumns /> : <CurrentStageColumns />}
|
||||
<CurrentStageColumns />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</GroupByObject>
|
||||
|
||||
@ -235,14 +235,6 @@ export const HiddenExpenseItems = ({ size = 20 }) => (
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const VisibleExpenseItems = ({ size = 20 }) => (
|
||||
<svg width={size} height={size} viewBox='0 0 20 20' fill='none' aria-hidden='true'>
|
||||
<path d='M3.25 5.25h9.5M3.25 9.25h7.5M3.25 13.25h5.5' stroke='currentColor' strokeWidth='1.25' strokeLinecap='round' />
|
||||
<path d='M10.25 11.25c.77-1 2.03-2 3.75-2s2.98 1 3.75 2c-.77 1-2.03 2-3.75 2s-2.98-1-3.75-2Z' stroke='currentColor' strokeWidth='1.25' strokeLinecap='round' strokeLinejoin='round' />
|
||||
<circle cx='14' cy='11.25' r='1' fill='currentColor' />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const CurrentStageColumns = ({ size = 20 }) => (
|
||||
<svg width={size} height={size} viewBox='0 0 20 20' fill='none' aria-hidden='true'>
|
||||
<rect x='2.75' y='3.25' width='4' height='13.5' rx='1' stroke='currentColor' strokeWidth='1.25' opacity='.45' />
|
||||
@ -252,15 +244,6 @@ export const CurrentStageColumns = ({ size = 20 }) => (
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const AllStageColumns = ({ size = 20 }) => (
|
||||
<svg width={size} height={size} viewBox='0 0 20 20' fill='none' aria-hidden='true'>
|
||||
<rect x='2.75' y='3.25' width='4' height='13.5' rx='1' stroke='currentColor' strokeWidth='1.25' />
|
||||
<rect x='8' y='3.25' width='4' height='13.5' rx='1' stroke='currentColor' strokeWidth='1.25' />
|
||||
<rect x='13.25' y='3.25' width='4' height='13.5' rx='1' stroke='currentColor' strokeWidth='1.25' />
|
||||
<path d='M4.25 10h1M9.5 10h1M14.75 10h1' stroke='currentColor' strokeWidth='1.25' strokeLinecap='round' />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const Trash = styled.div`
|
||||
background-image: url('images/Trash.svg');
|
||||
width: 1.25rem;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user