иконки новые
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(
|
const { errors: validationErrors, isCellInvalid } = useValidationRules(
|
||||||
data,
|
data,
|
||||||
columnsConfig?.columns,
|
columnsConfig?.columns,
|
||||||
|
formType,
|
||||||
|
sheetName,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [expanded, setExpanded] = useState(true);
|
const [expanded, setExpanded] = useState(true);
|
||||||
@ -692,4 +694,4 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo(RealtimeTable);
|
export default React.memo(RealtimeTable);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Divider, IconButton, Stack, Tooltip } from '@mui/material';
|
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 { FORM_TYPE_OPTIONS } from '../../../constants/constants';
|
||||||
import { exportSheet, exportSheetProject } from '../../../utils/exportFile';
|
import { exportSheet, exportSheetProject } from '../../../utils/exportFile';
|
||||||
import { ExportDefaultButton } from '../../common/Buttons/ButtonsActions';
|
import { ExportDefaultButton } from '../../common/Buttons/ButtonsActions';
|
||||||
@ -7,7 +7,6 @@ import CollapsibleTree from '../../common/CollapsibleTree';
|
|||||||
import SearchComponent from '../../common/SearchComponent';
|
import SearchComponent from '../../common/SearchComponent';
|
||||||
import {
|
import {
|
||||||
AddLine,
|
AddLine,
|
||||||
AllStageColumns,
|
|
||||||
CurrentStageColumns,
|
CurrentStageColumns,
|
||||||
HiddenExpenseItems,
|
HiddenExpenseItems,
|
||||||
Minus,
|
Minus,
|
||||||
@ -17,7 +16,6 @@ import {
|
|||||||
Project,
|
Project,
|
||||||
RemoveLine,
|
RemoveLine,
|
||||||
Search,
|
Search,
|
||||||
VisibleExpenseItems,
|
|
||||||
} from '../../common/icons/icons';
|
} from '../../common/icons/icons';
|
||||||
import { GroupByObject } from './GroupByObject/GroupByObject';
|
import { GroupByObject } from './GroupByObject/GroupByObject';
|
||||||
import { Panel } from './SettingPanel.style';
|
import { Panel } from './SettingPanel.style';
|
||||||
@ -104,23 +102,21 @@ const SettingPanel = ({
|
|||||||
await exportSheet(formId, sheetName, direction);
|
await exportSheet(formId, sheetName, direction);
|
||||||
setIsExporting(false);
|
setIsExporting(false);
|
||||||
};
|
};
|
||||||
const leafColumns = useMemo(() => collectLeafColumns({ columns }), [columns]);
|
// Обработчик скрытия всех столбцов кроме текущего этапа
|
||||||
const stageColumnIds = useMemo(() => new Set([...stageColumnsHiddenFromPicker, ...columnsCurStage]), [columnsCurStage]);
|
const handleShowOnlyCurrentStageColumns = useCallback(() => {
|
||||||
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(() => {
|
|
||||||
if (!columnsCurStage || columnsCurStage.length === 0) {
|
if (!columnsCurStage || columnsCurStage.length === 0) {
|
||||||
console.warn('Нет столбцов для текущего этапа');
|
console.warn('Нет столбцов для текущего этапа');
|
||||||
return;
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -186,9 +182,9 @@ const SettingPanel = ({
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Tooltip title={showOnlyDepth2 ? 'Показать статьи расходов' : 'Скрыть статьи расходов'}>
|
<Tooltip title='Скрыть статьи расходов'>
|
||||||
<IconButton onClick={onToggleDepthVisibility} variant='outlined' data-active={showOnlyDepth2} sx={controlSx}>
|
<IconButton onClick={onToggleDepthVisibility} variant='outlined' sx={controlSx}>
|
||||||
{showOnlyDepth2 ? <VisibleExpenseItems /> : <HiddenExpenseItems />}
|
<HiddenExpenseItems />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</GroupByObject>
|
</GroupByObject>
|
||||||
@ -200,16 +196,15 @@ const SettingPanel = ({
|
|||||||
) : (
|
) : (
|
||||||
''
|
''
|
||||||
)}
|
)}
|
||||||
<Tooltip title={showOnlyCurrentStageColumns ? 'Показать все столбцы' : 'Скрыть все столбцы кроме текущих'}>
|
<Tooltip title='Скрыть все столбцы кроме текущих'>
|
||||||
<IconButton
|
<IconButton
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
sx={controlSx}
|
sx={controlSx}
|
||||||
color='success'
|
color='success'
|
||||||
data-active={showOnlyCurrentStageColumns}
|
onClick={handleShowOnlyCurrentStageColumns}
|
||||||
onClick={handleToggleCurrentStageColumns}
|
|
||||||
disabled={!columnsCurStage || columnsCurStage.length === 0}
|
disabled={!columnsCurStage || columnsCurStage.length === 0}
|
||||||
>
|
>
|
||||||
{showOnlyCurrentStageColumns ? <AllStageColumns /> : <CurrentStageColumns />}
|
<CurrentStageColumns />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</GroupByObject>
|
</GroupByObject>
|
||||||
|
|||||||
@ -235,14 +235,6 @@ export const HiddenExpenseItems = ({ size = 20 }) => (
|
|||||||
</svg>
|
</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 }) => (
|
export const CurrentStageColumns = ({ size = 20 }) => (
|
||||||
<svg width={size} height={size} viewBox='0 0 20 20' fill='none' aria-hidden='true'>
|
<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' />
|
<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>
|
</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`
|
export const Trash = styled.div`
|
||||||
background-image: url('images/Trash.svg');
|
background-image: url('images/Trash.svg');
|
||||||
width: 1.25rem;
|
width: 1.25rem;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user