mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
Merge branch 'feat/autoRender' into 'release/1.0.51'
feat: 支持 disableAutoRender 配置项 See merge request !1273446
This commit is contained in:
commit
2e8545b51c
@ -1,4 +1,4 @@
|
||||
import { obx, autorun, computed, getPublicPath, hotkey, focusTracker } from '@ali/lowcode-editor-core';
|
||||
import { obx, autorun, computed, getPublicPath, hotkey, focusTracker, engineConfig } from '@ali/lowcode-editor-core';
|
||||
import { EventEmitter } from 'events';
|
||||
import { ISimulatorHost, Component, NodeInstance, ComponentInstance, DropContainer } from '../simulator';
|
||||
import Viewport from './viewport';
|
||||
@ -138,10 +138,16 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
|
||||
readonly emitter: EventEmitter = new EventEmitter();
|
||||
|
||||
/**
|
||||
* 是否为画布自动渲染
|
||||
*/
|
||||
autoRender = true;
|
||||
|
||||
constructor(project: Project) {
|
||||
this.project = project;
|
||||
this.designer = project?.designer;
|
||||
this.scroller = this.designer.createScroller(this.viewport);
|
||||
this.autoRender = engineConfig.get('disableAutoRender') !== true;
|
||||
}
|
||||
|
||||
get currentDocument() {
|
||||
|
||||
@ -191,6 +191,10 @@ interface EngineOptions {
|
||||
* 开启拖拽组件时,即将被放入的容器是否有视觉反馈
|
||||
*/
|
||||
enableReactiveContainer?: boolean;
|
||||
/**
|
||||
* 关闭画布自动渲染,在资产包多重异步加载的场景有效
|
||||
*/
|
||||
disableAutoRender?: boolean;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
@ -141,6 +141,7 @@ class Renderer extends Component<{
|
||||
const { designMode, device, locale } = container;
|
||||
const messages = container.context?.utils?.i18n?.messages || {};
|
||||
|
||||
if (!container.autoRender) return null;
|
||||
return (
|
||||
// @ts-ignore
|
||||
<LowCodeRenderer
|
||||
|
||||
@ -243,6 +243,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.autoRender = host.autoRender;
|
||||
|
||||
this.disposeFunctions.push(host.connect(this, () => {
|
||||
// sync layout config
|
||||
this._layout = host.project.get('config').layout;
|
||||
@ -386,6 +388,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
@computed get componentsMap(): any {
|
||||
return this._componentsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为画布自动渲染
|
||||
*/
|
||||
autoRender = true;
|
||||
/**
|
||||
* 加载资源
|
||||
*/
|
||||
@ -523,6 +530,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
* 刷新渲染器
|
||||
*/
|
||||
rerender() {
|
||||
this.autoRender = true;
|
||||
// TODO: 不太优雅
|
||||
this._appContext = { ...this._appContext };
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user