@odoo/o-spreadsheet 16.4.14 → 16.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o-spreadsheet.cjs.js +123 -108
- package/dist/o-spreadsheet.d.ts +9 -18
- package/dist/o-spreadsheet.esm.js +123 -108
- package/dist/o-spreadsheet.iife.js +123 -108
- package/dist/o-spreadsheet.iife.min.js +69 -69
- package/dist/o_spreadsheet.xml +6 -7
- package/package.json +1 -1
|
@@ -669,8 +669,7 @@
|
|
|
669
669
|
*
|
|
670
670
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
|
|
671
671
|
*/
|
|
672
|
-
const
|
|
673
|
-
" ",
|
|
672
|
+
const whiteSpaceSpecialCharacters = [
|
|
674
673
|
"\t",
|
|
675
674
|
"\f",
|
|
676
675
|
"\v",
|
|
@@ -685,8 +684,7 @@
|
|
|
685
684
|
String.fromCharCode(parseInt("3000", 16)),
|
|
686
685
|
String.fromCharCode(parseInt("feff", 16)),
|
|
687
686
|
];
|
|
688
|
-
const whiteSpaceRegexp = new RegExp(
|
|
689
|
-
const newLineRegex = /\r\n|\r|\n/g;
|
|
687
|
+
const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|") + "|(\r\n|\r|\n)", "g");
|
|
690
688
|
/**
|
|
691
689
|
* Replace all the special spaces in a string (non-breaking, tabs, ...) by normal spaces, and all the
|
|
692
690
|
* different newlines types by \n.
|
|
@@ -694,9 +692,9 @@
|
|
|
694
692
|
function replaceSpecialSpaces(text) {
|
|
695
693
|
if (!text)
|
|
696
694
|
return "";
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return text;
|
|
695
|
+
if (!whiteSpaceRegexp.test(text))
|
|
696
|
+
return text;
|
|
697
|
+
return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
|
|
700
698
|
}
|
|
701
699
|
/**
|
|
702
700
|
* Determine if the numbers are consecutive.
|
|
@@ -4266,6 +4264,7 @@
|
|
|
4266
4264
|
CommandResult[CommandResult["NoActiveSheet"] = 94] = "NoActiveSheet";
|
|
4267
4265
|
CommandResult[CommandResult["InvalidLocale"] = 95] = "InvalidLocale";
|
|
4268
4266
|
CommandResult[CommandResult["AlreadyInPaintingFormatMode"] = 96] = "AlreadyInPaintingFormatMode";
|
|
4267
|
+
CommandResult[CommandResult["NoChanges"] = 97] = "NoChanges";
|
|
4269
4268
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
4270
4269
|
|
|
4271
4270
|
const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
|
|
@@ -4355,12 +4354,12 @@
|
|
|
4355
4354
|
}
|
|
4356
4355
|
}
|
|
4357
4356
|
/** Normalize string by setting it to lowercase and replacing accent letters with plain letters */
|
|
4358
|
-
function normalizeString(str) {
|
|
4357
|
+
const normalizeString = memoize(function normalizeString(str) {
|
|
4359
4358
|
return str
|
|
4360
4359
|
.toLowerCase()
|
|
4361
4360
|
.normalize("NFD")
|
|
4362
4361
|
.replace(/[\u0300-\u036f]/g, "");
|
|
4363
|
-
}
|
|
4362
|
+
});
|
|
4364
4363
|
/**
|
|
4365
4364
|
* Normalize a value.
|
|
4366
4365
|
* If the cell value is a string, this will set it to lowercase and replacing accent letters with plain letters
|
|
@@ -14171,7 +14170,7 @@
|
|
|
14171
14170
|
return result;
|
|
14172
14171
|
}
|
|
14173
14172
|
function tokenizeDebugger(chars) {
|
|
14174
|
-
if (chars.current
|
|
14173
|
+
if (chars.current === "?") {
|
|
14175
14174
|
chars.shift();
|
|
14176
14175
|
return { type: "DEBUGGER", value: "?" };
|
|
14177
14176
|
}
|
|
@@ -14182,7 +14181,7 @@
|
|
|
14182
14181
|
")": "RIGHT_PAREN",
|
|
14183
14182
|
};
|
|
14184
14183
|
function tokenizeMisc(chars) {
|
|
14185
|
-
if (chars.current
|
|
14184
|
+
if (chars.current in misc) {
|
|
14186
14185
|
const value = chars.shift();
|
|
14187
14186
|
const type = misc[value];
|
|
14188
14187
|
return { type, value };
|
|
@@ -14190,7 +14189,7 @@
|
|
|
14190
14189
|
return null;
|
|
14191
14190
|
}
|
|
14192
14191
|
function tokenizeArgsSeparator(chars, locale) {
|
|
14193
|
-
if (chars.current
|
|
14192
|
+
if (chars.current === locale.formulaArgSeparator) {
|
|
14194
14193
|
const value = chars.shift();
|
|
14195
14194
|
const type = "ARG_SEPARATOR";
|
|
14196
14195
|
return { type, value };
|
|
@@ -14215,14 +14214,13 @@
|
|
|
14215
14214
|
return null;
|
|
14216
14215
|
}
|
|
14217
14216
|
function tokenizeString(chars) {
|
|
14218
|
-
if (chars.current
|
|
14217
|
+
if (chars.current === '"') {
|
|
14219
14218
|
const startChar = chars.shift();
|
|
14220
14219
|
let letters = startChar;
|
|
14221
|
-
while (chars.current()
|
|
14222
|
-
(chars.current() !== startChar || letters[letters.length - 1] === "\\")) {
|
|
14220
|
+
while (chars.current && (chars.current !== startChar || letters[letters.length - 1] === "\\")) {
|
|
14223
14221
|
letters += chars.shift();
|
|
14224
14222
|
}
|
|
14225
|
-
if (chars.current
|
|
14223
|
+
if (chars.current === '"') {
|
|
14226
14224
|
letters += chars.shift();
|
|
14227
14225
|
}
|
|
14228
14226
|
return {
|
|
@@ -14249,14 +14247,14 @@
|
|
|
14249
14247
|
let result = "";
|
|
14250
14248
|
// there are two main cases to manage: either something which starts with
|
|
14251
14249
|
// a ', like 'Sheet 2'A2, or a word-like element.
|
|
14252
|
-
if (chars.current
|
|
14250
|
+
if (chars.current === "'") {
|
|
14253
14251
|
let lastChar = chars.shift();
|
|
14254
14252
|
result += lastChar;
|
|
14255
|
-
while (chars.current
|
|
14253
|
+
while (chars.current) {
|
|
14256
14254
|
lastChar = chars.shift();
|
|
14257
14255
|
result += lastChar;
|
|
14258
14256
|
if (lastChar === "'") {
|
|
14259
|
-
if (chars.current
|
|
14257
|
+
if (chars.current && chars.current === "'") {
|
|
14260
14258
|
lastChar = chars.shift();
|
|
14261
14259
|
result += lastChar;
|
|
14262
14260
|
}
|
|
@@ -14272,7 +14270,7 @@
|
|
|
14272
14270
|
};
|
|
14273
14271
|
}
|
|
14274
14272
|
}
|
|
14275
|
-
while (chars.current
|
|
14273
|
+
while (chars.current && separatorRegexp.test(chars.current)) {
|
|
14276
14274
|
result += chars.shift();
|
|
14277
14275
|
}
|
|
14278
14276
|
if (result.length) {
|
|
@@ -14287,14 +14285,14 @@
|
|
|
14287
14285
|
}
|
|
14288
14286
|
function tokenizeSpace(chars) {
|
|
14289
14287
|
let length = 0;
|
|
14290
|
-
while (chars.current
|
|
14288
|
+
while (chars.current === NEWLINE) {
|
|
14291
14289
|
length++;
|
|
14292
14290
|
chars.shift();
|
|
14293
14291
|
}
|
|
14294
14292
|
if (length) {
|
|
14295
14293
|
return { type: "SPACE", value: NEWLINE.repeat(length) };
|
|
14296
14294
|
}
|
|
14297
|
-
while (chars.current
|
|
14295
|
+
while (chars.current === " ") {
|
|
14298
14296
|
length++;
|
|
14299
14297
|
chars.shift();
|
|
14300
14298
|
}
|
|
@@ -14313,17 +14311,20 @@
|
|
|
14313
14311
|
class TokenizingChars {
|
|
14314
14312
|
text;
|
|
14315
14313
|
currentIndex = 0;
|
|
14314
|
+
current;
|
|
14316
14315
|
constructor(text) {
|
|
14317
14316
|
this.text = text;
|
|
14318
|
-
|
|
14319
|
-
current() {
|
|
14320
|
-
return this.text[this.currentIndex];
|
|
14317
|
+
this.current = text[0];
|
|
14321
14318
|
}
|
|
14322
14319
|
shift() {
|
|
14323
|
-
|
|
14320
|
+
const current = this.current;
|
|
14321
|
+
const next = this.text[++this.currentIndex];
|
|
14322
|
+
this.current = next;
|
|
14323
|
+
return current;
|
|
14324
14324
|
}
|
|
14325
14325
|
advanceBy(length) {
|
|
14326
14326
|
this.currentIndex += length;
|
|
14327
|
+
this.current = this.text[this.currentIndex];
|
|
14327
14328
|
}
|
|
14328
14329
|
isOver() {
|
|
14329
14330
|
return this.currentIndex >= this.text.length;
|
|
@@ -31167,6 +31168,14 @@
|
|
|
31167
31168
|
// ---------------------------------------------------------------------------
|
|
31168
31169
|
// Command Handling
|
|
31169
31170
|
// ---------------------------------------------------------------------------
|
|
31171
|
+
allowDispatch(cmd) {
|
|
31172
|
+
switch (cmd.type) {
|
|
31173
|
+
case "SET_BORDER":
|
|
31174
|
+
return this.checkBordersUnchanged(cmd);
|
|
31175
|
+
default:
|
|
31176
|
+
return 0 /* CommandResult.Success */;
|
|
31177
|
+
}
|
|
31178
|
+
}
|
|
31170
31179
|
handle(cmd) {
|
|
31171
31180
|
switch (cmd.type) {
|
|
31172
31181
|
case "ADD_MERGE":
|
|
@@ -31586,6 +31595,14 @@
|
|
|
31586
31595
|
this.setBorders(sheetId, [{ ...zone, left: right }], "right", bordersTopLeft.right);
|
|
31587
31596
|
}
|
|
31588
31597
|
}
|
|
31598
|
+
checkBordersUnchanged(cmd) {
|
|
31599
|
+
const currentBorder = this.getCellBorder(cmd);
|
|
31600
|
+
const areAllNewBordersUndefined = !cmd.border?.bottom && !cmd.border?.left && !cmd.border?.right && !cmd.border?.top;
|
|
31601
|
+
if ((!currentBorder && areAllNewBordersUndefined) || deepEquals(currentBorder, cmd.border)) {
|
|
31602
|
+
return 97 /* CommandResult.NoChanges */;
|
|
31603
|
+
}
|
|
31604
|
+
return 0 /* CommandResult.Success */;
|
|
31605
|
+
}
|
|
31589
31606
|
// ---------------------------------------------------------------------------
|
|
31590
31607
|
// Import/Export
|
|
31591
31608
|
// ---------------------------------------------------------------------------
|
|
@@ -31693,8 +31710,9 @@
|
|
|
31693
31710
|
allowDispatch(cmd) {
|
|
31694
31711
|
switch (cmd.type) {
|
|
31695
31712
|
case "UPDATE_CELL":
|
|
31713
|
+
return this.checkCellOutOfSheet(cmd);
|
|
31696
31714
|
case "CLEAR_CELL":
|
|
31697
|
-
return this.
|
|
31715
|
+
return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
|
|
31698
31716
|
default:
|
|
31699
31717
|
return 0 /* CommandResult.Success */;
|
|
31700
31718
|
}
|
|
@@ -31853,14 +31871,9 @@
|
|
|
31853
31871
|
*/
|
|
31854
31872
|
getCellById(cellId) {
|
|
31855
31873
|
// this must be as fast as possible
|
|
31856
|
-
|
|
31857
|
-
|
|
31858
|
-
|
|
31859
|
-
if (cell) {
|
|
31860
|
-
return cell;
|
|
31861
|
-
}
|
|
31862
|
-
}
|
|
31863
|
-
return undefined;
|
|
31874
|
+
const position = this.getters.getCellPosition(cellId);
|
|
31875
|
+
const sheet = this.cells[position.sheetId];
|
|
31876
|
+
return sheet[cellId];
|
|
31864
31877
|
}
|
|
31865
31878
|
/*
|
|
31866
31879
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
@@ -32086,13 +32099,23 @@
|
|
|
32086
32099
|
dependencies: [],
|
|
32087
32100
|
};
|
|
32088
32101
|
}
|
|
32089
|
-
checkCellOutOfSheet(
|
|
32102
|
+
checkCellOutOfSheet(cmd) {
|
|
32103
|
+
const { sheetId, col, row } = cmd;
|
|
32090
32104
|
const sheet = this.getters.tryGetSheet(sheetId);
|
|
32091
32105
|
if (!sheet)
|
|
32092
32106
|
return 28 /* CommandResult.InvalidSheetId */;
|
|
32093
32107
|
const sheetZone = this.getters.getSheetZone(sheetId);
|
|
32094
32108
|
return isInside(col, row, sheetZone) ? 0 /* CommandResult.Success */ : 19 /* CommandResult.TargetOutOfSheet */;
|
|
32095
32109
|
}
|
|
32110
|
+
checkUselessClearCell(cmd) {
|
|
32111
|
+
const cell = this.getters.getCell(cmd);
|
|
32112
|
+
if (!cell)
|
|
32113
|
+
return 97 /* CommandResult.NoChanges */;
|
|
32114
|
+
if (!cell.content && !cell.style && !cell.format) {
|
|
32115
|
+
return 97 /* CommandResult.NoChanges */;
|
|
32116
|
+
}
|
|
32117
|
+
return 0 /* CommandResult.Success */;
|
|
32118
|
+
}
|
|
32096
32119
|
}
|
|
32097
32120
|
class FormulaCellWithDependencies {
|
|
32098
32121
|
id;
|
|
@@ -35161,10 +35184,13 @@
|
|
|
35161
35184
|
// begin with the end.
|
|
35162
35185
|
rows.sort((a, b) => b - a);
|
|
35163
35186
|
for (let group of groupConsecutive(rows)) {
|
|
35187
|
+
// indexes are sorted in the descending order
|
|
35188
|
+
const from = group[group.length - 1];
|
|
35189
|
+
const to = group[0];
|
|
35164
35190
|
// Move the cells.
|
|
35165
|
-
this.moveCellOnRowsDeletion(sheet,
|
|
35166
|
-
// Effectively delete the
|
|
35167
|
-
|
|
35191
|
+
this.moveCellOnRowsDeletion(sheet, from, to);
|
|
35192
|
+
// Effectively delete the rows
|
|
35193
|
+
this.updateRowsStructureOnDeletion(sheet, from, to);
|
|
35168
35194
|
}
|
|
35169
35195
|
const count = rows.filter((row) => row < sheet.panes.ySplit).length;
|
|
35170
35196
|
if (count) {
|
|
@@ -35186,8 +35212,6 @@
|
|
|
35186
35212
|
this.addEmptyRows(sheet, quantity);
|
|
35187
35213
|
// Move the cells.
|
|
35188
35214
|
this.moveCellsOnAddition(sheet, index, quantity, "rows");
|
|
35189
|
-
// Recompute the left-right/top-bottom.
|
|
35190
|
-
this.updateRowsStructureOnAddition(sheet, row, quantity);
|
|
35191
35215
|
if (index < sheet.panes.ySplit) {
|
|
35192
35216
|
this.setPaneDivisions(sheet.id, sheet.panes.ySplit + quantity, "ROW");
|
|
35193
35217
|
}
|
|
@@ -35288,35 +35312,20 @@
|
|
|
35288
35312
|
}
|
|
35289
35313
|
}
|
|
35290
35314
|
}
|
|
35291
|
-
updateRowsStructureOnDeletion(
|
|
35315
|
+
updateRowsStructureOnDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
35292
35316
|
const rows = [];
|
|
35293
|
-
const cellsQueue = sheet.rows.map((row) => row.cells);
|
|
35317
|
+
const cellsQueue = sheet.rows.map((row) => row.cells).reverse();
|
|
35294
35318
|
for (let i in sheet.rows) {
|
|
35295
|
-
|
|
35319
|
+
const row = Number(i);
|
|
35320
|
+
if (row >= deleteFromRow && row <= deleteToRow) {
|
|
35296
35321
|
continue;
|
|
35297
35322
|
}
|
|
35298
35323
|
rows.push({
|
|
35299
|
-
cells: cellsQueue.
|
|
35324
|
+
cells: cellsQueue.pop(),
|
|
35300
35325
|
});
|
|
35301
35326
|
}
|
|
35302
35327
|
this.history.update("sheets", sheet.id, "rows", rows);
|
|
35303
35328
|
}
|
|
35304
|
-
/**
|
|
35305
|
-
* Update the rows of the sheet after an addition:
|
|
35306
|
-
* - Rename the rows
|
|
35307
|
-
*
|
|
35308
|
-
* @param sheet Sheet on which the deletion occurs
|
|
35309
|
-
* @param addedRow Index of the added row
|
|
35310
|
-
* @param rowsToAdd Number of the rows to add
|
|
35311
|
-
*/
|
|
35312
|
-
updateRowsStructureOnAddition(sheet, addedRow, rowsToAdd) {
|
|
35313
|
-
const rows = [];
|
|
35314
|
-
const cellsQueue = sheet.rows.map((row) => row.cells);
|
|
35315
|
-
sheet.rows.forEach(() => rows.push({
|
|
35316
|
-
cells: cellsQueue.shift(),
|
|
35317
|
-
}));
|
|
35318
|
-
this.history.update("sheets", sheet.id, "rows", rows);
|
|
35319
|
-
}
|
|
35320
35329
|
/**
|
|
35321
35330
|
* Add empty rows at the end of the rows
|
|
35322
35331
|
*
|
|
@@ -35432,6 +35441,7 @@
|
|
|
35432
35441
|
getters;
|
|
35433
35442
|
computeCell;
|
|
35434
35443
|
evalContext;
|
|
35444
|
+
rangeCache = {};
|
|
35435
35445
|
constructor(context, getters, computeCell) {
|
|
35436
35446
|
this.getters = getters;
|
|
35437
35447
|
this.computeCell = computeCell;
|
|
@@ -35517,25 +35527,32 @@
|
|
|
35517
35527
|
if (!_zone) {
|
|
35518
35528
|
return { value: [[]], format: [[]] };
|
|
35519
35529
|
}
|
|
35530
|
+
const { top, left, bottom, right } = zone;
|
|
35531
|
+
const cacheKey = `${sheetId}-${top}-${left}-${bottom}-${right}`;
|
|
35532
|
+
if (cacheKey in this.rangeCache) {
|
|
35533
|
+
return this.rangeCache[cacheKey];
|
|
35534
|
+
}
|
|
35520
35535
|
const height = _zone.bottom - _zone.top + 1;
|
|
35521
35536
|
const width = _zone.right - _zone.left + 1;
|
|
35522
|
-
const value = Array
|
|
35523
|
-
const format = Array
|
|
35537
|
+
const value = new Array(width);
|
|
35538
|
+
const format = new Array(width);
|
|
35524
35539
|
// Performance issue: nested loop is faster than a map here
|
|
35525
35540
|
for (let col = _zone.left; col <= _zone.right; col++) {
|
|
35541
|
+
const colIndex = col - _zone.left;
|
|
35542
|
+
value[colIndex] = new Array(height);
|
|
35543
|
+
format[colIndex] = new Array(height);
|
|
35526
35544
|
for (let row = _zone.top; row <= _zone.bottom; row++) {
|
|
35527
|
-
const evaluatedCell = this.getEvaluatedCellIfNotEmpty({ sheetId
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
if (evaluatedCell.format !== undefined) {
|
|
35533
|
-
format[colIndex][rowIndex] = evaluatedCell.format;
|
|
35534
|
-
}
|
|
35545
|
+
const evaluatedCell = this.getEvaluatedCellIfNotEmpty({ sheetId, col, row });
|
|
35546
|
+
const rowIndex = row - _zone.top;
|
|
35547
|
+
value[colIndex][rowIndex] = evaluatedCell?.value;
|
|
35548
|
+
if (evaluatedCell?.format !== undefined) {
|
|
35549
|
+
format[colIndex][rowIndex] = evaluatedCell.format;
|
|
35535
35550
|
}
|
|
35536
35551
|
}
|
|
35537
35552
|
}
|
|
35538
|
-
|
|
35553
|
+
const result = { value, format };
|
|
35554
|
+
this.rangeCache[cacheKey] = result;
|
|
35555
|
+
return result;
|
|
35539
35556
|
}
|
|
35540
35557
|
}
|
|
35541
35558
|
|
|
@@ -35733,6 +35750,7 @@
|
|
|
35733
35750
|
this.formulaDependencies().addDependencies(positionId, dependencies);
|
|
35734
35751
|
}
|
|
35735
35752
|
updateCompilationParameters() {
|
|
35753
|
+
// rebuild the compilation parameters (with a clean cache)
|
|
35736
35754
|
this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
|
|
35737
35755
|
}
|
|
35738
35756
|
evaluateCells(positions) {
|
|
@@ -35776,6 +35794,15 @@
|
|
|
35776
35794
|
this.evaluatedCells = new Map();
|
|
35777
35795
|
this.evaluate(this.getAllCells());
|
|
35778
35796
|
}
|
|
35797
|
+
evaluateFormula(sheetId, formulaString) {
|
|
35798
|
+
const compiledFormula = compile(formulaString);
|
|
35799
|
+
const ranges = [];
|
|
35800
|
+
for (let xc of compiledFormula.dependencies) {
|
|
35801
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
35802
|
+
}
|
|
35803
|
+
this.updateCompilationParameters();
|
|
35804
|
+
return compiledFormula.execute(ranges, ...this.compilationParams).value;
|
|
35805
|
+
}
|
|
35779
35806
|
getAllCells() {
|
|
35780
35807
|
const positionIds = new JetSet();
|
|
35781
35808
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
@@ -35802,6 +35829,7 @@
|
|
|
35802
35829
|
this.nextPositionsToUpdate = cells;
|
|
35803
35830
|
let currentIteration = 0;
|
|
35804
35831
|
while (this.nextPositionsToUpdate.size && currentIteration++ < MAX_ITERATION) {
|
|
35832
|
+
this.updateCompilationParameters();
|
|
35805
35833
|
const positionIds = Array.from(this.nextPositionsToUpdate);
|
|
35806
35834
|
this.nextPositionsToUpdate.clear();
|
|
35807
35835
|
for (let i = 0; i < positionIds.length; ++i) {
|
|
@@ -36186,7 +36214,6 @@
|
|
|
36186
36214
|
// of other cells depending on it, at the next iteration.
|
|
36187
36215
|
//#endregion
|
|
36188
36216
|
class EvaluationPlugin extends UIPlugin {
|
|
36189
|
-
config;
|
|
36190
36217
|
static getters = [
|
|
36191
36218
|
"evaluateFormula",
|
|
36192
36219
|
"getRangeFormattedValues",
|
|
@@ -36198,12 +36225,9 @@
|
|
|
36198
36225
|
];
|
|
36199
36226
|
shouldRebuildDependenciesGraph = true;
|
|
36200
36227
|
evaluator;
|
|
36201
|
-
compilationParams;
|
|
36202
36228
|
positionsToUpdate = [];
|
|
36203
36229
|
constructor(config) {
|
|
36204
36230
|
super(config);
|
|
36205
|
-
this.config = config;
|
|
36206
|
-
this.compilationParams = this.getCompilationParameters();
|
|
36207
36231
|
this.evaluator = new Evaluator(config.custom, this.getters);
|
|
36208
36232
|
}
|
|
36209
36233
|
// ---------------------------------------------------------------------------
|
|
@@ -36228,10 +36252,6 @@
|
|
|
36228
36252
|
case "EVALUATE_CELLS":
|
|
36229
36253
|
this.evaluator.evaluateAllCells();
|
|
36230
36254
|
break;
|
|
36231
|
-
case "UPDATE_LOCALE":
|
|
36232
|
-
this.compilationParams = this.getCompilationParameters();
|
|
36233
|
-
this.evaluator.updateCompilationParameters();
|
|
36234
|
-
break;
|
|
36235
36255
|
}
|
|
36236
36256
|
}
|
|
36237
36257
|
finalize() {
|
|
@@ -36249,12 +36269,7 @@
|
|
|
36249
36269
|
// Getters
|
|
36250
36270
|
// ---------------------------------------------------------------------------
|
|
36251
36271
|
evaluateFormula(sheetId, formulaString) {
|
|
36252
|
-
|
|
36253
|
-
const ranges = [];
|
|
36254
|
-
for (let xc of compiledFormula.dependencies) {
|
|
36255
|
-
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
36256
|
-
}
|
|
36257
|
-
return compiledFormula.execute(ranges, ...this.compilationParams).value;
|
|
36272
|
+
return this.evaluator.evaluateFormula(sheetId, formulaString);
|
|
36258
36273
|
}
|
|
36259
36274
|
/**
|
|
36260
36275
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -36353,9 +36368,6 @@
|
|
|
36353
36368
|
}
|
|
36354
36369
|
return undefined;
|
|
36355
36370
|
}
|
|
36356
|
-
getCompilationParameters() {
|
|
36357
|
-
return buildCompilationParameters(this.config.custom, this.getters, (position) => this.evaluator.getEvaluatedCell(position));
|
|
36358
|
-
}
|
|
36359
36371
|
}
|
|
36360
36372
|
function isBadExpression(formula) {
|
|
36361
36373
|
try {
|
|
@@ -42072,8 +42084,8 @@
|
|
|
42072
42084
|
this.lastPasteState = this.state;
|
|
42073
42085
|
if (this.paintFormatStatus === "oneOff") {
|
|
42074
42086
|
this.paintFormatStatus = "inactive";
|
|
42075
|
-
this.status = "invisible";
|
|
42076
42087
|
}
|
|
42088
|
+
this.status = "invisible";
|
|
42077
42089
|
break;
|
|
42078
42090
|
case "CLEAN_CLIPBOARD_HIGHLIGHT":
|
|
42079
42091
|
this.status = "invisible";
|
|
@@ -47890,9 +47902,9 @@
|
|
|
47890
47902
|
* Apply the changes of the given HistoryChange to the state
|
|
47891
47903
|
*/
|
|
47892
47904
|
function applyChange(change, target) {
|
|
47893
|
-
let val = change.
|
|
47894
|
-
|
|
47895
|
-
for (let pathIndex =
|
|
47905
|
+
let val = change.path[0];
|
|
47906
|
+
const key = change.path[change.path.length - 1];
|
|
47907
|
+
for (let pathIndex = 1; pathIndex < change.path.slice(0, -1).length; pathIndex++) {
|
|
47896
47908
|
const p = change.path[pathIndex];
|
|
47897
47909
|
if (val[p] === undefined) {
|
|
47898
47910
|
const nextPath = change.path[pathIndex + 1];
|
|
@@ -48573,13 +48585,14 @@
|
|
|
48573
48585
|
}
|
|
48574
48586
|
addChange(...args) {
|
|
48575
48587
|
const val = args.pop();
|
|
48576
|
-
const
|
|
48588
|
+
const root = args[0];
|
|
48577
48589
|
let value = root;
|
|
48578
|
-
let key =
|
|
48579
|
-
|
|
48580
|
-
|
|
48590
|
+
let key = args[args.length - 1];
|
|
48591
|
+
const pathLength = args.length - 2;
|
|
48592
|
+
for (let pathIndex = 1; pathIndex <= pathLength; pathIndex++) {
|
|
48593
|
+
const p = args[pathIndex];
|
|
48581
48594
|
if (value[p] === undefined) {
|
|
48582
|
-
const nextPath =
|
|
48595
|
+
const nextPath = args[pathIndex + 1];
|
|
48583
48596
|
value[p] = createEmptyStructure(nextPath);
|
|
48584
48597
|
}
|
|
48585
48598
|
value = value[p];
|
|
@@ -48588,8 +48601,7 @@
|
|
|
48588
48601
|
return;
|
|
48589
48602
|
}
|
|
48590
48603
|
this.changes.push({
|
|
48591
|
-
|
|
48592
|
-
path,
|
|
48604
|
+
path: args,
|
|
48593
48605
|
before: value[key],
|
|
48594
48606
|
after: val,
|
|
48595
48607
|
});
|
|
@@ -50439,19 +50451,22 @@
|
|
|
50439
50451
|
* Check if the given command is allowed by all the plugins and the history.
|
|
50440
50452
|
*/
|
|
50441
50453
|
checkDispatchAllowed(command) {
|
|
50442
|
-
|
|
50443
|
-
|
|
50454
|
+
const results = isCoreCommand(command)
|
|
50455
|
+
? this.checkDispatchAllowedCoreCommand(command)
|
|
50456
|
+
: this.checkDispatchAllowedLocalCommand(command);
|
|
50457
|
+
if (results.some((r) => r !== 0 /* CommandResult.Success */)) {
|
|
50458
|
+
return new DispatchResult(results.flat());
|
|
50444
50459
|
}
|
|
50445
|
-
return
|
|
50460
|
+
return DispatchResult.Success;
|
|
50446
50461
|
}
|
|
50447
50462
|
checkDispatchAllowedCoreCommand(command) {
|
|
50448
50463
|
const results = this.corePlugins.map((handler) => handler.allowDispatch(command));
|
|
50449
50464
|
results.push(this.range.allowDispatch(command));
|
|
50450
|
-
return
|
|
50465
|
+
return results;
|
|
50451
50466
|
}
|
|
50452
50467
|
checkDispatchAllowedLocalCommand(command) {
|
|
50453
50468
|
const results = this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
50454
|
-
return
|
|
50469
|
+
return results;
|
|
50455
50470
|
}
|
|
50456
50471
|
finalize() {
|
|
50457
50472
|
this.status = 3 /* Status.Finalizing */;
|
|
@@ -50777,9 +50792,9 @@
|
|
|
50777
50792
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50778
50793
|
|
|
50779
50794
|
|
|
50780
|
-
__info__.version = '16.4.
|
|
50781
|
-
__info__.date = '2023-11-
|
|
50782
|
-
__info__.hash = '
|
|
50795
|
+
__info__.version = '16.4.15';
|
|
50796
|
+
__info__.date = '2023-11-24T13:12:26.608Z';
|
|
50797
|
+
__info__.hash = '141943d';
|
|
50783
50798
|
|
|
50784
50799
|
|
|
50785
50800
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|