import type { IArea, SerializedCellData, CellStyle, Color } from '../../treb-base-types/src/index'; import type { AnnotationData } from './annotation'; import type { GridSelection, SerializedGridSelection } from './sheet_selection'; import type { ConditionalFormatList } from './conditional_format'; import type { DataValidation } from './data-validation'; export interface UpdateHints { data?: boolean; layout?: boolean; style?: boolean; annotations?: boolean; freeze?: boolean; names?: boolean; } export interface FreezePane { rows: number; columns: number; } export interface ScrollOffset { x: number; y: number; } export interface CellStyleRecord { row: number; column: number; ref: number; rows?: number; } export interface SerializedSheet { /** cell data */ data: SerializedCellData; /** top-level sheet style, if any */ sheet_style: CellStyle; /** row count */ rows: number; /** column count */ columns: number; /** * cell styles is for empty cells that have styling */ cell_styles: CellStyleRecord[]; /** @internal */ conditional_formats?: ConditionalFormatList; /** @internal */ data_validations?: DataValidation[]; /** * @deprecated use `styles` instead */ cell_style_refs?: CellStyle[]; /** * new implementation */ styles?: CellStyle[]; /** * per-row styles */ row_style: Record; /** * per-column styles */ column_style: Record; /** * @deprecated no one uses this anymore and it's weird */ row_pattern?: CellStyle[]; /** default for new rows */ default_row_height?: number; /** default for new columns */ default_column_width?: number; /** list of row heights. we use a Record instead of an array because it's sparse */ row_height?: Record; /** list of column widths. we use a Record instead of an array because it's sparse */ column_width?: Record; /** * @deprecated these were moved to the containing document */ named_ranges?: Record; freeze?: FreezePane; /** sheet ID, for serializing references */ id?: number; /** sheet name */ name?: string; /** tab color */ tab_color?: Color; /** current active selection */ selection: SerializedGridSelection; /** */ annotations?: Partial[]; /** current scroll position */ scroll?: ScrollOffset; /** visible flag. we only support visible/hidden */ visible?: boolean; /** testing */ background_image?: string; } /** * support for legacy sheet data * (I think we can drop) * * @internal * @deprecated */ export type LegacySerializedSheet = SerializedSheet & { primary_selection?: GridSelection; };