opt:when subview is reused, transfer its property totally

This commit is contained in:
pengfei.zhou 2021-06-24 15:10:00 +08:00 committed by osborn
parent 07a958c3bd
commit 92b106d11f
8 changed files with 57 additions and 1 deletions

View File

@ -599,6 +599,14 @@ var Superview = /** @class */ (function (_super) {
for (var _b = __values$5(this.allSubviews()), _c = _b.next(); !_c.done; _c = _b.next()) {
var v = _c.value;
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (var key in v) {
if (key.startsWith("__prop__")) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
}
}
}
v.superview = this;
if (v.isDirty()) {
subviews.push(v.toModel());

View File

@ -486,6 +486,14 @@ class Superview extends View {
const subviews = [];
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
}
}
}
v.superview = this;
if (v.isDirty()) {
subviews.push(v.toModel());

View File

@ -2007,6 +2007,14 @@ class Superview extends View {
const subviews = [];
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
}
}
}
v.superview = this;
if (v.isDirty()) {
subviews.push(v.toModel());

View File

@ -368,6 +368,14 @@ export class Superview extends View {
const subviews = [];
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
}
}
}
v.superview = this;
if (v.isDirty()) {
subviews.push(v.toModel());

View File

@ -408,6 +408,14 @@ export abstract class Superview extends View {
const subviews = []
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (key.startsWith("__prop__")) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key))
}
}
}
v.superview = this
if (v.isDirty()) {
subviews.push(v.toModel())

View File

@ -434,6 +434,14 @@ export abstract class Superview extends View {
const subviews = []
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key))
}
}
}
v.superview = this
if (v.isDirty()) {
subviews.push(v.toModel())

View File

@ -2061,6 +2061,14 @@ class Superview extends View {
const subviews = [];
for (let v of this.allSubviews()) {
if (v != undefined) {
if (v.superview && v.superview !== this) {
//It had been added to another view, need to be marked totally
for (let key in v) {
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
}
}
}
v.superview = this;
if (v.isDirty()) {
subviews.push(v.toModel());

File diff suppressed because one or more lines are too long