From 4d2c4ad5fa00fc2a2c2fd0fbefc4e2d1587be367 Mon Sep 17 00:00:00 2001 From: Alexis Lacroix Date: Tue, 2 Jul 2024 11:22:15 +0200 Subject: [PATCH] [IMP] demo: add large demo data set for array formulas Task: 4036899 Part-of: odoo/o-spreadsheet#4589 Signed-off-by: Vincent Schippefilt (vsc) --- demo/data.js | 19 +++++++++++++++++++ demo/main.js | 2 ++ 2 files changed, 21 insertions(+) diff --git a/demo/data.js b/demo/data.js index 4ccaec8e7a..81715f9de8 100644 --- a/demo/data.js +++ b/demo/data.js @@ -2109,6 +2109,22 @@ function computeFormulaCells(cols, rows) { return cells; } +function computeArrayFormulaCells(cols, rows) { + const cells = {}; + const initRow = 4; + for (let row = initRow; row <= rows; row++) { + cells[`A${row}`] = { content: row.toString() }; + } + for (let col = 1; col < cols; col++) { + const colLetter = _getColumnLetter(col); + const prev = _getColumnLetter(col - 1); + cells[colLetter + initRow] = { + content: `=transpose(transpose(${prev}${initRow}:${prev}${rows}))`, + }; + } + return cells; +} + function computeNumberCells(cols, rows, type = "numbers") { const cells = {}; for (let col = 0; col < cols; col++) { @@ -2156,6 +2172,9 @@ export function makeLargeDataset(cols, rows, sheetsInfo = ["formulas"]) { case "formulas": cells = computeFormulaCells(cols, rows); break; + case "arrayFormulas": + cells = computeArrayFormulaCells(cols, rows); + break; case "numbers": case "floats": case "longFloats": diff --git a/demo/main.js b/demo/main.js index 9b8ae3c3e3..b5145a53db 100644 --- a/demo/main.js +++ b/demo/main.js @@ -240,6 +240,8 @@ class Demo extends Component { } this.createModel(data || demoData); // this.createModel(makeLargeDataset(26, 10_000, ["numbers"])); + // this.createModel(makeLargeDataset(26, 10_000, ["formulas"])); + // this.createModel(makeLargeDataset(26, 10_000, ["arrayFormulas"])); // this.createModel({}); }