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 = NonNullable, Value = unknown> { view: DataViewManager; column: DataViewColumnManager; 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 = NonNullable, Value = unknown> = UniComponent, DataViewCellLifeCycle>; export type CellRenderer = NonNullable, Value = unknown> = { view: DataViewCellComponent; edit?: DataViewCellComponent; }; type ColumnOps = NonNullable, 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; }; cellToJson: (data: Value, colData: Data) => JSON; addGroup?: (text: string, oldData: Data) => Data; }; type ConvertFunction = (column: GetColumnDataFromConfig, cells: (GetCellDataFromConfig | undefined)[]) => { column: GetColumnDataFromConfig; cells: (GetCellDataFromConfig | undefined)[]; }; declare global { export interface ColumnConfigMap { } } export declare class ColumnConfigManager { private map; getColumn(type: Type): ColumnConfigMap[Type]; getColumn(type: string): ColumnConfig; register = Record>(type: string, ops: ColumnOps): ColumnConfig; } export type GetColumnDataFromConfig = T extends ColumnConfig ? R : never; export type GetCellDataFromConfig = T extends ColumnConfig ? R : never; export declare class ColumnConfig = NonNullable, CellData = unknown> { readonly type: string; ops: ColumnOps; convertMap: Map; constructor(type: string, ops: ColumnOps); 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 | undefined; }; convertCell(to: string, column: Record, cells: unknown[]): any; registerConvert(to: ToCellName, convert: ConvertFunction): void; get name(): string; } export declare const columnManager: ColumnConfigManager; export {}; //# sourceMappingURL=manager.d.ts.map