Compare commits

..

2 Commits

Author SHA1 Message Date
PotapovaA
bc4e5122c6 Merge branch 'front-projects' of https://git.aepif.ru/RSHB/DFiP_Budget_planing into front-projects 2026-07-03 13:27:51 +03:00
PotapovaA
acd4645a4e fix aurora-1149 2026-07-03 12:46:05 +03:00
2 changed files with 5 additions and 12 deletions

View File

@ -72,7 +72,6 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
if (isFormula(curValue)) { if (isFormula(curValue)) {
// Сохраняем формулу в localStorage // Сохраняем формулу в localStorage
saveToStorage(storageKey, curValue); saveToStorage(storageKey, curValue);
// Вычисляем и сохраняем результат // Вычисляем и сохраняем результат
try { try {
const formula = extractFormula(curValue); const formula = extractFormula(curValue);
@ -112,6 +111,9 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
}; };
const finishEditing = () => { const finishEditing = () => {
if (!disabled) {
handleSave();
}
const editingCell = table.getState().editingCell || null; const editingCell = table.getState().editingCell || null;
if (editingCell) { if (editingCell) {
contextEndEditing?.(editingCell.row, editingCell.column); contextEndEditing?.(editingCell.row, editingCell.column);
@ -132,7 +134,7 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
return () => { return () => {
document.removeEventListener('mousedown', handleClickOutside); document.removeEventListener('mousedown', handleClickOutside);
}; };
}, [ref]); }, [ref, finishEditing]);
return ( return (
<tr> <tr>
@ -176,16 +178,10 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
}} }}
onChange={handleChangeValue} onChange={handleChangeValue}
value={curValue} value={curValue}
onBlur={handleSave}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && !e.shiftKey) { if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault(); e.preventDefault();
handleSave(); finishEditing();
// Закрываем редактирование
if (onChange) {
// Симулируем завершение редактирования
document.activeElement?.blur();
}
} }
}} }}
placeholder={isFormulaMode ? 'Введите формулу (начинается с =)' : ''} placeholder={isFormulaMode ? 'Введите формулу (начинается с =)' : ''}

View File

@ -63,7 +63,6 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
addRow: contextAddRow, addRow: contextAddRow,
deleteRow: contextDeleteRow, deleteRow: contextDeleteRow,
startEditing: contextStartEditing, startEditing: contextStartEditing,
endEditing: contextEndEditing,
} = useRealtime(); } = useRealtime();
const { const {
@ -181,8 +180,6 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
if (cell) { if (cell) {
if (editingCell) return; if (editingCell) return;
contextStartEditing?.(cell.row, cell.column); contextStartEditing?.(cell.row, cell.column);
} else {
contextEndEditing?.(editingCell.row, editingCell.column);
} }
}, },
columnVirtualizerOptions: ({ table }) => ({ columnVirtualizerOptions: ({ table }) => ({