Исправлено сравнение значений для выпадающих списков и форматирование чисел

- Унифицировано сравнение через normalizeValue() для всех типов ячеек
- Intl.NumberFormat с сохранением исходного количества знаков после запятой

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 22:06:04 +03:00
parent 1f9183f04e
commit f7c90aca76

View File

@@ -509,7 +509,12 @@ async function selectTable(schema, tableName) {
if (value === null || value === undefined || value === '') return '';
const num = parseFloat(value);
if (isNaN(num)) return value;
return num.toLocaleString('ru-RU');
// Определяем количество знаков после запятой из исходного значения
const decimalPlaces = (String(value).split('.')[1] || '').length;
return new Intl.NumberFormat('ru-RU', {
minimumFractionDigits: 0,
maximumFractionDigits: Math.min(decimalPlaces, 6)
}).format(num);
}
}),
// ✅ Добавляем тултип для заголовка
@@ -915,12 +920,12 @@ async function selectTable(schema, tableName) {
const newValue = cell.getValue();
// Проверяем, действительно ли значение изменилось
// Учитываем преобразование типов (число vs строка)
const valuesEqual = oldValue === newValue ||
(oldValue == null && newValue === '') ||
(oldValue === '' && newValue == null) ||
(typeof oldValue === 'number' && String(oldValue) === newValue) ||
(typeof newValue === 'number' && String(newValue) === oldValue);
// Учитываем преобразование типов и пустые значения
const normalizeValue = (v) => {
if (v === null || v === undefined || v === '') return null;
return String(v);
};
const valuesEqual = normalizeValue(oldValue) === normalizeValue(newValue);
if (valuesEqual) {
console.log('⏭️ Значение не изменилось:', cell.getField(), oldValue, '→', newValue);