mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 18:06:02 +00:00
feat: 支持 disableDefaultSettingPanel 禁止默认的设置面板
This commit is contained in:
parent
29eeaa07d1
commit
cc465469b2
@ -1,5 +1,68 @@
|
|||||||
import lodashGet from 'lodash.get';
|
import lodashGet from 'lodash.get';
|
||||||
|
|
||||||
|
export interface EngineOptions {
|
||||||
|
/**
|
||||||
|
* 是否开启 condition 的能力,默认在设计器中不管 condition 是啥都正常展示
|
||||||
|
*/
|
||||||
|
enableCondition?: boolean;
|
||||||
|
/**
|
||||||
|
* 设计模式,live 模式将会实时展示变量值,默认值:'design'
|
||||||
|
*/
|
||||||
|
designMode?: 'design' | 'live';
|
||||||
|
/**
|
||||||
|
* 设备类型,默认值:'default'
|
||||||
|
*/
|
||||||
|
device?: 'default' | 'mobile' | string;
|
||||||
|
/**
|
||||||
|
* 语言,默认值:'zh_CN'
|
||||||
|
*/
|
||||||
|
locale?: string;
|
||||||
|
/**
|
||||||
|
* 渲染器类型,默认值:'react'
|
||||||
|
*/
|
||||||
|
renderEnv?: 'react' | 'rax' | string;
|
||||||
|
/**
|
||||||
|
* 设备类型映射器,处理设计器与渲染器中 device 的映射
|
||||||
|
*/
|
||||||
|
deviceMapper?: {
|
||||||
|
transform: (originalDevice: string) => string;
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 开启拖拽组件时,即将被放入的容器是否有视觉反馈,默认值:false
|
||||||
|
*/
|
||||||
|
enableReactiveContainer?: boolean;
|
||||||
|
/**
|
||||||
|
* 关闭画布自动渲染,在资产包多重异步加载的场景有效,默认值:false
|
||||||
|
*/
|
||||||
|
disableAutoRender?: boolean;
|
||||||
|
/**
|
||||||
|
* 关闭拖拽组件时的虚线响应,性能考虑,默认值:false
|
||||||
|
*/
|
||||||
|
disableDetecting?: boolean;
|
||||||
|
/**
|
||||||
|
* 定制画布中点击被忽略的 selectors,默认值:undefined
|
||||||
|
*/
|
||||||
|
customizeIgnoreSelectors?: (defaultIgnoreSelectors: string[]) => string[];
|
||||||
|
/**
|
||||||
|
* 禁止默认的设置面板,默认值:false
|
||||||
|
*/
|
||||||
|
disableDefaultSettingPanel: boolean,
|
||||||
|
/**
|
||||||
|
* 禁止默认的设置器,默认值:false
|
||||||
|
*/
|
||||||
|
disableDefaultSetters: boolean,
|
||||||
|
/**
|
||||||
|
* Vision-polyfill settings
|
||||||
|
*/
|
||||||
|
visionSettings?: {
|
||||||
|
// 是否禁用降级 reducer,默认值:false
|
||||||
|
disableCompatibleReducer?: boolean;
|
||||||
|
// 是否开启在 render 阶段开启 filter reducer,默认值:false
|
||||||
|
enableFilterReducerInRenderStage?: boolean;
|
||||||
|
};
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
export class EngineConfig {
|
export class EngineConfig {
|
||||||
private config: { [key: string]: any } = {};
|
private config: { [key: string]: any } = {};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { createElement } from 'react';
|
import { createElement } from 'react';
|
||||||
import { render } from 'react-dom';
|
import { render } from 'react-dom';
|
||||||
import { globalContext, Editor, engineConfig } from '@ali/lowcode-editor-core';
|
import { globalContext, Editor, engineConfig, EngineOptions } from '@ali/lowcode-editor-core';
|
||||||
import * as editorCabin from '@ali/lowcode-editor-core';
|
import * as editorCabin from '@ali/lowcode-editor-core';
|
||||||
import {
|
import {
|
||||||
Designer,
|
Designer,
|
||||||
@ -108,6 +108,7 @@ plugins.register((ctx: ILowCodePluginContext) => {
|
|||||||
return {
|
return {
|
||||||
name: '___setter_registry___',
|
name: '___setter_registry___',
|
||||||
init() {
|
init() {
|
||||||
|
if (engineConfig.get('disableDefaultSetters')) return;
|
||||||
const builtinSetters = require('@ali/lowcode-engine-ext')?.setters;
|
const builtinSetters = require('@ali/lowcode-engine-ext')?.setters;
|
||||||
if (builtinSetters) {
|
if (builtinSetters) {
|
||||||
ctx.setters.registerSetter(builtinSetters);
|
ctx.setters.registerSetter(builtinSetters);
|
||||||
@ -127,15 +128,17 @@ plugins.register((ctx: ILowCodePluginContext) => {
|
|||||||
type: 'Widget',
|
type: 'Widget',
|
||||||
content: DesignerPlugin,
|
content: DesignerPlugin,
|
||||||
});
|
});
|
||||||
skeleton.add({
|
if (!engineConfig.get('disableDefaultSettingPanel')) {
|
||||||
area: 'rightArea',
|
skeleton.add({
|
||||||
name: 'settingsPane',
|
area: 'rightArea',
|
||||||
type: 'Panel',
|
name: 'settingsPane',
|
||||||
content: SettingsPrimaryPane,
|
type: 'Panel',
|
||||||
props: {
|
content: SettingsPrimaryPane,
|
||||||
ignoreRoot: true,
|
props: {
|
||||||
},
|
ignoreRoot: true,
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
skeleton.add({
|
skeleton.add({
|
||||||
area: 'leftArea',
|
area: 'leftArea',
|
||||||
name: 'outlinePane',
|
name: 'outlinePane',
|
||||||
@ -160,60 +163,6 @@ plugins.register((ctx: ILowCodePluginContext) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
interface EngineOptions {
|
|
||||||
/**
|
|
||||||
* 是否开启 condition 的能力,默认在设计器中不管 condition 是啥都正常展示
|
|
||||||
*/
|
|
||||||
enableCondition?: boolean;
|
|
||||||
/**
|
|
||||||
* 设计模式,live 模式将会实时展示变量值,默认值:'design'
|
|
||||||
*/
|
|
||||||
designMode?: 'design' | 'live';
|
|
||||||
/**
|
|
||||||
* 设备类型,默认值:'default'
|
|
||||||
*/
|
|
||||||
device?: 'default' | 'mobile' | string;
|
|
||||||
/**
|
|
||||||
* 语言,默认值:'zh_CN'
|
|
||||||
*/
|
|
||||||
locale?: string;
|
|
||||||
/**
|
|
||||||
* 渲染器类型,默认值:'react'
|
|
||||||
*/
|
|
||||||
renderEnv?: 'react' | 'rax' | string;
|
|
||||||
/**
|
|
||||||
* 设备类型映射器,处理设计器与渲染器中 device 的映射
|
|
||||||
*/
|
|
||||||
deviceMapper?: {
|
|
||||||
transform: (originalDevice: string) => string;
|
|
||||||
};
|
|
||||||
/**
|
|
||||||
* 开启拖拽组件时,即将被放入的容器是否有视觉反馈,默认值:false
|
|
||||||
*/
|
|
||||||
enableReactiveContainer?: boolean;
|
|
||||||
/**
|
|
||||||
* 关闭画布自动渲染,在资产包多重异步加载的场景有效,默认值:false
|
|
||||||
*/
|
|
||||||
disableAutoRender?: boolean;
|
|
||||||
/**
|
|
||||||
* 关闭拖拽组件时的虚线响应,性能考虑,默认值:false
|
|
||||||
*/
|
|
||||||
disableDetecting?: boolean;
|
|
||||||
/**
|
|
||||||
* 定制画布中点击被忽略的 selectors,默认值:(selectors) => selectors
|
|
||||||
*/
|
|
||||||
customizeIgnoreSelectors?: (defaultIgnoreSelectors: string[]) => string[];
|
|
||||||
/**
|
|
||||||
* Vision-polyfill settings
|
|
||||||
*/
|
|
||||||
visionSettings?: {
|
|
||||||
// 是否禁用降级 reducer,默认值:false
|
|
||||||
disableCompatibleReducer?: boolean;
|
|
||||||
// 是否开启在 render 阶段开启 filter reducer,默认值:false
|
|
||||||
enableFilterReducerInRenderStage?: boolean;
|
|
||||||
};
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
export async function init(container?: Element, options?: EngineOptions) {
|
export async function init(container?: Element, options?: EngineOptions) {
|
||||||
let engineOptions = null;
|
let engineOptions = null;
|
||||||
let engineContainer = null;
|
let engineContainer = null;
|
||||||
@ -231,8 +180,9 @@ export async function init(container?: Element, options?: EngineOptions) {
|
|||||||
}
|
}
|
||||||
engineContainer.id = 'engine';
|
engineContainer.id = 'engine';
|
||||||
|
|
||||||
await plugins.init();
|
|
||||||
engineConfig.setConfig(engineOptions as any);
|
engineConfig.setConfig(engineOptions as any);
|
||||||
|
|
||||||
|
await plugins.init();
|
||||||
render(
|
render(
|
||||||
createElement(Workbench, {
|
createElement(Workbench, {
|
||||||
skeleton,
|
skeleton,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user