@platform/cell.typesystem
Version:
The 'strongly typed sheets' system of the CellOS.
51 lines (50 loc) • 1.48 kB
TypeScript
import { t } from './common';
declare type IArgs = {
typename: string;
sheet: t.ITypedSheet;
uri: string | t.IRowUri;
columns: t.IColumnTypeDef[];
ctx: t.SheetCtx;
};
declare type ITypedSheetRowProp<T, K extends keyof T> = {
get(): T[K];
set(value: T[K]): t.ITypedSheetRow<T>;
clear(): t.ITypedSheetRow<T>;
};
export declare class TypedSheetRow<T> implements t.ITypedSheetRow<T> {
static create: <T_1>(args: IArgs) => t.ITypedSheetRow<T_1>;
static load: <T_1>(args: IArgs) => Promise<t.ITypedSheetRow<T_1>>;
private constructor();
private readonly _ctx;
private readonly _columns;
private readonly _prop;
private _refs;
private _props;
private _types;
private _data;
private _isLoaded;
private _status;
private _loading;
private _sheet;
readonly index: number;
readonly typename: string;
readonly uri: t.IRowUri;
get status(): "INIT" | "LOADING" | "LOADED";
get isLoaded(): boolean;
get types(): t.ITypedSheetRowTypes<T>;
get props(): t.ITypedSheetRowProps<T>;
toString(): string;
load(options?: {
props?: (keyof T)[];
force?: boolean;
}): Promise<t.ITypedSheetRow<T>>;
toObject(): T;
type(prop: keyof T): t.IColumnTypeDef<t.IType>;
prop<K extends keyof T>(name: K): ITypedSheetRowProp<T, K>;
private fire;
private findColumnByProp;
private fireChange;
private setData;
private getOrCreateRef;
}
export {};