import type { UniComponent } from '../../../_common/components/uni-component/uni-component.js';
import type { TType } from '../../logical/typesystem.js';
import type { DataViewColumnManager, DataViewManager } from '../data-view-manager.js';
type JSON = null | number | string | boolean | JSON[] | {
    [k: string]: JSON;
};
export interface CellRenderProps<Data extends NonNullable<unknown> = NonNullable<unknown>, Value = unknown> {
    view: DataViewManager;
    column: DataViewColumnManager<Value, Data>;
    rowId: string;
    isEditing: boolean;
    selectCurrentCell: (editing: boolean) => void;
}
export interface DataViewCellLifeCycle {
    beforeEnterEditMode(): boolean;
    onEnterEditMode(): void;
    onExitEditMode(): void;
    focusCell(): boolean;
    blurCell(): boolean;
    forceUpdate(): void;
}
export type DataViewCellComponent<Data extends NonNullable<unknown> = NonNullable<unknown>, Value = unknown> = UniComponent<CellRenderProps<Data, Value>, DataViewCellLifeCycle>;
export type CellRenderer<Data extends NonNullable<unknown> = NonNullable<unknown>, Value = unknown> = {
    view: DataViewCellComponent<Data, Value>;
    edit?: DataViewCellComponent<Data, Value>;
};
type ColumnOps<Data extends NonNullable<unknown> = NonNullable<unknown>, Value = unknown> = {
    name: string;
    defaultData: () => Data;
    type: (data: Data) => TType;
    formatValue?: (value: unknown, colData: Data) => Value;
    cellToString: (data: Value, colData: Data) => string;
    cellFromString: (data: string, colData: Data) => {
        value: unknown;
        data?: Record<string, unknown>;
    };
    cellToJson: (data: Value, colData: Data) => JSON;
    addGroup?: (text: string, oldData: Data) => Data;
};
type ConvertFunction<From extends ColumnConfig, To extends ColumnConfig> = (column: GetColumnDataFromConfig<From>, cells: (GetCellDataFromConfig<From> | undefined)[]) => {
    column: GetColumnDataFromConfig<To>;
    cells: (GetCellDataFromConfig<To> | undefined)[];
};
declare global {
    export interface ColumnConfigMap {
    }
}
export declare class ColumnConfigManager {
    private map;
    getColumn<Type extends keyof ColumnConfigMap>(type: Type): ColumnConfigMap[Type];
    getColumn(type: string): ColumnConfig;
    register<CellData, T extends Record<string, unknown> = Record<string, never>>(type: string, ops: ColumnOps<T, CellData>): ColumnConfig<T, CellData>;
}
export type GetColumnDataFromConfig<T extends ColumnConfig> = T extends ColumnConfig<infer R, any> ? R : never;
export type GetCellDataFromConfig<T extends ColumnConfig> = T extends ColumnConfig<any, infer R> ? R : never;
export declare class ColumnConfig<T extends NonNullable<unknown> = NonNullable<unknown>, CellData = unknown> {
    readonly type: string;
    ops: ColumnOps<T, CellData>;
    convertMap: Map<any, any>;
    constructor(type: string, ops: ColumnOps<T, CellData>);
    create(name: string, data?: T): {
        type: string;
        name: string;
        data: T;
    };
    defaultData(): T;
    createWithId(id: string, name: string, data?: T): {
        type: string;
        name: string;
        data: T;
        id: string;
    };
    dataType(data: T): TType;
    toString(cellData: CellData, colData: T): string;
    toJson(cellData: CellData, colData: T): JSON;
    formatValue(cellData: CellData, colData: T): CellData | undefined;
    fromString(cellData: string, colData: T): {
        value: unknown;
        data?: Record<string, unknown> | undefined;
    };
    convertCell(to: string, column: Record<string, unknown>, cells: unknown[]): any;
    registerConvert<ToCellName extends keyof ColumnConfigMap>(to: ToCellName, convert: ConvertFunction<this, ColumnConfigMap[ToCellName]>): void;
    get name(): string;
}
export declare const columnManager: ColumnConfigManager;
export {};
//# sourceMappingURL=manager.d.ts.map