@odoo/o-spreadsheet 17.0.1 → 17.0.3
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 +137 -86
- package/dist/o-spreadsheet.d.ts +13 -8
- package/dist/o-spreadsheet.esm.js +136 -87
- package/dist/o-spreadsheet.iife.js +137 -86
- package/dist/o-spreadsheet.iife.min.js +253 -253
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2023-11-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.3
|
|
6
|
+
* @date 2023-11-16T11:59:49.524Z
|
|
7
|
+
* @hash 8bd0fb2
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -4540,14 +4540,14 @@ function drawDecoratedText(context, text, position, underline = false, strikethr
|
|
|
4540
4540
|
switch (context.textBaseline) {
|
|
4541
4541
|
case "top":
|
|
4542
4542
|
underlineY += boxHeight - 2 * strokeWidth;
|
|
4543
|
-
strikeY += boxHeight -
|
|
4543
|
+
strikeY += boxHeight / 2 - strokeWidth;
|
|
4544
4544
|
break;
|
|
4545
4545
|
case "middle":
|
|
4546
4546
|
underlineY += boxHeight / 2 - strokeWidth;
|
|
4547
4547
|
break;
|
|
4548
4548
|
case "alphabetic":
|
|
4549
4549
|
underlineY += 2 * strokeWidth;
|
|
4550
|
-
strikeY -=
|
|
4550
|
+
strikeY -= 3 * strokeWidth;
|
|
4551
4551
|
break;
|
|
4552
4552
|
case "bottom":
|
|
4553
4553
|
underlineY = y;
|
|
@@ -5966,7 +5966,7 @@ autofillModifiersRegistry
|
|
|
5966
5966
|
return { cellData: {} };
|
|
5967
5967
|
}
|
|
5968
5968
|
const sheetId = data.sheetId;
|
|
5969
|
-
const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula
|
|
5969
|
+
const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula);
|
|
5970
5970
|
return {
|
|
5971
5971
|
cellData: {
|
|
5972
5972
|
border: data.border,
|
|
@@ -10693,6 +10693,17 @@ const SELECTION_CONTAINS_FILTER = (env) => {
|
|
|
10693
10693
|
const IS_ONLY_ONE_RANGE = (env) => {
|
|
10694
10694
|
return env.model.getters.getSelectedZones().length === 1;
|
|
10695
10695
|
};
|
|
10696
|
+
const CAN_INSERT_HEADER = (env, dimension) => {
|
|
10697
|
+
if (!IS_ONLY_ONE_RANGE(env)) {
|
|
10698
|
+
return false;
|
|
10699
|
+
}
|
|
10700
|
+
const activeHeaders = dimension === "COL" ? env.model.getters.getActiveCols() : env.model.getters.getActiveRows();
|
|
10701
|
+
const ortogonalActiveHeaders = dimension === "COL" ? env.model.getters.getActiveRows() : env.model.getters.getActiveCols();
|
|
10702
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
10703
|
+
const zone = env.model.getters.getSelectedZone();
|
|
10704
|
+
const allSheetSelected = isEqual(zone, env.model.getters.getSheetZone(sheetId));
|
|
10705
|
+
return isConsecutive(activeHeaders) && (ortogonalActiveHeaders.size === 0 || allSheetSelected);
|
|
10706
|
+
};
|
|
10696
10707
|
|
|
10697
10708
|
const undo = {
|
|
10698
10709
|
name: _t("Undo"),
|
|
@@ -19370,9 +19381,7 @@ const insertRow = {
|
|
|
19370
19381
|
const number = getRowsNumber(env);
|
|
19371
19382
|
return number === 1 ? _t("Insert row") : _t("Insert %s rows", number.toString());
|
|
19372
19383
|
},
|
|
19373
|
-
isVisible: (env) =>
|
|
19374
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19375
|
-
env.model.getters.getActiveCols().size === 0,
|
|
19384
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
|
|
19376
19385
|
icon: "o-spreadsheet-Icon.INSERT_ROW",
|
|
19377
19386
|
};
|
|
19378
19387
|
const rowInsertRowBefore = {
|
|
@@ -19381,9 +19390,7 @@ const rowInsertRowBefore = {
|
|
|
19381
19390
|
return number === 1 ? _t("Insert row above") : _t("Insert %s rows above", number.toString());
|
|
19382
19391
|
},
|
|
19383
19392
|
execute: INSERT_ROWS_BEFORE_ACTION,
|
|
19384
|
-
isVisible: (env) =>
|
|
19385
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19386
|
-
env.model.getters.getActiveCols().size === 0,
|
|
19393
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
|
|
19387
19394
|
icon: "o-spreadsheet-Icon.INSERT_ROW_BEFORE",
|
|
19388
19395
|
};
|
|
19389
19396
|
const topBarInsertRowsBefore = {
|
|
@@ -19414,9 +19421,7 @@ const rowInsertRowsAfter = {
|
|
|
19414
19421
|
const number = getRowsNumber(env);
|
|
19415
19422
|
return number === 1 ? _t("Insert row below") : _t("Insert %s rows below", number.toString());
|
|
19416
19423
|
},
|
|
19417
|
-
isVisible: (env) =>
|
|
19418
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19419
|
-
env.model.getters.getActiveCols().size === 0,
|
|
19424
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
|
|
19420
19425
|
icon: "o-spreadsheet-Icon.INSERT_ROW_AFTER",
|
|
19421
19426
|
};
|
|
19422
19427
|
const topBarInsertRowsAfter = {
|
|
@@ -19434,9 +19439,7 @@ const insertCol = {
|
|
|
19434
19439
|
const number = getColumnsNumber(env);
|
|
19435
19440
|
return number === 1 ? _t("Insert column") : _t("Insert %s columns", number.toString());
|
|
19436
19441
|
},
|
|
19437
|
-
isVisible: (env) =>
|
|
19438
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19439
|
-
env.model.getters.getActiveRows().size === 0,
|
|
19442
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
|
|
19440
19443
|
icon: "o-spreadsheet-Icon.INSERT_COL",
|
|
19441
19444
|
};
|
|
19442
19445
|
const colInsertColsBefore = {
|
|
@@ -19447,9 +19450,7 @@ const colInsertColsBefore = {
|
|
|
19447
19450
|
: _t("Insert %s columns left", number.toString());
|
|
19448
19451
|
},
|
|
19449
19452
|
execute: INSERT_COLUMNS_BEFORE_ACTION,
|
|
19450
|
-
isVisible: (env) =>
|
|
19451
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19452
|
-
env.model.getters.getActiveRows().size === 0,
|
|
19453
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
|
|
19453
19454
|
icon: "o-spreadsheet-Icon.INSERT_COL_BEFORE",
|
|
19454
19455
|
};
|
|
19455
19456
|
const topBarInsertColsBefore = {
|
|
@@ -19482,9 +19483,7 @@ const colInsertColsAfter = {
|
|
|
19482
19483
|
: _t("Insert %s columns right", number.toString());
|
|
19483
19484
|
},
|
|
19484
19485
|
execute: INSERT_COLUMNS_AFTER_ACTION,
|
|
19485
|
-
isVisible: (env) =>
|
|
19486
|
-
IS_ONLY_ONE_RANGE(env) &&
|
|
19487
|
-
env.model.getters.getActiveRows().size === 0,
|
|
19486
|
+
isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
|
|
19488
19487
|
icon: "o-spreadsheet-Icon.INSERT_COL_AFTER",
|
|
19489
19488
|
};
|
|
19490
19489
|
const topBarInsertColsAfter = {
|
|
@@ -23825,7 +23824,7 @@ css /* scss */ `
|
|
|
23825
23824
|
}
|
|
23826
23825
|
.o-input-count {
|
|
23827
23826
|
width: fit-content;
|
|
23828
|
-
padding:
|
|
23827
|
+
padding: 4px 0 4px 4px;
|
|
23829
23828
|
}
|
|
23830
23829
|
}
|
|
23831
23830
|
}
|
|
@@ -34946,6 +34945,9 @@ const functionCache = {};
|
|
|
34946
34945
|
// -----------------------------------------------------------------------------
|
|
34947
34946
|
function compile(formula) {
|
|
34948
34947
|
const tokens = rangeTokenize(formula);
|
|
34948
|
+
return compileTokens(tokens);
|
|
34949
|
+
}
|
|
34950
|
+
function compileTokens(tokens) {
|
|
34949
34951
|
const { dependencies, constantValues } = formulaArguments(tokens);
|
|
34950
34952
|
const cacheKey = compilationCacheKey(tokens, dependencies, constantValues);
|
|
34951
34953
|
if (!functionCache[cacheKey]) {
|
|
@@ -35312,11 +35314,11 @@ class CellPlugin extends CorePlugin {
|
|
|
35312
35314
|
for (const sheet of Object.keys(this.cells)) {
|
|
35313
35315
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
35314
35316
|
if (cell.isFormula) {
|
|
35315
|
-
for (const range of cell.dependencies) {
|
|
35317
|
+
for (const range of cell.compiledFormula.dependencies) {
|
|
35316
35318
|
if (!sheetId || range.sheetId === sheetId) {
|
|
35317
35319
|
const change = applyChange(range);
|
|
35318
35320
|
if (change.changeType !== "NONE") {
|
|
35319
|
-
this.history.update("cells", sheet, cell.id, "dependencies", cell.dependencies.indexOf(range), change.range);
|
|
35321
|
+
this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
|
|
35320
35322
|
}
|
|
35321
35323
|
}
|
|
35322
35324
|
}
|
|
@@ -35512,10 +35514,10 @@ class CellPlugin extends CorePlugin {
|
|
|
35512
35514
|
/*
|
|
35513
35515
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
35514
35516
|
*/
|
|
35515
|
-
getFormulaCellContent(sheetId,
|
|
35516
|
-
const ranges = dependencies ||
|
|
35517
|
+
getFormulaCellContent(sheetId, compiledFormula, dependencies) {
|
|
35518
|
+
const ranges = dependencies || compiledFormula.dependencies;
|
|
35517
35519
|
let rangeIndex = 0;
|
|
35518
|
-
return concat(
|
|
35520
|
+
return concat(compiledFormula.tokens.map((token) => {
|
|
35519
35521
|
if (token.type === "REFERENCE") {
|
|
35520
35522
|
const range = ranges[rangeIndex++];
|
|
35521
35523
|
return this.getters.getRangeString(range, sheetId);
|
|
@@ -35526,12 +35528,9 @@ class CellPlugin extends CorePlugin {
|
|
|
35526
35528
|
/*
|
|
35527
35529
|
* Constructs a formula string based on an initial formula and a translation vector
|
|
35528
35530
|
*/
|
|
35529
|
-
getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula
|
|
35530
|
-
const adaptedDependencies = this.getters.createAdaptedRanges(dependencies, offsetX, offsetY, sheetId);
|
|
35531
|
-
return this.getFormulaCellContent(sheetId,
|
|
35532
|
-
compiledFormula,
|
|
35533
|
-
dependencies: adaptedDependencies,
|
|
35534
|
-
});
|
|
35531
|
+
getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula) {
|
|
35532
|
+
const adaptedDependencies = this.getters.createAdaptedRanges(compiledFormula.dependencies, offsetX, offsetY, sheetId);
|
|
35533
|
+
return this.getFormulaCellContent(sheetId, compiledFormula, adaptedDependencies);
|
|
35535
35534
|
}
|
|
35536
35535
|
getCellStyle(position) {
|
|
35537
35536
|
return this.getters.getCell(position)?.style || {};
|
|
@@ -35711,8 +35710,10 @@ class CellPlugin extends CorePlugin {
|
|
|
35711
35710
|
style,
|
|
35712
35711
|
format,
|
|
35713
35712
|
isFormula: true,
|
|
35714
|
-
compiledFormula
|
|
35715
|
-
|
|
35713
|
+
compiledFormula: {
|
|
35714
|
+
...compiledFormula,
|
|
35715
|
+
dependencies: [],
|
|
35716
|
+
},
|
|
35716
35717
|
};
|
|
35717
35718
|
}
|
|
35718
35719
|
/**
|
|
@@ -35721,7 +35722,7 @@ class CellPlugin extends CorePlugin {
|
|
|
35721
35722
|
*/
|
|
35722
35723
|
createFormulaCellWithDependencies(id, compiledFormula, format, style, sheetId) {
|
|
35723
35724
|
const dependencies = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
35724
|
-
return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.
|
|
35725
|
+
return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.getters.getRangeString.bind(this));
|
|
35725
35726
|
}
|
|
35726
35727
|
createErrorFormula(id, content, format, style, error) {
|
|
35727
35728
|
return {
|
|
@@ -35731,13 +35732,12 @@ class CellPlugin extends CorePlugin {
|
|
|
35731
35732
|
format,
|
|
35732
35733
|
isFormula: true,
|
|
35733
35734
|
compiledFormula: {
|
|
35734
|
-
dependencies: [],
|
|
35735
35735
|
tokens: tokenize(content),
|
|
35736
|
+
dependencies: [],
|
|
35736
35737
|
execute: function () {
|
|
35737
35738
|
throw error;
|
|
35738
35739
|
},
|
|
35739
35740
|
},
|
|
35740
|
-
dependencies: [],
|
|
35741
35741
|
};
|
|
35742
35742
|
}
|
|
35743
35743
|
checkCellOutOfSheet(sheetId, col, row) {
|
|
@@ -35750,27 +35750,44 @@ class CellPlugin extends CorePlugin {
|
|
|
35750
35750
|
}
|
|
35751
35751
|
class FormulaCellWithDependencies {
|
|
35752
35752
|
id;
|
|
35753
|
-
compiledFormula;
|
|
35754
35753
|
format;
|
|
35755
35754
|
style;
|
|
35756
|
-
dependencies;
|
|
35757
35755
|
sheetId;
|
|
35758
|
-
|
|
35756
|
+
getRangeString;
|
|
35759
35757
|
isFormula = true;
|
|
35760
|
-
|
|
35758
|
+
compiledFormula;
|
|
35759
|
+
constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
|
|
35761
35760
|
this.id = id;
|
|
35762
|
-
this.compiledFormula = compiledFormula;
|
|
35763
35761
|
this.format = format;
|
|
35764
35762
|
this.style = style;
|
|
35765
|
-
this.dependencies = dependencies;
|
|
35766
35763
|
this.sheetId = sheetId;
|
|
35767
|
-
this.
|
|
35764
|
+
this.getRangeString = getRangeString;
|
|
35765
|
+
let rangeIndex = 0;
|
|
35766
|
+
const tokens = compiledFormula.tokens.map((token) => {
|
|
35767
|
+
if (token.type === "REFERENCE") {
|
|
35768
|
+
const index = rangeIndex++;
|
|
35769
|
+
return new RangeReferenceToken(() => this.getRangeString(dependencies[index], this.sheetId));
|
|
35770
|
+
}
|
|
35771
|
+
return token;
|
|
35772
|
+
});
|
|
35773
|
+
this.compiledFormula = {
|
|
35774
|
+
...compiledFormula,
|
|
35775
|
+
dependencies,
|
|
35776
|
+
tokens,
|
|
35777
|
+
};
|
|
35768
35778
|
}
|
|
35769
35779
|
get content() {
|
|
35770
|
-
return this.
|
|
35771
|
-
|
|
35772
|
-
|
|
35773
|
-
|
|
35780
|
+
return concat(this.compiledFormula.tokens.map((token) => token.value));
|
|
35781
|
+
}
|
|
35782
|
+
}
|
|
35783
|
+
class RangeReferenceToken {
|
|
35784
|
+
getValue;
|
|
35785
|
+
type = "REFERENCE";
|
|
35786
|
+
constructor(getValue) {
|
|
35787
|
+
this.getValue = getValue;
|
|
35788
|
+
}
|
|
35789
|
+
get value() {
|
|
35790
|
+
return this.getValue();
|
|
35774
35791
|
}
|
|
35775
35792
|
}
|
|
35776
35793
|
|
|
@@ -36915,6 +36932,13 @@ class FiltersPlugin extends CorePlugin {
|
|
|
36915
36932
|
}
|
|
36916
36933
|
onDeleteColumnsRows(cmd) {
|
|
36917
36934
|
for (const table of this.getFilterTables(cmd.sheetId)) {
|
|
36935
|
+
// Remove the filter tables whose data filter headers are in the removed rows.
|
|
36936
|
+
if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
|
|
36937
|
+
const tables = { ...this.tables[cmd.sheetId] };
|
|
36938
|
+
delete tables[table.id];
|
|
36939
|
+
this.history.update("tables", cmd.sheetId, tables);
|
|
36940
|
+
continue;
|
|
36941
|
+
}
|
|
36918
36942
|
const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
|
|
36919
36943
|
if (!zone) {
|
|
36920
36944
|
const tables = { ...this.tables[cmd.sheetId] };
|
|
@@ -39963,6 +39987,13 @@ class Evaluator {
|
|
|
39963
39987
|
return (this.evaluatedCells.get(this.encodePosition(position)) ||
|
|
39964
39988
|
createEvaluatedCell("", { locale: this.getters.getLocale() }));
|
|
39965
39989
|
}
|
|
39990
|
+
getSpreadPositionsOf(position) {
|
|
39991
|
+
const positionId = this.encodePosition(position);
|
|
39992
|
+
if (!this.spreadingRelations.isArrayFormula(positionId)) {
|
|
39993
|
+
return [];
|
|
39994
|
+
}
|
|
39995
|
+
return Array.from(this.spreadingRelations.getArrayResultPositionIds(positionId)).map(this.decodePosition.bind(this));
|
|
39996
|
+
}
|
|
39966
39997
|
getArrayFormulaSpreadingOn(position) {
|
|
39967
39998
|
const positionId = this.encodePosition(position);
|
|
39968
39999
|
const formulaPosition = this.getArrayFormulaSpreadingOnId(positionId);
|
|
@@ -40067,9 +40098,6 @@ class Evaluator {
|
|
|
40067
40098
|
}
|
|
40068
40099
|
}
|
|
40069
40100
|
setEvaluatedCell(positionId, evaluatedCell) {
|
|
40070
|
-
if (this.nextPositionsToUpdate.has(positionId)) {
|
|
40071
|
-
this.nextPositionsToUpdate.delete(positionId);
|
|
40072
|
-
}
|
|
40073
40101
|
this.evaluatedCells.set(positionId, evaluatedCell);
|
|
40074
40102
|
}
|
|
40075
40103
|
computeCell(positionId) {
|
|
@@ -40124,7 +40152,7 @@ class Evaluator {
|
|
|
40124
40152
|
const position = this.compilationParams[2].getters.getCellPosition(cellId);
|
|
40125
40153
|
return toXC(position.col, position.row);
|
|
40126
40154
|
};
|
|
40127
|
-
const formulaReturn = cellData.compiledFormula.execute(cellData.dependencies, ...this.compilationParams);
|
|
40155
|
+
const formulaReturn = cellData.compiledFormula.execute(cellData.compiledFormula.dependencies, ...this.compilationParams);
|
|
40128
40156
|
if (!isMatrix(formulaReturn)) {
|
|
40129
40157
|
return createEvaluatedCell(formulaReturn.value, {
|
|
40130
40158
|
format: cellData.format || formulaReturn.format,
|
|
@@ -40224,7 +40252,7 @@ class Evaluator {
|
|
|
40224
40252
|
return [];
|
|
40225
40253
|
}
|
|
40226
40254
|
const dependencies = [];
|
|
40227
|
-
for (const range of cell.dependencies) {
|
|
40255
|
+
for (const range of cell.compiledFormula.dependencies) {
|
|
40228
40256
|
if (range.invalidSheetName || range.invalidXc) {
|
|
40229
40257
|
continue;
|
|
40230
40258
|
}
|
|
@@ -40430,6 +40458,7 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
40430
40458
|
"getEvaluatedCell",
|
|
40431
40459
|
"getEvaluatedCells",
|
|
40432
40460
|
"getEvaluatedCellsInZone",
|
|
40461
|
+
"getSpreadPositionsOf",
|
|
40433
40462
|
];
|
|
40434
40463
|
shouldRebuildDependenciesGraph = true;
|
|
40435
40464
|
evaluator;
|
|
@@ -40539,6 +40568,9 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
40539
40568
|
getEvaluatedCellsInZone(sheetId, zone) {
|
|
40540
40569
|
return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
|
|
40541
40570
|
}
|
|
40571
|
+
getSpreadPositionsOf(position) {
|
|
40572
|
+
return this.evaluator.getSpreadPositionsOf(position);
|
|
40573
|
+
}
|
|
40542
40574
|
// ---------------------------------------------------------------------------
|
|
40543
40575
|
// Export
|
|
40544
40576
|
// ---------------------------------------------------------------------------
|
|
@@ -40576,10 +40608,10 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
40576
40608
|
*/
|
|
40577
40609
|
getCorrespondingFormulaCell(position) {
|
|
40578
40610
|
const cell = this.getters.getCell(position);
|
|
40579
|
-
if (cell && cell.
|
|
40580
|
-
|
|
40581
|
-
|
|
40582
|
-
|
|
40611
|
+
if (cell && cell.isFormula) {
|
|
40612
|
+
return isBadExpression(cell.compiledFormula.tokens) ? undefined : cell;
|
|
40613
|
+
}
|
|
40614
|
+
else if (cell && cell.content) {
|
|
40583
40615
|
return undefined;
|
|
40584
40616
|
}
|
|
40585
40617
|
const spreadingFormulaPosition = this.evaluator.getArrayFormulaSpreadingOn(position);
|
|
@@ -40596,9 +40628,9 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
40596
40628
|
return buildCompilationParameters(this.config.custom, this.getters, (position) => this.evaluator.getEvaluatedCell(position));
|
|
40597
40629
|
}
|
|
40598
40630
|
}
|
|
40599
|
-
function isBadExpression(
|
|
40631
|
+
function isBadExpression(tokens) {
|
|
40600
40632
|
try {
|
|
40601
|
-
|
|
40633
|
+
compileTokens(tokens);
|
|
40602
40634
|
return false;
|
|
40603
40635
|
}
|
|
40604
40636
|
catch (error) {
|
|
@@ -40767,22 +40799,20 @@ class EvaluationChartPlugin extends UIPlugin {
|
|
|
40767
40799
|
invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
40768
40800
|
cmd.type === "EVALUATE_CELLS" ||
|
|
40769
40801
|
cmd.type === "UPDATE_CELL") {
|
|
40770
|
-
|
|
40771
|
-
|
|
40772
|
-
this.history.update("charts", chartId, undefined);
|
|
40773
|
-
}
|
|
40802
|
+
for (const chartId in this.charts) {
|
|
40803
|
+
this.charts[chartId] = undefined;
|
|
40774
40804
|
}
|
|
40775
40805
|
}
|
|
40776
40806
|
switch (cmd.type) {
|
|
40777
40807
|
case "UPDATE_CHART":
|
|
40778
40808
|
case "CREATE_CHART":
|
|
40779
40809
|
case "DELETE_FIGURE":
|
|
40780
|
-
this.
|
|
40810
|
+
this.charts[cmd.id] = undefined;
|
|
40781
40811
|
break;
|
|
40782
40812
|
case "DELETE_SHEET":
|
|
40783
40813
|
for (let chartId in this.charts) {
|
|
40784
40814
|
if (!this.getters.isChartDefined(chartId)) {
|
|
40785
|
-
this.
|
|
40815
|
+
this.charts[chartId] = undefined;
|
|
40786
40816
|
}
|
|
40787
40817
|
}
|
|
40788
40818
|
break;
|
|
@@ -40794,8 +40824,7 @@ class EvaluationChartPlugin extends UIPlugin {
|
|
|
40794
40824
|
if (!chart) {
|
|
40795
40825
|
throw new Error(`No chart for the given id: ${figureId}`);
|
|
40796
40826
|
}
|
|
40797
|
-
|
|
40798
|
-
this.history.update("charts", figureId, runtime);
|
|
40827
|
+
this.charts[figureId] = this.createRuntimeChart(chart);
|
|
40799
40828
|
}
|
|
40800
40829
|
return this.charts[figureId];
|
|
40801
40830
|
}
|
|
@@ -40947,7 +40976,10 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
40947
40976
|
const values = cf.rule.values.map((value, i) => {
|
|
40948
40977
|
const compiledFormula = formulas[i];
|
|
40949
40978
|
if (compiledFormula) {
|
|
40950
|
-
return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top,
|
|
40979
|
+
return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top, {
|
|
40980
|
+
...compiledFormula,
|
|
40981
|
+
dependencies: compiledFormula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
|
|
40982
|
+
});
|
|
40951
40983
|
}
|
|
40952
40984
|
return value;
|
|
40953
40985
|
});
|
|
@@ -41319,7 +41351,10 @@ class EvaluationDataValidationPlugin extends UIPlugin {
|
|
|
41319
41351
|
}
|
|
41320
41352
|
try {
|
|
41321
41353
|
const formula = compile(value);
|
|
41322
|
-
const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row,
|
|
41354
|
+
const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, {
|
|
41355
|
+
...formula,
|
|
41356
|
+
dependencies: formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
|
|
41357
|
+
});
|
|
41323
41358
|
const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
|
|
41324
41359
|
return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
|
|
41325
41360
|
}
|
|
@@ -43571,7 +43606,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
43571
43606
|
}
|
|
43572
43607
|
let content = origin.cell.content;
|
|
43573
43608
|
if (origin.cell.isFormula && operation === "COPY") {
|
|
43574
|
-
content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula
|
|
43609
|
+
content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula);
|
|
43575
43610
|
}
|
|
43576
43611
|
this.dispatch("UPDATE_CELL", {
|
|
43577
43612
|
...target,
|
|
@@ -44103,20 +44138,29 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
44103
44138
|
const sheetId = this.getters.getActiveSheetId();
|
|
44104
44139
|
const cells = this.getters.getCells(sheetId);
|
|
44105
44140
|
const matches = [];
|
|
44106
|
-
if (this.toSearch) {
|
|
44141
|
+
if (this.toSearch && this.currentSearchRegex) {
|
|
44107
44142
|
for (const cell of Object.values(cells)) {
|
|
44108
44143
|
const { col, row } = this.getters.getCellPosition(cell.id);
|
|
44144
|
+
const cellPosition = { sheetId, col, row };
|
|
44109
44145
|
const isColHidden = this.getters.isColHidden(sheetId, col);
|
|
44110
44146
|
const isRowHidden = this.getters.isRowHidden(sheetId, row);
|
|
44111
44147
|
if (isColHidden || isRowHidden) {
|
|
44112
44148
|
continue;
|
|
44113
44149
|
}
|
|
44114
|
-
if (
|
|
44115
|
-
this.currentSearchRegex &&
|
|
44116
|
-
this.currentSearchRegex.test(this.getSearchableString({ sheetId, col, row }))) {
|
|
44150
|
+
if (this.currentSearchRegex.test(this.getSearchableString(cellPosition))) {
|
|
44117
44151
|
const match = { col, row, selected: false };
|
|
44118
44152
|
matches.push(match);
|
|
44119
44153
|
}
|
|
44154
|
+
for (const spreadPosition of this.getters.getSpreadPositionsOf(cellPosition)) {
|
|
44155
|
+
if (this.currentSearchRegex.test(this.getSearchableString(spreadPosition))) {
|
|
44156
|
+
const match = {
|
|
44157
|
+
col: spreadPosition.col,
|
|
44158
|
+
row: spreadPosition.row,
|
|
44159
|
+
selected: false,
|
|
44160
|
+
};
|
|
44161
|
+
matches.push(match);
|
|
44162
|
+
}
|
|
44163
|
+
}
|
|
44120
44164
|
}
|
|
44121
44165
|
}
|
|
44122
44166
|
return matches.sort(this.sortByRowThenColumn);
|
|
@@ -44175,16 +44219,19 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
44175
44219
|
return;
|
|
44176
44220
|
}
|
|
44177
44221
|
const sheetId = this.getters.getActiveSheetId();
|
|
44178
|
-
const
|
|
44179
|
-
const
|
|
44222
|
+
const position = { sheetId, ...selectedMatch };
|
|
44223
|
+
const cell = this.getters.getCell(position);
|
|
44224
|
+
if (!cell?.content) {
|
|
44225
|
+
return;
|
|
44226
|
+
}
|
|
44180
44227
|
if (cell?.isFormula && !this.searchOptions.searchFormulas) {
|
|
44181
44228
|
return;
|
|
44182
44229
|
}
|
|
44183
44230
|
const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
|
|
44184
|
-
const toReplace = this.getSearchableString(
|
|
44231
|
+
const toReplace = this.getSearchableString(position);
|
|
44185
44232
|
const content = toReplace.replace(replaceRegex, replaceWith);
|
|
44186
44233
|
const canonicalContent = canonicalizeNumberContent(content, this.getters.getLocale());
|
|
44187
|
-
this.dispatch("UPDATE_CELL", {
|
|
44234
|
+
this.dispatch("UPDATE_CELL", { ...position, content: canonicalContent });
|
|
44188
44235
|
}
|
|
44189
44236
|
/**
|
|
44190
44237
|
* Replace the value of the currently selected match
|
|
@@ -45759,7 +45806,7 @@ class SortPlugin extends UIPlugin {
|
|
|
45759
45806
|
if (cell.isFormula) {
|
|
45760
45807
|
const position = this.getters.getCellPosition(cell.id);
|
|
45761
45808
|
// we only have a vertical offset
|
|
45762
|
-
content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula
|
|
45809
|
+
content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula);
|
|
45763
45810
|
}
|
|
45764
45811
|
newCellValues.style = cell.style;
|
|
45765
45812
|
newCellValues.content = content;
|
|
@@ -47822,6 +47869,8 @@ class FilterEvaluationPlugin extends UIPlugin {
|
|
|
47822
47869
|
case "EVALUATE_CELLS":
|
|
47823
47870
|
case "ACTIVATE_SHEET":
|
|
47824
47871
|
case "REMOVE_FILTER_TABLE":
|
|
47872
|
+
case "ADD_COLUMNS_ROWS":
|
|
47873
|
+
case "REMOVE_COLUMNS_ROWS":
|
|
47825
47874
|
this.isEvaluationDirty = true;
|
|
47826
47875
|
break;
|
|
47827
47876
|
case "START":
|
|
@@ -55831,9 +55880,9 @@ const constants = {
|
|
|
55831
55880
|
DEFAULT_LOCALE,
|
|
55832
55881
|
};
|
|
55833
55882
|
|
|
55834
|
-
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
55883
|
+
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
55835
55884
|
|
|
55836
55885
|
|
|
55837
|
-
__info__.version = "17.0.
|
|
55838
|
-
__info__.date = "2023-11-
|
|
55839
|
-
__info__.hash = "
|
|
55886
|
+
__info__.version = "17.0.3";
|
|
55887
|
+
__info__.date = "2023-11-16T11:59:49.524Z";
|
|
55888
|
+
__info__.hash = "8bd0fb2";
|