@odoo/o-spreadsheet 15.0.25 → 15.0.26

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.
@@ -1378,7 +1378,7 @@ class DispatchResult {
1378
1378
  * Static helper which returns a successful DispatchResult
1379
1379
  */
1380
1380
  static get Success() {
1381
- return new DispatchResult();
1381
+ return SUCCESS;
1382
1382
  }
1383
1383
  get isSuccessful() {
1384
1384
  return this.reasons.length === 0;
@@ -1391,6 +1391,7 @@ class DispatchResult {
1391
1391
  return this.reasons.includes(reason);
1392
1392
  }
1393
1393
  }
1394
+ const SUCCESS = new DispatchResult();
1394
1395
  exports.CommandResult = void 0;
1395
1396
  (function (CommandResult) {
1396
1397
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9112,12 +9113,13 @@ class BordersPlugin extends CorePlugin {
9112
9113
  this.clearBorders(cmd.sheetId, cmd.target);
9113
9114
  break;
9114
9115
  case "REMOVE_COLUMNS_ROWS":
9115
- for (let el of cmd.elements) {
9116
+ cmd.elements.sort((a, b) => b - a);
9117
+ for (const group of groupConsecutive(cmd.elements)) {
9116
9118
  if (cmd.dimension === "COL") {
9117
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9119
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9118
9120
  }
9119
9121
  else {
9120
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9122
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9121
9123
  }
9122
9124
  }
9123
9125
  break;
@@ -11833,7 +11835,7 @@ class SheetPlugin extends CorePlugin {
11833
11835
  });
11834
11836
  }
11835
11837
  if (colIndex > deletedColumn) {
11836
- this.dispatch("UPDATE_CELL_POSITION", {
11838
+ this.updateCellPosition({
11837
11839
  sheetId: sheet.id,
11838
11840
  cellId: cell.id,
11839
11841
  cell: cell,
@@ -11849,7 +11851,7 @@ class SheetPlugin extends CorePlugin {
11849
11851
  * Move the cells after a column or rows insertion
11850
11852
  */
11851
11853
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11852
- const commands = [];
11854
+ const updates = [];
11853
11855
  for (const [index, row] of Object.entries(sheet.rows)) {
11854
11856
  const rowIndex = parseInt(index, 10);
11855
11857
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11858,8 +11860,7 @@ class SheetPlugin extends CorePlugin {
11858
11860
  const cell = row.cells[i];
11859
11861
  if (cell) {
11860
11862
  if (dimension === "rows" || colIndex >= addedElement) {
11861
- commands.push({
11862
- type: "UPDATE_CELL_POSITION",
11863
+ updates.push({
11863
11864
  sheetId: sheet.id,
11864
11865
  cellId: cell.id,
11865
11866
  cell: cell,
@@ -11871,8 +11872,8 @@ class SheetPlugin extends CorePlugin {
11871
11872
  }
11872
11873
  }
11873
11874
  }
11874
- for (let cmd of commands.reverse()) {
11875
- this.dispatch(cmd.type, cmd);
11875
+ for (let update of updates.reverse()) {
11876
+ this.updateCellPosition(update);
11876
11877
  }
11877
11878
  }
11878
11879
  /**
@@ -11905,7 +11906,7 @@ class SheetPlugin extends CorePlugin {
11905
11906
  const colIndex = parseInt(i, 10);
11906
11907
  const cell = row.cells[i];
11907
11908
  if (cell) {
11908
- this.dispatch("UPDATE_CELL_POSITION", {
11909
+ this.updateCellPosition({
11909
11910
  sheetId: sheet.id,
11910
11911
  cellId: cell.id,
11911
11912
  cell: cell,
@@ -31578,6 +31579,6 @@ exports.registries = registries;
31578
31579
  exports.setTranslationMethod = setTranslationMethod;
31579
31580
 
31580
31581
 
31581
- __info__.version = '15.0.25';
31582
- __info__.date = '2024-07-08T05:35:32.050Z';
31583
- __info__.hash = '364ec3b';
31582
+ __info__.version = '15.0.26';
31583
+ __info__.date = '2024-08-02T08:17:56.757Z';
31584
+ __info__.hash = '3f93d36';
@@ -1355,7 +1355,7 @@ class DispatchResult {
1355
1355
  * Static helper which returns a successful DispatchResult
1356
1356
  */
1357
1357
  static get Success() {
1358
- return new DispatchResult();
1358
+ return SUCCESS;
1359
1359
  }
1360
1360
  get isSuccessful() {
1361
1361
  return this.reasons.length === 0;
@@ -1368,6 +1368,7 @@ class DispatchResult {
1368
1368
  return this.reasons.includes(reason);
1369
1369
  }
1370
1370
  }
1371
+ const SUCCESS = new DispatchResult();
1371
1372
  var CommandResult;
1372
1373
  (function (CommandResult) {
1373
1374
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9089,12 +9090,13 @@ class BordersPlugin extends CorePlugin {
9089
9090
  this.clearBorders(cmd.sheetId, cmd.target);
9090
9091
  break;
9091
9092
  case "REMOVE_COLUMNS_ROWS":
9092
- for (let el of cmd.elements) {
9093
+ cmd.elements.sort((a, b) => b - a);
9094
+ for (const group of groupConsecutive(cmd.elements)) {
9093
9095
  if (cmd.dimension === "COL") {
9094
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9096
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9095
9097
  }
9096
9098
  else {
9097
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9099
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9098
9100
  }
9099
9101
  }
9100
9102
  break;
@@ -11810,7 +11812,7 @@ class SheetPlugin extends CorePlugin {
11810
11812
  });
11811
11813
  }
11812
11814
  if (colIndex > deletedColumn) {
11813
- this.dispatch("UPDATE_CELL_POSITION", {
11815
+ this.updateCellPosition({
11814
11816
  sheetId: sheet.id,
11815
11817
  cellId: cell.id,
11816
11818
  cell: cell,
@@ -11826,7 +11828,7 @@ class SheetPlugin extends CorePlugin {
11826
11828
  * Move the cells after a column or rows insertion
11827
11829
  */
11828
11830
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11829
- const commands = [];
11831
+ const updates = [];
11830
11832
  for (const [index, row] of Object.entries(sheet.rows)) {
11831
11833
  const rowIndex = parseInt(index, 10);
11832
11834
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11835,8 +11837,7 @@ class SheetPlugin extends CorePlugin {
11835
11837
  const cell = row.cells[i];
11836
11838
  if (cell) {
11837
11839
  if (dimension === "rows" || colIndex >= addedElement) {
11838
- commands.push({
11839
- type: "UPDATE_CELL_POSITION",
11840
+ updates.push({
11840
11841
  sheetId: sheet.id,
11841
11842
  cellId: cell.id,
11842
11843
  cell: cell,
@@ -11848,8 +11849,8 @@ class SheetPlugin extends CorePlugin {
11848
11849
  }
11849
11850
  }
11850
11851
  }
11851
- for (let cmd of commands.reverse()) {
11852
- this.dispatch(cmd.type, cmd);
11852
+ for (let update of updates.reverse()) {
11853
+ this.updateCellPosition(update);
11853
11854
  }
11854
11855
  }
11855
11856
  /**
@@ -11882,7 +11883,7 @@ class SheetPlugin extends CorePlugin {
11882
11883
  const colIndex = parseInt(i, 10);
11883
11884
  const cell = row.cells[i];
11884
11885
  if (cell) {
11885
- this.dispatch("UPDATE_CELL_POSITION", {
11886
+ this.updateCellPosition({
11886
11887
  sheetId: sheet.id,
11887
11888
  cellId: cell.id,
11888
11889
  cell: cell,
@@ -31533,6 +31534,6 @@ const helpers = {
31533
31534
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31534
31535
 
31535
31536
 
31536
- __info__.version = '15.0.25';
31537
- __info__.date = '2024-07-08T05:35:32.050Z';
31538
- __info__.hash = '364ec3b';
31537
+ __info__.version = '15.0.26';
31538
+ __info__.date = '2024-08-02T08:17:56.757Z';
31539
+ __info__.hash = '3f93d36';
@@ -1375,7 +1375,7 @@
1375
1375
  * Static helper which returns a successful DispatchResult
1376
1376
  */
1377
1377
  static get Success() {
1378
- return new DispatchResult();
1378
+ return SUCCESS;
1379
1379
  }
1380
1380
  get isSuccessful() {
1381
1381
  return this.reasons.length === 0;
@@ -1388,6 +1388,7 @@
1388
1388
  return this.reasons.includes(reason);
1389
1389
  }
1390
1390
  }
1391
+ const SUCCESS = new DispatchResult();
1391
1392
  exports.CommandResult = void 0;
1392
1393
  (function (CommandResult) {
1393
1394
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9109,12 +9110,13 @@
9109
9110
  this.clearBorders(cmd.sheetId, cmd.target);
9110
9111
  break;
9111
9112
  case "REMOVE_COLUMNS_ROWS":
9112
- for (let el of cmd.elements) {
9113
+ cmd.elements.sort((a, b) => b - a);
9114
+ for (const group of groupConsecutive(cmd.elements)) {
9113
9115
  if (cmd.dimension === "COL") {
9114
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9116
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9115
9117
  }
9116
9118
  else {
9117
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9119
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9118
9120
  }
9119
9121
  }
9120
9122
  break;
@@ -11830,7 +11832,7 @@
11830
11832
  });
11831
11833
  }
11832
11834
  if (colIndex > deletedColumn) {
11833
- this.dispatch("UPDATE_CELL_POSITION", {
11835
+ this.updateCellPosition({
11834
11836
  sheetId: sheet.id,
11835
11837
  cellId: cell.id,
11836
11838
  cell: cell,
@@ -11846,7 +11848,7 @@
11846
11848
  * Move the cells after a column or rows insertion
11847
11849
  */
11848
11850
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11849
- const commands = [];
11851
+ const updates = [];
11850
11852
  for (const [index, row] of Object.entries(sheet.rows)) {
11851
11853
  const rowIndex = parseInt(index, 10);
11852
11854
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11855,8 +11857,7 @@
11855
11857
  const cell = row.cells[i];
11856
11858
  if (cell) {
11857
11859
  if (dimension === "rows" || colIndex >= addedElement) {
11858
- commands.push({
11859
- type: "UPDATE_CELL_POSITION",
11860
+ updates.push({
11860
11861
  sheetId: sheet.id,
11861
11862
  cellId: cell.id,
11862
11863
  cell: cell,
@@ -11868,8 +11869,8 @@
11868
11869
  }
11869
11870
  }
11870
11871
  }
11871
- for (let cmd of commands.reverse()) {
11872
- this.dispatch(cmd.type, cmd);
11872
+ for (let update of updates.reverse()) {
11873
+ this.updateCellPosition(update);
11873
11874
  }
11874
11875
  }
11875
11876
  /**
@@ -11902,7 +11903,7 @@
11902
11903
  const colIndex = parseInt(i, 10);
11903
11904
  const cell = row.cells[i];
11904
11905
  if (cell) {
11905
- this.dispatch("UPDATE_CELL_POSITION", {
11906
+ this.updateCellPosition({
11906
11907
  sheetId: sheet.id,
11907
11908
  cellId: cell.id,
11908
11909
  cell: cell,
@@ -31577,9 +31578,9 @@
31577
31578
  Object.defineProperty(exports, '__esModule', { value: true });
31578
31579
 
31579
31580
 
31580
- __info__.version = '15.0.25';
31581
- __info__.date = '2024-07-08T05:35:32.050Z';
31582
- __info__.hash = '364ec3b';
31581
+ __info__.version = '15.0.26';
31582
+ __info__.date = '2024-08-02T08:17:56.757Z';
31583
+ __info__.hash = '3f93d36';
31583
31584
 
31584
31585
 
31585
31586
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);