@odoo/o-spreadsheet 17.0.33 → 17.0.35
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 +99 -64
- package/dist/o-spreadsheet.d.ts +16 -8
- package/dist/o-spreadsheet.esm.js +99 -64
- package/dist/o-spreadsheet.iife.js +99 -64
- package/dist/o-spreadsheet.iife.min.js +168 -168
- 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 2024-08-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.35
|
|
6
|
+
* @date 2024-08-19T08:09:02.631Z
|
|
7
|
+
* @hash 5572654
|
|
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';
|
|
@@ -1953,6 +1953,7 @@ const coreTypes = new Set([
|
|
|
1953
1953
|
"UPDATE_CELL",
|
|
1954
1954
|
"UPDATE_CELL_POSITION",
|
|
1955
1955
|
"CLEAR_CELL",
|
|
1956
|
+
"CLEAR_CELLS",
|
|
1956
1957
|
"DELETE_CONTENT",
|
|
1957
1958
|
/** GRID SHAPE */
|
|
1958
1959
|
"ADD_COLUMNS_ROWS",
|
|
@@ -35186,7 +35187,7 @@ function parse(str) {
|
|
|
35186
35187
|
}
|
|
35187
35188
|
function parseTokens(tokens) {
|
|
35188
35189
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
35189
|
-
if (tokens[0]
|
|
35190
|
+
if (tokens[0]?.value === "=") {
|
|
35190
35191
|
tokens.splice(0, 1);
|
|
35191
35192
|
}
|
|
35192
35193
|
const result = parseExpression(tokens);
|
|
@@ -35776,6 +35777,9 @@ class CellPlugin extends CorePlugin {
|
|
|
35776
35777
|
format: "",
|
|
35777
35778
|
});
|
|
35778
35779
|
break;
|
|
35780
|
+
case "CLEAR_CELLS":
|
|
35781
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
35782
|
+
break;
|
|
35779
35783
|
}
|
|
35780
35784
|
}
|
|
35781
35785
|
/**
|
|
@@ -35814,6 +35818,25 @@ class CellPlugin extends CorePlugin {
|
|
|
35814
35818
|
}
|
|
35815
35819
|
}
|
|
35816
35820
|
}
|
|
35821
|
+
/**
|
|
35822
|
+
* Clear the styles, the format and the content of zones
|
|
35823
|
+
*/
|
|
35824
|
+
clearCells(sheetId, zones) {
|
|
35825
|
+
for (const zone of zones) {
|
|
35826
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
35827
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
35828
|
+
this.dispatch("UPDATE_CELL", {
|
|
35829
|
+
sheetId: sheetId,
|
|
35830
|
+
col,
|
|
35831
|
+
row,
|
|
35832
|
+
content: "",
|
|
35833
|
+
style: null,
|
|
35834
|
+
format: "",
|
|
35835
|
+
});
|
|
35836
|
+
}
|
|
35837
|
+
}
|
|
35838
|
+
}
|
|
35839
|
+
}
|
|
35817
35840
|
/**
|
|
35818
35841
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
35819
35842
|
*/
|
|
@@ -38660,7 +38683,7 @@ class RangeAdapter {
|
|
|
38660
38683
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
38661
38684
|
*/
|
|
38662
38685
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
38663
|
-
if (!rangeReference.test(sheetXC)) {
|
|
38686
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
38664
38687
|
return new RangeImpl({
|
|
38665
38688
|
sheetId: "",
|
|
38666
38689
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -39546,19 +39569,23 @@ class SheetPlugin extends CorePlugin {
|
|
|
39546
39569
|
}
|
|
39547
39570
|
}
|
|
39548
39571
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
39572
|
+
this.dispatch("CLEAR_CELLS", {
|
|
39573
|
+
sheetId: sheet.id,
|
|
39574
|
+
target: [
|
|
39575
|
+
{
|
|
39576
|
+
left: deletedColumn,
|
|
39577
|
+
top: 0,
|
|
39578
|
+
right: deletedColumn,
|
|
39579
|
+
bottom: sheet.rows.length - 1,
|
|
39580
|
+
},
|
|
39581
|
+
],
|
|
39582
|
+
});
|
|
39549
39583
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39550
39584
|
const row = sheet.rows[rowIndex];
|
|
39551
39585
|
for (let i in row.cells) {
|
|
39552
39586
|
const colIndex = Number(i);
|
|
39553
39587
|
const cellId = row.cells[i];
|
|
39554
39588
|
if (cellId) {
|
|
39555
|
-
if (colIndex === deletedColumn) {
|
|
39556
|
-
this.dispatch("CLEAR_CELL", {
|
|
39557
|
-
sheetId: sheet.id,
|
|
39558
|
-
col: colIndex,
|
|
39559
|
-
row: rowIndex,
|
|
39560
|
-
});
|
|
39561
|
-
}
|
|
39562
39589
|
if (colIndex > deletedColumn) {
|
|
39563
39590
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
39564
39591
|
}
|
|
@@ -39604,22 +39631,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
39604
39631
|
*
|
|
39605
39632
|
*/
|
|
39606
39633
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
39634
|
+
this.dispatch("CLEAR_CELLS", {
|
|
39635
|
+
sheetId: sheet.id,
|
|
39636
|
+
target: [
|
|
39637
|
+
{
|
|
39638
|
+
left: 0,
|
|
39639
|
+
top: deleteFromRow,
|
|
39640
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
39641
|
+
bottom: deleteToRow,
|
|
39642
|
+
},
|
|
39643
|
+
],
|
|
39644
|
+
});
|
|
39607
39645
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
39608
39646
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39609
39647
|
const row = sheet.rows[rowIndex];
|
|
39610
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
39611
|
-
for (let i in row.cells) {
|
|
39612
|
-
const colIndex = Number(i);
|
|
39613
|
-
const cellId = row.cells[i];
|
|
39614
|
-
if (cellId) {
|
|
39615
|
-
this.dispatch("CLEAR_CELL", {
|
|
39616
|
-
sheetId: sheet.id,
|
|
39617
|
-
col: colIndex,
|
|
39618
|
-
row: rowIndex,
|
|
39619
|
-
});
|
|
39620
|
-
}
|
|
39621
|
-
}
|
|
39622
|
-
}
|
|
39623
39648
|
if (rowIndex > deleteToRow) {
|
|
39624
39649
|
for (let i in row.cells) {
|
|
39625
39650
|
const colIndex = Number(i);
|
|
@@ -41602,15 +41627,16 @@ class Evaluator {
|
|
|
41602
41627
|
this.evaluatedCells = new Map();
|
|
41603
41628
|
this.evaluate(this.getAllCells());
|
|
41604
41629
|
}
|
|
41605
|
-
|
|
41606
|
-
|
|
41607
|
-
|
|
41608
|
-
|
|
41609
|
-
|
|
41610
|
-
|
|
41611
|
-
|
|
41630
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
41631
|
+
try {
|
|
41632
|
+
const compiledFormula = compile(formulaString);
|
|
41633
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
41634
|
+
this.updateCompilationParameters();
|
|
41635
|
+
return compiledFormula.execute(ranges, ...this.compilationParams);
|
|
41636
|
+
}
|
|
41637
|
+
catch (error) {
|
|
41638
|
+
return this.handleError(error);
|
|
41612
41639
|
}
|
|
41613
|
-
return array.value;
|
|
41614
41640
|
}
|
|
41615
41641
|
getAllCells() {
|
|
41616
41642
|
const positionIds = new JetSet();
|
|
@@ -41686,7 +41712,7 @@ class Evaluator {
|
|
|
41686
41712
|
: evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
|
|
41687
41713
|
}
|
|
41688
41714
|
catch (e) {
|
|
41689
|
-
return this.handleError(e
|
|
41715
|
+
return this.handleError(e);
|
|
41690
41716
|
}
|
|
41691
41717
|
finally {
|
|
41692
41718
|
this.cellsBeingComputed.delete(cellId);
|
|
@@ -41701,7 +41727,7 @@ class Evaluator {
|
|
|
41701
41727
|
}
|
|
41702
41728
|
return evaluatedCell;
|
|
41703
41729
|
}
|
|
41704
|
-
handleError(e
|
|
41730
|
+
handleError(e) {
|
|
41705
41731
|
if (!(e instanceof EvaluationError)) {
|
|
41706
41732
|
e = new EvaluationError(CellErrorType.GenericError, e.message);
|
|
41707
41733
|
}
|
|
@@ -42035,6 +42061,7 @@ class PositionBitsEncoder {
|
|
|
42035
42061
|
class EvaluationPlugin extends UIPlugin {
|
|
42036
42062
|
static getters = [
|
|
42037
42063
|
"evaluateFormula",
|
|
42064
|
+
"evaluateFormulaResult",
|
|
42038
42065
|
"getCorrespondingFormulaCell",
|
|
42039
42066
|
"getRangeFormattedValues",
|
|
42040
42067
|
"getRangeValues",
|
|
@@ -42092,12 +42119,14 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
42092
42119
|
// Getters
|
|
42093
42120
|
// ---------------------------------------------------------------------------
|
|
42094
42121
|
evaluateFormula(sheetId, formulaString) {
|
|
42095
|
-
|
|
42096
|
-
|
|
42097
|
-
|
|
42098
|
-
catch (error) {
|
|
42099
|
-
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
42122
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42123
|
+
if (isMatrix(result)) {
|
|
42124
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42100
42125
|
}
|
|
42126
|
+
return result.value;
|
|
42127
|
+
}
|
|
42128
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42129
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42101
42130
|
}
|
|
42102
42131
|
/**
|
|
42103
42132
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -44451,7 +44480,7 @@ class Session extends EventBus {
|
|
|
44451
44480
|
*/
|
|
44452
44481
|
leave(data) {
|
|
44453
44482
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
44454
|
-
this.snapshot(data);
|
|
44483
|
+
this.snapshot(data());
|
|
44455
44484
|
}
|
|
44456
44485
|
delete this.clients[this.clientId];
|
|
44457
44486
|
this.transportService.leave(this.clientId);
|
|
@@ -45122,13 +45151,10 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
45122
45151
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
45123
45152
|
*/
|
|
45124
45153
|
clearClippedZones() {
|
|
45125
|
-
|
|
45126
|
-
|
|
45127
|
-
|
|
45128
|
-
|
|
45129
|
-
}
|
|
45130
|
-
}
|
|
45131
|
-
}
|
|
45154
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45155
|
+
sheetId: this.sheetId,
|
|
45156
|
+
target: this.zones,
|
|
45157
|
+
});
|
|
45132
45158
|
this.dispatch("CLEAR_FORMATTING", {
|
|
45133
45159
|
sheetId: this.sheetId,
|
|
45134
45160
|
target: this.zones,
|
|
@@ -45476,9 +45502,7 @@ class DataCleanupPlugin extends UIPlugin {
|
|
|
45476
45502
|
bottom: rowIndex,
|
|
45477
45503
|
}));
|
|
45478
45504
|
const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
|
|
45479
|
-
|
|
45480
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
45481
|
-
}
|
|
45505
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
45482
45506
|
const zonePasted = {
|
|
45483
45507
|
left: zone.left,
|
|
45484
45508
|
top: zone.top,
|
|
@@ -45897,6 +45921,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
45897
45921
|
* evaluated and updated with the number type.
|
|
45898
45922
|
*/
|
|
45899
45923
|
setDecimal(sheetId, zones, step) {
|
|
45924
|
+
const positionsByFormat = {};
|
|
45900
45925
|
// Find the each cell with a number value and get the format
|
|
45901
45926
|
for (const zone of zones) {
|
|
45902
45927
|
for (const position of positions(zone)) {
|
|
@@ -45906,15 +45931,20 @@ class FormatPlugin extends UIPlugin {
|
|
|
45906
45931
|
// of the format
|
|
45907
45932
|
this.getters.getLocale();
|
|
45908
45933
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
45909
|
-
|
|
45910
|
-
|
|
45911
|
-
sheetId,
|
|
45912
|
-
target: [positionToZone(position)],
|
|
45913
|
-
format: newFormat,
|
|
45914
|
-
});
|
|
45934
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
45935
|
+
positionsByFormat[newFormat].push(position);
|
|
45915
45936
|
}
|
|
45916
45937
|
}
|
|
45917
45938
|
}
|
|
45939
|
+
// consolidate all positions with the same format in bigger zones
|
|
45940
|
+
for (const newFormat in positionsByFormat) {
|
|
45941
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
45942
|
+
this.dispatch("SET_FORMATTING", {
|
|
45943
|
+
sheetId,
|
|
45944
|
+
format: newFormat,
|
|
45945
|
+
target: zones,
|
|
45946
|
+
});
|
|
45947
|
+
}
|
|
45918
45948
|
}
|
|
45919
45949
|
/**
|
|
45920
45950
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -47544,6 +47574,9 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
47544
47574
|
if (showFormula && cell?.isFormula) {
|
|
47545
47575
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
47546
47576
|
}
|
|
47577
|
+
else if (showFormula && !cell?.content) {
|
|
47578
|
+
return "";
|
|
47579
|
+
}
|
|
47547
47580
|
else {
|
|
47548
47581
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
47549
47582
|
}
|
|
@@ -47739,6 +47772,7 @@ function repeatGroupHeadersCommand(getters, cmd) {
|
|
|
47739
47772
|
const repeatCommandTransformRegistry = new Registry();
|
|
47740
47773
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
47741
47774
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
47775
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
47742
47776
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
47743
47777
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
47744
47778
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -48478,9 +48512,10 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
48478
48512
|
case "DELETE_CELL": {
|
|
48479
48513
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
48480
48514
|
if (!isZoneValid(cut[0])) {
|
|
48481
|
-
|
|
48482
|
-
|
|
48483
|
-
|
|
48515
|
+
this.dispatch("CLEAR_CELLS", {
|
|
48516
|
+
target: [cmd.zone],
|
|
48517
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
48518
|
+
});
|
|
48484
48519
|
break;
|
|
48485
48520
|
}
|
|
48486
48521
|
const state = this.getClipboardStateForCopyCells(cut, "CUT");
|
|
@@ -57081,7 +57116,7 @@ class Model extends EventBus {
|
|
|
57081
57116
|
this.session.join(this.config.client);
|
|
57082
57117
|
}
|
|
57083
57118
|
leaveSession() {
|
|
57084
|
-
this.session.leave(this.exportData());
|
|
57119
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
57085
57120
|
}
|
|
57086
57121
|
setupUiPlugin(Plugin) {
|
|
57087
57122
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -57549,6 +57584,6 @@ const constants = {
|
|
|
57549
57584
|
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 };
|
|
57550
57585
|
|
|
57551
57586
|
|
|
57552
|
-
__info__.version = "17.0.
|
|
57553
|
-
__info__.date = "2024-08-
|
|
57554
|
-
__info__.hash = "
|
|
57587
|
+
__info__.version = "17.0.35";
|
|
57588
|
+
__info__.date = "2024-08-19T08:09:02.631Z";
|
|
57589
|
+
__info__.hash = "5572654";
|
|
@@ -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 2024-08-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.35
|
|
6
|
+
* @date 2024-08-19T08:09:02.631Z
|
|
7
|
+
* @hash 5572654
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -1954,6 +1954,7 @@
|
|
|
1954
1954
|
"UPDATE_CELL",
|
|
1955
1955
|
"UPDATE_CELL_POSITION",
|
|
1956
1956
|
"CLEAR_CELL",
|
|
1957
|
+
"CLEAR_CELLS",
|
|
1957
1958
|
"DELETE_CONTENT",
|
|
1958
1959
|
/** GRID SHAPE */
|
|
1959
1960
|
"ADD_COLUMNS_ROWS",
|
|
@@ -35187,7 +35188,7 @@
|
|
|
35187
35188
|
}
|
|
35188
35189
|
function parseTokens(tokens) {
|
|
35189
35190
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
35190
|
-
if (tokens[0]
|
|
35191
|
+
if (tokens[0]?.value === "=") {
|
|
35191
35192
|
tokens.splice(0, 1);
|
|
35192
35193
|
}
|
|
35193
35194
|
const result = parseExpression(tokens);
|
|
@@ -35777,6 +35778,9 @@
|
|
|
35777
35778
|
format: "",
|
|
35778
35779
|
});
|
|
35779
35780
|
break;
|
|
35781
|
+
case "CLEAR_CELLS":
|
|
35782
|
+
this.clearCells(cmd.sheetId, cmd.target);
|
|
35783
|
+
break;
|
|
35780
35784
|
}
|
|
35781
35785
|
}
|
|
35782
35786
|
/**
|
|
@@ -35815,6 +35819,25 @@
|
|
|
35815
35819
|
}
|
|
35816
35820
|
}
|
|
35817
35821
|
}
|
|
35822
|
+
/**
|
|
35823
|
+
* Clear the styles, the format and the content of zones
|
|
35824
|
+
*/
|
|
35825
|
+
clearCells(sheetId, zones) {
|
|
35826
|
+
for (const zone of zones) {
|
|
35827
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
35828
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
35829
|
+
this.dispatch("UPDATE_CELL", {
|
|
35830
|
+
sheetId: sheetId,
|
|
35831
|
+
col,
|
|
35832
|
+
row,
|
|
35833
|
+
content: "",
|
|
35834
|
+
style: null,
|
|
35835
|
+
format: "",
|
|
35836
|
+
});
|
|
35837
|
+
}
|
|
35838
|
+
}
|
|
35839
|
+
}
|
|
35840
|
+
}
|
|
35818
35841
|
/**
|
|
35819
35842
|
* Copy the style of the reference column/row to the new columns/rows.
|
|
35820
35843
|
*/
|
|
@@ -38661,7 +38684,7 @@
|
|
|
38661
38684
|
* @param sheetXC the string description of a range, in the form SheetName!XC:XC
|
|
38662
38685
|
*/
|
|
38663
38686
|
getRangeFromSheetXC(defaultSheetId, sheetXC) {
|
|
38664
|
-
if (!rangeReference.test(sheetXC)) {
|
|
38687
|
+
if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
|
|
38665
38688
|
return new RangeImpl({
|
|
38666
38689
|
sheetId: "",
|
|
38667
38690
|
zone: { left: -1, top: -1, right: -1, bottom: -1 },
|
|
@@ -39547,19 +39570,23 @@
|
|
|
39547
39570
|
}
|
|
39548
39571
|
}
|
|
39549
39572
|
moveCellOnColumnsDeletion(sheet, deletedColumn) {
|
|
39573
|
+
this.dispatch("CLEAR_CELLS", {
|
|
39574
|
+
sheetId: sheet.id,
|
|
39575
|
+
target: [
|
|
39576
|
+
{
|
|
39577
|
+
left: deletedColumn,
|
|
39578
|
+
top: 0,
|
|
39579
|
+
right: deletedColumn,
|
|
39580
|
+
bottom: sheet.rows.length - 1,
|
|
39581
|
+
},
|
|
39582
|
+
],
|
|
39583
|
+
});
|
|
39550
39584
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39551
39585
|
const row = sheet.rows[rowIndex];
|
|
39552
39586
|
for (let i in row.cells) {
|
|
39553
39587
|
const colIndex = Number(i);
|
|
39554
39588
|
const cellId = row.cells[i];
|
|
39555
39589
|
if (cellId) {
|
|
39556
|
-
if (colIndex === deletedColumn) {
|
|
39557
|
-
this.dispatch("CLEAR_CELL", {
|
|
39558
|
-
sheetId: sheet.id,
|
|
39559
|
-
col: colIndex,
|
|
39560
|
-
row: rowIndex,
|
|
39561
|
-
});
|
|
39562
|
-
}
|
|
39563
39590
|
if (colIndex > deletedColumn) {
|
|
39564
39591
|
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
39565
39592
|
}
|
|
@@ -39605,22 +39632,20 @@
|
|
|
39605
39632
|
*
|
|
39606
39633
|
*/
|
|
39607
39634
|
moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
|
|
39635
|
+
this.dispatch("CLEAR_CELLS", {
|
|
39636
|
+
sheetId: sheet.id,
|
|
39637
|
+
target: [
|
|
39638
|
+
{
|
|
39639
|
+
left: 0,
|
|
39640
|
+
top: deleteFromRow,
|
|
39641
|
+
right: this.getters.getNumberCols(sheet.id),
|
|
39642
|
+
bottom: deleteToRow,
|
|
39643
|
+
},
|
|
39644
|
+
],
|
|
39645
|
+
});
|
|
39608
39646
|
const numberRows = deleteToRow - deleteFromRow + 1;
|
|
39609
39647
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
39610
39648
|
const row = sheet.rows[rowIndex];
|
|
39611
|
-
if (rowIndex >= deleteFromRow && rowIndex <= deleteToRow) {
|
|
39612
|
-
for (let i in row.cells) {
|
|
39613
|
-
const colIndex = Number(i);
|
|
39614
|
-
const cellId = row.cells[i];
|
|
39615
|
-
if (cellId) {
|
|
39616
|
-
this.dispatch("CLEAR_CELL", {
|
|
39617
|
-
sheetId: sheet.id,
|
|
39618
|
-
col: colIndex,
|
|
39619
|
-
row: rowIndex,
|
|
39620
|
-
});
|
|
39621
|
-
}
|
|
39622
|
-
}
|
|
39623
|
-
}
|
|
39624
39649
|
if (rowIndex > deleteToRow) {
|
|
39625
39650
|
for (let i in row.cells) {
|
|
39626
39651
|
const colIndex = Number(i);
|
|
@@ -41603,15 +41628,16 @@
|
|
|
41603
41628
|
this.evaluatedCells = new Map();
|
|
41604
41629
|
this.evaluate(this.getAllCells());
|
|
41605
41630
|
}
|
|
41606
|
-
|
|
41607
|
-
|
|
41608
|
-
|
|
41609
|
-
|
|
41610
|
-
|
|
41611
|
-
|
|
41612
|
-
|
|
41631
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
41632
|
+
try {
|
|
41633
|
+
const compiledFormula = compile(formulaString);
|
|
41634
|
+
const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
41635
|
+
this.updateCompilationParameters();
|
|
41636
|
+
return compiledFormula.execute(ranges, ...this.compilationParams);
|
|
41637
|
+
}
|
|
41638
|
+
catch (error) {
|
|
41639
|
+
return this.handleError(error);
|
|
41613
41640
|
}
|
|
41614
|
-
return array.value;
|
|
41615
41641
|
}
|
|
41616
41642
|
getAllCells() {
|
|
41617
41643
|
const positionIds = new JetSet();
|
|
@@ -41687,7 +41713,7 @@
|
|
|
41687
41713
|
: evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
|
|
41688
41714
|
}
|
|
41689
41715
|
catch (e) {
|
|
41690
|
-
return this.handleError(e
|
|
41716
|
+
return this.handleError(e);
|
|
41691
41717
|
}
|
|
41692
41718
|
finally {
|
|
41693
41719
|
this.cellsBeingComputed.delete(cellId);
|
|
@@ -41702,7 +41728,7 @@
|
|
|
41702
41728
|
}
|
|
41703
41729
|
return evaluatedCell;
|
|
41704
41730
|
}
|
|
41705
|
-
handleError(e
|
|
41731
|
+
handleError(e) {
|
|
41706
41732
|
if (!(e instanceof EvaluationError)) {
|
|
41707
41733
|
e = new EvaluationError(CellErrorType.GenericError, e.message);
|
|
41708
41734
|
}
|
|
@@ -42036,6 +42062,7 @@
|
|
|
42036
42062
|
class EvaluationPlugin extends UIPlugin {
|
|
42037
42063
|
static getters = [
|
|
42038
42064
|
"evaluateFormula",
|
|
42065
|
+
"evaluateFormulaResult",
|
|
42039
42066
|
"getCorrespondingFormulaCell",
|
|
42040
42067
|
"getRangeFormattedValues",
|
|
42041
42068
|
"getRangeValues",
|
|
@@ -42093,12 +42120,14 @@
|
|
|
42093
42120
|
// Getters
|
|
42094
42121
|
// ---------------------------------------------------------------------------
|
|
42095
42122
|
evaluateFormula(sheetId, formulaString) {
|
|
42096
|
-
|
|
42097
|
-
|
|
42098
|
-
|
|
42099
|
-
catch (error) {
|
|
42100
|
-
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
42123
|
+
const result = this.evaluateFormulaResult(sheetId, formulaString);
|
|
42124
|
+
if (isMatrix(result)) {
|
|
42125
|
+
return matrixMap(result, (cell) => cell.value);
|
|
42101
42126
|
}
|
|
42127
|
+
return result.value;
|
|
42128
|
+
}
|
|
42129
|
+
evaluateFormulaResult(sheetId, formulaString) {
|
|
42130
|
+
return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
|
|
42102
42131
|
}
|
|
42103
42132
|
/**
|
|
42104
42133
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -44452,7 +44481,7 @@
|
|
|
44452
44481
|
*/
|
|
44453
44482
|
leave(data) {
|
|
44454
44483
|
if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
|
|
44455
|
-
this.snapshot(data);
|
|
44484
|
+
this.snapshot(data());
|
|
44456
44485
|
}
|
|
44457
44486
|
delete this.clients[this.clientId];
|
|
44458
44487
|
this.transportService.leave(this.clientId);
|
|
@@ -45123,13 +45152,10 @@
|
|
|
45123
45152
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
45124
45153
|
*/
|
|
45125
45154
|
clearClippedZones() {
|
|
45126
|
-
|
|
45127
|
-
|
|
45128
|
-
|
|
45129
|
-
|
|
45130
|
-
}
|
|
45131
|
-
}
|
|
45132
|
-
}
|
|
45155
|
+
this.dispatch("CLEAR_CELLS", {
|
|
45156
|
+
sheetId: this.sheetId,
|
|
45157
|
+
target: this.zones,
|
|
45158
|
+
});
|
|
45133
45159
|
this.dispatch("CLEAR_FORMATTING", {
|
|
45134
45160
|
sheetId: this.sheetId,
|
|
45135
45161
|
target: this.zones,
|
|
@@ -45477,9 +45503,7 @@
|
|
|
45477
45503
|
bottom: rowIndex,
|
|
45478
45504
|
}));
|
|
45479
45505
|
const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
|
|
45480
|
-
|
|
45481
|
-
this.dispatch("CLEAR_CELL", { col, row, sheetId });
|
|
45482
|
-
}
|
|
45506
|
+
this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
|
|
45483
45507
|
const zonePasted = {
|
|
45484
45508
|
left: zone.left,
|
|
45485
45509
|
top: zone.top,
|
|
@@ -45898,6 +45922,7 @@
|
|
|
45898
45922
|
* evaluated and updated with the number type.
|
|
45899
45923
|
*/
|
|
45900
45924
|
setDecimal(sheetId, zones, step) {
|
|
45925
|
+
const positionsByFormat = {};
|
|
45901
45926
|
// Find the each cell with a number value and get the format
|
|
45902
45927
|
for (const zone of zones) {
|
|
45903
45928
|
for (const position of positions(zone)) {
|
|
@@ -45907,15 +45932,20 @@
|
|
|
45907
45932
|
// of the format
|
|
45908
45933
|
this.getters.getLocale();
|
|
45909
45934
|
const newFormat = changeDecimalPlaces(numberFormat, step);
|
|
45910
|
-
|
|
45911
|
-
|
|
45912
|
-
sheetId,
|
|
45913
|
-
target: [positionToZone(position)],
|
|
45914
|
-
format: newFormat,
|
|
45915
|
-
});
|
|
45935
|
+
positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
|
|
45936
|
+
positionsByFormat[newFormat].push(position);
|
|
45916
45937
|
}
|
|
45917
45938
|
}
|
|
45918
45939
|
}
|
|
45940
|
+
// consolidate all positions with the same format in bigger zones
|
|
45941
|
+
for (const newFormat in positionsByFormat) {
|
|
45942
|
+
const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
|
|
45943
|
+
this.dispatch("SET_FORMATTING", {
|
|
45944
|
+
sheetId,
|
|
45945
|
+
format: newFormat,
|
|
45946
|
+
target: zones,
|
|
45947
|
+
});
|
|
45948
|
+
}
|
|
45919
45949
|
}
|
|
45920
45950
|
/**
|
|
45921
45951
|
* Take a range of cells and return the format of the first cell containing a
|
|
@@ -47545,6 +47575,9 @@
|
|
|
47545
47575
|
if (showFormula && cell?.isFormula) {
|
|
47546
47576
|
return localizeFormula(cell.content, this.getters.getLocale());
|
|
47547
47577
|
}
|
|
47578
|
+
else if (showFormula && !cell?.content) {
|
|
47579
|
+
return "";
|
|
47580
|
+
}
|
|
47548
47581
|
else {
|
|
47549
47582
|
return this.getters.getEvaluatedCell(position).formattedValue;
|
|
47550
47583
|
}
|
|
@@ -47740,6 +47773,7 @@
|
|
|
47740
47773
|
const repeatCommandTransformRegistry = new Registry();
|
|
47741
47774
|
repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
|
|
47742
47775
|
repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
|
|
47776
|
+
repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
|
|
47743
47777
|
repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
|
|
47744
47778
|
repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
|
|
47745
47779
|
repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
|
|
@@ -48479,9 +48513,10 @@
|
|
|
48479
48513
|
case "DELETE_CELL": {
|
|
48480
48514
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
48481
48515
|
if (!isZoneValid(cut[0])) {
|
|
48482
|
-
|
|
48483
|
-
|
|
48484
|
-
|
|
48516
|
+
this.dispatch("CLEAR_CELLS", {
|
|
48517
|
+
target: [cmd.zone],
|
|
48518
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
48519
|
+
});
|
|
48485
48520
|
break;
|
|
48486
48521
|
}
|
|
48487
48522
|
const state = this.getClipboardStateForCopyCells(cut, "CUT");
|
|
@@ -57082,7 +57117,7 @@
|
|
|
57082
57117
|
this.session.join(this.config.client);
|
|
57083
57118
|
}
|
|
57084
57119
|
leaveSession() {
|
|
57085
|
-
this.session.leave(this.exportData());
|
|
57120
|
+
this.session.leave(lazy(() => this.exportData()));
|
|
57086
57121
|
}
|
|
57087
57122
|
setupUiPlugin(Plugin) {
|
|
57088
57123
|
const plugin = new Plugin(this.uiPluginConfig);
|
|
@@ -57585,9 +57620,9 @@
|
|
|
57585
57620
|
exports.tokenize = tokenize;
|
|
57586
57621
|
|
|
57587
57622
|
|
|
57588
|
-
__info__.version = "17.0.
|
|
57589
|
-
__info__.date = "2024-08-
|
|
57590
|
-
__info__.hash = "
|
|
57623
|
+
__info__.version = "17.0.35";
|
|
57624
|
+
__info__.date = "2024-08-19T08:09:02.631Z";
|
|
57625
|
+
__info__.hash = "5572654";
|
|
57591
57626
|
|
|
57592
57627
|
|
|
57593
57628
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|