@formily/core
Version:
English | [简体中文](./README.zh-cn.md)
30 lines (29 loc) • 1.53 kB
TypeScript
import { FormPathPattern, Subscribable } from '@formily/shared';
import { FormGraphNodeRef, FormGraphMatcher, FormGraphEacher, FormGraphProps } from '../types';
export declare class FormGraph<NodeType = any> extends Subscribable<{
type: string;
payload: FormGraphNodeRef;
}> {
private refrences;
private nodes;
private buffer;
private matchStrategy;
size: number;
constructor(props?: FormGraphProps);
select(path: FormPathPattern, eacher?: FormGraphMatcher<NodeType>): NodeType;
get(path: FormPathPattern): NodeType;
selectParent(path: FormPathPattern): NodeType;
selectChildren(path: FormPathPattern): any;
exist(path: FormPathPattern): boolean;
eachChildren(eacher: FormGraphEacher<NodeType>, recursion?: boolean): void;
eachChildren(path: FormPathPattern, eacher: FormGraphEacher<NodeType>, recursion?: boolean): void;
eachChildren(path: FormPathPattern, selector: FormPathPattern, eacher: FormGraphEacher<NodeType>, recursion?: boolean): void;
eachParent(path: FormPathPattern, eacher: FormGraphEacher<NodeType>): void;
eachParentAndChildren(path: FormPathPattern, eacher: FormGraphEacher<NodeType>): void;
getLatestParent(path: FormPathPattern): any;
map(mapper: (node: NodeType) => any): any;
reduce<T>(reducer: (buffer: T, node: NodeType, key: string) => T, initial: T): T;
appendNode(path: FormPathPattern, node: NodeType): void;
remove(path: FormPathPattern): void;
replace(path: FormPathPattern, node: NodeType): void;
}