Newer
Older
/**
* Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author David Sehnal <david.sehnal@gmail.com>
*/
readonly props: P,
readonly data: D
export function factory<Type, CommonProps>() {
return <D = { }, P = {}>(type: Type) => create<P & CommonProps, D, Type>(type);
export type Type<I = unknown> = I
export type Ctor = { new(...args: any[]): StateObject, type: any }
export function create<Props, Data, Type>(type: Type) {
return class implements StateObject<Props, Data, Type> {
static type = type;
static is(obj?: StateObject): obj is StateObject<Props, Data, Type> { return !!obj && type === obj.type; }
constructor(public props: Props, public data: Data) { }
}
}
transform: Transform,
// Which object was used as a parent to create data in this cell
sourceRef: Transform.Ref | undefined,
export type Status = 'ok' | 'error' | 'pending' | 'processing'
export const DefaultState: State = {
isObjectHidden: false,
isHidden: false,
isBinding: false,
isCollapsed: false
};