@odoo/o-spreadsheet 17.1.26 → 17.1.28
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 +107 -61
- package/dist/o-spreadsheet.d.ts +16 -8
- package/dist/o-spreadsheet.esm.js +107 -61
- package/dist/o-spreadsheet.iife.js +107 -61
- package/dist/o-spreadsheet.iife.min.js +248 -248
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -2
|
@@ -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.1.
|
|
6
|
-
* @date 2024-08-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.28
|
|
6
|
+
* @date 2024-08-19T08:08:59.669Z
|
|
7
|
+
* @hash 9674f1b
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, onWillUnmount, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -1893,6 +1893,7 @@ const coreTypes = new Set([
|
|
|
1893
1893
|
"UPDATE_CELL",
|
|
1894
1894
|
"UPDATE_CELL_POSITION",
|
|
1895
1895
|
"CLEAR_CELL",
|
|
1896
|
+
"CLEAR_CELLS",
|
|
1896
1897
|
"DELETE_CONTENT",
|
|
1897
1898
|
/** GRID SHAPE */
|
|
1898
1899
|
"ADD_COLUMNS_ROWS",
|
|
@@ -35670,7 +35671,7 @@ function parse(str) {
|
|
|
35670
35671
|
}
|
|
35671
35672
|
function parseTokens(tokens) {
|
|
35672
35673
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
35673
|
-
if (tokens[0]
|
|
35674
|
+
if (tokens[0]?.value === "=") {
|
|
35674
35675
|
tokens.splice(0, 1);
|
|
35675
35676
|
}
|
|
35676
35677
|
const result = parseExpression(tokens);
|
|
@@ -36237,6 +36238,9 @@ class CellPlugin extends CorePlugin {
|
|
|
36237
36238
|
format: "",
|
|
36238
36239
|
});
|
|
36239
36240
|
break;
|
|
36241
|
+
case "CLEAR_CELLS":
|
|
36242
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
36243
|
+
break;
|
|
36240
36244
|
}
|
|
36241
36245
|
}
|
|
36242
36246
|
/**
|
|
@@ -36275,6 +36279,25 @@ class CellPlugin extends CorePlugin {
|
|
|
36275
36279
|
}
|
|
36276
36280
|
}
|
|
36277
36281
|
}
|
|
36282
|
+
/**
|
|
36283
|
+
* Clear the styles, the format and the content of zones
|
|
36284
|
+
*/
|
|
36285
|
+
clearCells(sheetId, zones) {
|
|
36286
|
+
for (const zone of zones) {
|
|
36287
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
36288
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
36289
|
+
this.dispatch("UPDATE_CELL", {
|
|
36290
|
+
sheetId: sheetId,
|
|
36291
|
+
col,
|
|
36292
|
+
row,
|
|
36293
|
+
content: "",
|
|
36294
|
+
style: null,
|
|
36295
|
+
format: "",
|
|
36296
|
+
});
|
|
36297
|
+
}
|
|
36298
|
+
}
|
|
36299
|
+
}
|
|
36300
|
+
}
|
|
36278
36301
|
/**
|
|
36279
36302
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
36280
36303
|
*/
|
|
@@ -39124,7 +39147,7 @@ class RangeAdapter {
|
|
|
39124
39147
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
39125
39148
|
*/
|
|
39126
39149
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
39127
|
-
if (!rangeReference.test(sheetXC)) {
|
|
39150
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
39128
39151
|
return new RangeImpl({
|
|
39129
39152
|
sheetId: "",
|
|
39130
39153
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -40010,19 +40033,23 @@ class SheetPlugin extends CorePlugin {
|
|
|
40010
40033
|
}
|
|
40011
40034
|
}
|
|
40012
40035
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
40036
|
+
this.dispatch("CLEAR_CELLS", {
|
|
40037
|
+
sheetId: sheet.id,
|
|
40038
|
+
target: [
|
|
40039
|
+
{
|
|
40040
|
+
left: deletedColumn,
|
|
40041
|
+
top: 0,
|
|
40042
|
+
right: deletedColumn,
|
|
40043
|
+
bottom: sheet.rows.length - 1,
|
|
40044
|
+
},
|
|
40045
|
+
],
|
|
40046
|
+
});
|
|
40013
40047
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
40014
40048
|
const row = sheet.rows[rowIndex];
|
|
40015
40049
|
for (let i in row.cells) {
|
|
40016
40050
|
const colIndex = Number(i);
|
|
40017
40051
|
const cellId = row.cells[i];
|
|
40018
40052
|
if (cellId) {
|
|
40019
|
-
if (colIndex === deletedColumn) {
|
|
40020
|
-
this.dispatch("CLEAR_CELL", {
|
|
40021
|
-
sheetId: sheet.id,
|
|
40022
|
-
col: colIndex,
|
|
40023
|
-
row: rowIndex,
|
|
40024
|
-
});
|
|
40025
|
-
}
|
|
40026
40053
|
if (colIndex > deletedColumn) {
|
|
40027
40054
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
40028
40055
|
}
|
|
@@ -40068,22 +40095,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
40068
40095
|
*
|
|
40069
40096
|
*/
|
|
40070
40097
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
40098
|
+
this.dispatch("CLEAR_CELLS", {
|
|
40099
|
+
sheetId: sheet.id,
|
|
40100
|
+
target: [
|
|
40101
|
+
{
|
|
40102
|
+
left: 0,
|
|
40103
|
+
top: deleteFromRow,
|
|
40104
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
40105
|
+
bottom: deleteToRow,
|
|
40106
|
+
},
|
|
40107
|
+
],
|
|
40108
|
+
});
|
|
40071
40109
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
40072
40110
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
40073
40111
|
const row = sheet.rows[rowIndex];
|
|
40074
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
40075
|
-
for (let i in row.cells) {
|
|
40076
|
-
const colIndex = Number(i);
|
|
40077
|
-
const cellId = row.cells[i];
|
|
40078
|
-
if (cellId) {
|
|
40079
|
-
this.dispatch("CLEAR_CELL", {
|
|
40080
|
-
sheetId: sheet.id,
|
|
40081
|
-
col: colIndex,
|
|
40082
|
-
row: rowIndex,
|
|
40083
|
-
});
|
|
40084
|
-
}
|
|
40085
|
-
}
|
|
40086
|
-
}
|
|
40087
40112
|
if (rowIndex > deleteToRow) {
|
|
40088
40113
|
for (let i in row.cells) {
|
|
40089
40114
|
const colIndex = Number(i);
|
|
@@ -42058,18 +42083,30 @@ class Evaluator {
|
|
|
42058
42083
|
this.evaluate(this.getAllCells());
|
|
42059
42084
|
}
|
|
42060
42085
|
evaluateFormula(sheetId, formulaString) {
|
|
42061
|
-
const
|
|
42062
|
-
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42063
|
-
this.updateCompilationParameters();
|
|
42064
|
-
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42086
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42065
42087
|
if (isMatrix(result)) {
|
|
42066
42088
|
return matrixMap(result, (cell) => cell.value);
|
|
42067
42089
|
}
|
|
42068
|
-
if (result.value === null) {
|
|
42069
|
-
return 0;
|
|
42070
|
-
}
|
|
42071
42090
|
return result.value;
|
|
42072
42091
|
}
|
|
42092
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42093
|
+
try {
|
|
42094
|
+
const compiledFormula = compile(formulaString);
|
|
42095
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42096
|
+
this.updateCompilationParameters();
|
|
42097
|
+
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42098
|
+
if (isMatrix(result)) {
|
|
42099
|
+
return result;
|
|
42100
|
+
}
|
|
42101
|
+
if (result.value === null) {
|
|
42102
|
+
return { value: 0, format: result.format };
|
|
42103
|
+
}
|
|
42104
|
+
return result;
|
|
42105
|
+
}
|
|
42106
|
+
catch (error) {
|
|
42107
|
+
return handleError(error, "");
|
|
42108
|
+
}
|
|
42109
|
+
}
|
|
42073
42110
|
getAllCells() {
|
|
42074
42111
|
const positionIds = new JetSet();
|
|
42075
42112
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
@@ -42494,6 +42531,7 @@ function updateEvalContextAndExecute(compiledFormula, compilationParams, sheetId
|
|
|
42494
42531
|
class EvaluationPlugin extends UIPlugin {
|
|
42495
42532
|
static getters = [
|
|
42496
42533
|
"evaluateFormula",
|
|
42534
|
+
"evaluateFormulaResult",
|
|
42497
42535
|
"getCorrespondingFormulaCell",
|
|
42498
42536
|
"getRangeFormattedValues",
|
|
42499
42537
|
"getRangeValues",
|
|
@@ -42552,12 +42590,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
42552
42590
|
// Getters
|
|
42553
42591
|
// ---------------------------------------------------------------------------
|
|
42554
42592
|
evaluateFormula(sheetId, formulaString) {
|
|
42555
|
-
|
|
42556
|
-
|
|
42557
|
-
|
|
42558
|
-
catch (error) {
|
|
42559
|
-
return error.value || CellErrorType.GenericError;
|
|
42593
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42594
|
+
if (isMatrix(result)) {
|
|
42595
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42560
42596
|
}
|
|
42597
|
+
return result.value;
|
|
42598
|
+
}
|
|
42599
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42600
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42561
42601
|
}
|
|
42562
42602
|
/**
|
|
42563
42603
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -44897,7 +44937,7 @@ class Session extends EventBus {
|
|
|
44897
44937
|
*/
|
|
44898
44938
|
leave(data) {
|
|
44899
44939
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
44900
|
-
this.snapshot(data);
|
|
44940
|
+
this.snapshot(data());
|
|
44901
44941
|
}
|
|
44902
44942
|
delete this.clients[this.clientId];
|
|
44903
44943
|
this.transportService.leave(this.clientId);
|
|
@@ -45570,13 +45610,10 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45570
45610
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
45571
45611
|
*/
|
|
45572
45612
|
clearClippedZones() {
|
|
45573
|
-
|
|
45574
|
-
|
|
45575
|
-
|
|
45576
|
-
|
|
45577
|
-
}
|
|
45578
|
-
}
|
|
45579
|
-
}
|
|
45613
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45614
|
+
sheetId: this.sheetId,
|
|
45615
|
+
target: this.zones,
|
|
45616
|
+
});
|
|
45580
45617
|
this.dispatch("CLEAR_FORMATTING", {
|
|
45581
45618
|
sheetId: this.sheetId,
|
|
45582
45619
|
target: this.zones,
|
|
@@ -45925,9 +45962,7 @@ class DataCleanupPlugin extends UIPlugin {
|
|
|
45925
45962
|
bottom: rowIndex,
|
|
45926
45963
|
}));
|
|
45927
45964
|
const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
|
|
45928
|
-
|
|
45929
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
45930
|
-
}
|
|
45965
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
45931
45966
|
const zonePasted = {
|
|
45932
45967
|
left: zone.left,
|
|
45933
45968
|
top: zone.top,
|
|
@@ -46432,6 +46467,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
46432
46467
|
* evaluated and updated with the number type.
|
|
46433
46468
|
*/
|
|
46434
46469
|
setDecimal(sheetId, zones, step) {
|
|
46470
|
+
const positionsByFormat = {};
|
|
46435
46471
|
// Find the each cell with a number value and get the format
|
|
46436
46472
|
for (const zone of zones) {
|
|
46437
46473
|
for (const position of positions(zone)) {
|
|
@@ -46441,15 +46477,20 @@ class FormatPlugin extends UIPlugin {
|
|
|
46441
46477
|
// of the format
|
|
46442
46478
|
this.getters.getLocale();
|
|
46443
46479
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
46444
|
-
|
|
46445
|
-
|
|
46446
|
-
sheetId,
|
|
46447
|
-
target: [positionToZone(position)],
|
|
46448
|
-
format: newFormat,
|
|
46449
|
-
});
|
|
46480
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
46481
|
+
positionsByFormat[newFormat].push(position);
|
|
46450
46482
|
}
|
|
46451
46483
|
}
|
|
46452
46484
|
}
|
|
46485
|
+
// consolidate all positions with the same format in bigger zones
|
|
46486
|
+
for (const newFormat in positionsByFormat) {
|
|
46487
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
46488
|
+
this.dispatch("SET_FORMATTING", {
|
|
46489
|
+
sheetId,
|
|
46490
|
+
format: newFormat,
|
|
46491
|
+
target: zones,
|
|
46492
|
+
});
|
|
46493
|
+
}
|
|
46453
46494
|
}
|
|
46454
46495
|
/**
|
|
46455
46496
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -47946,6 +47987,9 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47946
47987
|
if (showFormula && cell?.isFormula) {
|
|
47947
47988
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
47948
47989
|
}
|
|
47990
|
+
else if (showFormula && !cell?.content) {
|
|
47991
|
+
return "";
|
|
47992
|
+
}
|
|
47949
47993
|
else {
|
|
47950
47994
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
47951
47995
|
}
|
|
@@ -48193,6 +48237,7 @@ function repeatGroupHeadersCommand(getters, cmd) {
|
|
|
48193
48237
|
const repeatCommandTransformRegistry = new Registry();
|
|
48194
48238
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
48195
48239
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
48240
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
48196
48241
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
48197
48242
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
48198
48243
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -48934,9 +48979,10 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
48934
48979
|
case "DELETE_CELL": {
|
|
48935
48980
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
48936
48981
|
if (!isZoneValid(cut[0])) {
|
|
48937
|
-
|
|
48938
|
-
|
|
48939
|
-
|
|
48982
|
+
this.dispatch("CLEAR_CELLS", {
|
|
48983
|
+
target: [cmd.zone],
|
|
48984
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
48985
|
+
});
|
|
48940
48986
|
break;
|
|
48941
48987
|
}
|
|
48942
48988
|
const state = this.getClipboardStateForCopyCells(cut, "CUT");
|
|
@@ -57368,7 +57414,7 @@ class Model extends EventBus {
|
|
|
57368
57414
|
this.session.join(this.config.client);
|
|
57369
57415
|
}
|
|
57370
57416
|
leaveSession() {
|
|
57371
|
-
this.session.leave(this.exportData());
|
|
57417
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
57372
57418
|
}
|
|
57373
57419
|
setupUiPlugin(Plugin) {
|
|
57374
57420
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -57844,6 +57890,6 @@ const constants = {
|
|
|
57844
57890
|
export { AbstractChart, CellErrorType, 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 };
|
|
57845
57891
|
|
|
57846
57892
|
|
|
57847
|
-
__info__.version = "17.1.
|
|
57848
|
-
__info__.date = "2024-08-
|
|
57849
|
-
__info__.hash = "
|
|
57893
|
+
__info__.version = "17.1.28";
|
|
57894
|
+
__info__.date = "2024-08-19T08:08:59.669Z";
|
|
57895
|
+
__info__.hash = "9674f1b";
|
|
@@ -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.1.
|
|
6
|
-
* @date 2024-08-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.1.28
|
|
6
|
+
* @date 2024-08-19T08:08:59.669Z
|
|
7
|
+
* @hash 9674f1b
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -1894,6 +1894,7 @@
|
|
|
1894
1894
|
"UPDATE_CELL",
|
|
1895
1895
|
"UPDATE_CELL_POSITION",
|
|
1896
1896
|
"CLEAR_CELL",
|
|
1897
|
+
"CLEAR_CELLS",
|
|
1897
1898
|
"DELETE_CONTENT",
|
|
1898
1899
|
/** GRID SHAPE */
|
|
1899
1900
|
"ADD_COLUMNS_ROWS",
|
|
@@ -35671,7 +35672,7 @@
|
|
|
35671
35672
|
}
|
|
35672
35673
|
function parseTokens(tokens) {
|
|
35673
35674
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
35674
|
-
if (tokens[0]
|
|
35675
|
+
if (tokens[0]?.value === "=") {
|
|
35675
35676
|
tokens.splice(0, 1);
|
|
35676
35677
|
}
|
|
35677
35678
|
const result = parseExpression(tokens);
|
|
@@ -36238,6 +36239,9 @@
|
|
|
36238
36239
|
format: "",
|
|
36239
36240
|
});
|
|
36240
36241
|
break;
|
|
36242
|
+
case "CLEAR_CELLS":
|
|
36243
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
36244
|
+
break;
|
|
36241
36245
|
}
|
|
36242
36246
|
}
|
|
36243
36247
|
/**
|
|
@@ -36276,6 +36280,25 @@
|
|
|
36276
36280
|
}
|
|
36277
36281
|
}
|
|
36278
36282
|
}
|
|
36283
|
+
/**
|
|
36284
|
+
* Clear the styles, the format and the content of zones
|
|
36285
|
+
*/
|
|
36286
|
+
clearCells(sheetId, zones) {
|
|
36287
|
+
for (const zone of zones) {
|
|
36288
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
36289
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
36290
|
+
this.dispatch("UPDATE_CELL", {
|
|
36291
|
+
sheetId: sheetId,
|
|
36292
|
+
col,
|
|
36293
|
+
row,
|
|
36294
|
+
content: "",
|
|
36295
|
+
style: null,
|
|
36296
|
+
format: "",
|
|
36297
|
+
});
|
|
36298
|
+
}
|
|
36299
|
+
}
|
|
36300
|
+
}
|
|
36301
|
+
}
|
|
36279
36302
|
/**
|
|
36280
36303
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
36281
36304
|
*/
|
|
@@ -39125,7 +39148,7 @@
|
|
|
39125
39148
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
39126
39149
|
*/
|
|
39127
39150
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
39128
|
-
if (!rangeReference.test(sheetXC)) {
|
|
39151
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
39129
39152
|
return new RangeImpl({
|
|
39130
39153
|
sheetId: "",
|
|
39131
39154
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -40011,19 +40034,23 @@
|
|
|
40011
40034
|
}
|
|
40012
40035
|
}
|
|
40013
40036
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
40037
|
+
this.dispatch("CLEAR_CELLS", {
|
|
40038
|
+
sheetId: sheet.id,
|
|
40039
|
+
target: [
|
|
40040
|
+
{
|
|
40041
|
+
left: deletedColumn,
|
|
40042
|
+
top: 0,
|
|
40043
|
+
right: deletedColumn,
|
|
40044
|
+
bottom: sheet.rows.length - 1,
|
|
40045
|
+
},
|
|
40046
|
+
],
|
|
40047
|
+
});
|
|
40014
40048
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
40015
40049
|
const row = sheet.rows[rowIndex];
|
|
40016
40050
|
for (let i in row.cells) {
|
|
40017
40051
|
const colIndex = Number(i);
|
|
40018
40052
|
const cellId = row.cells[i];
|
|
40019
40053
|
if (cellId) {
|
|
40020
|
-
if (colIndex === deletedColumn) {
|
|
40021
|
-
this.dispatch("CLEAR_CELL", {
|
|
40022
|
-
sheetId: sheet.id,
|
|
40023
|
-
col: colIndex,
|
|
40024
|
-
row: rowIndex,
|
|
40025
|
-
});
|
|
40026
|
-
}
|
|
40027
40054
|
if (colIndex > deletedColumn) {
|
|
40028
40055
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
40029
40056
|
}
|
|
@@ -40069,22 +40096,20 @@
|
|
|
40069
40096
|
*
|
|
40070
40097
|
*/
|
|
40071
40098
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
40099
|
+
this.dispatch("CLEAR_CELLS", {
|
|
40100
|
+
sheetId: sheet.id,
|
|
40101
|
+
target: [
|
|
40102
|
+
{
|
|
40103
|
+
left: 0,
|
|
40104
|
+
top: deleteFromRow,
|
|
40105
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
40106
|
+
bottom: deleteToRow,
|
|
40107
|
+
},
|
|
40108
|
+
],
|
|
40109
|
+
});
|
|
40072
40110
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
40073
40111
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
40074
40112
|
const row = sheet.rows[rowIndex];
|
|
40075
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
40076
|
-
for (let i in row.cells) {
|
|
40077
|
-
const colIndex = Number(i);
|
|
40078
|
-
const cellId = row.cells[i];
|
|
40079
|
-
if (cellId) {
|
|
40080
|
-
this.dispatch("CLEAR_CELL", {
|
|
40081
|
-
sheetId: sheet.id,
|
|
40082
|
-
col: colIndex,
|
|
40083
|
-
row: rowIndex,
|
|
40084
|
-
});
|
|
40085
|
-
}
|
|
40086
|
-
}
|
|
40087
|
-
}
|
|
40088
40113
|
if (rowIndex > deleteToRow) {
|
|
40089
40114
|
for (let i in row.cells) {
|
|
40090
40115
|
const colIndex = Number(i);
|
|
@@ -42059,18 +42084,30 @@
|
|
|
42059
42084
|
this.evaluate(this.getAllCells());
|
|
42060
42085
|
}
|
|
42061
42086
|
evaluateFormula(sheetId, formulaString) {
|
|
42062
|
-
const
|
|
42063
|
-
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42064
|
-
this.updateCompilationParameters();
|
|
42065
|
-
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42087
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42066
42088
|
if (isMatrix(result)) {
|
|
42067
42089
|
return matrixMap(result, (cell) => cell.value);
|
|
42068
42090
|
}
|
|
42069
|
-
if (result.value === null) {
|
|
42070
|
-
return 0;
|
|
42071
|
-
}
|
|
42072
42091
|
return result.value;
|
|
42073
42092
|
}
|
|
42093
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42094
|
+
try {
|
|
42095
|
+
const compiledFormula = compile(formulaString);
|
|
42096
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
42097
|
+
this.updateCompilationParameters();
|
|
42098
|
+
const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
|
|
42099
|
+
if (isMatrix(result)) {
|
|
42100
|
+
return result;
|
|
42101
|
+
}
|
|
42102
|
+
if (result.value === null) {
|
|
42103
|
+
return { value: 0, format: result.format };
|
|
42104
|
+
}
|
|
42105
|
+
return result;
|
|
42106
|
+
}
|
|
42107
|
+
catch (error) {
|
|
42108
|
+
return handleError(error, "");
|
|
42109
|
+
}
|
|
42110
|
+
}
|
|
42074
42111
|
getAllCells() {
|
|
42075
42112
|
const positionIds = new JetSet();
|
|
42076
42113
|
for (const sheetId of this.getters.getSheetIds()) {
|
|
@@ -42495,6 +42532,7 @@
|
|
|
42495
42532
|
class EvaluationPlugin extends UIPlugin {
|
|
42496
42533
|
static getters = [
|
|
42497
42534
|
"evaluateFormula",
|
|
42535
|
+
"evaluateFormulaResult",
|
|
42498
42536
|
"getCorrespondingFormulaCell",
|
|
42499
42537
|
"getRangeFormattedValues",
|
|
42500
42538
|
"getRangeValues",
|
|
@@ -42553,12 +42591,14 @@
|
|
|
42553
42591
|
// Getters
|
|
42554
42592
|
// ---------------------------------------------------------------------------
|
|
42555
42593
|
evaluateFormula(sheetId, formulaString) {
|
|
42556
|
-
|
|
42557
|
-
|
|
42558
|
-
|
|
42559
|
-
catch (error) {
|
|
42560
|
-
return error.value || CellErrorType.GenericError;
|
|
42594
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42595
|
+
if (isMatrix(result)) {
|
|
42596
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42561
42597
|
}
|
|
42598
|
+
return result.value;
|
|
42599
|
+
}
|
|
42600
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42601
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42562
42602
|
}
|
|
42563
42603
|
/**
|
|
42564
42604
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -44898,7 +44938,7 @@
|
|
|
44898
44938
|
*/
|
|
44899
44939
|
leave(data) {
|
|
44900
44940
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
44901
|
-
this.snapshot(data);
|
|
44941
|
+
this.snapshot(data());
|
|
44902
44942
|
}
|
|
44903
44943
|
delete this.clients[this.clientId];
|
|
44904
44944
|
this.transportService.leave(this.clientId);
|
|
@@ -45571,13 +45611,10 @@
|
|
|
45571
45611
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
45572
45612
|
*/
|
|
45573
45613
|
clearClippedZones() {
|
|
45574
|
-
|
|
45575
|
-
|
|
45576
|
-
|
|
45577
|
-
|
|
45578
|
-
}
|
|
45579
|
-
}
|
|
45580
|
-
}
|
|
45614
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45615
|
+
sheetId: this.sheetId,
|
|
45616
|
+
target: this.zones,
|
|
45617
|
+
});
|
|
45581
45618
|
this.dispatch("CLEAR_FORMATTING", {
|
|
45582
45619
|
sheetId: this.sheetId,
|
|
45583
45620
|
target: this.zones,
|
|
@@ -45926,9 +45963,7 @@
|
|
|
45926
45963
|
bottom: rowIndex,
|
|
45927
45964
|
}));
|
|
45928
45965
|
const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
|
|
45929
|
-
|
|
45930
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
45931
|
-
}
|
|
45966
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
45932
45967
|
const zonePasted = {
|
|
45933
45968
|
left: zone.left,
|
|
45934
45969
|
top: zone.top,
|
|
@@ -46433,6 +46468,7 @@
|
|
|
46433
46468
|
* evaluated and updated with the number type.
|
|
46434
46469
|
*/
|
|
46435
46470
|
setDecimal(sheetId, zones, step) {
|
|
46471
|
+
const positionsByFormat = {};
|
|
46436
46472
|
// Find the each cell with a number value and get the format
|
|
46437
46473
|
for (const zone of zones) {
|
|
46438
46474
|
for (const position of positions(zone)) {
|
|
@@ -46442,15 +46478,20 @@
|
|
|
46442
46478
|
// of the format
|
|
46443
46479
|
this.getters.getLocale();
|
|
46444
46480
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
46445
|
-
|
|
46446
|
-
|
|
46447
|
-
sheetId,
|
|
46448
|
-
target: [positionToZone(position)],
|
|
46449
|
-
format: newFormat,
|
|
46450
|
-
});
|
|
46481
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
46482
|
+
positionsByFormat[newFormat].push(position);
|
|
46451
46483
|
}
|
|
46452
46484
|
}
|
|
46453
46485
|
}
|
|
46486
|
+
// consolidate all positions with the same format in bigger zones
|
|
46487
|
+
for (const newFormat in positionsByFormat) {
|
|
46488
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
46489
|
+
this.dispatch("SET_FORMATTING", {
|
|
46490
|
+
sheetId,
|
|
46491
|
+
format: newFormat,
|
|
46492
|
+
target: zones,
|
|
46493
|
+
});
|
|
46494
|
+
}
|
|
46454
46495
|
}
|
|
46455
46496
|
/**
|
|
46456
46497
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -47947,6 +47988,9 @@
|
|
|
47947
47988
|
if (showFormula && cell?.isFormula) {
|
|
47948
47989
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
47949
47990
|
}
|
|
47991
|
+
else if (showFormula && !cell?.content) {
|
|
47992
|
+
return "";
|
|
47993
|
+
}
|
|
47950
47994
|
else {
|
|
47951
47995
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
47952
47996
|
}
|
|
@@ -48194,6 +48238,7 @@
|
|
|
48194
48238
|
const repeatCommandTransformRegistry = new Registry();
|
|
48195
48239
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
48196
48240
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
48241
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
48197
48242
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
48198
48243
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
48199
48244
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -48935,9 +48980,10 @@
|
|
|
48935
48980
|
case "DELETE_CELL": {
|
|
48936
48981
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
48937
48982
|
if (!isZoneValid(cut[0])) {
|
|
48938
|
-
|
|
48939
|
-
|
|
48940
|
-
|
|
48983
|
+
this.dispatch("CLEAR_CELLS", {
|
|
48984
|
+
target: [cmd.zone],
|
|
48985
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
48986
|
+
});
|
|
48941
48987
|
break;
|
|
48942
48988
|
}
|
|
48943
48989
|
const state = this.getClipboardStateForCopyCells(cut, "CUT");
|
|
@@ -57369,7 +57415,7 @@
|
|
|
57369
57415
|
this.session.join(this.config.client);
|
|
57370
57416
|
}
|
|
57371
57417
|
leaveSession() {
|
|
57372
|
-
this.session.leave(this.exportData());
|
|
57418
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
57373
57419
|
}
|
|
57374
57420
|
setupUiPlugin(Plugin) {
|
|
57375
57421
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -57881,9 +57927,9 @@
|
|
|
57881
57927
|
exports.tokenize = tokenize;
|
|
57882
57928
|
|
|
57883
57929
|
|
|
57884
|
-
__info__.version = "17.1.
|
|
57885
|
-
__info__.date = "2024-08-
|
|
57886
|
-
__info__.hash = "
|
|
57930
|
+
__info__.version = "17.1.28";
|
|
57931
|
+
__info__.date = "2024-08-19T08:08:59.669Z";
|
|
57932
|
+
__info__.hash = "9674f1b";
|
|
57887
57933
|
|
|
57888
57934
|
|
|
57889
57935
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|