добавила колонки + переехала на @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 RealtimeVspOptionsContext = createContext(null);
|
||||||
const LockedCellsStoreContext = 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 useRequiredContext = (context, hookName) => {
|
||||||
const value = useContext(context);
|
const value = useContext(context);
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
@ -238,21 +246,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
|||||||
// Функция для начала редактирования ячейки
|
// Функция для начала редактирования ячейки
|
||||||
const startEditing = useCallback(
|
const startEditing = useCallback(
|
||||||
(row, column) => {
|
(row, column) => {
|
||||||
const columnId = column.id;
|
|
||||||
|
|
||||||
if (!isConnectedRef.current) {
|
if (!isConnectedRef.current) {
|
||||||
onErrorRef.current?.('WebSocket не подключен');
|
onErrorRef.current?.('WebSocket не подключен');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lineId = row.id || null;
|
const lineId = row.id || null;
|
||||||
const colId = columnId.slice(5); // убираем префикс "data."
|
const columnKey = getColumnRequestKey(column);
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
event: 'cell_edit_start',
|
event: 'cell_edit_start',
|
||||||
data: {
|
data: {
|
||||||
line_id: lineId,
|
line_id: lineId,
|
||||||
column: colId,
|
column: columnKey,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -269,21 +275,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
|||||||
// Функция для завершения редактирования ячейки
|
// Функция для завершения редактирования ячейки
|
||||||
const endEditing = useCallback(
|
const endEditing = useCallback(
|
||||||
(row, column) => {
|
(row, column) => {
|
||||||
const columnId = column.id;
|
|
||||||
|
|
||||||
if (!isConnectedRef.current) {
|
if (!isConnectedRef.current) {
|
||||||
onErrorRef.current?.('WebSocket не подключен');
|
onErrorRef.current?.('WebSocket не подключен');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lineId = row.id || null;
|
const lineId = row.id || null;
|
||||||
const colId = columnId.slice(5);
|
const columnKey = getColumnRequestKey(column);
|
||||||
|
|
||||||
const message = {
|
const message = {
|
||||||
event: 'cell_edit_end',
|
event: 'cell_edit_end',
|
||||||
data: {
|
data: {
|
||||||
line_id: lineId,
|
line_id: lineId,
|
||||||
column: colId,
|
column: columnKey,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -299,20 +303,19 @@ export const RealtimeProvider = ({ children, formId, sheetName, direction, year,
|
|||||||
|
|
||||||
const updateCell = useCallback(
|
const updateCell = useCallback(
|
||||||
(row, column, value) => {
|
(row, column, value) => {
|
||||||
const columnId = column.id;
|
|
||||||
if (!isConnectedRef.current) {
|
if (!isConnectedRef.current) {
|
||||||
onErrorRef.current?.('WebSocket не подключен');
|
onErrorRef.current?.('WebSocket не подключен');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lineId = getRowId(row);
|
const lineId = getRowId(row);
|
||||||
const colId = columnId.slice(5);
|
const columnKey = getColumnRequestKey(column);
|
||||||
const message = {
|
const message = {
|
||||||
event: 'cell_updated',
|
event: 'cell_updated',
|
||||||
data: {
|
data: {
|
||||||
line_id: lineId,
|
line_id: lineId,
|
||||||
line_id_code: row.id,
|
line_id_code: row.id,
|
||||||
column: colId,
|
column: columnKey,
|
||||||
value: value,
|
value: value,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user