@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
94 lines • 3.44 kB
TypeScript
import { Size, Rectangle, AnchorLocation } from "@sheetxl/common";
import { ParsedNumberFormat } from "../utils/NumberFormatParser";
import { ITextFrame, HorizontalAlignment } from "../text";
import { ICellStyle } from "./ICellStyle";
import { ISheetStyle } from "./ISheetStyle";
import { ICellModel, ICalcCellValues } from "./ICellModel";
import { CellType, CellUpdate } from "./CellTypes";
import { ISheetModel } from "../sheet";
import { IHyperlink } from './IHyperlink';
interface CellModelState {
value?: string | number | boolean | null | undefined;
type?: CellType;
style?: ICellStyle;
hyperlink?: IHyperlink;
formula?: string;
formattedValue?: ParsedNumberFormat | null;
insets?: Rectangle;
textFrame?: ITextFrame;
overflowSize?: Partial<Size> | null;
overflowAnchor?: AnchorLocation | null;
error?: string;
warnings?: string[] | null;
}
declare class CellModel implements ICellModel {
protected _state: CellModelState;
protected _sheetModel: ISheetModel;
protected _sheetStyle: ISheetStyle;
protected _calcedValues: ICalcCellValues;
protected _bestFitCache?: any;
protected _bestFitCacheMin?: any;
protected _isEmpty: boolean;
protected _isReadOnly: boolean;
constructor(sheetModel: ISheetModel, calcedValues: ICalcCellValues, update?: CellUpdate, prevModel?: CellModel);
private _calcIsEmpty;
private _initializeState;
isEqual(other: ICellModel): boolean;
cloneWithUpdate(update: CellUpdate, calcedValues?: ICalcCellValues): ICellModel | null;
get couldOverflow(): boolean;
get overflowSize(): Size;
get overflowAnchor(): AnchorLocation;
get calcedValues(): ICalcCellValues;
get renderHorizontalAlignment(): HorizontalAlignment;
isEmpty(): boolean;
isReadOnly(): boolean;
isContentful(): boolean;
bestFitSize(colWidth: number, fullContent?: boolean): Size;
parseNumberFormat(numberFormat: string): ParsedNumberFormat;
insets(): Rectangle;
get textFrame(): ITextFrame;
get value(): string | number | boolean | null;
get type(): CellType;
get style(): ICellStyle;
is1904DateSystem(): boolean;
get formattedValue(): ParsedNumberFormat | null;
get asDate(): Date | null;
get asText(): string | null;
get asTextUnformatted(): string | null;
get comments(): string[] | null;
get hyperlink(): IHyperlink;
get formula(): string | null;
get warnings(): string[] | null;
get rowSpan(): number;
get colSpan(): number;
get isCellModel(): true;
}
export interface CalcCellValues {
rowSpan: number;
colSpan: number;
}
export declare class CalcCellModel implements ICalcCellValues {
private _rowSpan;
private _colSpan;
constructor(initial?: Partial<CalcCellValues>, prevValue?: ICalcCellValues);
get rowSpan(): number;
get colSpan(): number;
}
declare class EmptyCalcCellModel extends CalcCellModel {
}
export declare const EMPTY_CALCED_CELL_VALUES: EmptyCalcCellModel;
/**
* Default cell when there is no value. We never return null.
*/
export declare class EmptyCellModel extends CellModel {
constructor(sheetModel: ISheetModel);
isEmpty(): boolean;
isContentful(): boolean;
}
export declare class InvalidCellModel extends EmptyCellModel {
constructor();
cloneWithUpdate(): ICellModel | null;
}
export default CellModel;
export { CellModel };
//# sourceMappingURL=CellModel.d.ts.map