feat: modular add test case
This commit is contained in:
1
doric-js/lib/src/pattern/index.pattern.d.ts
vendored
1
doric-js/lib/src/pattern/index.pattern.d.ts
vendored
@@ -1,3 +1,4 @@
|
||||
export * from './candies';
|
||||
export * from './provider';
|
||||
export * from './mvvm';
|
||||
export * from './modular';
|
||||
|
@@ -16,3 +16,4 @@
|
||||
export * from './candies';
|
||||
export * from './provider';
|
||||
export * from './mvvm';
|
||||
export * from './modular';
|
||||
|
5
doric-js/lib/src/pattern/modular.d.ts
vendored
5
doric-js/lib/src/pattern/modular.d.ts
vendored
@@ -1,9 +1,10 @@
|
||||
import { Panel } from "../ui/panel";
|
||||
import { Group } from "../ui/view";
|
||||
import { ClassType } from "../util/types";
|
||||
export declare abstract class ModularPanel extends Panel {
|
||||
private modules;
|
||||
constructor(modules: Panel[]);
|
||||
abstract setupModules(): Panel[];
|
||||
constructor();
|
||||
abstract setupModules(): ClassType<Panel>[];
|
||||
abstract setupShelf(root: Group): Group;
|
||||
build(root: Group): void;
|
||||
onCreate(): void;
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import { Panel } from "../ui/panel";
|
||||
export class ModularPanel extends Panel {
|
||||
constructor(modules) {
|
||||
constructor() {
|
||||
super();
|
||||
this.modules = [];
|
||||
this.modules = modules;
|
||||
this.modules = this.setupModules().map(e => new e);
|
||||
}
|
||||
build(root) {
|
||||
const groupView = this.setupShelf(root);
|
||||
@@ -15,6 +14,7 @@ export class ModularPanel extends Panel {
|
||||
onCreate() {
|
||||
super.onCreate();
|
||||
this.modules.forEach(e => {
|
||||
e.context = this.context;
|
||||
e.onCreate();
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user