mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-13 12:13:10 +00:00
feat: extract simulator type
This commit is contained in:
parent
035c213b16
commit
980957f3ad
@ -1,29 +1,7 @@
|
|||||||
import { Component } from '../simulator';
|
import { Component } from '../simulator';
|
||||||
import { IPublicTypeComponentInstance, IPublicTypeNodeInstance, Asset, IPublicTypeComponentSchema, IPublicTypeProjectSchema, IPublicTypeLowCodeComponent } from '@alilc/lowcode-types';
|
import { IPublicTypeComponentInstance, IPublicTypeSimulatorRenderer } from '@alilc/lowcode-types';
|
||||||
|
|
||||||
export interface BuiltinSimulatorRenderer {
|
export type BuiltinSimulatorRenderer = IPublicTypeSimulatorRenderer<Component, IPublicTypeComponentInstance>;
|
||||||
readonly isSimulatorRenderer: true;
|
|
||||||
autoRepaintNode?: boolean;
|
|
||||||
components: Record<string, Component>;
|
|
||||||
rerender: () => void;
|
|
||||||
createComponent(schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>): Component | null;
|
|
||||||
getComponent(componentName: string): Component;
|
|
||||||
getClosestNodeInstance(
|
|
||||||
from: IPublicTypeComponentInstance,
|
|
||||||
nodeId?: string,
|
|
||||||
): IPublicTypeNodeInstance<IPublicTypeComponentInstance> | null;
|
|
||||||
findDOMNodes(instance: IPublicTypeComponentInstance): Array<Element | Text> | null;
|
|
||||||
getClientRects(element: Element | Text): DOMRect[];
|
|
||||||
setNativeSelection(enableFlag: boolean): void;
|
|
||||||
setDraggingState(state: boolean): void;
|
|
||||||
setCopyState(state: boolean): void;
|
|
||||||
loadAsyncLibrary(asyncMap: { [index: string]: any }): void;
|
|
||||||
clearState(): void;
|
|
||||||
stopAutoRepaintNode(): void;
|
|
||||||
enableAutoRepaintNode(): void;
|
|
||||||
run(): void;
|
|
||||||
load(asset: Asset): Promise<any>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer {
|
export function isSimulatorRenderer(obj: any): obj is BuiltinSimulatorRenderer {
|
||||||
return obj && obj.isSimulatorRenderer;
|
return obj && obj.isSimulatorRenderer;
|
||||||
|
|||||||
@ -90,3 +90,4 @@ export * from './editor-view-config';
|
|||||||
export * from './hotkey-callback-config';
|
export * from './hotkey-callback-config';
|
||||||
export * from './hotkey-callbacks';
|
export * from './hotkey-callbacks';
|
||||||
export * from './scrollable';
|
export * from './scrollable';
|
||||||
|
export * from './simulator-renderer';
|
||||||
|
|||||||
32
packages/types/src/shell/type/simulator-renderer.ts
Normal file
32
packages/types/src/shell/type/simulator-renderer.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { Asset } from '../../assets';
|
||||||
|
import {
|
||||||
|
IPublicTypeNodeInstance,
|
||||||
|
IPublicTypeProjectSchema,
|
||||||
|
IPublicTypeComponentSchema,
|
||||||
|
} from './';
|
||||||
|
|
||||||
|
export interface IPublicTypeSimulatorRenderer<Component, ComponentInstance> {
|
||||||
|
readonly isSimulatorRenderer: true;
|
||||||
|
autoRepaintNode?: boolean;
|
||||||
|
components: Record<string, Component>;
|
||||||
|
rerender: () => void;
|
||||||
|
createComponent(
|
||||||
|
schema: IPublicTypeProjectSchema<IPublicTypeComponentSchema>,
|
||||||
|
): Component | null;
|
||||||
|
getComponent(componentName: string): Component;
|
||||||
|
getClosestNodeInstance(
|
||||||
|
from: ComponentInstance,
|
||||||
|
nodeId?: string,
|
||||||
|
): IPublicTypeNodeInstance<ComponentInstance> | null;
|
||||||
|
findDOMNodes(instance: ComponentInstance): Array<Element | Text> | null;
|
||||||
|
getClientRects(element: Element | Text): DOMRect[];
|
||||||
|
setNativeSelection(enableFlag: boolean): void;
|
||||||
|
setDraggingState(state: boolean): void;
|
||||||
|
setCopyState(state: boolean): void;
|
||||||
|
loadAsyncLibrary(asyncMap: { [index: string]: any }): void;
|
||||||
|
clearState(): void;
|
||||||
|
stopAutoRepaintNode(): void;
|
||||||
|
enableAutoRepaintNode(): void;
|
||||||
|
run(): void;
|
||||||
|
load(asset: Asset): Promise<any>;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user