feat:support component view
This commit is contained in:
9
doric-web/dist/index.js
vendored
9
doric-web/dist/index.js
vendored
@@ -1705,12 +1705,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;
|
||||
@@ -1802,7 +1807,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) {
|
||||
@@ -4495,6 +4501,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;
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user