добавила колонки + переехала на @babel/traverse@^7.28.5
This commit is contained in:
parent
78a7628b23
commit
15ac95f7d7
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,14 @@ const RealtimeConnectionContext = createContext(null);
|
||||
const RealtimeVspOptionsContext = createContext(null);
|
||||
const LockedCellsStoreContext = createContext(null);
|
||||
|
||||
const getColumnRequestKey = (column) => {
|
||||
const columnKey = column?.columnDef?.id ?? column?.id;
|
||||
if (columnKey === null || columnKey === undefined) return '';
|
||||
|
||||
const normalizedColumnKey = String(columnKey);
|
||||
return normalizedColumnKey.startsWith('data.') ? normalizedColumnKey.slice(5) : normalizedColumnKey;
|
||||
};
|
||||
|
||||
const useRequiredContext = (context, hookName) => {
|
||||
const value = useContext(context);
|
||||
if (value === null) {
|
||||
@ -238,21 +246,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
||||
// Функция для начала редактирования ячейки
|
||||
const startEditing = useCallback(
|
||||
(row, column) => {
|
||||
const columnId = column.id;
|
||||
|
||||
if (!isConnectedRef.current) {
|
||||
onErrorRef.current?.('WebSocket не подключен');
|
||||
return false;
|
||||
}
|
||||
|
||||
const lineId = row.id || null;
|
||||
const colId = columnId.slice(5); // убираем префикс "data."
|
||||
const columnKey = getColumnRequestKey(column);
|
||||
|
||||
const message = {
|
||||
event: 'cell_edit_start',
|
||||
data: {
|
||||
line_id: lineId,
|
||||
column: colId,
|
||||
column: columnKey,
|
||||
},
|
||||
};
|
||||
|
||||
@ -269,21 +275,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
||||
// Функция для завершения редактирования ячейки
|
||||
const endEditing = useCallback(
|
||||
(row, column) => {
|
||||
const columnId = column.id;
|
||||
|
||||
if (!isConnectedRef.current) {
|
||||
onErrorRef.current?.('WebSocket не подключен');
|
||||
return false;
|
||||
}
|
||||
|
||||
const lineId = row.id || null;
|
||||
const colId = columnId.slice(5);
|
||||
const columnKey = getColumnRequestKey(column);
|
||||
|
||||
const message = {
|
||||
event: 'cell_edit_end',
|
||||
data: {
|
||||
line_id: lineId,
|
||||
column: colId,
|
||||
column: columnKey,
|
||||
},
|
||||
};
|
||||
|
||||
@ -299,20 +303,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
||||
|
||||
const updateCell = useCallback(
|
||||
(row, column, value) => {
|
||||
const columnId = column.id;
|
||||
if (!isConnectedRef.current) {
|
||||
onErrorRef.current?.('WebSocket не подключен');
|
||||
return false;
|
||||
}
|
||||
|
||||
const lineId = getRowId(row);
|
||||
const colId = columnId.slice(5);
|
||||
const columnKey = getColumnRequestKey(column);
|
||||
const message = {
|
||||
event: 'cell_updated',
|
||||
data: {
|
||||
line_id: lineId,
|
||||
line_id_code: row.id,
|
||||
column: colId,
|
||||
column: columnKey,
|
||||
value: value,
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user