@knxcloud/lowcode-vue-simulator-renderer
Version:
60 lines (56 loc) • 2.6 kB
TypeScript
import { Router } from 'vue-router';
import { I18nMessages, Config } from '@knxcloud/lowcode-vue-renderer';
export * from '@knxcloud/lowcode-vue-renderer';
export { default as VueRenderer, config as vueRendererConfig } from '@knxcloud/lowcode-vue-renderer';
import { DesignMode } from '@knxcloud/lowcode-hooks';
import { Component, ComponentPublicInstance, App } from 'vue';
import { IPublicTypeNpmInfo, IPublicTypeComponentSchema, IPublicModelDocumentModel, IPublicTypeRootSchema, IPublicModelNode, IPublicTypeSimulatorRenderer, IPublicTypeNodeInstance } from '@alilc/lowcode-types';
type MixedComponent = IPublicTypeNpmInfo | Component | IPublicTypeComponentSchema;
type ComponentInstance = ComponentPublicInstance;
interface ComponentRecord {
did: string;
nid: string;
cid: number;
}
interface SimulatorViewLayout {
Component?: Component;
componentName?: string;
props?: Record<string, unknown>;
}
interface DocumentInstance {
readonly id: string;
readonly key: string;
readonly path: string;
readonly scope: Record<string, unknown>;
readonly document: IPublicModelDocumentModel;
readonly instancesMap: Map<string, ComponentInstance[]>;
readonly schema: IPublicTypeRootSchema;
readonly messages: I18nMessages;
readonly appHelper: Record<string, unknown>;
getComponentInstance(id: number): ComponentInstance | null;
mountInstance(id: string, instance: ComponentInstance | HTMLElement): (() => void) | void;
unmountInstance(id: string, instance: ComponentInstance): void;
rerender(): void;
getNode(id: string): IPublicModelNode | null;
}
interface VueSimulatorRenderer extends IPublicTypeSimulatorRenderer<ComponentInstance, ComponentRecord> {
app: App;
config: Config;
router: Router;
layout: SimulatorViewLayout;
device: string;
locale: string;
designMode: DesignMode;
libraryMap: Record<string, string>;
thisRequiredInJSE: boolean;
autoRender: boolean;
componentsMap: Record<string, MixedComponent>;
disableCompMock: boolean | string[];
documentInstances: DocumentInstance[];
requestHandlersMap: Record<string, CallableFunction>;
dispose(): void;
getCurrentDocument(): DocumentInstance | null;
getClosestNodeInstance(from: ComponentRecord | Element, nodeId?: string): IPublicTypeNodeInstance<ComponentRecord> | null;
}
declare const _default: VueSimulatorRenderer;
export { type ComponentInstance, type ComponentRecord, type DocumentInstance, type MixedComponent, type SimulatorViewLayout, type VueSimulatorRenderer, _default as default };