@odoo/o-spreadsheet 17.1.27 → 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.
@@ -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.27
6
- * @date 2024-08-09T12:20:52.051Z
7
- * @hash c626332
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].value === "=") {
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
  */
@@ -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);
@@ -44913,7 +44938,7 @@
44913
44938
  */
44914
44939
  leave(data) {
44915
44940
  if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44916
- this.snapshot(data);
44941
+ this.snapshot(data());
44917
44942
  }
44918
44943
  delete this.clients[this.clientId];
44919
44944
  this.transportService.leave(this.clientId);
@@ -45586,13 +45611,10 @@
45586
45611
  * Clear the clipped zones: remove the cells and clear the formatting
45587
45612
  */
45588
45613
  clearClippedZones() {
45589
- for (const row of this.cells) {
45590
- for (const cell of row) {
45591
- if (cell?.cell) {
45592
- this.dispatch("CLEAR_CELL", cell.position);
45593
- }
45594
- }
45595
- }
45614
+ this.dispatch("CLEAR_CELLS", {
45615
+ sheetId: this.sheetId,
45616
+ target: this.zones,
45617
+ });
45596
45618
  this.dispatch("CLEAR_FORMATTING", {
45597
45619
  sheetId: this.sheetId,
45598
45620
  target: this.zones,
@@ -45941,9 +45963,7 @@
45941
45963
  bottom: rowIndex,
45942
45964
  }));
45943
45965
  const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
45944
- for (const { col, row } of positions(zone)) {
45945
- this.dispatch("CLEAR_CELL", { col, row, sheetId });
45946
- }
45966
+ this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
45947
45967
  const zonePasted = {
45948
45968
  left: zone.left,
45949
45969
  top: zone.top,
@@ -47968,6 +47988,9 @@
47968
47988
  if (showFormula && cell?.isFormula) {
47969
47989
  return localizeFormula(cell.content, this.getters.getLocale());
47970
47990
  }
47991
+ else if (showFormula && !cell?.content) {
47992
+ return "";
47993
+ }
47971
47994
  else {
47972
47995
  return this.getters.getEvaluatedCell(position).formattedValue;
47973
47996
  }
@@ -48215,6 +48238,7 @@
48215
48238
  const repeatCommandTransformRegistry = new Registry();
48216
48239
  repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
48217
48240
  repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
48241
+ repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
48218
48242
  repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
48219
48243
  repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
48220
48244
  repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
@@ -48956,9 +48980,10 @@
48956
48980
  case "DELETE_CELL": {
48957
48981
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
48958
48982
  if (!isZoneValid(cut[0])) {
48959
- for (const { col, row } of positions(cmd.zone)) {
48960
- this.dispatch("CLEAR_CELL", { col, row, sheetId: this.getters.getActiveSheetId() });
48961
- }
48983
+ this.dispatch("CLEAR_CELLS", {
48984
+ target: [cmd.zone],
48985
+ sheetId: this.getters.getActiveSheetId(),
48986
+ });
48962
48987
  break;
48963
48988
  }
48964
48989
  const state = this.getClipboardStateForCopyCells(cut, "CUT");
@@ -57390,7 +57415,7 @@
57390
57415
  this.session.join(this.config.client);
57391
57416
  }
57392
57417
  leaveSession() {
57393
- this.session.leave(this.exportData());
57418
+ this.session.leave(lazy(() => this.exportData()));
57394
57419
  }
57395
57420
  setupUiPlugin(Plugin) {
57396
57421
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57902,9 +57927,9 @@
57902
57927
  exports.tokenize = tokenize;
57903
57928
 
57904
57929
 
57905
- __info__.version = "17.1.27";
57906
- __info__.date = "2024-08-09T12:20:52.051Z";
57907
- __info__.hash = "c626332";
57930
+ __info__.version = "17.1.28";
57931
+ __info__.date = "2024-08-19T08:08:59.669Z";
57932
+ __info__.hash = "9674f1b";
57908
57933
 
57909
57934
 
57910
57935
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);