@odoo/o-spreadsheet 17.1.27 → 17.1.29

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.29
6
+ * @date 2024-08-26T13:49:00.557Z
7
+ * @hash 52753da
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
  */
@@ -37978,7 +38001,10 @@
37978
38001
  handle(cmd) {
37979
38002
  switch (cmd.type) {
37980
38003
  case "CREATE_SHEET": {
37981
- this.history.update("sizes", cmd.sheetId, { COL: [], ROW: [] });
38004
+ this.history.update("sizes", cmd.sheetId, {
38005
+ COL: Array(this.getters.getNumberCols(cmd.sheetId)).fill(undefined),
38006
+ ROW: Array(this.getters.getNumberRows(cmd.sheetId)).fill(undefined),
38007
+ });
37982
38008
  break;
37983
38009
  }
37984
38010
  case "DUPLICATE_SHEET":
@@ -40011,19 +40037,23 @@
40011
40037
  }
40012
40038
  }
40013
40039
  moveCellOnColumnsDeletion(sheet, deletedColumn) {
40040
+ this.dispatch("CLEAR_CELLS", {
40041
+ sheetId: sheet.id,
40042
+ target: [
40043
+ {
40044
+ left: deletedColumn,
40045
+ top: 0,
40046
+ right: deletedColumn,
40047
+ bottom: sheet.rows.length - 1,
40048
+ },
40049
+ ],
40050
+ });
40014
40051
  for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
40015
40052
  const row = sheet.rows[rowIndex];
40016
40053
  for (let i in row.cells) {
40017
40054
  const colIndex = Number(i);
40018
40055
  const cellId = row.cells[i];
40019
40056
  if (cellId) {
40020
- if (colIndex === deletedColumn) {
40021
- this.dispatch("CLEAR_CELL", {
40022
- sheetId: sheet.id,
40023
- col: colIndex,
40024
- row: rowIndex,
40025
- });
40026
- }
40027
40057
  if (colIndex > deletedColumn) {
40028
40058
  this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
40029
40059
  }
@@ -40069,22 +40099,20 @@
40069
40099
  *
40070
40100
  */
40071
40101
  moveCellOnRowsDeletion(sheet, deleteFromRow, deleteToRow) {
40102
+ this.dispatch("CLEAR_CELLS", {
40103
+ sheetId: sheet.id,
40104
+ target: [
40105
+ {
40106
+ left: 0,
40107
+ top: deleteFromRow,
40108
+ right: this.getters.getNumberCols(sheet.id),
40109
+ bottom: deleteToRow,
40110
+ },
40111
+ ],
40112
+ });
40072
40113
  const numberRows = deleteToRow - deleteFromRow + 1;
40073
40114
  for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
40074
40115
  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
40116
  if (rowIndex > deleteToRow) {
40089
40117
  for (let i in row.cells) {
40090
40118
  const colIndex = Number(i);
@@ -44913,7 +44941,7 @@
44913
44941
  */
44914
44942
  leave(data) {
44915
44943
  if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44916
- this.snapshot(data);
44944
+ this.snapshot(data());
44917
44945
  }
44918
44946
  delete this.clients[this.clientId];
44919
44947
  this.transportService.leave(this.clientId);
@@ -45586,13 +45614,10 @@
45586
45614
  * Clear the clipped zones: remove the cells and clear the formatting
45587
45615
  */
45588
45616
  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
- }
45617
+ this.dispatch("CLEAR_CELLS", {
45618
+ sheetId: this.sheetId,
45619
+ target: this.zones,
45620
+ });
45596
45621
  this.dispatch("CLEAR_FORMATTING", {
45597
45622
  sheetId: this.sheetId,
45598
45623
  target: this.zones,
@@ -45941,9 +45966,7 @@
45941
45966
  bottom: rowIndex,
45942
45967
  }));
45943
45968
  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
- }
45969
+ this.dispatch("CLEAR_CELLS", { target: [zone], sheetId });
45947
45970
  const zonePasted = {
45948
45971
  left: zone.left,
45949
45972
  top: zone.top,
@@ -47968,6 +47991,9 @@
47968
47991
  if (showFormula && cell?.isFormula) {
47969
47992
  return localizeFormula(cell.content, this.getters.getLocale());
47970
47993
  }
47994
+ else if (showFormula && !cell?.content) {
47995
+ return "";
47996
+ }
47971
47997
  else {
47972
47998
  return this.getters.getEvaluatedCell(position).formattedValue;
47973
47999
  }
@@ -48215,6 +48241,7 @@
48215
48241
  const repeatCommandTransformRegistry = new Registry();
48216
48242
  repeatCommandTransformRegistry.add("UPDATE_CELL", genericRepeat);
48217
48243
  repeatCommandTransformRegistry.add("CLEAR_CELL", genericRepeat);
48244
+ repeatCommandTransformRegistry.add("CLEAR_CELLS", genericRepeat);
48218
48245
  repeatCommandTransformRegistry.add("DELETE_CONTENT", genericRepeat);
48219
48246
  repeatCommandTransformRegistry.add("ADD_MERGE", genericRepeat);
48220
48247
  repeatCommandTransformRegistry.add("REMOVE_MERGE", genericRepeat);
@@ -48956,9 +48983,10 @@
48956
48983
  case "DELETE_CELL": {
48957
48984
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
48958
48985
  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
- }
48986
+ this.dispatch("CLEAR_CELLS", {
48987
+ target: [cmd.zone],
48988
+ sheetId: this.getters.getActiveSheetId(),
48989
+ });
48962
48990
  break;
48963
48991
  }
48964
48992
  const state = this.getClipboardStateForCopyCells(cut, "CUT");
@@ -57390,7 +57418,7 @@
57390
57418
  this.session.join(this.config.client);
57391
57419
  }
57392
57420
  leaveSession() {
57393
- this.session.leave(this.exportData());
57421
+ this.session.leave(lazy(() => this.exportData()));
57394
57422
  }
57395
57423
  setupUiPlugin(Plugin) {
57396
57424
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57902,9 +57930,9 @@
57902
57930
  exports.tokenize = tokenize;
57903
57931
 
57904
57932
 
57905
- __info__.version = "17.1.27";
57906
- __info__.date = "2024-08-09T12:20:52.051Z";
57907
- __info__.hash = "c626332";
57933
+ __info__.version = "17.1.29";
57934
+ __info__.date = "2024-08-26T13:49:00.557Z";
57935
+ __info__.hash = "52753da";
57908
57936
 
57909
57937
 
57910
57938
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);