Compare commits

..

No commits in common. "abafe0e9a0a49363012b3fa215df1216354d3c77" and "b45722f11b8461e5b457d0caa8c47921fb4ae559" have entirely different histories.

7 changed files with 29 additions and 59 deletions

View File

@ -1,4 +1,4 @@
import React, { useMemo } from 'react'; import React from 'react';
import ColumnResizer from './ColumnResizer'; import ColumnResizer from './ColumnResizer';
import { columnPinningDefault } from '../constants/columnConfig'; import { columnPinningDefault } from '../constants/columnConfig';
@ -149,24 +149,6 @@ const ColumnNumberCell = ({ column, table, selectedColumnId, onColumnSelect }) =
); );
}; };
const getColorBrightness = (hexColor) => {
if (!hexColor) return 255;
const color = hexColor.replace('#', '');
let r, g, b;
if (color.length === 3) {
r = parseInt(color[0] + color[0], 16);
g = parseInt(color[1] + color[1], 16);
b = parseInt(color[2] + color[2], 16);
} else if (color.length === 6) {
r = parseInt(color.substring(0, 2), 16);
g = parseInt(color.substring(2, 4), 16);
b = parseInt(color.substring(4, 6), 16);
} else {
return 255;
}
return (0.299 * r + 0.587 * g + 0.114 * b);
};
const HeaderCell = ({ header, table, onClick, onChangeWidth }) => { const HeaderCell = ({ header, table, onClick, onChangeWidth }) => {
const column = header.column; const column = header.column;
const pinningColumn = getPinnedColumnIds(table); const pinningColumn = getPinnedColumnIds(table);
@ -178,16 +160,12 @@ const HeaderCell = ({ header, table, onClick, onChangeWidth }) => {
const splitGroup = isGroup && isPinned && pinnedBandWidth > 0 && pinnedBandWidth < headerSize; const splitGroup = isGroup && isPinned && pinnedBandWidth > 0 && pinnedBandWidth < headerSize;
const customBgColor = column.columnDef?.muiTableHeadCellProps?.sx?.backgroundColor; const customBgColor = column.columnDef?.muiTableHeadCellProps?.sx?.backgroundColor;
const color = column.columnDef?.muiTableHeadCellProps?.sx?.color || '#000000';
const backgroundColor = customBgColor const backgroundColor = customBgColor
? customBgColor ? customBgColor
: 'rgba(243, 244, 246, 1)'; : 'rgba(243, 244, 246, 1)';
const color = useMemo(() => {
const brightness = getColorBrightness(backgroundColor);
return brightness < 128 ? '#ffffff' : '#000000';
}, [backgroundColor]);
const handleChangeWidth = (deltaWidth) => { const handleChangeWidth = (deltaWidth) => {
const size = header.getSize(); const size = header.getSize();
onChangeWidth(header, size + deltaWidth); onChangeWidth(header, size + deltaWidth);
@ -335,8 +313,8 @@ const FilterCell = ({ column, table }) => {
onChange={(e) => handleFilterChange(e.target.value)} onChange={(e) => handleFilterChange(e.target.value)}
style={{ style={{
width: '100%', width: '100%',
padding: '0.25rem 0.375rem', padding: '0.25rem 0.375rem',
fontSize: '0.6875rem', fontSize: '0.6875rem',
border: '1px solid #ddd', border: '1px solid #ddd',
borderRadius: '0.25rem', borderRadius: '0.25rem',
backgroundColor: 'white', backgroundColor: 'white',
@ -362,8 +340,8 @@ const FilterCell = ({ column, table }) => {
onChange={(e) => column.setFilterValue([e.target.value, max])} onChange={(e) => column.setFilterValue([e.target.value, max])}
style={{ style={{
width: '50%', width: '50%',
padding: '0.25rem', padding: '0.25rem',
fontSize: '0.6875rem' fontSize: '0.6875rem'
}} }}
/> />
<input <input
@ -373,8 +351,8 @@ const FilterCell = ({ column, table }) => {
onChange={(e) => column.setFilterValue([min, e.target.value])} onChange={(e) => column.setFilterValue([min, e.target.value])}
style={{ style={{
width: '50%', width: '50%',
padding: '0.25rem', padding: '0.25rem',
fontSize: '0.6875rem' fontSize: '0.6875rem'
}} }}
/> />
</div> </div>
@ -393,7 +371,7 @@ const FilterCell = ({ column, table }) => {
padding: '0.25rem 0.375rem', padding: '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',
}} }}
/> />

View File

@ -768,7 +768,7 @@ export const config = {
}, },
columns: [ columns: [
{ {
header: "", header: ".",
accessorKey: "field", accessorKey: "field",
columns: [ columns: [
{ {
@ -1469,7 +1469,7 @@ export const config = {
}, },
}, },
{ {
header: "", header: "..",
accessorKey: "field_4", accessorKey: "field_4",
columns: [ columns: [
{ {

View File

@ -1020,7 +1020,7 @@ export const config = {
}, },
}, },
{ {
header: "Платежи в 2027 году", header: "Платежив 2027 году",
accessorKey: "data.contract_summary.future_payments_y1", accessorKey: "data.contract_summary.future_payments_y1",
columnLetter: "Q", columnLetter: "Q",
size: 190, size: 190,
@ -1033,7 +1033,7 @@ export const config = {
}, },
}, },
{ {
header: "Платежи в 2028 году", header: "Платежив 2028 году",
accessorKey: "data.contract_summary.future_payments_y2", accessorKey: "data.contract_summary.future_payments_y2",
columnLetter: "R", columnLetter: "R",
size: 190, size: 190,
@ -2374,7 +2374,7 @@ export const config = {
header: "Сумма (без НДС)", header: "Сумма (без НДС)",
accessorKey: "data.q2.target_change", accessorKey: "data.q2.target_change",
columnLetter: "DE", columnLetter: "DE",
size: 300, size: 150,
filterFn: "contains", filterFn: "contains",
muiTableHeadCellProps: { muiTableHeadCellProps: {
sx: { sx: {
@ -2399,7 +2399,7 @@ export const config = {
header: "Сумма (без НДС)", header: "Сумма (без НДС)",
accessorKey: "data.q2.base_correction", accessorKey: "data.q2.base_correction",
columnLetter: "DF", columnLetter: "DF",
size: 300, size: 150,
filterFn: "contains", filterFn: "contains",
}, },
], ],

View File

@ -308,7 +308,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Поддержка", header: "ИТОГОПоддержка",
accessorKey: "data.plan.support.year", accessorKey: "data.plan.support.year",
columnLetter: "H", columnLetter: "H",
@ -386,7 +386,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Развитие", header: "ИТОГОРазвитие",
accessorKey: "data.plan.development.year", accessorKey: "data.plan.development.year",
columnLetter: "M", columnLetter: "M",
size: 150, size: 150,
@ -477,7 +477,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Поддержка", header: "ИТОГОПоддержка",
accessorKey: "data.approved.support.year", accessorKey: "data.approved.support.year",
columnLetter: "T", columnLetter: "T",
size: 150, size: 150,
@ -554,7 +554,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Развитие", header: "ИТОГОРазвитие",
accessorKey: "data.approved.development.year", accessorKey: "data.approved.development.year",
columnLetter: "Y", columnLetter: "Y",
size: 150, size: 150,
@ -643,7 +643,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Поддержка", header: "ИТОГОПоддержка",
accessorKey: "data.fact.support.year", accessorKey: "data.fact.support.year",
columnLetter: "AF", columnLetter: "AF",
size: 150, size: 150,
@ -720,7 +720,7 @@ export const config = {
}, },
}, },
{ {
header: "ИТОГО Развитие", header: "ИТОГОРазвитие",
accessorKey: "data.fact.development.year", accessorKey: "data.fact.development.year",
columnLetter: "AK", columnLetter: "AK",
size: 150, size: 150,

View File

@ -764,7 +764,7 @@ export const config = {
}, },
columns: [ columns: [
{ {
header: "", header: ".",
accessorKey: "field", accessorKey: "field",
columns: [ columns: [
{ {
@ -1487,7 +1487,7 @@ export const config = {
}, },
}, },
{ {
header: "", header: "..",
accessorKey: "field_6", accessorKey: "field_6",
columns: [ columns: [
{ {
@ -3953,7 +3953,7 @@ export const config = {
}, },
}, },
{ {
header: "", header: "...",
accessorKey: "field_40", accessorKey: "field_40",
columns: [ columns: [
{ {

View File

@ -238,13 +238,9 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
}); });
}); });
const unsubscribeProgramAdds = subscribeToProgramAdds((msg) => { const unsubscribeProgramAdds = subscribeToProgramAdds((data) => {
let newRow = msg.result[1][0]; const newRow = data.result[1][0];
setData((prevData) => { setData((prevData) => {
const hasRoot = prevData.length > 0 && prevData[0].row_type === "ROOT";
if (hasRoot) {
newRow = msg.result[1][1];
}
const updateData = structuredClone(prevData); const updateData = structuredClone(prevData);
const [row_type, depth, sort_order, dataRow] = newRow; const [row_type, depth, sort_order, dataRow] = newRow;
const newRowObject = { const newRowObject = {
@ -254,11 +250,8 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
subRows: [], subRows: [],
data: dataRow, data: dataRow,
}; };
if (hasRoot) { const newData = [...updateData, newRowObject];
updateData[0].subRows.push(newRowObject); return newData;
return updateData;
}
return [...updateData, newRowObject];
}); });
}); });

View File

@ -25,7 +25,6 @@ const CollapsibleTree = ({
onSelectNode, onSelectNode,
forStage = false forStage = false
}) => { }) => {
const [expandedItems, setExpandedItems] = useState([]); const [expandedItems, setExpandedItems] = useState([]);
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const [selectedNodes, setSelectedNodes] = useState([]); const [selectedNodes, setSelectedNodes] = useState([]);
@ -161,7 +160,7 @@ const CollapsibleTree = ({
const visibleSelectedCount = selectedNodes.filter((id) => const visibleSelectedCount = selectedNodes.filter((id) =>
visibleLeafKeys.includes(id), visibleLeafKeys.includes(id),
).length; ).length;
const selectedCount = visibleSelectedCount; const selectedCount = forStage ? visibleSelectedCount : visibleSelectedCount - 1; //1 колонка всегда скрыта
const isAllSelected = () => { const isAllSelected = () => {
if (!visibleColumnTree.length) return false; if (!visibleColumnTree.length) return false;