feat:modular add provider
This commit is contained in:
4
doric-js/lib/src/pattern/modular.d.ts
vendored
4
doric-js/lib/src/pattern/modular.d.ts
vendored
@@ -1,8 +1,12 @@
|
||||
import { Panel } from "../ui/panel";
|
||||
import { Group } from "../ui/view";
|
||||
import { ClassType } from "../util/types";
|
||||
import { Provider } from "./provider";
|
||||
export declare abstract class Module extends Panel {
|
||||
superPanel?: ModularPanel;
|
||||
__provider?: Provider;
|
||||
get provider(): Provider | undefined;
|
||||
set provider(provider: Provider | undefined);
|
||||
dispatchMessage(message: any): void;
|
||||
onMessage(message: any): void;
|
||||
}
|
||||
|
@@ -1,5 +1,12 @@
|
||||
import { Panel } from "../ui/panel";
|
||||
export class Module extends Panel {
|
||||
get provider() {
|
||||
var _a;
|
||||
return this.__provider || ((_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.provider);
|
||||
}
|
||||
set provider(provider) {
|
||||
this.__provider = provider;
|
||||
}
|
||||
dispatchMessage(message) {
|
||||
var _a;
|
||||
(_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.dispatchMessage(message);
|
||||
|
1
doric-js/lib/src/ui/view.d.ts
vendored
1
doric-js/lib/src/ui/view.d.ts
vendored
@@ -76,6 +76,7 @@ export declare abstract class View implements Modeling {
|
||||
[index: string]: Model;
|
||||
};
|
||||
nativeViewModel: NativeViewModel;
|
||||
viewType(): string;
|
||||
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void;
|
||||
clean(): void;
|
||||
isDirty(): boolean;
|
||||
|
@@ -30,7 +30,7 @@ export class View {
|
||||
this.__dirty_props__ = {};
|
||||
this.nativeViewModel = {
|
||||
id: this.viewId,
|
||||
type: this.constructor.name,
|
||||
type: this.viewType(),
|
||||
props: this.__dirty_props__,
|
||||
};
|
||||
return new Proxy(this, {
|
||||
@@ -108,6 +108,9 @@ export class View {
|
||||
get dirtyProps() {
|
||||
return this.__dirty_props__;
|
||||
}
|
||||
viewType() {
|
||||
return this.constructor.name;
|
||||
}
|
||||
onPropertyChanged(propKey, oldV, newV) {
|
||||
if (newV instanceof Function) {
|
||||
newV = this.callback2Id(newV);
|
||||
|
Reference in New Issue
Block a user