From ff0b899fa2fee1088a40eab018bfeb42c1b6ba9b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 11 May 2017 17:38:31 +0200 Subject: [PATCH] Errores solucionados --- js/db/form.js | 2 +- js/db/iterator-iface.js | 12 ------------ js/db/iterator.js | 8 ++++++-- js/vn/hash.js | 6 ++++-- js/vn/lot.js | 6 +++--- js/vn/value.js | 4 +--- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/js/db/form.js b/js/db/form.js index 93694232..2acf4fde 100644 --- a/js/db/form.js +++ b/js/db/form.js @@ -80,6 +80,6 @@ module.exports = new Class ,onRowUpdate: function (model, row) { if (row == this._row) - this.changed (); + this.rowChanged(); } }); diff --git a/js/db/iterator-iface.js b/js/db/iterator-iface.js index bc0dc0f1..ac3c49f7 100644 --- a/js/db/iterator-iface.js +++ b/js/db/iterator-iface.js @@ -119,17 +119,5 @@ module.exports = new Class { return this._model.setByIndex (this._row, column, value); } - - ,keys: function () - { - return this._model ? - this.model.keys () : null; - } - - ,getParams: function () - { - return this._model ? - this.model.getObject (this._row) : null; - } }); diff --git a/js/db/iterator.js b/js/db/iterator.js index ee33cfee..b5b88711 100644 --- a/js/db/iterator.js +++ b/js/db/iterator.js @@ -30,7 +30,7 @@ module.exports = new Class ,set: function (x) { this._row = x; - this.updateParams (); + this.rowChanged (); } ,get: function () { @@ -62,18 +62,22 @@ module.exports = new Class Object.assign (this, { _model: null ,_row: -1 + ,_rowLock: false }); this.parent (props); } ,_paramsChanged: function (diff) { + if (!this._rowLock) for (var key in diff) this._model.set (this._row, key, diff[key]); } - ,updateParams: function () + ,rowChanged: function () { + this._rowLock = true; this.params = this._model.getObject (this._row); + this._rowLock = false; } }); diff --git a/js/vn/hash.js b/js/vn/hash.js index 4b0053b6..0f50c6bb 100644 --- a/js/vn/hash.js +++ b/js/vn/hash.js @@ -42,7 +42,7 @@ module.exports = new Class ,_paramsChanged: function () { - this._updateHash (); + this.updateHash (); } /** @@ -63,7 +63,7 @@ module.exports = new Class params[key] = this._params[key]; } - return this.renderHash (object); + return this.renderHash (params); } /** @@ -138,6 +138,8 @@ module.exports = new Class if (kvPair[0]) newMap[decodeURIComponent (kvPair[0])] = this.parseValue (kvPair[1]); } + + return newMap; } ,renderValue: function (v) diff --git a/js/vn/lot.js b/js/vn/lot.js index 190d91a4..57cbe91c 100644 --- a/js/vn/lot.js +++ b/js/vn/lot.js @@ -15,7 +15,7 @@ module.exports = new Class type: Object ,set: function (x) { - this._setAll (x); + this.setAll (x); } ,get: function () { @@ -27,7 +27,7 @@ module.exports = new Class type: Object ,set: function (x) { - this._setAll (x); + this.setAll (x); } ,get: function () { @@ -67,7 +67,7 @@ module.exports = new Class ,setAll: function (params) { var diff = Value.diff (this._params, params); - + if (diff) { this._params = Value.kvClone (params); diff --git a/js/vn/value.js b/js/vn/value.js index a37a5b2e..87acb1fe 100644 --- a/js/vn/value.js +++ b/js/vn/value.js @@ -79,11 +79,9 @@ function partialDiff (orgObject, newObject) function kvClone (object) { - var key; var copy = {}; - var keys = Object.keys (object); - for (var i = keys.length; --i; key = keys[i]) + for (var key in object) copy[key] = simpleClone (object[key]); return copy;