color for 4 form ahr cap oper
This commit is contained in:
parent
c754dc2b0b
commit
b55f80aa58
@ -275,6 +275,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
columnsConfig,
|
columnsConfig,
|
||||||
columnsCurStage,
|
columnsCurStage,
|
||||||
userRoleId,
|
userRoleId,
|
||||||
|
sheetName,
|
||||||
onCellNumberClick: handleClickRowCell,
|
onCellNumberClick: handleClickRowCell,
|
||||||
onCellUpdateError: handleCellUpdateError,
|
onCellUpdateError: handleCellUpdateError,
|
||||||
isCellInvalid,
|
isCellInvalid,
|
||||||
@ -283,7 +284,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
console.error('Error creating columns:', error);
|
console.error('Error creating columns:', error);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}, [columnsConfig, columnsCurStage, userRoleId, handleCellUpdateError, handleClickRowCell, handleUpdateCell, isCellInvalid]);
|
}, [columnsConfig, columnsCurStage, userRoleId, sheetName, handleCellUpdateError, handleClickRowCell, handleUpdateCell, isCellInvalid]);
|
||||||
|
|
||||||
// MRT запоминает индексы pinned-колонок до завершения асинхронной
|
// MRT запоминает индексы pinned-колонок до завершения асинхронной
|
||||||
// загрузки конфигурации. Новая ссылка на columnPinning заставляет
|
// загрузки конфигурации. Новая ссылка на columnPinning заставляет
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { blueColumn, greenColumn, orangeColumn } from "./columnColors";
|
import { blueColumn, greenColumn, orangeColumn } from './columnColors';
|
||||||
|
|
||||||
export const columnPinningDefault = {
|
export const columnPinningDefault = {
|
||||||
left: ['mrt-row-expand', 'sort_order'],
|
left: ['mrt-row-expand', 'sort_order'],
|
||||||
@ -7,4 +7,5 @@ export const columnPinningDefault = {
|
|||||||
|
|
||||||
export const columnVisibilityDefault = { 'mrt-row-select': false };
|
export const columnVisibilityDefault = { 'mrt-row-select': false };
|
||||||
|
|
||||||
export const sectionCodeColor = { 1: greenColumn, 3: orangeColumn, 4: blueColumn}
|
export const sectionCodeColor = { 1: greenColumn, 3: orangeColumn, 4: blueColumn };
|
||||||
|
export const SECTION_CODE_COLOR_SHEETS = new Set(['SMETA', 'STRUCTURE']);
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import { useVspOptions } from './contexts/RealtimeContext';
|
|||||||
|
|
||||||
import { ROLES_NAME_ID } from '../../constants/constants';
|
import { ROLES_NAME_ID } from '../../constants/constants';
|
||||||
import { blueColumn } from './constants/columnColors';
|
import { blueColumn } from './constants/columnColors';
|
||||||
import { sectionCodeColor } from './constants/columnConfig';
|
import { SECTION_CODE_COLOR_SHEETS, sectionCodeColor } from './constants/columnConfig';
|
||||||
|
|
||||||
import VspDropdownEditCell from './Cell/EditCell/VspDropdownEditCell';
|
import VspDropdownEditCell from './Cell/EditCell/VspDropdownEditCell';
|
||||||
|
|
||||||
@ -76,8 +76,14 @@ const EditCellPortal = React.memo(({ cell, table, EditCell, onError, isEditable
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
function getColorCell(colors, column, row) {
|
function getColorCell(colors, column, row, sheetName) {
|
||||||
const rowType = row?.original?.row_type || row?.row_type;
|
const rowType = row?.original?.row_type || row?.row_type;
|
||||||
|
const configuredColor = colors[column.id]?.color_type?.[rowType];
|
||||||
|
|
||||||
|
if (!SECTION_CODE_COLOR_SHEETS.has(sheetName)) {
|
||||||
|
return configuredColor;
|
||||||
|
}
|
||||||
|
|
||||||
const sectionCodeValue = row?.original?.data?.section_code ?? row?.original?.data?.header?.section_code;
|
const sectionCodeValue = row?.original?.data?.section_code ?? row?.original?.data?.header?.section_code;
|
||||||
|
|
||||||
if (sectionCodeValue !== null && sectionCodeValue !== undefined && sectionCodeValue !== '') {
|
if (sectionCodeValue !== null && sectionCodeValue !== undefined && sectionCodeValue !== '') {
|
||||||
@ -85,7 +91,7 @@ function getColorCell(colors, column, row) {
|
|||||||
return (sectionCodeColor[sectionCode] || blueColumn)[rowType];
|
return (sectionCodeColor[sectionCode] || blueColumn)[rowType];
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors[column.id]?.color_type?.[rowType];
|
return configuredColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UPPERCASE_MONTH_PATTERN = /ЯНВАРЬ|ФЕВРАЛЬ|МАРТ|АПРЕЛЬ|МАЙ|ИЮНЬ|ИЮЛЬ|АВГУСТ|СЕНТЯБРЬ|ОКТЯБРЬ|НОЯБРЬ|ДЕКАБРЬ/g;
|
const UPPERCASE_MONTH_PATTERN = /ЯНВАРЬ|ФЕВРАЛЬ|МАРТ|АПРЕЛЬ|МАЙ|ИЮНЬ|ИЮЛЬ|АВГУСТ|СЕНТЯБРЬ|ОКТЯБРЬ|НОЯБРЬ|ДЕКАБРЬ/g;
|
||||||
@ -112,6 +118,7 @@ export const getTableColumns = ({
|
|||||||
columnsConfig,
|
columnsConfig,
|
||||||
columnsCurStage,
|
columnsCurStage,
|
||||||
userRoleId,
|
userRoleId,
|
||||||
|
sheetName,
|
||||||
onCellUpdateError,
|
onCellUpdateError,
|
||||||
onCellNumberClick,
|
onCellNumberClick,
|
||||||
isCellInvalid,
|
isCellInvalid,
|
||||||
@ -135,7 +142,7 @@ export const getTableColumns = ({
|
|||||||
const value = row.getValue(column.id);
|
const value = row.getValue(column.id);
|
||||||
const isInvalid = isCellInvalid?.(column.id, value, row.original) || false;
|
const isInvalid = isCellInvalid?.(column.id, value, row.original) || false;
|
||||||
const isEditableCell = isEditable(row, column);
|
const isEditableCell = isEditable(row, column);
|
||||||
const backgroundColor = getColorCell(columnColors, column, row);
|
const backgroundColor = getColorCell(columnColors, column, row, sheetName);
|
||||||
if (!cellPropsCache.has(row)) {
|
if (!cellPropsCache.has(row)) {
|
||||||
cellPropsCache.set(row, {});
|
cellPropsCache.set(row, {});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user