@odoo/o-spreadsheet 17.2.19 → 17.2.21
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 +103 -64
- package/dist/o-spreadsheet.d.ts +29 -13
- package/dist/o-spreadsheet.esm.js +103 -64
- package/dist/o-spreadsheet.iife.js +103 -64
- package/dist/o-spreadsheet.iife.min.js +262 -262
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -2
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
5
5
|
* @see https://github.com/odoo/o-spreadsheet
|
|
6
|
-
* @version 17.2.
|
|
7
|
-
* @date 2024-08-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.2.21
|
|
7
|
+
* @date 2024-08-19T08:10:10.580Z
|
|
8
|
+
* @hash fb17f9c
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -1936,6 +1936,7 @@ const coreTypes = new Set([
|
|
|
1936
1936
|
"UPDATE_CELL",
|
|
1937
1937
|
"UPDATE_CELL_POSITION",
|
|
1938
1938
|
"CLEAR_CELL",
|
|
1939
|
+
"CLEAR_CELLS",
|
|
1939
1940
|
"DELETE_CONTENT",
|
|
1940
1941
|
/** GRID SHAPE */
|
|
1941
1942
|
"ADD_COLUMNS_ROWS",
|
|
@@ -5755,13 +5756,10 @@ class CellClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
5755
5756
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
5756
5757
|
*/
|
|
5757
5758
|
clearClippedZones(content) {
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
}
|
|
5763
|
-
}
|
|
5764
|
-
}
|
|
5759
|
+
this.dispatch("CLEAR_CELLS", {
|
|
5760
|
+
sheetId: content.sheetId,
|
|
5761
|
+
target: content.zones,
|
|
5762
|
+
});
|
|
5765
5763
|
this.dispatch("CLEAR_FORMATTING", {
|
|
5766
5764
|
sheetId: content.sheetId,
|
|
5767
5765
|
target: content.zones,
|
|
@@ -6751,7 +6749,7 @@ function parse(str) {
|
|
|
6751
6749
|
}
|
|
6752
6750
|
function parseTokens(tokens) {
|
|
6753
6751
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
6754
|
-
if (tokens[0]
|
|
6752
|
+
if (tokens[0]?.value === "=") {
|
|
6755
6753
|
tokens.splice(0, 1);
|
|
6756
6754
|
}
|
|
6757
6755
|
const result = parseExpression(tokens);
|
|
@@ -41534,6 +41532,9 @@ class CellPlugin extends CorePlugin {
|
|
|
41534
41532
|
format: "",
|
|
41535
41533
|
});
|
|
41536
41534
|
break;
|
|
41535
|
+
case "CLEAR_CELLS":
|
|
41536
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
41537
|
+
break;
|
|
41537
41538
|
case "DELETE_CONTENT":
|
|
41538
41539
|
this.clearZones(cmd.sheetId, cmd.target);
|
|
41539
41540
|
break;
|
|
@@ -41592,6 +41593,25 @@ class CellPlugin extends CorePlugin {
|
|
|
41592
41593
|
}
|
|
41593
41594
|
}
|
|
41594
41595
|
}
|
|
41596
|
+
/**
|
|
41597
|
+
* Clear the styles, the format and the content of zones
|
|
41598
|
+
*/
|
|
41599
|
+
clearCells(sheetId, zones) {
|
|
41600
|
+
for (const zone of zones) {
|
|
41601
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
41602
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
41603
|
+
this.dispatch("UPDATE_CELL", {
|
|
41604
|
+
sheetId: sheetId,
|
|
41605
|
+
col,
|
|
41606
|
+
row,
|
|
41607
|
+
content: "",
|
|
41608
|
+
style: null,
|
|
41609
|
+
format: "",
|
|
41610
|
+
});
|
|
41611
|
+
}
|
|
41612
|
+
}
|
|
41613
|
+
}
|
|
41614
|
+
}
|
|
41595
41615
|
/**
|
|
41596
41616
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
41597
41617
|
*/
|
|
@@ -44138,7 +44158,7 @@ class RangeAdapter {
|
|
|
44138
44158
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
44139
44159
|
*/
|
|
44140
44160
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
44141
|
-
if (!rangeReference.test(sheetXC)) {
|
|
44161
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
44142
44162
|
return new RangeImpl({
|
|
44143
44163
|
sheetId: "",
|
|
44144
44164
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -45018,19 +45038,23 @@ class SheetPlugin extends CorePlugin {
|
|
|
45018
45038
|
}
|
|
45019
45039
|
}
|
|
45020
45040
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
45041
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45042
|
+
sheetId: sheet.id,
|
|
45043
|
+
target: [
|
|
45044
|
+
{
|
|
45045
|
+
left: deletedColumn,
|
|
45046
|
+
top: 0,
|
|
45047
|
+
right: deletedColumn,
|
|
45048
|
+
bottom: sheet.rows.length - 1,
|
|
45049
|
+
},
|
|
45050
|
+
],
|
|
45051
|
+
});
|
|
45021
45052
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
45022
45053
|
const row = sheet.rows[rowIndex];
|
|
45023
45054
|
for (let i in row.cells) {
|
|
45024
45055
|
const colIndex = Number(i);
|
|
45025
45056
|
const cellId = row.cells[i];
|
|
45026
45057
|
if (cellId) {
|
|
45027
|
-
if (colIndex === deletedColumn) {
|
|
45028
|
-
this.dispatch("CLEAR_CELL", {
|
|
45029
|
-
sheetId: sheet.id,
|
|
45030
|
-
col: colIndex,
|
|
45031
|
-
row: rowIndex,
|
|
45032
|
-
});
|
|
45033
|
-
}
|
|
45034
45058
|
if (colIndex > deletedColumn) {
|
|
45035
45059
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
45036
45060
|
}
|
|
@@ -45076,22 +45100,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
45076
45100
|
*
|
|
45077
45101
|
*/
|
|
45078
45102
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
45103
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45104
|
+
sheetId: sheet.id,
|
|
45105
|
+
target: [
|
|
45106
|
+
{
|
|
45107
|
+
left: 0,
|
|
45108
|
+
top: deleteFromRow,
|
|
45109
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
45110
|
+
bottom: deleteToRow,
|
|
45111
|
+
},
|
|
45112
|
+
],
|
|
45113
|
+
});
|
|
45079
45114
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
45080
45115
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
45081
45116
|
const row = sheet.rows[rowIndex];
|
|
45082
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
45083
|
-
for (let i in row.cells) {
|
|
45084
|
-
const colIndex = Number(i);
|
|
45085
|
-
const cellId = row.cells[i];
|
|
45086
|
-
if (cellId) {
|
|
45087
|
-
this.dispatch("CLEAR_CELL", {
|
|
45088
|
-
sheetId: sheet.id,
|
|
45089
|
-
col: colIndex,
|
|
45090
|
-
row: rowIndex,
|
|
45091
|
-
});
|
|
45092
|
-
}
|
|
45093
|
-
}
|
|
45094
|
-
}
|
|
45095
45117
|
if (rowIndex > deleteToRow) {
|
|
45096
45118
|
for (let i in row.cells) {
|
|
45097
45119
|
const colIndex = Number(i);
|
|
@@ -47727,18 +47749,23 @@ class Evaluator {
|
|
|
47727
47749
|
this.evaluatedCells = new PositionMap();
|
|
47728
47750
|
this.evaluate(this.getAllCells());
|
|
47729
47751
|
}
|
|
47730
|
-
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47752
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
47753
|
+
try {
|
|
47754
|
+
const compiledFormula = compile(formulaString);
|
|
47755
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
47756
|
+
this.updateCompilationParameters();
|
|
47757
|
+
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
47758
|
+
if (isMatrix(result)) {
|
|
47759
|
+
return result;
|
|
47760
|
+
}
|
|
47761
|
+
if (result.value === null) {
|
|
47762
|
+
return { value: 0, format: result.format };
|
|
47763
|
+
}
|
|
47764
|
+
return result;
|
|
47737
47765
|
}
|
|
47738
|
-
|
|
47739
|
-
return
|
|
47766
|
+
catch (error) {
|
|
47767
|
+
return handleError(error, "");
|
|
47740
47768
|
}
|
|
47741
|
-
return result.value;
|
|
47742
47769
|
}
|
|
47743
47770
|
getAllCells() {
|
|
47744
47771
|
const positions = this.createEmptyPositionSet();
|
|
@@ -48082,6 +48109,7 @@ function updateEvalContextAndExecute(compiledFormula, compilationParams, sheetId
|
|
|
48082
48109
|
class EvaluationPlugin extends UIPlugin {
|
|
48083
48110
|
static getters = [
|
|
48084
48111
|
"evaluateFormula",
|
|
48112
|
+
"evaluateFormulaResult",
|
|
48085
48113
|
"getCorrespondingFormulaCell",
|
|
48086
48114
|
"getRangeFormattedValues",
|
|
48087
48115
|
"getRangeValues",
|
|
@@ -48144,12 +48172,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
48144
48172
|
// Getters
|
|
48145
48173
|
// ---------------------------------------------------------------------------
|
|
48146
48174
|
evaluateFormula(sheetId, formulaString) {
|
|
48147
|
-
|
|
48148
|
-
|
|
48149
|
-
|
|
48150
|
-
catch (error) {
|
|
48151
|
-
return error.value || CellErrorType.GenericError;
|
|
48175
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
48176
|
+
if (isMatrix(result)) {
|
|
48177
|
+
return matrixMap(result, (cell) => cell.value);
|
|
48152
48178
|
}
|
|
48179
|
+
return result.value;
|
|
48180
|
+
}
|
|
48181
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
48182
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
48153
48183
|
}
|
|
48154
48184
|
/**
|
|
48155
48185
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -50399,7 +50429,7 @@ class Session extends EventBus {
|
|
|
50399
50429
|
*/
|
|
50400
50430
|
leave(data) {
|
|
50401
50431
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
50402
|
-
this.snapshot(data);
|
|
50432
|
+
this.snapshot(data());
|
|
50403
50433
|
}
|
|
50404
50434
|
delete this.clients[this.clientId];
|
|
50405
50435
|
this.transportService.leave(this.clientId);
|
|
@@ -50821,9 +50851,7 @@ class DataCleanupPlugin extends UIPlugin {
|
|
|
50821
50851
|
if (!data) {
|
|
50822
50852
|
return;
|
|
50823
50853
|
}
|
|
50824
|
-
|
|
50825
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
50826
|
-
}
|
|
50854
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
50827
50855
|
const zonePasted = {
|
|
50828
50856
|
left: zone.left,
|
|
50829
50857
|
top: zone.top,
|
|
@@ -51008,6 +51036,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
51008
51036
|
* evaluated and updated with the number type.
|
|
51009
51037
|
*/
|
|
51010
51038
|
setDecimal(sheetId, zones, step) {
|
|
51039
|
+
const positionsByFormat = {};
|
|
51011
51040
|
// Find the each cell with a number value and get the format
|
|
51012
51041
|
for (const zone of zones) {
|
|
51013
51042
|
for (const position of positions(zone)) {
|
|
@@ -51017,15 +51046,20 @@ class FormatPlugin extends UIPlugin {
|
|
|
51017
51046
|
// of the format
|
|
51018
51047
|
this.getters.getLocale();
|
|
51019
51048
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
51020
|
-
|
|
51021
|
-
|
|
51022
|
-
sheetId,
|
|
51023
|
-
target: [positionToZone(position)],
|
|
51024
|
-
format: newFormat,
|
|
51025
|
-
});
|
|
51049
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
51050
|
+
positionsByFormat[newFormat].push(position);
|
|
51026
51051
|
}
|
|
51027
51052
|
}
|
|
51028
51053
|
}
|
|
51054
|
+
// consolidate all positions with the same format in bigger zones
|
|
51055
|
+
for (const newFormat in positionsByFormat) {
|
|
51056
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
51057
|
+
this.dispatch("SET_FORMATTING", {
|
|
51058
|
+
sheetId,
|
|
51059
|
+
format: newFormat,
|
|
51060
|
+
target: zones,
|
|
51061
|
+
});
|
|
51062
|
+
}
|
|
51029
51063
|
}
|
|
51030
51064
|
/**
|
|
51031
51065
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -51378,6 +51412,9 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
51378
51412
|
if (showFormula && cell?.isFormula) {
|
|
51379
51413
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
51380
51414
|
}
|
|
51415
|
+
else if (showFormula && !cell?.content) {
|
|
51416
|
+
return "";
|
|
51417
|
+
}
|
|
51381
51418
|
else {
|
|
51382
51419
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
51383
51420
|
}
|
|
@@ -51649,6 +51686,7 @@ function repeatGroupHeadersCommand(getters, cmd) {
|
|
|
51649
51686
|
const repeatCommandTransformRegistry = new Registry();
|
|
51650
51687
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
51651
51688
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
51689
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
51652
51690
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
51653
51691
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
51654
51692
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -52367,9 +52405,10 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
52367
52405
|
case "DELETE_CELL": {
|
|
52368
52406
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
52369
52407
|
if (!isZoneValid(cut[0])) {
|
|
52370
|
-
|
|
52371
|
-
|
|
52372
|
-
|
|
52408
|
+
this.dispatch("CLEAR_CELLS", {
|
|
52409
|
+
target: [cmd.zone],
|
|
52410
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
52411
|
+
});
|
|
52373
52412
|
break;
|
|
52374
52413
|
}
|
|
52375
52414
|
const copiedData = this.copy(cut);
|
|
@@ -60329,7 +60368,7 @@ class Model extends EventBus {
|
|
|
60329
60368
|
this.session.join(this.config.client);
|
|
60330
60369
|
}
|
|
60331
60370
|
leaveSession() {
|
|
60332
|
-
this.session.leave(this.exportData());
|
|
60371
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
60333
60372
|
}
|
|
60334
60373
|
setupUiPlugin(Plugin) {
|
|
60335
60374
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -60842,6 +60881,6 @@ const constants = {
|
|
|
60842
60881
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
60843
60882
|
|
|
60844
60883
|
|
|
60845
|
-
__info__.version = "17.2.
|
|
60846
|
-
__info__.date = "2024-08-
|
|
60847
|
-
__info__.hash = "
|
|
60884
|
+
__info__.version = "17.2.21";
|
|
60885
|
+
__info__.date = "2024-08-19T08:10:10.580Z";
|
|
60886
|
+
__info__.hash = "fb17f9c";
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
5
5
|
* @see https://github.com/odoo/o-spreadsheet
|
|
6
|
-
* @version 17.2.
|
|
7
|
-
* @date 2024-08-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.2.21
|
|
7
|
+
* @date 2024-08-19T08:10:10.580Z
|
|
8
|
+
* @hash fb17f9c
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function (exports, owl) {
|
|
@@ -1937,6 +1937,7 @@
|
|
|
1937
1937
|
"UPDATE_CELL",
|
|
1938
1938
|
"UPDATE_CELL_POSITION",
|
|
1939
1939
|
"CLEAR_CELL",
|
|
1940
|
+
"CLEAR_CELLS",
|
|
1940
1941
|
"DELETE_CONTENT",
|
|
1941
1942
|
/** GRID SHAPE */
|
|
1942
1943
|
"ADD_COLUMNS_ROWS",
|
|
@@ -5756,13 +5757,10 @@
|
|
|
5756
5757
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
5757
5758
|
*/
|
|
5758
5759
|
clearClippedZones(content) {
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
}
|
|
5764
|
-
}
|
|
5765
|
-
}
|
|
5760
|
+
this.dispatch("CLEAR_CELLS", {
|
|
5761
|
+
sheetId: content.sheetId,
|
|
5762
|
+
target: content.zones,
|
|
5763
|
+
});
|
|
5766
5764
|
this.dispatch("CLEAR_FORMATTING", {
|
|
5767
5765
|
sheetId: content.sheetId,
|
|
5768
5766
|
target: content.zones,
|
|
@@ -6752,7 +6750,7 @@
|
|
|
6752
6750
|
}
|
|
6753
6751
|
function parseTokens(tokens) {
|
|
6754
6752
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
6755
|
-
if (tokens[0]
|
|
6753
|
+
if (tokens[0]?.value === "=") {
|
|
6756
6754
|
tokens.splice(0, 1);
|
|
6757
6755
|
}
|
|
6758
6756
|
const result = parseExpression(tokens);
|
|
@@ -41535,6 +41533,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41535
41533
|
format: "",
|
|
41536
41534
|
});
|
|
41537
41535
|
break;
|
|
41536
|
+
case "CLEAR_CELLS":
|
|
41537
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
41538
|
+
break;
|
|
41538
41539
|
case "DELETE_CONTENT":
|
|
41539
41540
|
this.clearZones(cmd.sheetId, cmd.target);
|
|
41540
41541
|
break;
|
|
@@ -41593,6 +41594,25 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41593
41594
|
}
|
|
41594
41595
|
}
|
|
41595
41596
|
}
|
|
41597
|
+
/**
|
|
41598
|
+
* Clear the styles, the format and the content of zones
|
|
41599
|
+
*/
|
|
41600
|
+
clearCells(sheetId, zones) {
|
|
41601
|
+
for (const zone of zones) {
|
|
41602
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
41603
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
41604
|
+
this.dispatch("UPDATE_CELL", {
|
|
41605
|
+
sheetId: sheetId,
|
|
41606
|
+
col,
|
|
41607
|
+
row,
|
|
41608
|
+
content: "",
|
|
41609
|
+
style: null,
|
|
41610
|
+
format: "",
|
|
41611
|
+
});
|
|
41612
|
+
}
|
|
41613
|
+
}
|
|
41614
|
+
}
|
|
41615
|
+
}
|
|
41596
41616
|
/**
|
|
41597
41617
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
41598
41618
|
*/
|
|
@@ -44139,7 +44159,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44139
44159
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
44140
44160
|
*/
|
|
44141
44161
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
44142
|
-
if (!rangeReference.test(sheetXC)) {
|
|
44162
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
44143
44163
|
return new RangeImpl({
|
|
44144
44164
|
sheetId: "",
|
|
44145
44165
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -45019,19 +45039,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45019
45039
|
}
|
|
45020
45040
|
}
|
|
45021
45041
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
45042
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45043
|
+
sheetId: sheet.id,
|
|
45044
|
+
target: [
|
|
45045
|
+
{
|
|
45046
|
+
left: deletedColumn,
|
|
45047
|
+
top: 0,
|
|
45048
|
+
right: deletedColumn,
|
|
45049
|
+
bottom: sheet.rows.length - 1,
|
|
45050
|
+
},
|
|
45051
|
+
],
|
|
45052
|
+
});
|
|
45022
45053
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
45023
45054
|
const row = sheet.rows[rowIndex];
|
|
45024
45055
|
for (let i in row.cells) {
|
|
45025
45056
|
const colIndex = Number(i);
|
|
45026
45057
|
const cellId = row.cells[i];
|
|
45027
45058
|
if (cellId) {
|
|
45028
|
-
if (colIndex === deletedColumn) {
|
|
45029
|
-
this.dispatch("CLEAR_CELL", {
|
|
45030
|
-
sheetId: sheet.id,
|
|
45031
|
-
col: colIndex,
|
|
45032
|
-
row: rowIndex,
|
|
45033
|
-
});
|
|
45034
|
-
}
|
|
45035
45059
|
if (colIndex > deletedColumn) {
|
|
45036
45060
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
45037
45061
|
}
|
|
@@ -45077,22 +45101,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45077
45101
|
*
|
|
45078
45102
|
*/
|
|
45079
45103
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
45104
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45105
|
+
sheetId: sheet.id,
|
|
45106
|
+
target: [
|
|
45107
|
+
{
|
|
45108
|
+
left: 0,
|
|
45109
|
+
top: deleteFromRow,
|
|
45110
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
45111
|
+
bottom: deleteToRow,
|
|
45112
|
+
},
|
|
45113
|
+
],
|
|
45114
|
+
});
|
|
45080
45115
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
45081
45116
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
45082
45117
|
const row = sheet.rows[rowIndex];
|
|
45083
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
45084
|
-
for (let i in row.cells) {
|
|
45085
|
-
const colIndex = Number(i);
|
|
45086
|
-
const cellId = row.cells[i];
|
|
45087
|
-
if (cellId) {
|
|
45088
|
-
this.dispatch("CLEAR_CELL", {
|
|
45089
|
-
sheetId: sheet.id,
|
|
45090
|
-
col: colIndex,
|
|
45091
|
-
row: rowIndex,
|
|
45092
|
-
});
|
|
45093
|
-
}
|
|
45094
|
-
}
|
|
45095
|
-
}
|
|
45096
45118
|
if (rowIndex > deleteToRow) {
|
|
45097
45119
|
for (let i in row.cells) {
|
|
45098
45120
|
const colIndex = Number(i);
|
|
@@ -47728,18 +47750,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47728
47750
|
this.evaluatedCells = new PositionMap();
|
|
47729
47751
|
this.evaluate(this.getAllCells());
|
|
47730
47752
|
}
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47737
|
-
|
|
47753
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
47754
|
+
try {
|
|
47755
|
+
const compiledFormula = compile(formulaString);
|
|
47756
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
47757
|
+
this.updateCompilationParameters();
|
|
47758
|
+
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
47759
|
+
if (isMatrix(result)) {
|
|
47760
|
+
return result;
|
|
47761
|
+
}
|
|
47762
|
+
if (result.value === null) {
|
|
47763
|
+
return { value: 0, format: result.format };
|
|
47764
|
+
}
|
|
47765
|
+
return result;
|
|
47738
47766
|
}
|
|
47739
|
-
|
|
47740
|
-
return
|
|
47767
|
+
catch (error) {
|
|
47768
|
+
return handleError(error, "");
|
|
47741
47769
|
}
|
|
47742
|
-
return result.value;
|
|
47743
47770
|
}
|
|
47744
47771
|
getAllCells() {
|
|
47745
47772
|
const positions = this.createEmptyPositionSet();
|
|
@@ -48083,6 +48110,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48083
48110
|
class EvaluationPlugin extends UIPlugin {
|
|
48084
48111
|
static getters = [
|
|
48085
48112
|
"evaluateFormula",
|
|
48113
|
+
"evaluateFormulaResult",
|
|
48086
48114
|
"getCorrespondingFormulaCell",
|
|
48087
48115
|
"getRangeFormattedValues",
|
|
48088
48116
|
"getRangeValues",
|
|
@@ -48145,12 +48173,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48145
48173
|
// Getters
|
|
48146
48174
|
// ---------------------------------------------------------------------------
|
|
48147
48175
|
evaluateFormula(sheetId, formulaString) {
|
|
48148
|
-
|
|
48149
|
-
|
|
48150
|
-
|
|
48151
|
-
catch (error) {
|
|
48152
|
-
return error.value || CellErrorType.GenericError;
|
|
48176
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
48177
|
+
if (isMatrix(result)) {
|
|
48178
|
+
return matrixMap(result, (cell) => cell.value);
|
|
48153
48179
|
}
|
|
48180
|
+
return result.value;
|
|
48181
|
+
}
|
|
48182
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
48183
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
48154
48184
|
}
|
|
48155
48185
|
/**
|
|
48156
48186
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -50400,7 +50430,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50400
50430
|
*/
|
|
50401
50431
|
leave(data) {
|
|
50402
50432
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
50403
|
-
this.snapshot(data);
|
|
50433
|
+
this.snapshot(data());
|
|
50404
50434
|
}
|
|
50405
50435
|
delete this.clients[this.clientId];
|
|
50406
50436
|
this.transportService.leave(this.clientId);
|
|
@@ -50822,9 +50852,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50822
50852
|
if (!data) {
|
|
50823
50853
|
return;
|
|
50824
50854
|
}
|
|
50825
|
-
|
|
50826
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
50827
|
-
}
|
|
50855
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
50828
50856
|
const zonePasted = {
|
|
50829
50857
|
left: zone.left,
|
|
50830
50858
|
top: zone.top,
|
|
@@ -51009,6 +51037,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51009
51037
|
* evaluated and updated with the number type.
|
|
51010
51038
|
*/
|
|
51011
51039
|
setDecimal(sheetId, zones, step) {
|
|
51040
|
+
const positionsByFormat = {};
|
|
51012
51041
|
// Find the each cell with a number value and get the format
|
|
51013
51042
|
for (const zone of zones) {
|
|
51014
51043
|
for (const position of positions(zone)) {
|
|
@@ -51018,15 +51047,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51018
51047
|
// of the format
|
|
51019
51048
|
this.getters.getLocale();
|
|
51020
51049
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
51021
|
-
|
|
51022
|
-
|
|
51023
|
-
sheetId,
|
|
51024
|
-
target: [positionToZone(position)],
|
|
51025
|
-
format: newFormat,
|
|
51026
|
-
});
|
|
51050
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
51051
|
+
positionsByFormat[newFormat].push(position);
|
|
51027
51052
|
}
|
|
51028
51053
|
}
|
|
51029
51054
|
}
|
|
51055
|
+
// consolidate all positions with the same format in bigger zones
|
|
51056
|
+
for (const newFormat in positionsByFormat) {
|
|
51057
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
51058
|
+
this.dispatch("SET_FORMATTING", {
|
|
51059
|
+
sheetId,
|
|
51060
|
+
format: newFormat,
|
|
51061
|
+
target: zones,
|
|
51062
|
+
});
|
|
51063
|
+
}
|
|
51030
51064
|
}
|
|
51031
51065
|
/**
|
|
51032
51066
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -51379,6 +51413,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51379
51413
|
if (showFormula && cell?.isFormula) {
|
|
51380
51414
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
51381
51415
|
}
|
|
51416
|
+
else if (showFormula && !cell?.content) {
|
|
51417
|
+
return "";
|
|
51418
|
+
}
|
|
51382
51419
|
else {
|
|
51383
51420
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
51384
51421
|
}
|
|
@@ -51650,6 +51687,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51650
51687
|
const repeatCommandTransformRegistry = new Registry();
|
|
51651
51688
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
51652
51689
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
51690
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
51653
51691
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
51654
51692
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
51655
51693
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -52368,9 +52406,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52368
52406
|
case "DELETE_CELL": {
|
|
52369
52407
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
52370
52408
|
if (!isZoneValid(cut[0])) {
|
|
52371
|
-
|
|
52372
|
-
|
|
52373
|
-
|
|
52409
|
+
this.dispatch("CLEAR_CELLS", {
|
|
52410
|
+
target: [cmd.zone],
|
|
52411
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
52412
|
+
});
|
|
52374
52413
|
break;
|
|
52375
52414
|
}
|
|
52376
52415
|
const copiedData = this.copy(cut);
|
|
@@ -60330,7 +60369,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60330
60369
|
this.session.join(this.config.client);
|
|
60331
60370
|
}
|
|
60332
60371
|
leaveSession() {
|
|
60333
|
-
this.session.leave(this.exportData());
|
|
60372
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
60334
60373
|
}
|
|
60335
60374
|
setupUiPlugin(Plugin) {
|
|
60336
60375
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -60884,9 +60923,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60884
60923
|
exports.tokenize = tokenize;
|
|
60885
60924
|
|
|
60886
60925
|
|
|
60887
|
-
__info__.version = "17.2.
|
|
60888
|
-
__info__.date = "2024-08-
|
|
60889
|
-
__info__.hash = "
|
|
60926
|
+
__info__.version = "17.2.21";
|
|
60927
|
+
__info__.date = "2024-08-19T08:10:10.580Z";
|
|
60928
|
+
__info__.hash = "fb17f9c";
|
|
60890
60929
|
|
|
60891
60930
|
|
|
60892
60931
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|