@odoo/o-spreadsheet 17.0.34 → 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.
@@ -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.34
6
- * @date 2024-08-09T12:20:17.042Z
7
- * @hash 1573912
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].value === "=") {
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
  */
@@ -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);
@@ -44456,7 +44481,7 @@
44456
44481
  */
44457
44482
  leave(data) {
44458
44483
  if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44459
- this.snapshot(data);
44484
+ this.snapshot(data());
44460
44485
  }
44461
44486
  delete this.clients[this.clientId];
44462
44487
  this.transportService.leave(this.clientId);
@@ -45127,13 +45152,10 @@
45127
45152
  * Clear the clipped zones: remove the cells and clear the formatting
45128
45153
  */
45129
45154
  clearClippedZones() {
45130
- for (const row of this.cells) {
45131
- for (const cell of row) {
45132
- if (cell?.cell) {
45133
- this.dispatch("CLEAR_CELL", cell.position);
45134
- }
45135
- }
45136
- }
45155
+ this.dispatch("CLEAR_CELLS", {
45156
+ sheetId: this.sheetId,
45157
+ target: this.zones,
45158
+ });
45137
45159
  this.dispatch("CLEAR_FORMATTING", {
45138
45160
  sheetId: this.sheetId,
45139
45161
  target: this.zones,
@@ -45481,9 +45503,7 @@
45481
45503
  bottom: rowIndex,
45482
45504
  }));
45483
45505
  const state = new ClipboardCellsState(rowsToKeep, "COPY", this.getters, this.dispatch, this.selection);
45484
- for (const { col, row } of positions(zone)) {
45485
- this.dispatch("CLEAR_CELL", { col, row, sheetId });
45486
- }
45506
+ this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
45487
45507
  const zonePasted = {
45488
45508
  left: zone.left,
45489
45509
  top: zone.top,
@@ -47555,6 +47575,9 @@
47555
47575
  if (showFormula && cell?.isFormula) {
47556
47576
  return localizeFormula(cell.content, this.getters.getLocale());
47557
47577
  }
47578
+ else if (showFormula && !cell?.content) {
47579
+ return "";
47580
+ }
47558
47581
  else {
47559
47582
  return this.getters.getEvaluatedCell(position).formattedValue;
47560
47583
  }
@@ -47750,6 +47773,7 @@
47750
47773
  const repeatCommandTransformRegistry = new Registry();
47751
47774
  repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
47752
47775
  repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
47776
+ repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
47753
47777
  repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
47754
47778
  repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
47755
47779
  repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
@@ -48489,9 +48513,10 @@
48489
48513
  case "DELETE_CELL": {
48490
48514
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
48491
48515
  if (!isZoneValid(cut[0])) {
48492
- for (const { col, row } of positions(cmd.zone)) {
48493
- this.dispatch("CLEAR_CELL", { col, row, sheetId: this.getters.getActiveSheetId() });
48494
- }
48516
+ this.dispatch("CLEAR_CELLS", {
48517
+ target: [cmd.zone],
48518
+ sheetId: this.getters.getActiveSheetId(),
48519
+ });
48495
48520
  break;
48496
48521
  }
48497
48522
  const state = this.getClipboardStateForCopyCells(cut, "CUT");
@@ -57092,7 +57117,7 @@
57092
57117
  this.session.join(this.config.client);
57093
57118
  }
57094
57119
  leaveSession() {
57095
- this.session.leave(this.exportData());
57120
+ this.session.leave(lazy(() => this.exportData()));
57096
57121
  }
57097
57122
  setupUiPlugin(Plugin) {
57098
57123
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57595,9 +57620,9 @@
57595
57620
  exports.tokenize = tokenize;
57596
57621
 
57597
57622
 
57598
- __info__.version = "17.0.34";
57599
- __info__.date = "2024-08-09T12:20:17.042Z";
57600
- __info__.hash = "1573912";
57623
+ __info__.version = "17.0.35";
57624
+ __info__.date = "2024-08-19T08:09:02.631Z";
57625
+ __info__.hash = "5572654";
57601
57626
 
57602
57627
 
57603
57628
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);