feat: modular add test case

This commit is contained in:
pengfei.zhou
2021-05-13 16:26:48 +08:00
committed by osborn
parent c27a9bd672
commit 546af79534
14 changed files with 358 additions and 57 deletions

View File

@@ -4,7 +4,6 @@ import { ClassType } from "../util/types"
export abstract class ModularPanel extends Panel {
private modules: Panel[]
constructor() {
super()
this.modules = this.setupModules().map(e => new e)
@@ -14,7 +13,6 @@ export abstract class ModularPanel extends Panel {
abstract setupShelf(root: Group): Group
build(root: Group) {
root.children.length = 0
const groupView = this.setupShelf(root)
this.modules.forEach(e => {
Reflect.set(e, "__root__", groupView)
@@ -25,6 +23,7 @@ export abstract class ModularPanel extends Panel {
onCreate() {
super.onCreate()
this.modules.forEach(e => {
e.context = this.context
e.onCreate()
})
}