import { DataManager } from '../data/DataManager';
import { Wtr, Wtbl, Wtc } from '../model/document';
import { RepeatingRegion, BoundedRegion, TableHeaderRegion, SubTableHeaderRegion, CheckTableRegion, _2DTableRegion } from '../model/logic';
import { Doc } from '../view/Doc';
export type CellFragment = {
    id: string;
    expandFromId: string;
    rowspan: number;
    colspan: number;
    dataIndex?: number;
    repeatingId?: string;
    _2DTableId?: string;
    boundedId?: string;
    checkTableId?: string;
    mergeFromId?: string;
    headerId?: string;
};
type RowFragment = {
    id: string;
    expandFromId: string;
    cells: CellFragment[];
};
type ModelNode = Wtr | Wtc;
type IndexMap = Map<string, {
    dataIndex: number;
    refPos?: string;
    refCellId?: string;
}>;
export declare class TableExpander {
    table: Wtbl;
    doc: Doc;
    data: DataManager;
    modelMapper: Map<string, ModelNode>;
    instanceMapper: Map<string, RowFragment | CellFragment>;
    rowIndexRepeatingMapper: Map<number, RepeatingRegion>;
    rowIndex2DTableMapper: Map<number, _2DTableRegion>;
    rowIndexBoundedMapper: Map<number, BoundedRegion>;
    rowIndexCheckTableMapper: Map<number, CheckTableRegion>;
    rowIndexTableHeaderMapper: Map<number, TableHeaderRegion | SubTableHeaderRegion>;
    rowIdTableHeaderMapper: Map<string, TableHeaderRegion | SubTableHeaderRegion>;
    rowIdSubTableMapper: Map<string, RepeatingRegion | BoundedRegion | CheckTableRegion | _2DTableRegion>;
    boundedCellDataIndexMap: IndexMap;
    checkTableCellDataIndexMap: IndexMap;
    _2DTableCellDataIndexMap: IndexMap;
    rows: RowFragment[];
    regionIdTableHeaderMetaMap: Map<string, {
        rowIds: string[];
    }>;
    constructor(table: Wtbl, doc: Doc);
    getModelById<T extends ModelNode = Wtc>(id: string): T | undefined;
    initialize(): void;
    private initializeModelMapper;
    private initializeRepeatingMapper;
    private initialize2DTableMapper;
    private initializeBoundedMapper;
    private initializeCheckTableMapper;
    private initializeTableHeaderMapper;
    private initializeBoundedItemDataIndex;
    private initializeDataGroup2DDataIndex;
    private initializeRows;
    getDataCount(region: RepeatingRegion | _2DTableRegion): number;
    private initializeRepeatingRowsInRange;
    private initialize2DTableRowsInRange;
    private initializeBoundedRowInRange;
    private initializeCheckTableRowInRange;
    private initializeTableHeaderRowInRange;
    private initializeNormalRowInRange;
    private transformMergeRelations;
    /**
     * 计算单元格对应的数据索引（用于范围扩展）
     *
     * @param range - 整体范围 {start:{row,col} end:{row,col}}，表示需要分配数据项的总区域
     * @param itemRange - 局部范围 {start:{row,col} end:{row,col}}，表示一个数据项的模板大小
     * @returns Map，key 为字符串 "row,col"，值为对应的数据索引
     *
     * 算法说明：
     * 1. 局部范围内的单元格数据索引为 0
     * 2. 从局部范围右侧开始，按 itemWidth 宽度逐个扩展数据项
     * 3. 当同一行内无法再放置更多数据项时（列数不足），换行到下一个 itemHeight 行
     * 4. 换行后从整体范围的最左侧列开始继续扩展，而不是从局部范围的列开始
     * 5. 如果行数超出整体范围则停止
     */
    computeDataIndexMap(range: {
        start: {
            row: number;
            col: number;
        };
        end: {
            row: number;
            col: number;
        };
    }, itemRange: {
        start: {
            row: number;
            col: number;
        };
        end: {
            row: number;
            col: number;
        };
    }): IndexMap;
}
export {};
