Compare commits

...

15 Commits

Author SHA1 Message Date
LeoYuan 袁力皓
68fe51f2ec chore(release): publish 1.0.7-beta.6 2022-05-10 14:02:27 +08:00
LeoYuan 袁力皓
8ec0a9ab6f fix: fix test case failures of designer 2022-05-10 13:55:44 +08:00
LeoYuan 袁力皓
28261fdc65 feat: export nodeChildrenSymbol && remove some unnecessary editor.set 2022-05-10 13:39:37 +08:00
liujuping
610fe3a569 feat: fix render-core leaf hoc component condition config should get from leaf exportSchema fn 2022-05-10 13:04:08 +08:00
LeoYuan 袁力皓
9284cf4e9b chore(release): publish 1.0.7-beta.5 2022-05-09 20:42:23 +08:00
LeoYuan 袁力皓
0b33f0efa8 feat: add some necessary methods and attributes 2022-05-09 20:38:38 +08:00
LeoYuan 袁力皓
0a2c37fea8 chore(release): publish 1.0.7-beta.4 2022-05-06 16:20:03 +08:00
liujuping
6ae94807a7 fix: type=legao dont make request 2022-05-06 15:58:04 +08:00
liujuping
325d2fb413 fix: lowcode component exec lifecycle has error 2022-05-06 15:09:37 +08:00
liujuping
f71d0079e8 fix: lowcode component leaf dont have export prop, exec leaf.export make error 2022-05-06 14:55:53 +08:00
LeoYuan 袁力皓
5be9b384d6 chore(release): publish 1.0.7-beta.3 2022-05-06 12:16:09 +08:00
LeoYuan 袁力皓
58ed44a6d1 chore(release): publish 1.0.7-beta.2 2022-05-06 11:46:41 +08:00
LeoYuan 袁力皓
1ff46346ac chore(release): publish 1.0.7-beta.1 2022-05-06 11:44:16 +08:00
LeoYuan 袁力皓
44650604a2 feat: cp dist files of simulator-renderer to that of engine 2022-05-06 11:43:41 +08:00
LeoYuan 袁力皓
82a0f50847 chore(release): publish 1.0.7-beta.0 2022-05-05 19:47:59 +08:00
38 changed files with 278 additions and 119 deletions

View File

