Commit 81a070b9 authored by Grand Francois's avatar Grand Francois
Browse files

Props.setProps() : correction d'un bug copiant incorrectement les propriétés membres

Showing with 7 additions and 4 deletions
+7 -4
...@@ -14,7 +14,7 @@ export class Props implements IObservable { ...@@ -14,7 +14,7 @@ export class Props implements IObservable {
public hasProperties(props: Props | {}): boolean { public hasProperties(props: Props | {}): boolean {
const keys = Object.keys(this._props); const keys = Object.keys(this._props);
const p = props instanceof Props ? props.props : props; const p = props instanceof Props ? props._props : props;
// if (keys.length != Object.keys(p).length) // if (keys.length != Object.keys(p).length)
// return false; // return false;
...@@ -97,12 +97,15 @@ export class Props implements IObservable { ...@@ -97,12 +97,15 @@ export class Props implements IObservable {
*/ */
public setProps(props: {}, sender?: any) { public setProps(props: {}, sender?: any) {
if (props instanceof Props) if (props instanceof Props)
var p = props.props; var p = props._props;
else else
p = props; p = props;
const changed = this.compareObjects(this._props, p); const changed = this.compareObjects(this._props, p);
if (changed) { if (changed) {
this._props = p; this._props = {};
for (const k in p)
this._props[k] = p[k];
this.notifyPropsChange(sender); this.notifyPropsChange(sender);
} }
} }
...@@ -123,7 +126,7 @@ export class Props implements IObservable { ...@@ -123,7 +126,7 @@ export class Props implements IObservable {
for (const k in this._props) { for (const k in this._props) {
if (res != "[") if (res != "[")
res += ", "; res += ", ";
res += `${k}:${this.props[k]}`; res += `${k}:${this._props[k]}`;
} }
res += "]" res += "]"
return res; return res;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment