From 3b6c59e705000e9c5f046889f03f85fb397b13d9 Mon Sep 17 00:00:00 2001 From: tlartem Date: Fri, 18 Jul 2025 15:20:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B6=D0=B5=D0=BB=D1=82=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=8F=D1=87=D0=B5=D0=B9=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DualSpreadsheet/DualSpreadsheet.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/components/DualSpreadsheet/DualSpreadsheet.tsx b/src/components/DualSpreadsheet/DualSpreadsheet.tsx index 663e129..ec0c892 100644 --- a/src/components/DualSpreadsheet/DualSpreadsheet.tsx +++ b/src/components/DualSpreadsheet/DualSpreadsheet.tsx @@ -711,6 +711,7 @@ const DualSpreadsheet: FC = ({ useEffect(() => { const reportTemplate = templateData?.[SHEET_NAMES.report] + if (reportTemplate) { // Очищаем старые значения initialTemplateValues.current = {} @@ -774,10 +775,23 @@ const DualSpreadsheet: FC = ({ const cellName = getColumnLabel(col) + (row + 1) const templateValue = initialTemplateValues.current[cellName] ?? '' + + // Нормализуем значения для сравнения + const normalizeValue = (value: any): string => { + if (value === null || value === undefined) return '' + const str = String(value).trim() + // Считаем "0" и пустую строку эквивалентными + if (str === '0' || str === '') return '' + return str + } + + const normalizedTemplate = normalizeValue(templateValue) + const normalizedRaw = normalizeValue(rawValue) + const isModified = sheetType === 'report' && - templateValue !== '' && - rawValue !== templateValue + normalizedTemplate !== '' && + normalizedRaw !== normalizedTemplate cachedData[cellKey] = { displayValue,