import { ComponentType } from 'react'; import { IReactionPublic, IReactionOptions, IReactionDisposer } from '@alilc/lowcode-editor-core'; import { IPublicTypeProjectSchema, IPublicTypeComponentMetadata, IPublicTypeComponentAction, IPublicTypeNpmInfo, IPublicModelEditor, IPublicTypePropsList, IPublicTypeNodeSchema, IPublicTypePropsTransducer, IShellModelFactory, IPublicModelDragObject, IPublicTypeScrollable, IPublicModelScroller, IPublicTypeLocationData, IPublicEnumTransformStage, IPublicModelLocateEvent, IPublicTypePropsMap } from '@alilc/lowcode-types'; import { IPublicTypeAssetsJson } from '@alilc/lowcode-utils'; import { IProject } from '../project'; import { Node, DocumentModel, INode } from '../document'; import { IComponentMeta } from '../component-meta'; import { INodeSelector, Component } from '../simulator'; import { IDragon } from './dragon'; import { ActiveTracker } from './active-tracker'; import { Detecting } from './detecting'; import { DropLocation } from './location'; import { OffsetObserver } from './offset-observer'; import { ISettingTopEntry } from './setting'; import { BemToolsManager } from '../builtin-simulator/bem-tools/manager'; import { ComponentActions } from '../component-actions'; import { IContextMenuActions } from '../context-menu-actions'; export interface DesignerProps { [key: string]: any; editor: IPublicModelEditor; shellModelFactory: IShellModelFactory; className?: string; style?: object; defaultSchema?: IPublicTypeProjectSchema; hotkeys?: object; viewName?: string; simulatorProps?: Record | ((document: DocumentModel) => object); simulatorComponent?: ComponentType; dragGhostComponent?: ComponentType<{ designer: IDesigner; }>; suspensed?: boolean; componentMetadatas?: IPublicTypeComponentMetadata[]; globalComponentActions?: IPublicTypeComponentAction[]; onMount?: (designer: Designer) => void; onDragstart?: (e: IPublicModelLocateEvent) => void; onDrag?: (e: IPublicModelLocateEvent) => void; onDragend?: (e: { dragObject: IPublicModelDragObject; copy: boolean; }, loc?: DropLocation) => void; } export declare class Designer { dragon: IDragon; readonly viewName: string | undefined; readonly componentActions: ComponentActions; readonly contextMenuActions: IContextMenuActions; readonly activeTracker: ActiveTracker; readonly detecting: Detecting; readonly project: IProject; readonly editor: IPublicModelEditor; readonly bemToolsManager: BemToolsManager; readonly shellModelFactory: IShellModelFactory; private _dropLocation?; private propsReducers; private _lostComponentMetasMap; private props?; private oobxList; private selectionDispose; private _componentMetasMap; private _simulatorComponent?; private _simulatorProps?; private _suspensed; get currentDocument(): import("../document").IDocumentModel; get currentHistory(): import("../document").IHistory; get currentSelection(): import("../document").ISelection; constructor(props: DesignerProps); setupSelection: () => void; postEvent(event: string, ...args: any[]): void; get dropLocation(): DropLocation; /** * 创建插入位置,考虑放到 dragon 中 */ createLocation(locationData: IPublicTypeLocationData): DropLocation; /** * 清除插入位置 */ clearLocation(): void; createScroller(scrollable: IPublicTypeScrollable): IPublicModelScroller; createOffsetObserver(nodeInstance: INodeSelector): OffsetObserver | null; private clearOobxList; touchOffsetObserver(): void; createSettingEntry(nodes: INode[]): ISettingTopEntry; /** * 获得合适的插入位置 * @deprecated */ getSuitableInsertion(insertNode?: INode | IPublicTypeNodeSchema | IPublicTypeNodeSchema[]): { target: INode; index?: number; } | null; setProps(nextProps: DesignerProps): void; loadIncrementalAssets(incrementalAssets: IPublicTypeAssetsJson): Promise; /** * 刷新 componentMetasMap,可间接触发模拟器里的 buildComponents */ refreshComponentMetasMap(): void; get(key: string): any; get simulatorComponent(): ComponentType | undefined; get simulatorProps(): Record; /** * 提供给模拟器的参数 */ get projectSimulatorProps(): any; get suspensed(): boolean; set suspensed(flag: boolean); get schema(): IPublicTypeProjectSchema; setSchema(schema?: IPublicTypeProjectSchema): void; buildComponentMetasMap(metas: IPublicTypeComponentMetadata[]): void; createComponentMeta(data: IPublicTypeComponentMetadata): IComponentMeta | null; getGlobalComponentActions(): IPublicTypeComponentAction[] | null; getComponentMeta(componentName: string, generateMetadata?: () => IPublicTypeComponentMetadata | null): IComponentMeta; getComponentMetasMap(): Map; get componentsMap(): { [key: string]: IPublicTypeNpmInfo | Component; }; transformProps(props: IPublicTypePropsMap | IPublicTypePropsList, node: Node, stage: IPublicEnumTransformStage): IPublicTypePropsMap | IPublicTypePropsList; addPropsReducer(reducer: IPublicTypePropsTransducer, stage: IPublicEnumTransformStage): void; autorun(effect: (reaction: IReactionPublic) => void, options?: IReactionOptions): IReactionDisposer; purge(): void; } export interface IDesigner extends Designer { }