Compare commits
No commits in common. "bc4e5122c68b55e940be97d746fc2228cbfe957c" and "2cd80343ab85d97a0e441566a2e37e0e9f598c78" have entirely different histories.
bc4e5122c6
...
2cd80343ab
@ -72,6 +72,7 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
|
||||
if (isFormula(curValue)) {
|
||||
// Сохраняем формулу в localStorage
|
||||
saveToStorage(storageKey, curValue);
|
||||
|
||||
// Вычисляем и сохраняем результат
|
||||
try {
|
||||
const formula = extractFormula(curValue);
|
||||
@ -111,9 +112,6 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
|
||||
};
|
||||
|
||||
const finishEditing = () => {
|
||||
if (!disabled) {
|
||||
handleSave();
|
||||
}
|
||||
const editingCell = table.getState().editingCell || null;
|
||||
if (editingCell) {
|
||||
contextEndEditing?.(editingCell.row, editingCell.column);
|
||||
@ -134,7 +132,7 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', handleClickOutside);
|
||||
};
|
||||
}, [ref, finishEditing]);
|
||||
}, [ref]);
|
||||
|
||||
return (
|
||||
<tr>
|
||||
@ -178,10 +176,16 @@ const EditCell = ({ refCell, onChange, disabled, value, tableId, cellId, table }
|
||||
}}
|
||||
onChange={handleChangeValue}
|
||||
value={curValue}
|
||||
onBlur={handleSave}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
finishEditing();
|
||||
handleSave();
|
||||
// Закрываем редактирование
|
||||
if (onChange) {
|
||||
// Симулируем завершение редактирования
|
||||
document.activeElement?.blur();
|
||||
}
|
||||
}
|
||||
}}
|
||||
placeholder={isFormulaMode ? 'Введите формулу (начинается с =)' : ''}
|
||||
|
||||
@ -63,6 +63,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
||||
addRow: contextAddRow,
|
||||
deleteRow: contextDeleteRow,
|
||||
startEditing: contextStartEditing,
|
||||
endEditing: contextEndEditing,
|
||||
} = useRealtime();
|
||||
|
||||
const {
|
||||
@ -180,6 +181,8 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
||||
if (cell) {
|
||||
if (editingCell) return;
|
||||
contextStartEditing?.(cell.row, cell.column);
|
||||
} else {
|
||||
contextEndEditing?.(editingCell.row, editingCell.column);
|
||||
}
|
||||
},
|
||||
columnVirtualizerOptions: ({ table }) => ({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user