extends ISensor {
*/
getComponentInstances(node: Node): ComponentInstance[] | null;
/**
- * 根据低代码组件 schema 创建组件类
+ * 根据 schema 创建组件类
*/
- createComponent(schema: ComponentSchema): Component | null;
+ createComponent(schema: NodeSchema): Component | null;
/**
* 根据节点获取节点的组件运行上下文
*/
diff --git a/packages/editor-preset-general/CHANGELOG.md b/packages/editor-preset-general/CHANGELOG.md
index 40d6aacc3..5efd0039e 100644
--- a/packages/editor-preset-general/CHANGELOG.md
+++ b/packages/editor-preset-general/CHANGELOG.md
@@ -3,6 +3,46 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [0.9.27](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.26...@ali/lowcode-editor-preset-general@0.9.27) (2020-08-14)
+
+
+
+
+**Note:** Version bump only for package @ali/lowcode-editor-preset-general
+
+
+## [0.9.26](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.25...@ali/lowcode-editor-preset-general@0.9.26) (2020-08-07)
+
+
+
+
+**Note:** Version bump only for package @ali/lowcode-editor-preset-general
+
+
+## [0.9.25](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.24...@ali/lowcode-editor-preset-general@0.9.25) (2020-08-06)
+
+
+
+
+**Note:** Version bump only for package @ali/lowcode-editor-preset-general
+
+
+## [0.9.24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.23...@ali/lowcode-editor-preset-general@0.9.24) (2020-08-06)
+
+
+
+
+**Note:** Version bump only for package @ali/lowcode-editor-preset-general
+
+
+## [0.9.23](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.22...@ali/lowcode-editor-preset-general@0.9.23) (2020-08-06)
+
+
+
+
+**Note:** Version bump only for package @ali/lowcode-editor-preset-general
+
## [0.9.22](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-general@0.9.21...@ali/lowcode-editor-preset-general@0.9.22) (2020-08-04)
diff --git a/packages/editor-preset-general/package.json b/packages/editor-preset-general/package.json
index 825445506..2cdb6064b 100644
--- a/packages/editor-preset-general/package.json
+++ b/packages/editor-preset-general/package.json
@@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-general",
- "version": "0.9.22",
+ "version": "0.9.27",
"private": true,
"description": "Ali General Editor Preset",
"main": "lib/index.js",
@@ -16,9 +16,9 @@
"license": "MIT",
"dependencies": {
"@ali/lowcode-editor-core": "^0.8.28",
- "@ali/lowcode-editor-skeleton": "^0.8.43",
- "@ali/lowcode-plugin-designer": "^0.9.37",
- "@ali/lowcode-plugin-outline-pane": "^0.8.43",
+ "@ali/lowcode-editor-skeleton": "^0.8.48",
+ "@ali/lowcode-plugin-designer": "^0.9.42",
+ "@ali/lowcode-plugin-outline-pane": "^0.8.48",
"@ali/lowcode-types": "^0.8.14",
"@ali/lowcode-utils": "^0.8.16",
"@alifd/next": "^1.19.12",
diff --git a/packages/editor-preset-vision/CHANGELOG.md b/packages/editor-preset-vision/CHANGELOG.md
index 74f3a84f3..82773919a 100644
--- a/packages/editor-preset-vision/CHANGELOG.md
+++ b/packages/editor-preset-vision/CHANGELOG.md
@@ -3,6 +3,67 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [0.8.43](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.42...@ali/lowcode-editor-preset-vision@0.8.43) (2020-08-14)
+
+
+### Bug Fixes
+
+* createComponent 支持所有 schema ([7f946f5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7f946f5))
+* upgradePropsReducer ([e68977f](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e68977f))
+* vision 大包 window 指向问题 ([aa1b526](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/aa1b526))
+* 不对外暴露 Node ([05957ce](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/05957ce))
+* 支持 AC 组件 ([c287bad](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/c287bad))
+
+
+
+
+
+## [0.8.42](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.41...@ali/lowcode-editor-preset-vision@0.8.42) (2020-08-07)
+
+
+### Bug Fixes
+
+* vision API 兼容 DockPane.getDocks() ([f72fb66](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/f72fb66))
+
+
+
+
+
+## [0.8.41](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.40...@ali/lowcode-editor-preset-vision@0.8.41) (2020-08-06)
+
+
+### Bug Fixes
+
+* fieldId 重复问题 ([e761b1a](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/e761b1a))
+
+
+
+
+
+## [0.8.40](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.39...@ali/lowcode-editor-preset-vision@0.8.40) (2020-08-06)
+
+
+### Bug Fixes
+
+* 保存区块按钮渲染异常 ([33a7227](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/33a7227))
+* 增加兼容 API ([2960446](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/2960446))
+
+
+
+
+
+## [0.8.39](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.38...@ali/lowcode-editor-preset-vision@0.8.39) (2020-08-06)
+
+
+### Bug Fixes
+
+* 修复 preset-vision 版本 lifeCycles 丢失以及 slot 初始化问题 ([7cf6d24](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/7cf6d24))
+* 框架样式调整 ([58790c5](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/commit/58790c5))
+
+
+
+
## [0.8.38](https://gitlab.alibaba-inc.com/ali-lowcode/ali-lowcode-engine/compare/@ali/lowcode-editor-preset-vision@0.8.37...@ali/lowcode-editor-preset-vision@0.8.38) (2020-08-04)
diff --git a/packages/editor-preset-vision/package.json b/packages/editor-preset-vision/package.json
index 0ce5449f1..c7584782b 100644
--- a/packages/editor-preset-vision/package.json
+++ b/packages/editor-preset-vision/package.json
@@ -1,6 +1,6 @@
{
"name": "@ali/lowcode-editor-preset-vision",
- "version": "0.8.38",
+ "version": "0.8.43",
"private": true,
"description": "Vision Polyfill for Ali lowCode engine",
"main": "lib/index.js",
@@ -15,11 +15,11 @@
},
"license": "MIT",
"dependencies": {
- "@ali/lowcode-designer": "^0.9.37",
+ "@ali/lowcode-designer": "^0.9.42",
"@ali/lowcode-editor-core": "^0.8.28",
- "@ali/lowcode-editor-skeleton": "^0.8.43",
- "@ali/lowcode-plugin-designer": "^0.9.37",
- "@ali/lowcode-plugin-outline-pane": "^0.8.43",
+ "@ali/lowcode-editor-skeleton": "^0.8.48",
+ "@ali/lowcode-plugin-designer": "^0.9.42",
+ "@ali/lowcode-plugin-outline-pane": "^0.8.48",
"@ali/ve-i18n-util": "^2.0.0",
"@ali/ve-icons": "^4.1.9",
"@ali/ve-less-variables": "2.0.3",
diff --git a/packages/editor-preset-vision/src/bundle/bundle.ts b/packages/editor-preset-vision/src/bundle/bundle.ts
index c913b7e84..8b0ce27d5 100644
--- a/packages/editor-preset-vision/src/bundle/bundle.ts
+++ b/packages/editor-preset-vision/src/bundle/bundle.ts
@@ -2,6 +2,7 @@ import lg from '@ali/vu-logger';
import { ComponentClass, ComponentType } from 'react';
import Prototype, { isPrototype } from './prototype';
import { designer } from '../editor';
+import trunk from './trunk';
function basename(name: string) {
return name ? (/[^\/]+$/.exec(name) || [''])[0] : '';
@@ -65,6 +66,22 @@ export default class Bundle {
this.recursivelyRegisterPrototypes(prototype, item);
}
});
+
+ // invoke prototype mocker while the prototype does not exist
+ Object.keys(this.viewsMap).forEach((viewName) => {
+ const test = this;
+ // console.log(test, viewName);
+ if (!this.prototypeList.find((proto) => proto.getComponentName() === viewName)) {
+ const mockedPrototype = trunk.mockComponentPrototype(this.viewsMap[viewName]);
+ if (mockedPrototype) {
+ mockedPrototype.setView(this.viewsMap[viewName]);
+ this.registerPrototype(mockedPrototype);
+ if (!mockedPrototype.getPackageName()) {
+ mockedPrototype.setPackageName((this.viewsMap[viewName] as any)._packageName_);
+ }
+ }
+ }
+ });
}
getFromMeta(componentName: string): Prototype {
@@ -148,7 +165,7 @@ export default class Bundle {
}
if (isPrototype(proto)) {
const componentName = proto.getComponentName()!;
- if (!proto.getView() && this.viewsMap[componentName]) {
+ if (this.viewsMap[componentName]) {
proto.setView(this.viewsMap[componentName]);
}
if (cp.name && !proto.getPackageName()) {
diff --git a/packages/editor-preset-vision/src/bundle/prototype.ts b/packages/editor-preset-vision/src/bundle/prototype.ts
index b1406c987..7499f899e 100644
--- a/packages/editor-preset-vision/src/bundle/prototype.ts
+++ b/packages/editor-preset-vision/src/bundle/prototype.ts
@@ -213,8 +213,8 @@ class Prototype {
static addGlobalExtraActions = addGlobalExtraActions;
static removeGlobalPropsConfigure = removeGlobalPropsConfigure;
static overridePropsConfigure = overridePropsConfigure;
- static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
- return new Prototype(config, lookup);
+ static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
+ return new Prototype(config, extraConfigs, lookup);
}
readonly isPrototype = true;
@@ -224,7 +224,7 @@ class Prototype {
return this.meta.npm?.package;
}
- constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
+ constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
if (lookup) {
this.meta = designer.getComponentMeta(input.componentName);
this.options = this.meta.getMetadata();
@@ -279,15 +279,15 @@ class Prototype {
private category?: string;
getCategory() {
- if (this.category != null) {
- return this.category;
+ if (this.options.category != null) {
+ return this.options.category;
}
return this.meta.getMetadata().tags?.[0] || '*';
}
setCategory(category: string) {
- this.category = category;
+ this.options.category = category;
}
getIcon() {
diff --git a/packages/editor-preset-vision/src/bundle/trunk.ts b/packages/editor-preset-vision/src/bundle/trunk.ts
index b8e0f19d6..4ae5ed640 100644
--- a/packages/editor-preset-vision/src/bundle/trunk.ts
+++ b/packages/editor-preset-vision/src/bundle/trunk.ts
@@ -3,11 +3,13 @@ import { EventEmitter } from 'events';
import { registerSetter, RegisteredSetter, getSetter } from '@ali/lowcode-editor-core';
import Bundle from './bundle';
import { CustomView } from '@ali/lowcode-types';
+import Prototype from './prototype';
export class Trunk {
private trunk: any[] = [];
private emitter: EventEmitter = new EventEmitter();
private metaBundle = new Bundle();
+ private componentPrototypeMocker: any;
isReady() {
return this.getList().length > 0;
@@ -25,7 +27,13 @@ export class Trunk {
getList(): any[] {
const list = this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
- return Array.from(new Set(list));
+ const result: Prototype[] = [];
+ list.forEach((item: Prototype) => {
+ if (!result.find(r => r.options.componentName === item.options.componentName)) {
+ result.push(item);
+ }
+ });
+ return result;
}
getPrototype(name: string) {
@@ -98,8 +106,16 @@ export class Trunk {
console.warn('Trunk.afterLoadBundle is deprecated');
}
- registerComponentPrototypeMocker() {
- console.warn('Trunk.registerComponentPrototypeMocker is deprecated');
+ registerComponentPrototypeMocker(mocker: any) {
+ this.componentPrototypeMocker = mocker;
+ }
+
+ mockComponentPrototype(bundle: any) {
+ if (!this.componentPrototypeMocker) {
+ lg.error('ERROR: no component prototypeMocker is set');
+ }
+ return this.componentPrototypeMocker
+ && this.componentPrototypeMocker.mockPrototype(bundle);
}
setPackages() {
@@ -113,6 +129,10 @@ export class Trunk {
}
return setter;
}
+
+ getRecents(limit: number) {
+ return this.getList().filter((prototype) => prototype.getCategory()).slice(0, limit);
+ }
}
export default new Trunk();
diff --git a/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts b/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts
index 4af320f41..c03b7f82e 100644
--- a/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts
+++ b/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts
@@ -564,7 +564,7 @@ export function upgradeActions(actions?: Array