Единый интерфейс элементов

This commit is contained in:
2025-07-22 19:44:49 +03:00
parent 553da77a87
commit 3fc352f8e9
36 changed files with 2108 additions and 675 deletions

View File

@@ -1,4 +1,4 @@
import { Save } from 'lucide-react'
import { Redo2, Save, Undo2 } from 'lucide-react'
import { memo } from 'react'
import { FormulaBarProps } from '../types'
import { getColumnLabel } from '../utils'
@@ -144,6 +144,25 @@ export const FormulaBar = memo(
)}
</div>
)}
{/* Кнопки отмены и повтора */}
{
<div className="flex items-center gap-1">
<button
disabled={true}
className="flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/80 disabled:cursor-not-allowed disabled:opacity-50"
title="Отменить (Ctrl+Z)"
>
<Undo2 className="h-3 w-3" />
</button>
<button
disabled={true}
className="flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted/80 disabled:cursor-not-allowed disabled:opacity-50"
title="Повторить (Ctrl+Y)"
>
<Redo2 className="h-3 w-3" />
</button>
</div>
}
{/* Кнопка ручного сохранения */}
{onManualSave && (
<button

View File

@@ -4,6 +4,9 @@ import { COL_COUNT, ROW_COUNT, SHEET_NAMES, SpreadsheetProps } from '../types'
import { getColumnLabel } from '../utils'
import { CellRenderer } from './CellRenderer'
// Создаем типизированный компонент для совместимости с React 18
const Grid = VariableSizeGrid as unknown as React.ComponentType<any>
// --- Spreadsheet Component ---
export const Spreadsheet = ({
sheetType,
@@ -274,9 +277,11 @@ export const Spreadsheet = ({
/>
)
})()}
<VariableSizeGrid
ref={(el: VariableSizeGrid | null) => {
gridRefs.current[sheetType] = el
<Grid
ref={(el: any) => {
if (gridRefs.current) {
gridRefs.current[sheetType] = el
}
}}
columnCount={COL_COUNT}
rowCount={ROW_COUNT}
@@ -287,13 +292,13 @@ export const Spreadsheet = ({
itemData={itemData}
overscanColumnCount={20}
overscanRowCount={10}
onScroll={e => {
onScroll={(e: any) => {
setScrollPos({ left: e.scrollLeft, top: e.scrollTop })
onGridScroll(sheetType, e)
}}
>
{CellRenderer}
</VariableSizeGrid>
</Grid>
</div>
</div>
</div>