@ -1,6 +1,6 @@
{ {
"lerna": "4.0.0", "lerna": "4.0.0",
"version": "1.0.6", "version": "1.0.7-beta.6",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"packages": [ "packages": [

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-designer", "name": "@alilc/lowcode-designer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Designer for Ali LowCode Engine", "description": "Designer for Ali LowCode Engine",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -15,10 +15,10 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-shell": "1.0.6", "@alilc/lowcode-shell": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5", "enzyme-adapter-react-16": "^1.15.5",
@ -58,5 +58,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/designer"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -550,7 +550,7 @@ export class Designer {
return reducers.reduce((xprops, reducer) => { return reducers.reduce((xprops, reducer) => {
try { try {
return reducer(xprops, node, { stage }); return reducer(xprops, node.internalToShellNode() as any, { stage });
} catch (e) { } catch (e) {
// todo: add log // todo: add log
console.warn(e); console.warn(e);

View File

@ -5,6 +5,10 @@ import { Prop, IPropParent, UNSET } from './prop';
import { Node } from '../node'; import { Node } from '../node';
import { TransformStage } from '../transform-stage'; import { TransformStage } from '../transform-stage';
interface ExtrasObject {
[key: string]: any;
}
export const EXTRA_KEY_PREFIX = '___'; export const EXTRA_KEY_PREFIX = '___';
export function getConvertedExtraKey(key: string): string { export function getConvertedExtraKey(key: string): string {
if (!key) { if (!key) {
@ -53,7 +57,7 @@ export class Props implements IPropParent {
@obx type: 'map' | 'list' = 'map'; @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); makeObservable(this);
this.owner = owner; this.owner = owner;
if (Array.isArray(value)) { if (Array.isArray(value)) {
@ -70,7 +74,7 @@ export class Props implements IPropParent {
} }
@action @action
import(value?: PropsMap | PropsList | null, extras?: object) { import(value?: PropsMap | PropsList | null, extras?: ExtrasObject) {
const originItems = this.items; const originItems = this.items;
if (Array.isArray(value)) { if (Array.isArray(value)) {
this.type = 'list'; 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); stage = compatStage(stage);
if (this.items.length < 1) { if (this.items.length < 1) {
return {}; return {};

View File

@ -117,7 +117,7 @@ export class Selection {
/** /**
* *
*/ */
getNodes() { getNodes(): Node[] {
const nodes = []; const nodes = [];
for (const id of this._selected) { for (const id of this._selected) {
const node = this.doc.getNode(id); const node = this.doc.getNode(id);

View File

@ -12,6 +12,12 @@ import divMetadata from '../fixtures/component-metadata/div';
import { delayObxTick } from '../utils'; import { delayObxTick } from '../utils';
import { fireEvent } from '@testing-library/react'; import { fireEvent } from '@testing-library/react';
const mockNode = {
internalToShellNode() {
return 'mockNode';
},
};
describe('Designer 测试', () => { describe('Designer 测试', () => {
let editor: Editor; let editor: Editor;
let designer: Designer; let designer: Designer;
@ -178,9 +184,9 @@ describe('Designer 测试', () => {
it('addPropsReducer / transformProps', () => { it('addPropsReducer / transformProps', () => {
// 没有相应的 reducer // 没有相应的 reducer
expect(designer.transformProps({ num: 1 }, TransformStage.Init)).toEqual({ num: 1 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Init)).toEqual({ num: 1 });
// props 是数组 // 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) => { designer.addPropsReducer((props, node) => {
props.num += 1; props.num += 1;
@ -217,17 +223,17 @@ describe('Designer 测试', () => {
return props; return props;
}, TransformStage.Upgrade); }, TransformStage.Upgrade);
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Init)).toEqual({ num: 3 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Init)).toEqual({ num: 3 });
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Clone)).toEqual({ num: 2 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Clone)).toEqual({ num: 2 });
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Serilize)).toEqual({ num: 2 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Serilize)).toEqual({ num: 2 });
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Render)).toEqual({ num: 2 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Render)).toEqual({ num: 2 });
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Save)).toEqual({ num: 2 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Save)).toEqual({ num: 2 });
expect(designer.transformProps({ num: 1 }, {}, TransformStage.Upgrade)).toEqual({ num: 2 }); expect(designer.transformProps({ num: 1 }, mockNode, TransformStage.Upgrade)).toEqual({ num: 2 });
designer.addPropsReducer((props, node) => { designer.addPropsReducer((props, node) => {
throw new Error('calculate error'); throw new Error('calculate error');
}, TransformStage.Upgrade); }, 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', () => { it('setProps', () => {

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-editor-core", "name": "@alilc/lowcode-editor-core",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Core Api for Ali lowCode engine", "description": "Core Api for Ali lowCode engine",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
@ -14,8 +14,8 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.16", "@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"debug": "^4.1.1", "debug": "^4.1.1",
"intl-messageformat": "^9.3.1", "intl-messageformat": "^9.3.1",
@ -48,5 +48,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-core"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -20,6 +20,15 @@ import { AssetsJson, AssetLoader } from '@alilc/lowcode-utils';
EventEmitter.defaultMaxListeners = 100; 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> { export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalEvent.EventConfig> {
addListener(event: string | symbol, listener: (...args: any[]) => void): this; addListener(event: string | symbol, listener: (...args: any[]) => void): this;
once(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; return;
} }
// store the data to engineConfig while invoking editor.set() // 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.context.set(key, data);
this.notifyGot(key); this.notifyGot(key);
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-editor-skeleton", "name": "@alilc/lowcode-editor-skeleton",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "alibaba lowcode editor skeleton", "description": "alibaba lowcode editor skeleton",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -18,10 +18,10 @@
], ],
"dependencies": { "dependencies": {
"@alifd/next": "^1.20.12", "@alifd/next": "^1.20.12",
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1" "react-dom": "^16.8.1"
@ -42,5 +42,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/editor-skeleton"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-engine", "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 / 一套面向扩展设计的企业级低代码技术体系", "description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
"main": "lib/engine-core.js", "main": "lib/engine-core.js",
"module": "es/engine-core.js", "module": "es/engine-core.js",
@ -19,14 +19,14 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.12", "@alifd/next": "^1.19.12",
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-editor-skeleton": "1.0.6", "@alilc/lowcode-editor-skeleton": "1.0.7-beta.6",
"@alilc/lowcode-engine-ext": "^1.0.0", "@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-designer": "1.0.6", "@alilc/lowcode-plugin-designer": "1.0.7-beta.6",
"@alilc/lowcode-plugin-outline-pane": "1.0.6", "@alilc/lowcode-plugin-outline-pane": "1.0.7-beta.6",
"@alilc/lowcode-shell": "1.0.6", "@alilc/lowcode-shell": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1" "react-dom": "^16.8.1"
}, },
@ -53,5 +53,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/engine"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -37,14 +37,10 @@ globalContext.register(editor, Editor);
globalContext.register(editor, 'editor'); globalContext.register(editor, 'editor');
const innerSkeleton = new InnerSkeleton(editor); const innerSkeleton = new InnerSkeleton(editor);
editor.set(Skeleton, innerSkeleton);
editor.set('skeleton' as any, innerSkeleton); editor.set('skeleton' as any, innerSkeleton);
engineConfig.set('skeleton' as any, innerSkeleton);
const designer = new Designer({ editor }); const designer = new Designer({ editor });
editor.set(Designer, designer);
editor.set('designer' as any, designer); editor.set('designer' as any, designer);
engineConfig.set('designer' as any, designer);
const plugins = new LowCodePluginManager(editor).toProxy(); const plugins = new LowCodePluginManager(editor).toProxy();
editor.set('plugins' as any, plugins); editor.set('plugins' as any, plugins);

View File

@ -2,6 +2,7 @@ import {
projectSymbol, projectSymbol,
documentSymbol, documentSymbol,
nodeSymbol, nodeSymbol,
nodeChildrenSymbol,
designerSymbol, designerSymbol,
skeletonSymbol, skeletonSymbol,
editorSymbol, editorSymbol,
@ -13,6 +14,7 @@ export default {
projectSymbol, projectSymbol,
documentSymbol, documentSymbol,
nodeSymbol, nodeSymbol,
nodeChildrenSymbol,
skeletonSymbol, skeletonSymbol,
editorSymbol, editorSymbol,
designerSymbol, designerSymbol,

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-ignitor", "name": "@alilc/lowcode-ignitor",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "点火器bootstrap lce project", "description": "点火器bootstrap lce project",
"main": "lib/index.js", "main": "lib/index.js",
"private": true, "private": true,

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-plugin-designer", "name": "@alilc/lowcode-plugin-designer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "alibaba lowcode editor designer plugin", "description": "alibaba lowcode editor designer plugin",
"files": [ "files": [
"es", "es",
@ -18,9 +18,9 @@
], ],
"author": "xiayang.xy", "author": "xiayang.xy",
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1" "react-dom": "^16.8.1"
}, },
@ -38,5 +38,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-designer"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-plugin-outline-pane", "name": "@alilc/lowcode-plugin-outline-pane",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Outline pane for Ali lowCode engine", "description": "Outline pane for Ali lowCode engine",
"files": [ "files": [
"es", "es",
@ -13,10 +13,10 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.16", "@alifd/next": "^1.19.16",
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^16", "react": "^16",
"react-dom": "^16.7.0" "react-dom": "^16.7.0"
@ -40,5 +40,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/plugin-outline-pane"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-renderer", "name": "@alilc/lowcode-rax-renderer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Rax renderer for Ali lowCode engine", "description": "Rax renderer for Ali lowCode engine",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -30,8 +30,8 @@
"build": "build-scripts build" "build": "build-scripts build"
}, },
"dependencies": { "dependencies": {
"@alilc/lowcode-renderer-core": "1.0.6", "@alilc/lowcode-renderer-core": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"rax-find-dom-node": "^1.0.1" "rax-find-dom-node": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
@ -49,5 +49,5 @@
}, },
"license": "MIT", "license": "MIT",
"homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html", "homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-renderer@0.1.2/build/index.html",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-simulator-renderer", "name": "@alilc/lowcode-rax-simulator-renderer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "rax simulator renderer for alibaba lowcode designer", "description": "rax simulator renderer for alibaba lowcode designer",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -13,10 +13,10 @@
"build:umd": "build-scripts build --config build.umd.json" "build:umd": "build-scripts build --config build.umd.json"
}, },
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-rax-renderer": "1.0.6", "@alilc/lowcode-rax-renderer": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"driver-universal": "^3.1.3", "driver-universal": "^3.1.3",
"history": "^5.0.0", "history": "^5.0.0",
@ -51,5 +51,5 @@
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/rax-simulator-renderer" "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", "homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-rax-simulator-renderer@1.0.73/build/index.html",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-renderer", "name": "@alilc/lowcode-react-renderer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "react renderer for ali lowcode engine", "description": "react renderer for ali lowcode engine",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -22,7 +22,7 @@
], ],
"dependencies": { "dependencies": {
"@alifd/next": "^1.21.16", "@alifd/next": "^1.21.16",
"@alilc/lowcode-renderer-core": "1.0.6" "@alilc/lowcode-renderer-core": "1.0.7-beta.6"
}, },
"devDependencies": { "devDependencies": {
"@alib/build-scripts": "^0.1.18", "@alib/build-scripts": "^0.1.18",
@ -43,5 +43,5 @@
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-renderer" "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", "homepage": "https://unpkg.alibaba-inc.com/@alilc/lowcode-react-renderer@1.0.21/build/index.html",
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-simulator-renderer", "name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "react simulator renderer for alibaba lowcode designer", "description": "react simulator renderer for alibaba lowcode designer",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/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" "build:umd": "NODE_OPTIONS=--max_old_space_size=8192 build-scripts build --config build.umd.json"
}, },
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-react-renderer": "1.0.6", "@alilc/lowcode-react-renderer": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"mobx": "^6.3.0", "mobx": "^6.3.0",
"mobx-react": "^7.2.0", "mobx-react": "^7.2.0",
@ -43,5 +43,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/react-simulator-renderer"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -14,23 +14,15 @@ const jestConfig = {
transformIgnorePatterns: [ transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`, `/node_modules/(?!${esModules})/`,
], ],
setupFiles: ['./tests/fixtures/unhandled-rejection.ts'], setupFiles: [
'./tests/fixtures/unhandled-rejection.ts',
'./tests/setup.ts',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
collectCoverage: true, collectCoverage: true,
collectCoverageFrom: [ collectCoverageFrom: [
'src/**/*.ts', 'src/**/*.ts',
'!src/**/*.d.ts', 'src/**/*.tsx',
'!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/**',
], ],
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-renderer-core", "name": "@alilc/lowcode-renderer-core",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "renderer core", "description": "renderer core",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
@ -16,8 +16,8 @@
}, },
"dependencies": { "dependencies": {
"@alilc/lowcode-datasource-engine": "^1.0.0", "@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"debug": "^4.1.1", "debug": "^4.1.1",
"fetch-jsonp": "^1.1.3", "fetch-jsonp": "^1.1.3",
@ -34,7 +34,7 @@
}, },
"devDependencies": { "devDependencies": {
"@alib/build-scripts": "^0.1.18", "@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", "@alilc/lowcode-test-mate": "^1.0.1",
"@babel/plugin-transform-typescript": "^7.16.8", "@babel/plugin-transform-typescript": "^7.16.8",
"@testing-library/react": "^11.2.2", "@testing-library/react": "^11.2.2",
@ -60,5 +60,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/renderer-core"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -238,7 +238,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
const { const {
hidden = false, hidden = false,
condition = true, condition = true,
} = this.leaf?.export(TransformStage.Render) || {}; } = this.leaf?.export?.(TransformStage.Render) || {};
return { return {
nodeChildren: null, nodeChildren: null,
childrenInState: false, childrenInState: false,
@ -412,11 +412,12 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
const node = leaf; const node = leaf;
if (key === '___condition___') { 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}]`); __debug(`key is ___condition___, change condition value to [${condition}]`);
// 条件表达式改变 // 条件表达式改变
this.setState({ this.setState({
condition, condition: conditionValue,
}); });
return; return;
} }

View File

@ -108,6 +108,9 @@ export default function rendererFactory(): IRenderComponent {
if (SetComponent.patchedCatch) { if (SetComponent.patchedCatch) {
return; return;
} }
if (!SetComponent.prototype) {
return;
}
SetComponent.patchedCatch = true; SetComponent.patchedCatch = true;
// Rax 的 getDerivedStateFromError 有 BUG这里先用 componentDidCatch 来替代 // Rax 的 getDerivedStateFromError 有 BUG这里先用 componentDidCatch 来替代

View File

@ -3,6 +3,7 @@ import { isJSFunction } from '@alilc/lowcode-types';
import { transformArrayToMap, transformStringToFunction, clone } from './common'; import { transformArrayToMap, transformStringToFunction, clone } from './common';
import { jsonp, request, get, post } from './request'; import { jsonp, request, get, post } from './request';
import { DataSource, DataSourceItem } from '../types'; import { DataSource, DataSourceItem } from '../types';
import logger from './logger';
const DS_STATUS = { const DS_STATUS = {
INIT: 'init', INIT: 'init',
@ -179,7 +180,7 @@ export class DataHelper {
const _tb_token_ = (csrfInput as any)?.value; const _tb_token_ = (csrfInput as any)?.value;
asyncDataList.forEach((req) => { asyncDataList.forEach((req) => {
const { id, type, options } = req; const { id, type, options } = req;
if (!id || !type) return; if (!id || !type || type === 'legao') return;
if (type === 'doServer') { if (type === 'doServer') {
const { uri, params } = options || {}; const { uri, params } = options || {};
if (!uri) return; 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);
} }
} }

View File

@ -25,6 +25,52 @@ exports[`leafWrapper base 1`] = `
</div> </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`] = ` exports[`leafWrapper change props 1`] = `
<div <div
_leaf={ _leaf={

View File

@ -6,7 +6,6 @@ import { leafWrapper } from '../../src/hoc/leaf';
import components from '../utils/components'; import components from '../utils/components';
import Node from '../utils/node'; import Node from '../utils/node';
const baseRenderer: any = { const baseRenderer: any = {
__debug () {}, __debug () {},
__getComponentProps (schema: any) { __getComponentProps (schema: any) {
@ -71,8 +70,29 @@ describe('leafWrapper', () => {
let tree = component.toJSON(); let tree = component.toJSON();
expect(tree).toMatchSnapshot(); 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', () => { describe('loop', () => {
const Div = leafWrapper(components.Div as any, { const Div = leafWrapper(components.Div as any, {
@ -105,4 +125,4 @@ describe('loop', () => {
<Text _leaf={TextNode} content="content"></Text> <Text _leaf={TextNode} content="content"></Text>
</Div> </Div>
); );
}) });

View File

@ -9,4 +9,9 @@ jest.mock('zen-logger', () => {
__esModule: true, __esModule: true,
default: Logger, default: Logger,
}; };
}); });
export const mockConsoleWarn = jest.fn();
console.warn = mockConsoleWarn;
process.env.NODE_ENV = 'production';

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-shell", "name": "@alilc/lowcode-shell",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Shell Layer for AliLowCodeEngine", "description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js", "main": "lib/index.js",
"module": "es/index.js", "module": "es/index.js",
@ -15,11 +15,11 @@
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.0.6", "@alilc/lowcode-designer": "1.0.7-beta.6",
"@alilc/lowcode-editor-core": "1.0.6", "@alilc/lowcode-editor-core": "1.0.7-beta.6",
"@alilc/lowcode-editor-skeleton": "1.0.6", "@alilc/lowcode-editor-skeleton": "1.0.7-beta.6",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"@alilc/lowcode-utils": "1.0.6", "@alilc/lowcode-utils": "1.0.7-beta.6",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5", "enzyme-adapter-react-16": "^1.15.5",
@ -57,5 +57,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/shell"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -61,6 +61,13 @@ export default class DocumentModel {
return new DocumentModel(document); return new DocumentModel(document);
} }
/**
* id
*/
get id() {
return this[documentSymbol].id;
}
/** /**
* project * project
* @returns * @returns

View File

@ -2,6 +2,15 @@ import { hotkey, HotkeyCallback } from '@alilc/lowcode-editor-core';
import { Disposable } from '@alilc/lowcode-types'; import { Disposable } from '@alilc/lowcode-types';
export default class Hotkey { export default class Hotkey {
get callbacks() {
return hotkey.callBacks;
}
/**
* @deprecated
*/
get callBacks() {
return this.callbacks;
}
/** /**
* *
* @param combos ['command + s'] ['ctrl + shift + s'] * @param combos ['command + s'] ['ctrl + shift + s']

View File

@ -9,6 +9,7 @@ import Props from './props';
import DocumentModel from './document-model'; import DocumentModel from './document-model';
import NodeChildren from './node-children'; import NodeChildren from './node-children';
import ComponentMeta from './component-meta'; import ComponentMeta from './component-meta';
import SettingTopEntry from './setting-top-entry';
import { documentSymbol, nodeSymbol } from './symbols'; import { documentSymbol, nodeSymbol } from './symbols';
const shellNodeSymbol = Symbol('shellNodeSymbol'); const shellNodeSymbol = Symbol('shellNodeSymbol');
@ -237,6 +238,10 @@ export default class Node {
return this[nodeSymbol].schema; return this[nodeSymbol].schema;
} }
get settingEntry(): any {
return SettingTopEntry.create(this[nodeSymbol].settingEntry as any);
}
/** /**
* @deprecated use .children instead * @deprecated use .children instead
*/ */

View File

@ -94,4 +94,23 @@ export default class Props {
setExtraPropValue(path: string, value: CompositeValue) { setExtraPropValue(path: string, value: CompositeValue) {
return this.getExtraProp(path)?.setValue(value); 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);
}
} }

View File

@ -18,14 +18,14 @@ export default class Selection {
/** /**
* id * id
*/ */
get selected() { get selected(): string[] {
return this[selectionSymbol].selected; return this[selectionSymbol].selected;
} }
/** /**
* return selected Node instance * return selected Node instance
*/ */
get node() { get node(): Node {
return this.getNodes()[0]; return this.getNodes()[0];
} }
@ -81,7 +81,7 @@ export default class Selection {
* *
* @returns * @returns
*/ */
getNodes() { getNodes(): Node[] {
return this[selectionSymbol].getNodes().map((node: InnerNode) => Node.create(node)); return this[selectionSymbol].getNodes().map((node: InnerNode) => Node.create(node));
} }
} }

View File

@ -64,6 +64,10 @@ export default class SettingPropEntry {
return this[settingPropEntrySymbol].extraProps; return this[settingPropEntrySymbol].extraProps;
} }
get props() {
return SettingTopEntry.create(this[settingPropEntrySymbol].props);
}
/** /**
* *
*/ */

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-types", "name": "@alilc/lowcode-types",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Types for Ali lowCode engine", "description": "Types for Ali lowCode engine",
"files": [ "files": [
"es", "es",
@ -30,5 +30,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/types"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-utils", "name": "@alilc/lowcode-utils",
"version": "1.0.6", "version": "1.0.7-beta.6",
"description": "Utils for Ali lowCode engine", "description": "Utils for Ali lowCode engine",
"files": [ "files": [
"lib", "lib",
@ -14,7 +14,7 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.16", "@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.0.6", "@alilc/lowcode-types": "1.0.7-beta.6",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"react": "^16", "react": "^16",
"zen-logger": "^1.1.0" "zen-logger": "^1.1.0"
@ -33,5 +33,5 @@
"type": "http", "type": "http",
"url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils" "url": "https://github.com/alibaba/lowcode-engine/tree/main/packages/utils"
}, },
"gitHead": "2669f179e6f899d395ce1942d0fe04f9c5ed48a6" "gitHead": "58ed44a6d13a316073cf2c4a012d062748877a50"
} }

View File

@ -2,6 +2,15 @@ import { isJSBlock, isJSSlot, ActivityType, NodeSchema, PageSchema, RootSchema }
import { isVariable } from './misc'; import { isVariable } from './misc';
import { isPlainObject } from './is-plain-object'; 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 * JSExpression / JSSlot
* @param props * @param props
@ -40,6 +49,19 @@ export function compatibleLegaoSchema(props: any): any {
mock: props.value, 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 = {}; const newProps: any = {};
Object.keys(props).forEach((key) => { Object.keys(props).forEach((key) => {
if (/^__slot__/.test(key) && props[key] === true) { if (/^__slot__/.test(key) && props[key] === true) {

View File

@ -22,4 +22,10 @@ lerna run build:umd \
--scope @alilc/lowcode-rax-simulator-renderer \ --scope @alilc/lowcode-rax-simulator-renderer \
--scope @alilc/lowcode-react-simulator-renderer \ --scope @alilc/lowcode-react-simulator-renderer \
--scope @alilc/lowcode-react-renderer \ --scope @alilc/lowcode-react-renderer \
--stream --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/