копирование
This commit is contained in:
@@ -35,6 +35,8 @@ export const Cell = memo(
|
||||
style, // Добавляем style для react-window
|
||||
mergedCellInfo,
|
||||
highlightColor, // Цвет подсветки для формул
|
||||
isCopied, // Является ли ячейка скопированной
|
||||
isCut, // Является ли ячейка вырезанной
|
||||
}: CellProps) => {
|
||||
// Если ячейка объединена, но не является основной, не рендерим её
|
||||
if (mergedCellInfo?.isMerged && !mergedCellInfo.isMainCell) {
|
||||
@@ -67,6 +69,17 @@ export const Cell = memo(
|
||||
}
|
||||
}
|
||||
|
||||
// Стили для скопированных/вырезанных ячеек
|
||||
if (isCopied || isCut) {
|
||||
cellStyle = {
|
||||
...cellStyle,
|
||||
border: '2px dashed hsl(var(--primary))',
|
||||
backgroundColor: isCut
|
||||
? 'rgba(239, 68, 68, 0.1)'
|
||||
: 'rgba(34, 197, 94, 0.1)', // красноватый для вырезанных, зеленоватый для скопированных
|
||||
}
|
||||
}
|
||||
|
||||
// Отладка стилей для измененных ячеек
|
||||
if (isModified) {
|
||||
// console.log(`🎨 Стили для измененной ячейки ${rowIndex},${colIndex}:`, //{
|
||||
|
||||
@@ -20,6 +20,7 @@ export const CellRenderer = ({
|
||||
cachedData,
|
||||
mergedCells,
|
||||
highlightedCells,
|
||||
copiedCells,
|
||||
handleCellClick,
|
||||
handleCellDoubleClick,
|
||||
handleCellChange,
|
||||
@@ -121,6 +122,15 @@ export const CellRenderer = ({
|
||||
}
|
||||
: undefined
|
||||
|
||||
// Проверяем, является ли ячейка скопированной
|
||||
const isCopied =
|
||||
copiedCells &&
|
||||
copiedCells.sourceSheet === sheetType &&
|
||||
copiedCells.data.some(
|
||||
cell => cell.row === rowIndex && cell.col === columnIndex
|
||||
)
|
||||
const isCut = isCopied && copiedCells?.isCut
|
||||
|
||||
return (
|
||||
<Cell
|
||||
style={style}
|
||||
@@ -155,6 +165,8 @@ export const CellRenderer = ({
|
||||
activeCellRef={activeCellInputRef}
|
||||
mergedCellInfo={mergedCellProps}
|
||||
highlightColor={highlightColor}
|
||||
isCopied={isCopied}
|
||||
isCut={isCut}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export const Spreadsheet = ({
|
||||
onGridScroll,
|
||||
handleColumnResize,
|
||||
mergedCells,
|
||||
copiedCells,
|
||||
}: SpreadsheetProps) => {
|
||||
const widths = columnWidths
|
||||
const cachedData = getCachedCellData(sheetType)
|
||||
@@ -53,6 +54,7 @@ export const Spreadsheet = ({
|
||||
cachedData,
|
||||
mergedCells,
|
||||
highlightedCells,
|
||||
copiedCells,
|
||||
multiSelectionActive:
|
||||
activeSheet === sheetType && multiSelection.length > 0,
|
||||
handleCellClick,
|
||||
|
||||
Reference in New Issue
Block a user