feat:modular add provider

This commit is contained in:
pengfei.zhou
2021-05-14 13:14:54 +08:00
committed by osborn
parent eb7fc6c137
commit 67f3f354af
11 changed files with 79 additions and 6 deletions

View File

@@ -1,10 +1,21 @@
import { Panel } from "../ui/panel"
import { Group } from "../ui/view"
import { ClassType } from "../util/types"
import { Provider } from "./provider"
export abstract class Module extends Panel {
superPanel?: ModularPanel
__provider?: Provider
get provider(): Provider | undefined {
return this.__provider || (this.superPanel?.provider)
}
set provider(provider: Provider | undefined) {
this.__provider = provider
}
dispatchMessage(message: any) {
this.superPanel?.dispatchMessage(message)
}

View File

@@ -185,10 +185,14 @@ export abstract class View implements Modeling {
nativeViewModel: NativeViewModel = {
id: this.viewId,
type: this.constructor.name,
type: this.viewType(),
props: this.__dirty_props__,
}
viewType() {
return this.constructor.name
}
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void {
if (newV instanceof Function) {
newV = this.callback2Id(newV)

View File

@@ -191,10 +191,14 @@ export abstract class View implements Modeling {
nativeViewModel: NativeViewModel = {
id: this.viewId,
type: this.constructor.name,
type: this.viewType(),
props: this.__dirty_props__,
}
viewType() {
return this.constructor.name
}
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void {
if (newV instanceof Function) {
newV = this.callback2Id(newV)