mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
Merge branch 'feat/vision-reducer-disabled' into 'release/1.0.51'
feat: 新增vision engineconfig,支持禁用某些reducer feat: 新增vision engineconfig,支持禁用某些reducer See merge request !1273445
This commit is contained in:
commit
7d4496eac2
@ -21,6 +21,7 @@
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"intl-messageformat": "^9.3.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"power-di": "^2.2.4",
|
||||
"react": "^16",
|
||||
"react-dom": "^16.7.0",
|
||||
@ -29,6 +30,7 @@
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
"@types/classnames": "^2.2.7",
|
||||
"@types/lodash.get": "^4.4.6",
|
||||
"@types/node": "^13.7.1",
|
||||
"@types/react": "^16",
|
||||
"@types/react-dom": "^16",
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import lodashGet from 'lodash.get';
|
||||
|
||||
export class EngineConfig {
|
||||
private config: { [key: string]: any } = {};
|
||||
|
||||
@ -17,8 +19,8 @@ export class EngineConfig {
|
||||
return this.config[key] !== undefined;
|
||||
}
|
||||
|
||||
get(key: string): any {
|
||||
return this.config[key];
|
||||
get(key: string, defaultValue?: any): any {
|
||||
return lodashGet(this.config, key, defaultValue);
|
||||
}
|
||||
|
||||
set(key: string, value: any) {
|
||||
|
||||
@ -195,6 +195,13 @@ interface EngineOptions {
|
||||
* 关闭画布自动渲染,在资产包多重异步加载的场景有效
|
||||
*/
|
||||
disableAutoRender?: boolean;
|
||||
/**
|
||||
* Vision-polyfill settings
|
||||
*/
|
||||
visionSettings?: {
|
||||
// 是否禁用降级Reducer
|
||||
disableCompatibleReducer?: boolean;
|
||||
}
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,13 @@ import {
|
||||
} from '@ali/lowcode-utils';
|
||||
import { isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
import { Node } from '@ali/lowcode-designer';
|
||||
import { engineConfig } from '@ali/lowcode-editor-core';
|
||||
|
||||
export function compatibleReducer(props: any, node: Node): any {
|
||||
// 如果禁用了降级reducer,则不做处理
|
||||
if (engineConfig.get('visionSettings.disableCompatibleReducer')) {
|
||||
return props;
|
||||
}
|
||||
// 如果不是 vc 体系,不做这个兼容处理
|
||||
if (!node.componentMeta.prototype) {
|
||||
return props;
|
||||
@ -27,7 +32,7 @@ export function compatibleReducer(props: any, node: Node): any {
|
||||
},
|
||||
};
|
||||
}
|
||||
if (isJSExpression(props) && !props.events) {
|
||||
if (!props.events && isJSExpression(props)) {
|
||||
return {
|
||||
type: 'variable',
|
||||
value: props.mock,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user