mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-06-11 01:42:47 +00:00
Compare commits
15 Commits
main
...
v1.0.7-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68fe51f2ec | ||
|
|
8ec0a9ab6f | ||
|
|
28261fdc65 | ||
|
|
610fe3a569 | ||
|
|
9284cf4e9b | ||
|
|
0b33f0efa8 | ||
|
|
0a2c37fea8 | ||
|
|
6ae94807a7 | ||
|
|
325d2fb413 | ||
|
|
f71d0079e8 | ||
|
|
5be9b384d6 | ||
|
|
58ed44a6d1 | ||
|
|
1ff46346ac | ||
|
|
44650604a2 | ||
|
|
82a0f50847 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"lerna": "4.0.0",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-designer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Designer for Ali LowCode Engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -15,10 +15,10 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-shell": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-shell": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
@ -58,5 +58,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ export class Designer {
|
||||
|
||||
return reducers.reduce((xprops, reducer) => {
|
||||
try {
|
||||
return reducer(xprops, node, { stage });
|
||||
return reducer(xprops, node.internalToShellNode() as any, { stage });
|
||||
} catch (e) {
|
||||
// todo: add log
|
||||
console.warn(e);
|
||||
|
||||
@ -5,6 +5,10 @@ import { Prop, IPropParent, UNSET } from './prop';
|
||||
import { Node } from '../node';
|
||||
import { TransformStage } from '../transform-stage';
|
||||
|
||||
interface ExtrasObject {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export const EXTRA_KEY_PREFIX = '___';
|
||||
export function getConvertedExtraKey(key: string): string {
|
||||
if (!key) {
|
||||
@ -53,7 +57,7 @@ export class Props implements IPropParent {
|
||||
|
||||
@obx type: 'map' | 'list' = 'map';
|
||||
|
||||
constructor(owner: Node, value?: PropsMap | PropsList | null, extras?: object) {
|
||||
constructor(owner: Node, value?: PropsMap | PropsList | null, extras?: ExtrasObject) {
|
||||
makeObservable(this);
|
||||
this.owner = owner;
|
||||
if (Array.isArray(value)) {
|
||||
@ -70,7 +74,7 @@ export class Props implements IPropParent {
|
||||
}
|
||||
|
||||
@action
|
||||
import(value?: PropsMap | PropsList | null, extras?: object) {
|
||||
import(value?: PropsMap | PropsList | null, extras?: ExtrasObject) {
|
||||
const originItems = this.items;
|
||||
if (Array.isArray(value)) {
|
||||
this.type = 'list';
|
||||
@ -104,7 +108,7 @@ export class Props implements IPropParent {
|
||||
}
|
||||
}
|
||||
|
||||
export(stage: TransformStage = TransformStage.Save): { props?: PropsMap | PropsList; extras?: object } {
|
||||
export(stage: TransformStage = TransformStage.Save): { props?: PropsMap | PropsList; extras?: ExtrasObject } {
|
||||
stage = compatStage(stage);
|
||||
if (this.items.length < 1) {
|
||||
return {};
|
||||
|
||||
@ -117,7 +117,7 @@ export class Selection {
|
||||
/**
|
||||
* 获取选中的节点
|
||||
*/
|
||||
getNodes() {
|
||||
getNodes(): Node[] {
|
||||
const nodes = [];
|
||||
for (const id of this._selected) {
|
||||
const node = this.doc.getNode(id);
|
||||
|
||||
@ -12,6 +12,12 @@ import divMetadata from '../fixtures/component-metadata/div';
|
||||
import { delayObxTick } from '../utils';
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
|
||||
const mockNode = {
|
||||
internalToShellNode() {
|
||||
return 'mockNode';
|
||||
},
|
||||
};
|
||||
|
||||
describe('Designer 测试', () => {
|
||||
let editor: Editor;
|
||||
let designer: Designer;
|
||||
@ -178,9 +184,9 @@ describe('Designer 测试', () => {
|
||||
|
||||
it('addPropsReducer / transformProps', () => {
|
||||
// 没有相应的 reducer
|
||||
expect(designer.transformProps({ num: 1 }, TransformStage.Init)).toEqual({ num: 1 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Init)).toEqual({ num: 1 });
|
||||
// props 是数组
|
||||
expect(designer.transformProps([{ num: 1 }], TransformStage.Init)).toEqual([{ num: 1 }]);
|
||||
expect(designer.transformProps([{ num: 1 }], mockNode, TransformStage.Init)).toEqual([{ num: 1 }]);
|
||||
|
||||
designer.addPropsReducer((props, node) => {
|
||||
props.num += 1;
|
||||
@ -217,17 +223,17 @@ describe('Designer 测试', () => {
|
||||
return props;
|
||||
}, TransformStage.Upgrade);
|
||||
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Init)).toEqual({ num: 3 });
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Clone)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Serilize)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Render)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Save)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Upgrade)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Init)).toEqual({ num: 3 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Clone)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Serilize)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Render)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Save)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Upgrade)).toEqual({ num: 2 });
|
||||
|
||||
designer.addPropsReducer((props, node) => {
|
||||
throw new Error('calculate error');
|
||||
}, TransformStage.Upgrade);
|
||||
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Upgrade)).toEqual({ num: 2 });
|
||||
expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Upgrade)).toEqual({ num: 2 });
|
||||
});
|
||||
|
||||
it('setProps', () => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-core",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Core Api for Ali lowCode engine",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -14,8 +14,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"intl-messageformat": "^9.3.1",
|
||||
@ -48,5 +48,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -20,6 +20,15 @@ import { AssetsJson, AssetLoader } from '@alilc/lowcode-utils';
|
||||
|
||||
EventEmitter.defaultMaxListeners = 100;
|
||||
|
||||
// inner instance keys which should not be stored in config
|
||||
const keyBlacklist = [
|
||||
'designer',
|
||||
'skeleton',
|
||||
'currentDocument',
|
||||
'simulator',
|
||||
'plugins',
|
||||
];
|
||||
|
||||
export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalEvent.EventConfig> {
|
||||
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
@ -73,7 +82,9 @@ export class Editor extends (EventEmitter as any) implements IEditor {
|
||||
return;
|
||||
}
|
||||
// store the data to engineConfig while invoking editor.set()
|
||||
engineConfig.set(key as any, data);
|
||||
if (!keyBlacklist.includes(key as string)) {
|
||||
engineConfig.set(key as any, data);
|
||||
}
|
||||
this.context.set(key, data);
|
||||
this.notifyGot(key);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-editor-skeleton",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "alibaba lowcode editor skeleton",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -18,10 +18,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.20.12",
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
@ -42,5 +42,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-engine",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
|
||||
"main": "lib/engine-core.js",
|
||||
"module": "es/engine-core.js",
|
||||
@ -19,14 +19,14 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.12",
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||
"@alilc/lowcode-plugin-designer": "1.0.6",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.0.6",
|
||||
"@alilc/lowcode-shell": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-plugin-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-plugin-outline-pane": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-shell": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
@ -53,5 +53,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -37,14 +37,10 @@ globalContext.register(editor, Editor);
|
||||
globalContext.register(editor, 'editor');
|
||||
|
||||
const innerSkeleton = new InnerSkeleton(editor);
|
||||
editor.set(Skeleton, innerSkeleton);
|
||||
editor.set('skeleton' as any, innerSkeleton);
|
||||
engineConfig.set('skeleton' as any, innerSkeleton);
|
||||
|
||||
const designer = new Designer({ editor });
|
||||
editor.set(Designer, designer);
|
||||
editor.set('designer' as any, designer);
|
||||
engineConfig.set('designer' as any, designer);
|
||||
|
||||
const plugins = new LowCodePluginManager(editor).toProxy();
|
||||
editor.set('plugins' as any, plugins);
|
||||
|
||||
@ -2,6 +2,7 @@ import {
|
||||
projectSymbol,
|
||||
documentSymbol,
|
||||
nodeSymbol,
|
||||
nodeChildrenSymbol,
|
||||
designerSymbol,
|
||||
skeletonSymbol,
|
||||
editorSymbol,
|
||||
@ -13,6 +14,7 @@ export default {
|
||||
projectSymbol,
|
||||
documentSymbol,
|
||||
nodeSymbol,
|
||||
nodeChildrenSymbol,
|
||||
skeletonSymbol,
|
||||
editorSymbol,
|
||||
designerSymbol,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-ignitor",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "点火器,bootstrap lce project",
|
||||
"main": "lib/index.js",
|
||||
"private": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-designer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "alibaba lowcode editor designer plugin",
|
||||
"files": [
|
||||
"es",
|
||||
@ -18,9 +18,9 @@
|
||||
],
|
||||
"author": "xiayang.xy",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"react": "^16.8.1",
|
||||
"react-dom": "^16.8.1"
|
||||
},
|
||||
@ -38,5 +38,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-plugin-outline-pane",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Outline pane for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
@ -13,10 +13,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"react": "^16",
|
||||
"react-dom": "^16.7.0"
|
||||
@ -40,5 +40,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-renderer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Rax renderer for Ali lowCode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -30,8 +30,8 @@
|
||||
"build": "build-scripts build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-renderer-core": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-renderer-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"rax-find-dom-node": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -49,5 +49,5 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html",
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-rax-simulator-renderer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "rax simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -13,10 +13,10 @@
|
||||
"build:umd": "build-scripts build --config build.umd.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-rax-renderer": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-rax-renderer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"driver-universal": "^3.1.3",
|
||||
"history": "^5.0.0",
|
||||
@ -51,5 +51,5 @@
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-simulator-renderer"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-simulator-renderer@1.0.73/build/index.html",
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-renderer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "react renderer for ali lowcode engine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -22,7 +22,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.21.16",
|
||||
"@alilc/lowcode-renderer-core": "1.0.6"
|
||||
"@alilc/lowcode-renderer-core": "1.0.7-beta.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
@ -43,5 +43,5 @@
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-react-renderer@1.0.21/build/index.html",
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-react-simulator-renderer",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "react simulator renderer for alibaba lowcode designer",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -16,10 +16,10 @@
|
||||
"build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-react-renderer": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-react-renderer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"mobx": "^6.3.0",
|
||||
"mobx-react": "^7.2.0",
|
||||
@ -43,5 +43,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -14,23 +14,15 @@ const jestConfig = {
|
||||
transformIgnorePatterns: [
|
||||
`/node_modules/(?!${esModules})/`,
|
||||
],
|
||||
setupFiles: ['./tests/fixtures/unhandled-rejection.ts'],
|
||||
setupFiles: [
|
||||
'./tests/fixtures/unhandled-rejection.ts',
|
||||
'./tests/setup.ts',
|
||||
],
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: [
|
||||
'src/**/*.ts',
|
||||
'!src/**/*.d.ts',
|
||||
'!src/icons/**',
|
||||
'!src/locale/**',
|
||||
'!src/builtin-simulator/utils/**',
|
||||
'!src/plugin/sequencify.ts',
|
||||
'!src/document/node/exclusive-group.ts',
|
||||
'!src/document/node/props/value-to-source.ts',
|
||||
'!src/builtin-simulator/live-editing/live-editing.ts',
|
||||
'!src/designer/offset-observer.ts',
|
||||
'!src/designer/clipboard.ts',
|
||||
'!**/node_modules/**',
|
||||
'!**/vendor/**',
|
||||
'src/**/*.tsx',
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-renderer-core",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "renderer core",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
@ -16,8 +16,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-datasource-engine": "^1.0.0",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"debug": "^4.1.1",
|
||||
"fetch-jsonp": "^1.1.3",
|
||||
@ -34,7 +34,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alib/build-scripts": "^0.1.18",
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-test-mate": "^1.0.1",
|
||||
"@babel/plugin-transform-typescript": "^7.16.8",
|
||||
"@testing-library/react": "^11.2.2",
|
||||
@ -60,5 +60,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
const {
|
||||
hidden = false,
|
||||
condition = true,
|
||||
} = this.leaf?.export(TransformStage.Render) || {};
|
||||
} = this.leaf?.export?.(TransformStage.Render) || {};
|
||||
return {
|
||||
nodeChildren: null,
|
||||
childrenInState: false,
|
||||
@ -412,11 +412,12 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
|
||||
const node = leaf;
|
||||
|
||||
if (key === '___condition___') {
|
||||
const condition = parseData(newValue, scope);
|
||||
const { condition = true } = this.leaf?.export(TransformStage.Render) || {};
|
||||
const conditionValue = parseData(condition, scope);
|
||||
__debug(`key is ___condition___, change condition value to [${condition}]`);
|
||||
// 条件表达式改变
|
||||
this.setState({
|
||||
condition,
|
||||
condition: conditionValue,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,6 +108,9 @@ export default function rendererFactory(): IRenderComponent {
|
||||
if (SetComponent.patchedCatch) {
|
||||
return;
|
||||
}
|
||||
if (!SetComponent.prototype) {
|
||||
return;
|
||||
}
|
||||
SetComponent.patchedCatch = true;
|
||||
|
||||
// Rax 的 getDerivedStateFromError 有 BUG,这里先用 componentDidCatch 来替代
|
||||
|
||||
@ -3,6 +3,7 @@ import { isJSFunction } from '@alilc/lowcode-types';
|
||||
import { transformArrayToMap, transformStringToFunction, clone } from './common';
|
||||
import { jsonp, request, get, post } from './request';
|
||||
import { DataSource, DataSourceItem } from '../types';
|
||||
import logger from './logger';
|
||||
|
||||
const DS_STATUS = {
|
||||
INIT: 'init',
|
||||
@ -179,7 +180,7 @@ export class DataHelper {
|
||||
const _tb_token_ = (csrfInput as any)?.value;
|
||||
asyncDataList.forEach((req) => {
|
||||
const { id, type, options } = req;
|
||||
if (!id || !type) return;
|
||||
if (!id || !type || type === 'legao') return;
|
||||
if (type === 'doServer') {
|
||||
const { uri, params } = options || {};
|
||||
if (!uri) return;
|
||||
@ -310,7 +311,7 @@ export class DataHelper {
|
||||
}
|
||||
}
|
||||
|
||||
console.error(`Engine default dataSource not support type:[${type}] dataSource request!`);
|
||||
logger.log(`Engine default dataSource not support type:[${type}] dataSource request!`, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,52 @@ exports[`leafWrapper base 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`leafWrapper change ___condition___ props 1`] = `
|
||||
<div
|
||||
_leaf={
|
||||
Node {
|
||||
"emitter": EventEmitter {
|
||||
"_events": Object {
|
||||
"onChildrenChange": [Function],
|
||||
"onPropChange": [Function],
|
||||
"onVisibleChange": [Function],
|
||||
},
|
||||
"_eventsCount": 3,
|
||||
"_maxListeners": undefined,
|
||||
Symbol(kCapture): false,
|
||||
},
|
||||
"hasLoop": false,
|
||||
"schema": Object {},
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
||||
|
||||
exports[`leafWrapper change ___condition___ props, but not hidden component 1`] = `
|
||||
<div
|
||||
_leaf={
|
||||
Node {
|
||||
"emitter": EventEmitter {
|
||||
"_events": Object {
|
||||
"onChildrenChange": [Function],
|
||||
"onPropChange": [Function],
|
||||
"onVisibleChange": [Function],
|
||||
},
|
||||
"_eventsCount": 3,
|
||||
"_maxListeners": undefined,
|
||||
Symbol(kCapture): false,
|
||||
},
|
||||
"hasLoop": false,
|
||||
"schema": Object {},
|
||||
}
|
||||
}
|
||||
>
|
||||
<div>
|
||||
new content
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`leafWrapper change props 1`] = `
|
||||
<div
|
||||
_leaf={
|
||||
|
||||
@ -6,7 +6,6 @@ import { leafWrapper } from '../../src/hoc/leaf';
|
||||
import components from '../utils/components';
|
||||
import Node from '../utils/node';
|
||||
|
||||
|
||||
const baseRenderer: any = {
|
||||
__debug () {},
|
||||
__getComponentProps (schema: any) {
|
||||
@ -71,8 +70,29 @@ describe('leafWrapper', () => {
|
||||
let tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it('change ___condition___ props', () => {
|
||||
TextNode.schema.condition = false;
|
||||
TextNode.emitPropChange({
|
||||
key: '___condition___',
|
||||
newValue: false,
|
||||
} as any);
|
||||
|
||||
let tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('change ___condition___ props, but not hidden component', () => {
|
||||
TextNode.schema.condition = true;
|
||||
TextNode.emitPropChange({
|
||||
key: '___condition___',
|
||||
newValue: false,
|
||||
} as any);
|
||||
|
||||
let tree = component.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
})
|
||||
});
|
||||
|
||||
describe('loop', () => {
|
||||
const Div = leafWrapper(components.Div as any, {
|
||||
@ -105,4 +125,4 @@ describe('loop', () => {
|
||||
<Text _leaf={TextNode} content="content"></Text>
|
||||
</Div>
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
@ -10,3 +10,8 @@ jest.mock('zen-logger', () => {
|
||||
default: Logger,
|
||||
};
|
||||
});
|
||||
|
||||
export const mockConsoleWarn = jest.fn();
|
||||
console.warn = mockConsoleWarn;
|
||||
|
||||
process.env.NODE_ENV = 'production';
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-shell",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Shell Layer for AliLowCodeEngine",
|
||||
"main": "lib/index.js",
|
||||
"module": "es/index.js",
|
||||
@ -15,11 +15,11 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@alilc/lowcode-designer": "1.0.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.6",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-utils": "1.0.6",
|
||||
"@alilc/lowcode-designer": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-core": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-editor-skeleton": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"@alilc/lowcode-utils": "1.0.7-beta.6",
|
||||
"classnames": "^2.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
@ -57,5 +57,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -61,6 +61,13 @@ export default class DocumentModel {
|
||||
return new DocumentModel(document);
|
||||
}
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
get id() {
|
||||
return this[documentSymbol].id;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前文档所属的 project
|
||||
* @returns
|
||||
|
||||
@ -2,6 +2,15 @@ import { hotkey, HotkeyCallback } from '@alilc/lowcode-editor-core';
|
||||
import { Disposable } from '@alilc/lowcode-types';
|
||||
|
||||
export default class Hotkey {
|
||||
get callbacks() {
|
||||
return hotkey.callBacks;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
get callBacks() {
|
||||
return this.callbacks;
|
||||
}
|
||||
/**
|
||||
* 绑定快捷键
|
||||
* @param combos 快捷键,格式如:['command + s'] 、['ctrl + shift + s'] 等
|
||||
|
||||
@ -9,6 +9,7 @@ import Props from './props';
|
||||
import DocumentModel from './document-model';
|
||||
import NodeChildren from './node-children';
|
||||
import ComponentMeta from './component-meta';
|
||||
import SettingTopEntry from './setting-top-entry';
|
||||
import { documentSymbol, nodeSymbol } from './symbols';
|
||||
|
||||
const shellNodeSymbol = Symbol('shellNodeSymbol');
|
||||
@ -237,6 +238,10 @@ export default class Node {
|
||||
return this[nodeSymbol].schema;
|
||||
}
|
||||
|
||||
get settingEntry(): any {
|
||||
return SettingTopEntry.create(this[nodeSymbol].settingEntry as any);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use .children instead
|
||||
*/
|
||||
|
||||
@ -94,4 +94,23 @@ export default class Props {
|
||||
setExtraPropValue(path: string, value: CompositeValue) {
|
||||
return this.getExtraProp(path)?.setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* test if the specified key is existing or not.
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
has(key: string) {
|
||||
return this[propsSymbol].has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a key with given value
|
||||
* @param value
|
||||
* @param key
|
||||
* @returns
|
||||
*/
|
||||
add(value: CompositeValue, key?: string | number | undefined) {
|
||||
return this[propsSymbol].add(value, key);
|
||||
}
|
||||
}
|
||||
@ -18,14 +18,14 @@ export default class Selection {
|
||||
/**
|
||||
* 返回选中的节点 id
|
||||
*/
|
||||
get selected() {
|
||||
get selected(): string[] {
|
||||
return this[selectionSymbol].selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* return selected Node instance
|
||||
*/
|
||||
get node() {
|
||||
get node(): Node {
|
||||
return this.getNodes()[0];
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ export default class Selection {
|
||||
* 获取选中的节点实例
|
||||
* @returns
|
||||
*/
|
||||
getNodes() {
|
||||
getNodes(): Node[] {
|
||||
return this[selectionSymbol].getNodes().map((node: InnerNode) => Node.create(node));
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,6 +64,10 @@ export default class SettingPropEntry {
|
||||
return this[settingPropEntrySymbol].extraProps;
|
||||
}
|
||||
|
||||
get props() {
|
||||
return SettingTopEntry.create(this[settingPropEntrySymbol].props);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置属性对应的节点实例
|
||||
*/
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-types",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Types for Ali lowCode engine",
|
||||
"files": [
|
||||
"es",
|
||||
@ -30,5 +30,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@alilc/lowcode-utils",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7-beta.6",
|
||||
"description": "Utils for Ali lowCode engine",
|
||||
"files": [
|
||||
"lib",
|
||||
@ -14,7 +14,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@alifd/next": "^1.19.16",
|
||||
"@alilc/lowcode-types": "1.0.6",
|
||||
"@alilc/lowcode-types": "1.0.7-beta.6",
|
||||
"lodash": "^4.17.21",
|
||||
"react": "^16",
|
||||
"zen-logger": "^1.1.0"
|
||||
@ -33,5 +33,5 @@
|
||||
"type": "http",
|
||||
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils"
|
||||
},
|
||||
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6"
|
||||
"gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
|
||||
}
|
||||
|
||||
@ -2,6 +2,15 @@ import { isJSBlock, isJSSlot, ActivityType, NodeSchema, PageSchema, RootSchema }
|
||||
import { isVariable } from './misc';
|
||||
import { isPlainObject } from './is-plain-object';
|
||||
|
||||
function isJsObject(props: any) {
|
||||
if (typeof props === 'object' && props !== null) {
|
||||
return props.type && props.source && props.compiled;
|
||||
}
|
||||
}
|
||||
function isActionRef(props: any): boolean {
|
||||
return props.type && props.type === 'actionRef';
|
||||
}
|
||||
|
||||
/**
|
||||
* 将「乐高版本」协议升级成 JSExpression / JSSlot 等标准协议的结构
|
||||
* @param props
|
||||
@ -40,6 +49,19 @@ export function compatibleLegaoSchema(props: any): any {
|
||||
mock: props.value,
|
||||
};
|
||||
}
|
||||
if (isJsObject(props)) {
|
||||
return {
|
||||
type: 'JSExpression',
|
||||
value: props.compiled,
|
||||
extType: 'function',
|
||||
};
|
||||
}
|
||||
if (isActionRef(props)) {
|
||||
return {
|
||||
type: 'JSExpression',
|
||||
value: `${props.id}.bind(this)`,
|
||||
};
|
||||
}
|
||||
const newProps: any = {};
|
||||
Object.keys(props).forEach((key) => {
|
||||
if (/^__slot__/.test(key) && props[key] === true) {
|
||||
|
||||
@ -23,3 +23,9 @@ lerna run build:umd \
|
||||
--scope @alilc/lowcode-react-simulator-renderer \
|
||||
--scope @alilc/lowcode-react-renderer \
|
||||
--stream
|
||||
|
||||
cp ./packages/react-simulator-renderer/dist/js/* ./packages/engine/dist/js/
|
||||
cp ./packages/react-simulator-renderer/dist/css/* ./packages/engine/dist/css/
|
||||
|
||||
cp ./packages/rax-simulator-renderer/dist/js/* ./packages/engine/dist/js/
|
||||
cp ./packages/rax-simulator-renderer/dist/css/* ./packages/engine/dist/css/
|
||||
Loading…
x
Reference in New Issue
Block a user