mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 17:48:13 +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);
|
||||
if (meta) {
|
||||
meta.setMetadata(data);
|
||||
|
||||
this._componentMetasMap.set(key, meta);
|
||||
} else {
|
||||
meta = this._lostComponentMetasMap.get(key);
|
||||
|
||||
@ -426,10 +428,11 @@ export class Designer {
|
||||
|
||||
@computed get componentsMap(): { [key: string]: NpmInfo | Component } {
|
||||
const maps: any = {};
|
||||
this._componentMetasMap.forEach((config, key) => {
|
||||
const designer = this;
|
||||
designer._componentMetasMap.forEach((config, key) => {
|
||||
const metaData = config.getMetadata();
|
||||
if (metaData.devMode === 'lowcode') {
|
||||
maps[key] = this.currentDocument?.simulator?.createComponent(metaData.schema!);
|
||||
maps[key] = metaData.schema;
|
||||
} else {
|
||||
const view = metaData.experimental?.view;
|
||||
if (view) {
|
||||
|
||||
@ -102,7 +102,7 @@ export class Project {
|
||||
| string,
|
||||
): any {}
|
||||
|
||||
open(doc?: string | DocumentModel | RootSchema): void {
|
||||
open(doc?: string | DocumentModel | RootSchema): DocumentModel {
|
||||
if (!doc) {
|
||||
const got = this.documents.find((item) => item.isBlank());
|
||||
if (got) {
|
||||
|
||||
@ -74,7 +74,7 @@ export class SimulatorRenderer implements BuiltinSimulatorRenderer {
|
||||
}
|
||||
private _libraryMap: { [key: string]: string } = {};
|
||||
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 = {};
|
||||
@computed get components(): object {
|
||||
@ -386,13 +386,17 @@ const builtinComponents = {
|
||||
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 = {
|
||||
...builtinComponents
|
||||
};
|
||||
Object.keys(componentsMap).forEach((componentName) => {
|
||||
let component = componentsMap[componentName];
|
||||
if (isReactComponent(component)) {
|
||||
if (component && component.componentName === 'Component') {
|
||||
components[componentName] = createComponent(component);
|
||||
} else if (isReactComponent(component)) {
|
||||
components[componentName] = component;
|
||||
} else {
|
||||
component = findComponent(libraryMap, componentName, component);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user