interface IViewFile {
    addImportSpecifiers: ((source: string, newSpecifiers: IImportSpecifierData[]) => IViewFile);
    filename: string;
    getNode: ((targetNodeId: string) => AbstractViewNode<unknown, AbstractFile>);
    hasNodeByCodeId?: ((codeId: string) => boolean);
    idGenerator: IdGenerator;
    importMap?: Dict<IImportSpecifierSourceData>;
    insertAfter: ((targetNodeId: string, newNode: any) => this);
    insertBefore: ((targetNodeId: string, newNode: any) => this);
    insertChild: ((targetNodeId: string, newNode: any, position?: InsertChildPositionType) => this);
    listForms?: (() => Record<string, string[]>);
    listImportSources?: (() => string[]);
    listModals?: (() => {
        label: string;
        value: string;
    }[]);
    removeNode: ((targetNodeId: string) => this);
    replaceNode: ((targetNodeId: string, newNode: any) => this);
    replaceViewChildren: ((rawNodes: any[]) => this);
    update: ((code?: string, isFormatCode?: boolean, refreshWorkspace?: boolean) => void);
    updateNodeAttribute: ((nodeId: string, attrName: string, attrValue?: any, relatedImports?: string[]) => this);
    updateNodeAttributes: ((nodeId: string, config: Record<string, any>, relatedImports?: string[]) => this);
    get code(): string;
    get nodes(): Map<string, AbstractViewNode<unknown, AbstractFile>>;
    get nodesTree(): object[];
    get tree(): any;
}

Implemented by

Properties

addImportSpecifiers: ((source: string, newSpecifiers: IImportSpecifierData[]) => IViewFile)

添加新的导入符号

Type declaration

filename: string

文件名

getNode: ((targetNodeId: string) => AbstractViewNode<unknown, AbstractFile>)
hasNodeByCodeId?: ((codeId: string) => boolean)

判断节点是否存在

Type declaration

    • (codeId): boolean
    • Parameters

      • codeId: string

        节点 ID

      Returns boolean

      存在返回 true,否则返回 false

idGenerator: IdGenerator

ID 生成器

通过导入组件名查找组件来自的包

insertAfter: ((targetNodeId: string, newNode: any) => this)
insertBefore: ((targetNodeId: string, newNode: any) => this)
insertChild: ((targetNodeId: string, newNode: any, position?: InsertChildPositionType) => this)
listForms?: (() => Record<string, string[]>)
listImportSources?: (() => string[])
listModals?: (() => {
    label: string;
    value: string;
}[])
removeNode: ((targetNodeId: string) => this)
replaceNode: ((targetNodeId: string, newNode: any) => this)
replaceViewChildren: ((rawNodes: any[]) => this)
update: ((code?: string, isFormatCode?: boolean, refreshWorkspace?: boolean) => void)
updateNodeAttribute: ((nodeId: string, attrName: string, attrValue?: any, relatedImports?: string[]) => this)
updateNodeAttributes: ((nodeId: string, config: Record<string, any>, relatedImports?: string[]) => this)

Accessors