import type { BaseTableAPI } from './base-table'; import type { ColorsDef, ICellHeaderPaths, LineDashsDef, LineWidthsDef, PaddingsDef } from './common'; import type { ColumnIconOption } from './icon'; import type { FieldData } from './table-engine'; export type TextOverflow = string; export type LineClamp = number | 'auto'; export type TextAlignType = 'center' | 'end' | 'left' | 'right' | 'start'; export type TextBaselineType = 'alphabetic' | 'bottom' | 'middle' | 'top'; export interface StylePropertyFunctionArg { row: number; col: number; table: BaseTableAPI; value?: FieldData; dataValue?: FieldData; percentile?: number; cellHeaderPaths?: ICellHeaderPaths; } export type ColorPropertyDefine = string | ((args: StylePropertyFunctionArg) => string) | ((args: StylePropertyFunctionArg) => CanvasGradient) | ((args: StylePropertyFunctionArg) => CanvasPattern); export type ColorsPropertyDefine = ColorPropertyDefine | (string | null)[] | ((args: StylePropertyFunctionArg) => (string | null)[]); export type LineWidthPropertyDefine = number | ((args: StylePropertyFunctionArg) => number); export type LineWidthsPropertyDefine = LineWidthPropertyDefine | (number | null)[] | ((args: StylePropertyFunctionArg) => (number | null)[]); export type LineDashPropertyDefine = Array | ((args: StylePropertyFunctionArg) => Array); export type LineDashsPropertyDefine = LineDashPropertyDefine | (Array | null)[] | ((args: StylePropertyFunctionArg) => (Array | null)[]); export type FontSizePropertyDefine = number | ((args: StylePropertyFunctionArg) => number); export type FontFamilyPropertyDefine = string | ((args: StylePropertyFunctionArg) => string); export type FontWeightPropertyDefine = string | number | ((args: StylePropertyFunctionArg) => string | number); export type FontVariantPropertyDefine = string | ((args: StylePropertyFunctionArg) => string); export type FontStylePropertyDefine = string | ((args: StylePropertyFunctionArg) => string); export type TagPropertyDefine = string | ((args: StylePropertyFunctionArg) => string); export type CursorPropertyDefine = string | ((args: StylePropertyFunctionArg) => string); export type IconPropertyDefine = string | ColumnIconOption | ((args: StylePropertyFunctionArg) => string | ColumnIconOption); export type UnderlinePropertyDefine = boolean | ((args: StylePropertyFunctionArg) => boolean); export type LineThroughPropertyDefine = boolean | ((args: StylePropertyFunctionArg) => boolean); export type PaddingPropertyDefine = number | ((args: StylePropertyFunctionArg) => number); export type PaddingsPropertyDefine = PaddingPropertyDefine | (number | null)[] | ((args: StylePropertyFunctionArg) => (number | null)[]); export type MarkCellStyle = { bgColor?: CanvasRenderingContext2D['fillStyle']; shape?: 'rect' | 'triangle' | 'sector'; position?: 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom'; size?: number; offset?: number; }; export type MarkedPropertyDefine = boolean | MarkCellStyle | ((args: StylePropertyFunctionArg) => boolean | MarkCellStyle); export type CellStyle = { textAlign: CanvasTextAlign; padding: PaddingsDef; textBaseline: CanvasTextBaseline; color: CanvasRenderingContext2D['fillStyle']; strokeColor?: CanvasRenderingContext2D['fillStyle']; bgColor: CanvasRenderingContext2D['fillStyle']; fontSize: number; fontFamily: string; fontWeight: string | number; fontVariant: string; fontStyle: string; lineHeight: number; autoWrapText: boolean; lineClamp: LineClamp; textOverflow: TextOverflow; borderColor: ColorsDef; borderLineWidth: LineWidthsDef; borderLineDash: LineDashsDef; underline: boolean; underlineWidth: number; underlineDash: number[]; underlineOffset: number; lineThrough: boolean; lineThroughLineWidth: number; _strokeArrayWidth: number[]; _strokeArrayColor: string[]; _linkColor: CanvasRenderingContext2D['fillStyle']; }; export type CustomSelectionStyle = { cellBorderColor?: string; cellBorderLineWidth?: number; cellBorderLineDash?: number[]; cellBgColor?: string; };