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

@@ -209,7 +209,7 @@ var View = /** @class */ (function () {
this.viewId = uniqueId('ViewId');
this.nativeViewModel = {
id: this.viewId,
type: this.constructor.name,
type: this.viewType(),
props: this.__dirty_props__,
};
}
@@ -300,6 +300,9 @@ var View = /** @class */ (function () {
enumerable: false,
configurable: true
});
View.prototype.viewType = function () {
return this.constructor.name;
};
View.prototype.onPropertyChanged = function (propKey, oldV, newV) {
var _this = this;
if (newV instanceof Function) {
@@ -3625,6 +3628,17 @@ var Module = /** @class */ (function (_super) {
function Module() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Module.prototype, "provider", {
get: function () {
var _a;
return this.__provider || ((_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.provider);
},
set: function (provider) {
this.__provider = provider;
},
enumerable: false,
configurable: true
});
Module.prototype.dispatchMessage = function (message) {
var _a;
(_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.dispatchMessage(message);

View File

@@ -148,7 +148,7 @@ 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, {
@@ -226,6 +226,9 @@ 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);
@@ -2789,6 +2792,13 @@ class VMPanel extends Panel {
}
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);

View File

@@ -1669,7 +1669,7 @@ 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, {
@@ -1747,6 +1747,9 @@ 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);
@@ -4310,6 +4313,13 @@ class VMPanel extends Panel {
}
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);