load proto to iframe loopup parent

This commit is contained in:
kangwei 2020-06-22 21:12:13 +08:00
parent bb698e7b99
commit 8c3169532e
3 changed files with 20 additions and 13 deletions

View File

@ -57,7 +57,7 @@ export default class Bundle {
this.revisePrototype(item, prototype);
const componentName = item.componentName || prototype.getComponentName()!;
const matchedView = this.viewsMap[componentName] || null;
if (!prototype.getView() && matchedView) {
if (matchedView) {
prototype.setView(matchedView);
}
this.registerPrototype(prototype);

View File

@ -212,24 +212,30 @@ class Prototype {
static addGlobalExtraActions = addGlobalExtraActions;
static removeGlobalPropsConfigure = removeGlobalPropsConfigure;
static overridePropsConfigure = overridePropsConfigure;
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta) {
return new Prototype(config);
static create(config: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
return new Prototype(config, lookup);
}
readonly isPrototype = true;
readonly meta: ComponentMeta;
readonly options: OldPrototypeConfig | ComponentMetadata;
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta) {
if (isComponentMeta(input)) {
this.meta = input;
this.options = input.getMetadata();
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, lookup: boolean = false) {
if (lookup) {
this.meta = designer.getComponentMeta(input.componentName);
this.options = this.meta.getMetadata();
return this.meta.prototype || this;
} else {
this.options = input;
const metadata = isNewSpec(input) ? input : upgradeMetadata(input);
this.meta = designer.createComponentMeta(metadata);
if (isComponentMeta(input)) {
this.meta = input;
this.options = input.getMetadata();
} else {
this.options = input;
const metadata = isNewSpec(input) ? input : upgradeMetadata(input);
this.meta = designer.createComponentMeta(metadata);
}
(this.meta as any).prototype = this;
}
(this.meta as any).prototype = this;
}
getId() {

View File

@ -24,7 +24,8 @@ export class Trunk {
}
getList(): any[] {
return this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
const list = this.trunk.reduceRight((prev, cur) => prev.concat(cur.getList()), []);
return Array.from(new Set(list));
}
getPrototype(name: string) {
@ -85,7 +86,7 @@ export class Trunk {
}
registerSetter(type: string, setter: CustomView | RegisteredSetter) {
console.warn('Trunk.registerSetter is deprecated');
// console.warn('Trunk.registerSetter is deprecated');
registerSetter(type, setter);
}