Skip to content

Commit 0b8d16f

Browse files
author
QuantLab
authored
Merge pull request #2 from quantlabio/quantlab
array formula
2 parents 5e6aa52 + fc43086 commit 0b8d16f

11 files changed

Lines changed: 168 additions & 40 deletions

dist/@quantlab/handsontable.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/@quantlab/handsontable.full.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2424
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
*
26-
* Version: 0.33.5
27-
* Date: Mon Sep 04 2017 16:53:18 GMT+0800 (China Standard Time)
26+
* Version: 0.33.6
27+
* Date: Tue Sep 05 2017 12:04:11 GMT+0800 (China Standard Time)
2828
*/
2929
@charset "UTF-8";
3030

dist/@quantlab/handsontable.full.js

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2424
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
*
26-
* Version: 0.33.5
27-
* Date: Mon Sep 04 2017 16:53:18 GMT+0800 (China Standard Time)
26+
* Version: 0.33.6
27+
* Date: Tue Sep 05 2017 12:04:11 GMT+0800 (China Standard Time)
2828
*/
2929
(function webpackUniversalModuleDefinition(root, factory) {
3030
if(typeof exports === 'object' && typeof module === 'object')
@@ -53259,9 +53259,9 @@ Handsontable.DefaultSettings = _defaultSettings2.default;
5325953259
Handsontable.EventManager = _eventManager2.default;
5326053260
Handsontable._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests
5326153261

53262-
Handsontable.buildDate = "2017-09-04T08:53:18.435Z";
53262+
Handsontable.buildDate = "2017-09-05T04:04:11.911Z";
5326353263
Handsontable.packageName = "@quantlab/handsontable";
53264-
Handsontable.version = "0.33.5";
53264+
Handsontable.version = "0.33.6";
5326553265

5326653266
var baseVersion = undefined;
5326753267

@@ -61740,16 +61740,59 @@ function formulaRenderer(instance, TD, row, col, prop, value, cellProperties) {
6174061740
newValue.result.onIOPub = function (msg) {
6174161741
if (msg.content) {
6174261742
if (msg.content.hasOwnProperty('data')) {
61743-
var result = JSON.parse(msg.content.data['text/plain'].replace(/\'/g, '"')).join('');
61744-
61743+
var result = JSON.parse(msg.content.data['text/plain'].replace(/\'/g, '"'));
61744+
61745+
// only set left upper corner of matrix
61746+
var leftUp = result[1];
61747+
if (Array.isArray(result[1])) {
61748+
leftUp = result[1][0];
61749+
if (Array.isArray(result[1][0])) {
61750+
leftUp = result[1][0][0];
61751+
}
61752+
}
6174561753
instance.formula.matrix.updateItem(currentItem, {
6174661754
formula: formula,
61747-
value: result,
61755+
value: leftUp,
6174861756
error: newValue.error,
6174961757
needUpdate: false
6175061758
});
61751-
var escaped = (0, _mixed.stringify)(result);
61752-
(0, _element.fastInnerText)(TD, escaped);
61759+
61760+
// for now only kernel async formulas might return matrix
61761+
if (Array.isArray(result[1])) {
61762+
61763+
var body = TD.parentNode.parentNode;
61764+
var ri = TD.parentNode.rowIndex;
61765+
var ci = TD.cellIndex;
61766+
var i = 0;
61767+
var j = 0;
61768+
var escaped;
61769+
61770+
result[1].forEach(function (rr) {
61771+
61772+
if (Array.isArray(rr)) {
61773+
// matrix
61774+
61775+
rr.forEach(function (rc) {
61776+
escaped = (0, _mixed.stringify)(rc);
61777+
(0, _element.fastInnerText)(body.rows[ri - 1].cells[ci], escaped);
61778+
if (i > 0 || j > 0) instance.setDataAtCell(row + i, col + j, escaped);
61779+
ci++;
61780+
j++;
61781+
});
61782+
} else {
61783+
// vector
61784+
escaped = (0, _mixed.stringify)(rr);
61785+
(0, _element.fastInnerText)(body.rows[ri - 1].cells[ci], escaped);
61786+
if (i > 0 || j > 0) instance.setDataAtCell(row + i, col + j, escaped);
61787+
}
61788+
ri++;
61789+
i++;
61790+
});
61791+
} else {
61792+
// scalar
61793+
var escaped = (0, _mixed.stringify)(result.join(''));
61794+
(0, _element.fastInnerText)(TD, escaped);
61795+
}
6175361796
}
6175461797
}
6175561798
};

dist/@quantlab/handsontable.full.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/@quantlab/handsontable.full.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/@quantlab/handsontable.js

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
2424
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
*
26-
* Version: 0.33.5
27-
* Date: Mon Sep 04 2017 16:53:18 GMT+0800 (China Standard Time)
26+
* Version: 0.33.6
27+
* Date: Tue Sep 05 2017 12:04:11 GMT+0800 (China Standard Time)
2828
*/
2929
(function webpackUniversalModuleDefinition(root, factory) {
3030
if(typeof exports === 'object' && typeof module === 'object')
@@ -36387,9 +36387,9 @@ Handsontable.DefaultSettings = _defaultSettings2.default;
3638736387
Handsontable.EventManager = _eventManager2.default;
3638836388
Handsontable._getListenersCounter = _eventManager.getListenersCounter; // For MemoryLeak tests
3638936389

36390-
Handsontable.buildDate = "2017-09-04T08:53:18.435Z";
36390+
Handsontable.buildDate = "2017-09-05T04:04:11.911Z";
3639136391
Handsontable.packageName = "@quantlab/handsontable";
36392-
Handsontable.version = "0.33.5";
36392+
Handsontable.version = "0.33.6";
3639336393

3639436394
var baseVersion = undefined;
3639536395

@@ -40119,16 +40119,59 @@ function formulaRenderer(instance, TD, row, col, prop, value, cellProperties) {
4011940119
newValue.result.onIOPub = function (msg) {
4012040120
if (msg.content) {
4012140121
if (msg.content.hasOwnProperty('data')) {
40122-
var result = JSON.parse(msg.content.data['text/plain'].replace(/\'/g, '"')).join('');
40123-
40122+
var result = JSON.parse(msg.content.data['text/plain'].replace(/\'/g, '"'));
40123+
40124+
// only set left upper corner of matrix
40125+
var leftUp = result[1];
40126+
if (Array.isArray(result[1])) {
40127+
leftUp = result[1][0];
40128+
if (Array.isArray(result[1][0])) {
40129+
leftUp = result[1][0][0];
40130+
}
40131+
}
4012440132
instance.formula.matrix.updateItem(currentItem, {
4012540133
formula: formula,
40126-
value: result,
40134+
value: leftUp,
4012740135
error: newValue.error,
4012840136
needUpdate: false
4012940137
});
40130-
var escaped = (0, _mixed.stringify)(result);
40131-
(0, _element.fastInnerText)(TD, escaped);
40138+
40139+
// for now only kernel async formulas might return matrix
40140+
if (Array.isArray(result[1])) {
40141+
40142+
var body = TD.parentNode.parentNode;
40143+
var ri = TD.parentNode.rowIndex;
40144+
var ci = TD.cellIndex;
40145+
var i = 0;
40146+
var j = 0;
40147+
var escaped;
40148+
40149+
result[1].forEach(function (rr) {
40150+
40151+
if (Array.isArray(rr)) {
40152+
// matrix
40153+
40154+
rr.forEach(function (rc) {
40155+
escaped = (0, _mixed.stringify)(rc);
40156+
(0, _element.fastInnerText)(body.rows[ri - 1].cells[ci], escaped);
40157+
if (i > 0 || j > 0) instance.setDataAtCell(row + i, col + j, escaped);
40158+
ci++;
40159+
j++;
40160+
});
40161+
} else {
40162+
// vector
40163+
escaped = (0, _mixed.stringify)(rr);
40164+
(0, _element.fastInnerText)(body.rows[ri - 1].cells[ci], escaped);
40165+
if (i > 0 || j > 0) instance.setDataAtCell(row + i, col + j, escaped);
40166+
}
40167+
ri++;
40168+
i++;
40169+
});
40170+
} else {
40171+
// scalar
40172+
var escaped = (0, _mixed.stringify)(result.join(''));
40173+
(0, _element.fastInnerText)(TD, escaped);
40174+
}
4013240175
}
4013340176
}
4013440177
};

dist/@quantlab/handsontable.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/@quantlab/handsontable.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/@quantlab/handsontable.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "https://github.com/handsontable/handsontable/issues"
1111
},
1212
"author": "Handsoncode <hello@handsontable.com>",
13-
"version": "0.33.5",
13+
"version": "0.33.6",
1414
"browser": "dist/@quantlab/handsontable.full.js",
1515
"main": "commonjs/index.js",
1616
"module": "es/index.js",

0 commit comments

Comments
 (0)