mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 07:14:23 +00:00
fix: 低代码组件修改之后渲染为空
This commit is contained in:
parent
d666317d86
commit
ef71632dc0
@ -386,6 +386,8 @@ export class Designer {
|
|||||||
let meta = this._componentMetasMap.get(key);
|
let meta = this._componentMetasMap.get(key);
|
||||||
if (meta) {
|
if (meta) {
|
||||||
meta.setMetadata(data);
|
meta.setMetadata(data);
|
||||||
|
|
||||||
|
this._componentMetasMap.set(key, meta);
|
||||||
} else {
|
} else {
|
||||||
meta = this._lostComponentMetasMap.get(key);
|
meta = this._lostComponentMetasMap.get(key);
|
||||||
|
|
||||||
@ -426,10 +428,11 @@ export class Designer {
|
|||||||
|
|
||||||
@computed get componentsMap(): { [key: string]: NpmInfo | Component } {
|
@computed get componentsMap(): { [key: string]: NpmInfo | Component } {
|
||||||
const maps: any = {};
|
const maps: any = {};
|
||||||
this._componentMetasMap.forEach((config, key) => {
|
const designer = this;
|
||||||
|
designer._componentMetasMap.forEach((config, key) => {
|
||||||
const metaData = config.getMetadata();
|
const metaData = config.getMetadata();
|
||||||
if (metaData.devMode === 'lowcode') {
|
if (metaData.devMode === 'lowcode') {
|
||||||
maps[key] = this.currentDocument?.simulator?.createComponent(metaData.schema!);
|
maps[key] = metaData.schema;
|
||||||
} else {
|
} else {
|
||||||
const view = metaData.experimental?.view;
|
const view = metaData.experimental?.view;
|
||||||
if (view) {
|
if (view) {
|
||||||
|
|||||||
@ -102,7 +102,7 @@ export class Project {
|
|||||||
| string,
|
| string,
|
||||||
): any {}
|
): any {}
|
||||||
|
|
||||||
open(doc?: string | DocumentModel | RootSchema): void {
|
open(doc?: string | DocumentModel | RootSchema): DocumentModel {
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
const got = this.documents.find((item) => item.isBlank());
|
const got = this.documents.find((item) => item.isBlank());
|
||||||
if (got) {
|
if (got) {
|
||||||
|
|||||||
@ -74,7 +74,7 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
|
|||||||
}
|
}
|
||||||
private _libraryMap: { [key: string]: string } = {};
|
private _libraryMap: { [key: string]: string } = {};
|
||||||
private buildComponents() {
|
private buildComponents() {
|
||||||
this._components = buildComponents(this._libraryMap, this._componentsMap);
|
this._components = buildComponents(this._libraryMap, this._componentsMap, this.createComponent.bind(this));
|
||||||
}
|
}
|
||||||
@obx.ref private _components: any = {};
|
@obx.ref private _components: any = {};
|
||||||
@computed get components(): object {
|
@computed get components(): object {
|
||||||
@ -386,13 +386,17 @@ const builtinComponents = {
|
|||||||
Leaf,
|
Leaf,
|
||||||
};
|
};
|
||||||
|
|
||||||
function buildComponents(libraryMap: LibraryMap, componentsMap: { [componentName: string]: NpmInfo | ComponentType<any> }) {
|
function buildComponents(libraryMap: LibraryMap,
|
||||||
|
componentsMap: { [componentName: string]: NpmInfo | ComponentType<any> },
|
||||||
|
createComponent: (schema: ComponentSchema) => Component | null) {
|
||||||
const components: any = {
|
const components: any = {
|
||||||
...builtinComponents
|
...builtinComponents
|
||||||
};
|
};
|
||||||
Object.keys(componentsMap).forEach((componentName) => {
|
Object.keys(componentsMap).forEach((componentName) => {
|
||||||
let component = componentsMap[componentName];
|
let component = componentsMap[componentName];
|
||||||
if (isReactComponent(component)) {
|
if (component && component.componentName === 'Component') {
|
||||||
|
components[componentName] = createComponent(component);
|
||||||
|
} else if (isReactComponent(component)) {
|
||||||
components[componentName] = component;
|
components[componentName] = component;
|
||||||
} else {
|
} else {
|
||||||
component = findComponent(libraryMap, componentName, component);
|
component = findComponent(libraryMap, componentName, component);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user