import { DataManager } from '../data/DataManager';
import { Wtr, Wtbl, Wtc } from '../model/document';
import { RepeatingRegion, BoundedRegion } from '../model/logic';
import { Doc } from '../view/Doc';
export type CellFragment = {
    id: string;
    expandFromId: string;
    rowspan: number;
    colspan: number;
    dataIndex?: number;
    repeatingId?: string;
    boundedId?: string;
    mergeFromId?: string;
};
type RowFragment = {
    id: string;
    expandFromId: string;
    cells: CellFragment[];
};
type ModelNode = Wtr | Wtc;
export declare class TableExpander {
    table: Wtbl;
    doc: Doc;
    data: DataManager;
    modelMapper: Map<string, ModelNode>;
    instanceMapper: Map<string, RowFragment | CellFragment>;
    rowIndexRepeatingMapper: Map<number, RepeatingRegion>;
    rowIndexBoundedMapper: Map<number, BoundedRegion>;
    boundedCellDataIndexMap: Map<string, number>;
    rows: RowFragment[];
    constructor(table: Wtbl, doc: Doc);
    getModelById<T extends ModelNode = Wtc>(id: string): T | undefined;
    initialize(): void;
    private initializeModelMapper;
    private initializeRepeatingMapper;
    private initializeBoundedMapper;
    private initializeBoundedItemDataIndex;
    private initializeRows;
    getRepeatingTimes(region: RepeatingRegion): number;
    private initializeRepeatingRowsInRange;
    private initializeBoundedRowInRange;
    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;
        };
    }): Map<string, number>;
}
export {};
