import * as TSU from "@panyam/tsutils";
export interface LayoutChangeEvent {
    affectedRowRange: {
        start: number;
        end: number;
    } | null;
    affectedColRange: {
        start: number;
        end: number;
    } | null;
    columnWidthsChanged: boolean;
    rowHeightsChanged: boolean;
    affectedGridModels: GridModel[];
}
export type LayoutChangeCallback = (event: LayoutChangeEvent) => void;
export declare class GridModel extends TSU.Events.EventEmitter {
    private static idCounter;
    readonly uuid: number;
    lastUpdatedAt: number;
    rows: GridRow[];
    rowAligns: Map<number, RowAlign>;
    colAligns: Map<number, ColAlign>;
    debugValue(): any;
    get firstRow(): number;
    get firstCol(): number;
    cellsInRow(row: number): GridCell[];
    cellsInCol(col: number): GridCell[];
    addRowAlign(align: RowAlign): void;
    addColAlign(align: ColAlign): void;
    addRows(insertBefore?: number, numRows?: number): this;
    getRow(row: number): GridRow;
    setValue(row: number, col: number, value: any, cellCreator?: (row: GridRow, col: number) => GridCell): any;
    protected eventHubChanged(): void;
}
export interface GridCellView {
    readonly cell: GridCell;
    x: number;
    y: number;
    width: number;
    height: number;
    setBounds(x: number | null, y: number | null, w: number | null, h: number | null, applyLayout: boolean): [number | null, number | null, number | null, number | null];
    readonly needsLayout: boolean;
    readonly minSize: TSU.Geom.Size;
    readonly bbox: TSU.Geom.Rect;
}
export declare enum GridCellEvent {
    ADDED = "CellAdded",
    CLEARED = "CellCleared",
    REMOVED = "CellRemoved",
    UPDATED = "CellUpdated",
    MOVED = "CellMoved"
}
export declare class GridCell {
    gridRow: GridRow;
    colIndex: number;
    value: any;
    private static idCounter;
    readonly uuid: number;
    cellView: GridCellView | null;
    private _rowAlign;
    private _colAlign;
    constructor(gridRow: GridRow, colIndex: number, value?: any);
    get rowAlign(): RowAlign;
    set rowAlign(val: RowAlign);
    get colAlign(): ColAlign;
    set colAlign(val: ColAlign);
    get location(): string;
    get grid(): GridModel;
    get rowIndex(): number;
    debugValue(): any;
}
export declare class GridRow {
    grid: GridModel;
    rowIndex: number;
    cells: (null | GridCell)[];
    defaultRowAlign: RowAlign;
    constructor(grid: GridModel, rowIndex: number);
    get firstCol(): number;
    get numCols(): number;
    get numCells(): number;
    cellAt(col: number, creator?: (row: GridRow, col: number) => GridCell): GridCell | null;
    clearCellAt(col: number): GridCell | null;
    debugValue(): {
        r: number;
        cells: any[];
    };
}
export declare abstract class AlignedLine {
    private static idCounter;
    readonly uuid: number;
    needsLayout: boolean;
    protected _coordOffset: number;
    protected _maxLength: number;
    paddingBefore: number;
    paddingAfter: number;
    cells: GridCell[];
    getCellView: (value: any) => GridCellView;
    abstract setOffset(val: number): void;
    abstract evalMaxLength(changedCells: GridCell[]): number;
    get coordOffset(): number;
    get maxLength(): number;
    setMaxLength(length: number): void;
    setPadding(before: number, after: number): void;
    addCell(cell: GridCell): this;
    protected abstract beforeAddingCell(cell: GridCell): boolean;
    removeCell(cell: GridCell): this;
    protected abstract beforeRemovingCell(cell: GridCell): boolean;
    prevLines: this[];
    nextLines: this[];
    addSuccessor(next: this): void;
}
export declare class ColAlign extends AlignedLine {
    paddingBefore: number;
    paddingAfter: number;
    setOffset(val: number): void;
    evalMaxLength(changedCells?: GridCell[]): number;
    protected beforeAddingCell(cell: GridCell): boolean;
    beforeRemovingCell(cell: GridCell): boolean;
}
export declare class RowAlign extends AlignedLine {
    setOffset(val: number): void;
    evalMaxLength(changedCells?: GridCell[]): number;
    protected beforeAddingCell(cell: GridCell): boolean;
    beforeRemovingCell(cell: GridCell): boolean;
}
export declare class GridLayoutGroup {
    gridModels: GridModel[];
    private layoutChangeSubscribers;
    private previousColumnWidths;
    private previousRowHeights;
    onLayoutChange(callback: LayoutChangeCallback): () => void;
    protected notifyLayoutChange(event: LayoutChangeEvent): void;
    get subscriberCount(): number;
    private eventHandler;
    addGridModel(gridModel: GridModel): boolean;
    startingRowAligns(): RowAlign[];
    startingColAligns(): ColAlign[];
    removeGridModel(gridModel: GridModel): void;
    getCellView: (cell: GridCell) => GridCellView;
    get startingRows(): RowAlign[];
    get startingCols(): ColAlign[];
    refreshLayout(notify?: boolean): void;
    protected applyModelEvents(events: TSU.Events.TEvent[]): void;
    protected calculateAffectedRowRange(changedRowAligns: any): {
        start: number;
        end: number;
    } | null;
    protected calculateAffectedColRange(changedColAligns: any): {
        start: number;
        end: number;
    } | null;
    private checkAndUpdateLength;
    protected changesForEvents(events: TSU.Events.TEvent[]): [any, any, GridModel[]];
    protected ensureGetCellView(align: AlignedLine): ((value: any) => GridCellView) | null;
    protected doBfsLayout<T extends AlignedLine>(startingLines: T[], changedAligns: any, previousLengths?: Map<number, number>): boolean;
}
