feat:support component view
This commit is contained in:
@@ -200,6 +200,11 @@ function InconsistProperty(target, propKey) {
|
||||
},
|
||||
});
|
||||
}
|
||||
var PROP_KEY_VIEW_TYPE = "__prop__ViewType";
|
||||
function ViewComponent(constructor) {
|
||||
var name = Reflect.get(constructor, PROP_KEY_VIEW_TYPE) || Object.getPrototypeOf(constructor).name;
|
||||
Reflect.set(constructor, PROP_KEY_VIEW_TYPE, name);
|
||||
}
|
||||
var View = /** @class */ (function () {
|
||||
function View() {
|
||||
this.width = 0;
|
||||
@@ -301,7 +306,7 @@ var View = /** @class */ (function () {
|
||||
configurable: true
|
||||
});
|
||||
View.prototype.viewType = function () {
|
||||
return this.constructor.name;
|
||||
return Reflect.get(this.constructor, PROP_KEY_VIEW_TYPE) || this.constructor.name;
|
||||
};
|
||||
View.prototype.onPropertyChanged = function (propKey, oldV, newV) {
|
||||
var _this = this;
|
||||
@@ -3765,6 +3770,7 @@ exports.TranslationAnimation = TranslationAnimation;
|
||||
exports.VLayout = VLayout;
|
||||
exports.VMPanel = VMPanel;
|
||||
exports.View = View;
|
||||
exports.ViewComponent = ViewComponent;
|
||||
exports.ViewHolder = ViewHolder;
|
||||
exports.ViewModel = ViewModel;
|
||||
exports.animate = animate;
|
||||
|
@@ -130,12 +130,17 @@ var __metadata$d = (undefined && undefined.__metadata) || function (k, v) {
|
||||
};
|
||||
const PROP_CONSIST = 1;
|
||||
const PROP_INCONSIST = 2;
|
||||
const PROP_KEY_VIEW_TYPE = "ViewType";
|
||||
function Property(target, propKey) {
|
||||
Reflect.defineMetadata(propKey, PROP_CONSIST, target);
|
||||
}
|
||||
function InconsistProperty(target, propKey) {
|
||||
Reflect.defineMetadata(propKey, PROP_INCONSIST, target);
|
||||
}
|
||||
function ViewComponent(constructor) {
|
||||
const name = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, constructor) || Object.getPrototypeOf(constructor).name;
|
||||
Reflect.defineMetadata(PROP_KEY_VIEW_TYPE, name, constructor);
|
||||
}
|
||||
class View {
|
||||
constructor() {
|
||||
this.width = 0;
|
||||
@@ -227,7 +232,8 @@ class View {
|
||||
return this.__dirty_props__;
|
||||
}
|
||||
viewType() {
|
||||
return this.constructor.name;
|
||||
const viewType = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, this.constructor);
|
||||
return viewType || this.constructor.name;
|
||||
}
|
||||
onPropertyChanged(propKey, oldV, newV) {
|
||||
if (newV instanceof Function) {
|
||||
@@ -2920,6 +2926,7 @@ exports.TranslationAnimation = TranslationAnimation;
|
||||
exports.VLayout = VLayout;
|
||||
exports.VMPanel = VMPanel;
|
||||
exports.View = View;
|
||||
exports.ViewComponent = ViewComponent;
|
||||
exports.ViewHolder = ViewHolder;
|
||||
exports.ViewModel = ViewModel;
|
||||
exports.animate = animate;
|
||||
|
@@ -1651,12 +1651,17 @@ var __metadata$d = (undefined && undefined.__metadata) || function (k, v) {
|
||||
};
|
||||
const PROP_CONSIST = 1;
|
||||
const PROP_INCONSIST = 2;
|
||||
const PROP_KEY_VIEW_TYPE = "ViewType";
|
||||
function Property(target, propKey) {
|
||||
Reflect.defineMetadata(propKey, PROP_CONSIST, target);
|
||||
}
|
||||
function InconsistProperty(target, propKey) {
|
||||
Reflect.defineMetadata(propKey, PROP_INCONSIST, target);
|
||||
}
|
||||
function ViewComponent(constructor) {
|
||||
const name = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, constructor) || Object.getPrototypeOf(constructor).name;
|
||||
Reflect.defineMetadata(PROP_KEY_VIEW_TYPE, name, constructor);
|
||||
}
|
||||
class View {
|
||||
constructor() {
|
||||
this.width = 0;
|
||||
@@ -1748,7 +1753,8 @@ class View {
|
||||
return this.__dirty_props__;
|
||||
}
|
||||
viewType() {
|
||||
return this.constructor.name;
|
||||
const viewType = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, this.constructor);
|
||||
return viewType || this.constructor.name;
|
||||
}
|
||||
onPropertyChanged(propKey, oldV, newV) {
|
||||
if (newV instanceof Function) {
|
||||
@@ -4682,6 +4688,7 @@ exports.TranslationAnimation = TranslationAnimation;
|
||||
exports.VLayout = VLayout;
|
||||
exports.VMPanel = VMPanel;
|
||||
exports.View = View;
|
||||
exports.ViewComponent = ViewComponent;
|
||||
exports.ViewHolder = ViewHolder;
|
||||
exports.ViewModel = ViewModel;
|
||||
exports.animate = animate;
|
||||
|
Reference in New Issue
Block a user