@platform/cell.typesystem
Version:
The 'strongly typed sheets' system of the CellOS.
54 lines (53 loc) • 1.67 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, P extends keyof T[K]> = {
get(): T[K][P];
set(value: T[K][P]): t.ITypedSheetRow<T, K>;
clear(): t.ITypedSheetRow<T, K>;
};
export declare class TypedSheetRow<T, K extends keyof T> implements t.ITypedSheetRow<T, K> {
static create<T, K extends keyof T>(args: IArgs): t.ITypedSheetRow<T, K>;
static load<T, K extends keyof T>(args: IArgs): Promise<t.ITypedSheetRow<T, K>>;
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[K]>;
get props(): t.ITypedSheetRowProps<T[K]>;
toString(): string;
load(options?: {
props?: (keyof T[K])[];
force?: boolean;
}): Promise<t.ITypedSheetRow<T, K>>;
toObject(): T[K];
type(prop: keyof T[K]): t.IColumnTypeDef<t.IType>;
prop<P extends keyof T[K]>(name: P): ITypedSheetRowProp<T, K, P>;
private fire;
private isThisSheet;
private isThisRow;
private findColumnByKey;
private findColumnByProp;
private fireChange;
private setData;
private getOrCreateRef;
}
export {};