import { ObjectForExtending } from '../types/utils.type'; import { ColumnConfigInternal } from '../types/column-config-internal.type'; import { GridSelection, Rectangle } from '@glideappsfinal/glide-data-grid'; export type { Rectangle }; export type ReadonlyBehavior = 'skip' | 'abort'; export type OverflowBehavior = 'truncate' | 'abort'; export type ValidationMode = 'none' | 'type-check'; export type AllowedFillDirections = 'horizontal' | 'vertical' | 'orthogonal' | 'any'; export type HotkeyConfig = { code: string; ctrl?: boolean; shift?: boolean; alt?: boolean; meta?: boolean; }; export type PasteConfig = { readonlyBehavior?: ReadonlyBehavior; allowSubRows?: boolean; overflowBehavior?: OverflowBehavior; broadcast?: boolean; validation?: ValidationMode; }; export type FillHandleConfig = { enabled?: boolean; shape?: 'square' | 'circle'; size?: number; outline?: number; allowedDirections?: AllowedFillDirections; readonlyBehavior?: ReadonlyBehavior; allowSubRows?: boolean; }; export type FillPatternEvent = { patternSource: Rectangle; fillDestination: Rectangle; preventDefault: () => void; }; export type CellTransferCellInfo = { row: ObjectForExtending; column: TransferColumnConfig; colIndex: number; rowIndex: number; lvl: number; rawValue: unknown; formattedValue: string; }; export type CopyMeta = { range: Rectangle; cells: CellTransferCellInfo[][]; }; export type PasteMeta = { target: { col: number; row: number; }; targetCells: CellTransferCellInfo[][]; selection: GridSelection; }; export type RowsChangeType = 'edit' | 'paste' | 'fill'; export type FillMeta = { sourceRange: Rectangle; destinationRange: Rectangle; sourceCells: CellTransferCellInfo[][]; targetCells: CellTransferCellInfo[][]; }; export type CellTransferConfig = { enabled?: boolean; hotkeys?: { copy?: HotkeyConfig | HotkeyConfig[]; paste?: HotkeyConfig | HotkeyConfig[]; }; paste?: PasteConfig; fillHandle?: boolean | FillHandleConfig; onBeforeCopy?: (data: string[][], meta: CopyMeta) => string[][] | false; onBeforePaste?: (data: string[][], meta: PasteMeta) => string[][] | false; onBeforeFill?: (data: string[][], meta: FillMeta) => string[][] | false; }; export type CellIterationItem = { row: R; column: TransferColumnConfig; colIndex: number; rowIndex: number; lvl: number; }; export type TransferColumnConfig = Pick, 'key' | 'name' | 'isServiceColumn' | 'copyData' | 'editable' | 'editingCell' | 'contentFormat' | 'subRow' | 'colSpan' | 'rowSpan'>;