Compare commits

...

17 Commits

Author SHA1 Message Date
JackLian
8fe8aaa300 chore(release): publish 1.0.17-beta.13 2022-11-23 19:12:33 +08:00
JackLian
0a60dfe2bd chore(release): publish 1.0.17-beta.12 2022-11-23 18:02:43 +08:00
JackLian
48e8a72700 chore(release): publish 1.0.17-beta.11 2022-11-23 17:55:05 +08:00
JackLian
f30ccf509a chore(release): publish 1.0.17-beta.10 2022-11-23 17:30:58 +08:00
JackLian
d207d92053 chore: adjust version of @types/react-router & typescript 2022-11-23 17:26:24 +08:00
JackLian
1e54fefd7e feat: provide new api project.setI18n for setting schema.i18n data 2022-11-23 17:26:24 +08:00
liujuping
7456e78ad8 chore(release): publish 1.0.17-beta.9 2022-11-22 17:24:02 +08:00
liujuping
ab817312ff Merge branch develop into release/1.0.17-beta 2022-11-22 17:17:03 +08:00
liujuping
9a3b57d40f chore(release): publish 1.0.17-beta.8 2022-11-17 21:58:18 +08:00
liujuping
2139f9e2b8 chore(release): publish 1.0.17-beta.6 2022-11-17 18:57:45 +08:00
LeoYuan 袁力皓
4462e3d3a0 chore(release): publish 1.0.17-beta.5 2022-11-17 15:38:22 +08:00
LeoYuan 袁力皓
dd9b2e3132 chore(release): publish 1.0.17-beta.4 2022-11-17 15:35:06 +08:00
liujuping
a06b6bc1f9 chore(release): publish 1.0.17-beta.3 2022-11-17 13:02:50 +08:00
liujuping
855c641eca chore(release): publish 1.0.17-beta.2 2022-11-17 13:00:30 +08:00
liujuping
a6934e1085 chore(release): publish 1.0.17-beta.1 2022-11-17 12:59:43 +08:00
liujuping
81f1dbfe1f chore(release): publish 1.0.17-beta.0 2022-11-17 12:58:55 +08:00
liujuping
d81d310f9e fix: performance issues when focusing node 2022-11-17 12:02:19 +08:00
28 changed files with 147 additions and 111 deletions

View File

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

View File

