import { IType } from '../types/Type'; import { ObjectNode } from './ObjectNode'; import { IReversibleJsonPatch } from './NodeUtils'; import { IDisposer } from '../utils'; export interface IField { value?: any; showError: boolean; readonly typeName: string; label?: string; placeholder?: string; disabled: boolean; focused: boolean; changed: boolean; validators?: any; error: string | null; hasError: boolean; path?: string; name?: string; extra?: any; parent?: IField; sync(e: any, v?: any): void; onBlur(e?: any): void; onFocus(e?: any): void; focus(): void; showErrors(show?: boolean): void; showAsyncErrors(show?: boolean): void; validate(opt?: object, obj?: object): Promise; get(prop?: null | string | string[], strict?: boolean): {}; set(prop: any, value?: any): void; $(path?: string): this; select(path?: string, fields?: any, isStrict?: boolean): this; values(): {}; errors(): {}; each(iteratee: (field: this, index: number, depth: number) => any): void; } export interface INode extends IField { readonly nodeId: number; readonly type: IType; readonly storedValue: any; readonly path: string; readonly isRoot: boolean; readonly parent: ObjectNode | null; readonly root: ObjectNode; readonly _environment: any; readonly snapshot: any; readonly hasNestedFields: boolean; subpath: string; isAlive: boolean; boxValue: any; value: any; submitting: boolean; submit(o?: { onSuccess?: (obj?: ObjectNode) => any; onError?: (obj?: ObjectNode) => any; }): Promise; setParent(newParent: ObjectNode | null, subpath?: string | null): void; getChildren(): this[]; getChildField(subpath: string): this; getChildType(key: string): IType; die(): void; resetValidation(): void; addDisposer(disposer: () => void): any; onPatch(onPatch: (patch: IReversibleJsonPatch) => void, includeOldValue?: boolean): IDisposer; onStatePropChanged(prop: string, changed: (value: any) => void): IDisposer; } export interface NodeCreateOptions { type: IType; parent: ObjectNode | null; subpath: string; environment: any; initialValue: any; storedValue: any; canAttachTreeNode: boolean; finalizeNewInstance: (node: INode, initialValue: any) => void; }