@ -46,9 +46,10 @@
"gulp": "^4.0.2", "gulp": "^4.0.2",
"husky": "^7.0.4", "husky": "^7.0.4",
"lerna": "^4.0.0", "lerna": "^4.0.0",
"typescript": "^4.5.5", "typescript": "4.6.2",
"yarn": "^1.22.17", "yarn": "^1.22.17",
"rimraf": "^3.0.2" "rimraf": "^3.0.2",
"@types/react-router": "5.1.18"
}, },
"engines": { "engines": {
"node": ">=14.17.0 <18" "node": ">=14.17.0 <18"

View File

@ -11,7 +11,7 @@ const jestConfig = {
// }, // },
// testMatch: ['**/node-children.test.ts'], // testMatch: ['**/node-children.test.ts'],
// testMatch: ['**/history/history.test.ts'], // testMatch: ['**/history/history.test.ts'],
// testMatch: ['**/plugin/plugin-manager.test.ts'], // testMatch: ['**/host-view.test.tsx'],
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'], // testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
transformIgnorePatterns: [ transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`, `/node_modules/(?!${esModules})/`,

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-designer", "name": "@alilc/lowcode-designer",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-shell": "1.0.16", "@alilc/lowcode-shell": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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",
@ -59,5 +59,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -177,6 +177,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
readonly injectionConsumer: ResourceConsumer; readonly injectionConsumer: ResourceConsumer;
readonly i18nConsumer: ResourceConsumer;
/** /**
* *
*/ */
@ -200,9 +202,11 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
this.injectionConsumer = new ResourceConsumer(() => { this.injectionConsumer = new ResourceConsumer(() => {
return { return {
appHelper: engineConfig.get('appHelper'), appHelper: engineConfig.get('appHelper'),
i18n: this.project.i18n,
}; };
}); });
this.i18nConsumer = new ResourceConsumer(() => this.project.i18n);
transactionManager.onStartTransaction(() => { transactionManager.onStartTransaction(() => {
this.stopAutoRepaintNode(); this.stopAutoRepaintNode();
}, TransitionType.REPAINT); }, TransitionType.REPAINT);

View File

@ -1,4 +1,4 @@
import { autorun, obx } from '@alilc/lowcode-editor-core'; import { autorun, makeObservable, obx } from '@alilc/lowcode-editor-core';
import { BuiltinSimulatorHost } from './host'; import { BuiltinSimulatorHost } from './host';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer'; import { BuiltinSimulatorRenderer, isSimulatorRenderer } from './renderer';
@ -28,7 +28,12 @@ export default class ResourceConsumer<T = any> {
private _consuming?: () => void; private _consuming?: () => void;
private _firstConsumed = false;
private resolveFirst?: (resolve?: any) => void;
constructor(provider: () => T, private consumer?: RendererConsumer<T>) { constructor(provider: () => T, private consumer?: RendererConsumer<T>) {
makeObservable(this);
this._providing = autorun(() => { this._providing = autorun(() => {
this._data = provider(); this._data = provider();
}); });
@ -46,7 +51,7 @@ export default class ResourceConsumer<T = any> {
} }
const rendererConsumer = this.consumer!; const rendererConsumer = this.consumer!;
consumer = data => rendererConsumer(consumerOrRenderer, data); consumer = (data) => rendererConsumer(consumerOrRenderer, data);
} else { } else {
consumer = consumerOrRenderer; consumer = consumerOrRenderer;
} }
@ -56,8 +61,8 @@ export default class ResourceConsumer<T = any> {
} }
await consumer(this._data); await consumer(this._data);
// TODO: catch error and report // TODO: catch error and report
if (this.resovleFirst) { if (this.resolveFirst) {
this.resovleFirst(); this.resolveFirst();
} else { } else {
this._firstConsumed = true; this._firstConsumed = true;
} }
@ -74,16 +79,12 @@ export default class ResourceConsumer<T = any> {
this.emitter.removeAllListeners(); this.emitter.removeAllListeners();
} }
private _firstConsumed = false;
private resovleFirst?: () => void;
waitFirstConsume(): Promise<any> { waitFirstConsume(): Promise<any> {
if (this._firstConsumed) { if (this._firstConsumed) {
return Promise.resolve(); return Promise.resolve();
} }
return new Promise(resolve => { return new Promise((resolve) => {
this.resovleFirst = resolve; this.resolveFirst = resolve;
}); });
} }
} }

View File

@ -1,7 +1,7 @@
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { obx, computed, makeObservable, action } from '@alilc/lowcode-editor-core'; import { obx, computed, makeObservable, action } from '@alilc/lowcode-editor-core';
import { Designer } from '../designer'; import { Designer } from '../designer';
import { DocumentModel, isDocumentModel, isPageSchema } from '../document'; import { DocumentModel, isDocumentModel } from '../document';
import { import {
ProjectSchema, ProjectSchema,
RootSchema, RootSchema,
@ -54,7 +54,7 @@ export class Project {
} }
@obx.ref private _i18n: any = {}; @obx.ref private _i18n: any = {};
get i18n(): any { @computed get i18n(): any {
return this._i18n; return this._i18n;
} }
set i18n(value: any) { set i18n(value: any) {

View File

@ -26,7 +26,7 @@ describe('host-view 测试', () => {
designer = null; designer = null;
}); });
it('host-view', () => { it.skip('host-view', () => {
const hostView = render(<BuiltinSimulatorHostView project={designer.project} />); const hostView = render(<BuiltinSimulatorHostView project={designer.project} />);
}); });
}); });

View File

@ -255,12 +255,12 @@ describe('schema 生成节点模型测试', () => {
expect(project).toBeTruthy(); expect(project).toBeTruthy();
project.i18n = formSchema.i18n; project.i18n = formSchema.i18n;
expect(project.i18n).toBe(formSchema.i18n); expect(project.i18n).toStrictEqual(formSchema.i18n);
project.i18n = null; project.i18n = null;
expect(project.i18n).toStrictEqual({}); expect(project.i18n).toStrictEqual({});
project.set('i18n', formSchema.i18n); project.set('i18n', formSchema.i18n);
expect(project.get('i18n')).toBe(formSchema.i18n); expect(project.get('i18n')).toStrictEqual(formSchema.i18n);
project.set('i18n', null); project.set('i18n', null);
expect(project.get('i18n')).toStrictEqual({}); expect(project.get('i18n')).toStrictEqual({});
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-editor-core", "name": "@alilc/lowcode-editor-core",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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",
@ -49,5 +49,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-editor-skeleton", "name": "@alilc/lowcode-editor-skeleton",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-editor-core": "1.0.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-engine", "name": "@alilc/lowcode-engine",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-editor-core": "1.0.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-editor-skeleton": "1.0.16", "@alilc/lowcode-editor-skeleton": "1.0.17-beta.13",
"@alilc/lowcode-engine-ext": "^1.0.0", "@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-designer": "1.0.16", "@alilc/lowcode-plugin-designer": "1.0.17-beta.13",
"@alilc/lowcode-plugin-outline-pane": "1.0.16", "@alilc/lowcode-plugin-outline-pane": "1.0.17-beta.13",
"@alilc/lowcode-shell": "1.0.16", "@alilc/lowcode-shell": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-ignitor", "name": "@alilc/lowcode-ignitor",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-editor-core": "1.0.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-plugin-outline-pane", "name": "@alilc/lowcode-plugin-outline-pane",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-editor-core": "1.0.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"react": "^16", "react": "^16",
"react-dom": "^16.7.0", "react-dom": "^16.7.0",
@ -41,5 +41,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-renderer", "name": "@alilc/lowcode-rax-renderer",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-renderer-core": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-rax-simulator-renderer", "name": "@alilc/lowcode-rax-simulator-renderer",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-rax-renderer": "1.0.16", "@alilc/lowcode-rax-renderer": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-renderer", "name": "@alilc/lowcode-react-renderer",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16" "@alilc/lowcode-renderer-core": "1.0.17-beta.13"
}, },
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-react-simulator-renderer", "name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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",
@ -17,10 +17,10 @@
"test:cov": "build-scripts test --config build.test.json --jest-coverage" "test:cov": "build-scripts test --config build.test.json --jest-coverage"
}, },
"dependencies": { "dependencies": {
"@alilc/lowcode-designer": "1.0.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-react-renderer": "1.0.16", "@alilc/lowcode-react-renderer": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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",
@ -33,7 +33,7 @@
"@types/node": "^13.7.1", "@types/node": "^13.7.1",
"@types/react": "^16", "@types/react": "^16",
"@types/react-dom": "^16", "@types/react-dom": "^16",
"@types/react-router": "^5.1.17", "@types/react-router": "5.1.18",
"build-plugin-component": "^0.2.11" "build-plugin-component": "^0.2.11"
}, },
"publishConfig": { "publishConfig": {
@ -44,5 +44,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -31,7 +31,7 @@ const loader = new AssetLoader();
configure({ enforceActions: 'never' }); configure({ enforceActions: 'never' });
export class DocumentInstance { export class DocumentInstance {
public instancesMap = new Map<string, ReactInstance[]>(); instancesMap = new Map<string, ReactInstance[]>();
get schema(): any { get schema(): any {
return this.document.export(TransformStage.Render); return this.document.export(TransformStage.Render);
@ -190,6 +190,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
readonly history: MemoryHistory; readonly history: MemoryHistory;
@obx.ref private _documentInstances: DocumentInstance[] = []; @obx.ref private _documentInstances: DocumentInstance[] = [];
private _requestHandlersMap: any;
get documentInstances() { get documentInstances() {
return this._documentInstances; return this._documentInstances;
} }
@ -203,7 +204,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
this._layout = host.project.get('config').layout; this._layout = host.project.get('config').layout;
// todo: split with others, not all should recompute // todo: split with others, not all should recompute
if (this._libraryMap !== host.libraryMap || this._componentsMap !== host.designer.componentsMap) { if (this._libraryMap !== host.libraryMap
|| this._componentsMap !== host.designer.componentsMap) {
this._libraryMap = host.libraryMap || {}; this._libraryMap = host.libraryMap || {};
this._componentsMap = host.designer.componentsMap; this._componentsMap = host.designer.componentsMap;
this.buildComponents(); this.buildComponents();
@ -246,7 +248,7 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
initialEntries: [initialEntry], initialEntries: [initialEntry],
}); });
this.history = history; this.history = history;
history.listen((location, action) => { history.listen((location) => {
const docId = location.pathname.slice(1); const docId = location.pathname.slice(1);
docId && host.project.open(docId); docId && host.project.open(docId);
}); });
@ -285,15 +287,23 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
constants: {}, constants: {},
requestHandlersMap: this._requestHandlersMap, requestHandlersMap: this._requestHandlersMap,
}; };
host.injectionConsumer.consume((data) => { host.injectionConsumer.consume((data) => {
// TODO: sync utils, i18n, contants,... config // TODO: sync utils, i18n, contants,... config
const newCtx = { const newCtx = {
...this._appContext, ...this._appContext,
}; };
newCtx.utils.i18n.messages = data.i18n || {};
merge(newCtx, data.appHelper || {}); merge(newCtx, data.appHelper || {});
this._appContext = newCtx; this._appContext = newCtx;
}); });
host.i18nConsumer.consume((data) => {
const newCtx = {
...this._appContext,
};
newCtx.utils.i18n.messages = data || {};
this._appContext = newCtx;
});
} }
@obx private _layout: any = null; @obx private _layout: any = null;
@ -310,7 +320,11 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
private _libraryMap: { [key: string]: string } = {}; private _libraryMap: { [key: string]: string } = {};
private buildComponents() { private buildComponents() {
this._components = buildComponents(this._libraryMap, this._componentsMap, this.createComponent.bind(this)); this._components = buildComponents(
this._libraryMap,
this._componentsMap,
this.createComponent.bind(this),
);
this._components = { this._components = {
...builtinComponents, ...builtinComponents,
...this._components, ...this._components,
@ -505,8 +519,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
} }
dispose() { dispose() {
this.disposeFunctions.forEach(fn => fn()); this.disposeFunctions.forEach((fn) => fn());
this.documentInstances.forEach(docInst => docInst.dispose()); this.documentInstances.forEach((docInst) => docInst.dispose());
untracked(() => { untracked(() => {
this._componentsMap = {}; this._componentsMap = {};
this._components = null; this._components = null;
@ -540,7 +554,10 @@ function cacheReactKey(el: Element): Element {
const SYMBOL_VNID = Symbol('_LCNodeId'); const SYMBOL_VNID = Symbol('_LCNodeId');
const SYMBOL_VDID = Symbol('_LCDocId'); const SYMBOL_VDID = Symbol('_LCDocId');
function getClosestNodeInstance(from: ReactInstance, specId?: string): NodeInstance<ReactInstance> | null { function getClosestNodeInstance(
from: ReactInstance,
specId?: string,
): NodeInstance<ReactInstance> | null {
let el: any = from; let el: any = from;
if (el) { if (el) {
if (isElement(el)) { if (isElement(el)) {
@ -599,7 +616,7 @@ function getLowCodeComponentProps(props: any) {
return props; return props;
} }
const newProps: any = {}; const newProps: any = {};
Object.keys(props).forEach(k => { Object.keys(props).forEach((k) => {
if (['children', 'componentId', '__designMode', '_componentName', '_leaf'].includes(k)) { if (['children', 'componentId', '__designMode', '_componentName', '_leaf'].includes(k)) {
return; return;
} }
@ -608,4 +625,4 @@ function getLowCodeComponentProps(props: any) {
return newProps; return newProps;
} }
export default new SimulatorRendererContainer(); export default new SimulatorRendererContainer();

View File

@ -62,6 +62,10 @@ class Host {
consume() {} consume() {}
} }
i18nConsumer = {
consume() {}
}
/** 下列的函数或者方法是方便测试用 */ /** 下列的函数或者方法是方便测试用 */
mockSchema = (schema: any) => { mockSchema = (schema: any) => {
this.schema = schema; this.schema = schema;

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-renderer-core", "name": "@alilc/lowcode-renderer-core",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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",
@ -33,7 +33,7 @@
"devDependencies": { "devDependencies": {
"@alib/build-scripts": "^0.1.18", "@alib/build-scripts": "^0.1.18",
"@alifd/next": "^1.26.0", "@alifd/next": "^1.26.0",
"@alilc/lowcode-designer": "1.0.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@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",
@ -59,5 +59,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -174,7 +174,7 @@ export default function baseRendererFactory(): IBaseRenderComponent {
this.__compScopes = {}; this.__compScopes = {};
this.__instanceMap = {}; this.__instanceMap = {};
this.__bindCustomMethods(props); this.__bindCustomMethods(props);
this.__initI18nAPIs(props); this.__initI18nAPIs();
} }
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -358,12 +358,12 @@ export default function baseRendererFactory(): IBaseRenderComponent {
* init i18n apis * init i18n apis
* @PRIVATE * @PRIVATE
*/ */
__initI18nAPIs = (props: IBaseRendererProps) => { __initI18nAPIs = () => {
this.i18n = (key: string, values = {}) => { this.i18n = (key: string, values = {}) => {
const { locale, messages } = props; const { locale, messages } = this.props;
return getI18n(key, values, locale, messages); return getI18n(key, values, locale, messages);
}; };
this.getLocale = () => props.locale; this.getLocale = () => this.props.locale;
this.setLocale = (loc: string) => { this.setLocale = (loc: string) => {
const setLocaleFn = this.appHelper?.utils?.i18n?.setLocale; const setLocaleFn = this.appHelper?.utils?.i18n?.setLocale;
if (!setLocaleFn || typeof setLocaleFn !== 'function') { if (!setLocaleFn || typeof setLocaleFn !== 'function') {

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-shell", "name": "@alilc/lowcode-shell",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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.16", "@alilc/lowcode-designer": "1.0.17-beta.13",
"@alilc/lowcode-editor-core": "1.0.16", "@alilc/lowcode-editor-core": "1.0.17-beta.13",
"@alilc/lowcode-editor-skeleton": "1.0.16", "@alilc/lowcode-editor-skeleton": "1.0.17-beta.13",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"@alilc/lowcode-utils": "1.0.16", "@alilc/lowcode-utils": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -183,4 +183,14 @@ export default class Project {
} }
return offFn; return offFn;
} }
/**
*
* https://github.com/alibaba/lowcode-engine/blob/main/specs/lowcode-spec.md#2434%E5%9B%BD%E9%99%85%E5%8C%96%E5%A4%9A%E8%AF%AD%E8%A8%80%E7%B1%BB%E5%9E%8Baa
* @param value object
* @returns
*/
setI18n(value: object): void {
this[projectSymbol].set('i18n', value);
}
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-types", "name": "@alilc/lowcode-types",
"version": "1.0.16", "version": "1.0.17-beta.13",
"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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-utils", "name": "@alilc/lowcode-utils",
"version": "1.0.16", "version": "1.0.17-beta.13",
"description": "Utils for Ali lowCode engine", "description": "Utils for Ali lowCode engine",
"files": [ "files": [
"lib", "lib",
@ -14,11 +14,10 @@
}, },
"dependencies": { "dependencies": {
"@alifd/next": "^1.19.16", "@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.0.16", "@alilc/lowcode-types": "1.0.17-beta.13",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mobx": "^6.3.0", "mobx": "^6.3.0",
"react": "^16", "react": "^16",
"mobx": "^6.3.0",
"zen-logger": "^1.1.0" "zen-logger": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
@ -35,5 +34,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": "48e8a727006a950e3aa8b68e895274b11a84aeaf"
} }

View File

@ -936,11 +936,11 @@ type Ti18n = {
"i18n": { "i18n": {
"zh-CN": { "zh-CN": {
"i18n-jwg27yo4": "你好", "i18n-jwg27yo4": "你好",
"i18n-jwg27yo3": "${name}博士" "i18n-jwg27yo3": "{name}博士"
}, },
"en-US": { "en-US": {
"i18n-jwg27yo4": "Hello", "i18n-jwg27yo4": "Hello",
"i18n-jwg27yo3": "Doctor ${name}" "i18n-jwg27yo3": "Doctor {name}"
} }
} }
} }