@odoo/o-spreadsheet 15.0.24 → 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.
@@ -767,6 +767,9 @@ function getPredicate(descr, isQuery) {
767
767
  return result;
768
768
  }
769
769
  function operandToRegExp(operand) {
770
+ if (operand === "*") {
771
+ return /.+/;
772
+ }
770
773
  let exp = "";
771
774
  let predecessor = "";
772
775
  for (let char of operand) {
@@ -790,9 +793,9 @@ function operandToRegExp(operand) {
790
793
  }
791
794
  return new RegExp("^" + exp + "$", "i");
792
795
  }
793
- function evaluatePredicate(value, criterion) {
796
+ function evaluatePredicate(value = "", criterion) {
794
797
  const { operator, operand } = criterion;
795
- if (value === undefined || operand === undefined) {
798
+ if (operand === undefined) {
796
799
  return false;
797
800
  }
798
801
  if (typeof operand === "number" && operator === "=") {
@@ -1375,7 +1378,7 @@ class DispatchResult {
1375
1378
  * Static helper which returns a successful DispatchResult
1376
1379
  */
1377
1380
  static get Success() {
1378
- return new DispatchResult();
1381
+ return SUCCESS;
1379
1382
  }
1380
1383
  get isSuccessful() {
1381
1384
  return this.reasons.length === 0;
@@ -1388,6 +1391,7 @@ class DispatchResult {
1388
1391
  return this.reasons.includes(reason);
1389
1392
  }
1390
1393
  }
1394
+ const SUCCESS = new DispatchResult();
1391
1395
  exports.CommandResult = void 0;
1392
1396
  (function (CommandResult) {
1393
1397
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9109,12 +9113,13 @@ class BordersPlugin extends CorePlugin {
9109
9113
  this.clearBorders(cmd.sheetId, cmd.target);
9110
9114
  break;
9111
9115
  case "REMOVE_COLUMNS_ROWS":
9112
- for (let el of cmd.elements) {
9116
+ cmd.elements.sort((a, b) => b - a);
9117
+ for (const group of groupConsecutive(cmd.elements)) {
9113
9118
  if (cmd.dimension === "COL") {
9114
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9119
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9115
9120
  }
9116
9121
  else {
9117
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9122
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9118
9123
  }
9119
9124
  }
9120
9125
  break;
@@ -11830,7 +11835,7 @@ class SheetPlugin extends CorePlugin {
11830
11835
  });
11831
11836
  }
11832
11837
  if (colIndex > deletedColumn) {
11833
- this.dispatch("UPDATE_CELL_POSITION", {
11838
+ this.updateCellPosition({
11834
11839
  sheetId: sheet.id,
11835
11840
  cellId: cell.id,
11836
11841
  cell: cell,
@@ -11846,7 +11851,7 @@ class SheetPlugin extends CorePlugin {
11846
11851
  * Move the cells after a column or rows insertion
11847
11852
  */
11848
11853
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11849
- const commands = [];
11854
+ const updates = [];
11850
11855
  for (const [index, row] of Object.entries(sheet.rows)) {
11851
11856
  const rowIndex = parseInt(index, 10);
11852
11857
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11855,8 +11860,7 @@ class SheetPlugin extends CorePlugin {
11855
11860
  const cell = row.cells[i];
11856
11861
  if (cell) {
11857
11862
  if (dimension === "rows" || colIndex >= addedElement) {
11858
- commands.push({
11859
- type: "UPDATE_CELL_POSITION",
11863
+ updates.push({
11860
11864
  sheetId: sheet.id,
11861
11865
  cellId: cell.id,
11862
11866
  cell: cell,
@@ -11868,8 +11872,8 @@ class SheetPlugin extends CorePlugin {
11868
11872
  }
11869
11873
  }
11870
11874
  }
11871
- for (let cmd of commands.reverse()) {
11872
- this.dispatch(cmd.type, cmd);
11875
+ for (let update of updates.reverse()) {
11876
+ this.updateCellPosition(update);
11873
11877
  }
11874
11878
  }
11875
11879
  /**
@@ -11902,7 +11906,7 @@ class SheetPlugin extends CorePlugin {
11902
11906
  const colIndex = parseInt(i, 10);
11903
11907
  const cell = row.cells[i];
11904
11908
  if (cell) {
11905
- this.dispatch("UPDATE_CELL_POSITION", {
11909
+ this.updateCellPosition({
11906
11910
  sheetId: sheet.id,
11907
11911
  cellId: cell.id,
11908
11912
  cell: cell,
@@ -31575,6 +31579,6 @@ exports.registries = registries;
31575
31579
  exports.setTranslationMethod = setTranslationMethod;
31576
31580
 
31577
31581
 
31578
- __info__.version = '15.0.24';
31579
- __info__.date = '2024-07-02T08:44:51.424Z';
31580
- __info__.hash = 'd1f2791';
31582
+ __info__.version = '15.0.26';
31583
+ __info__.date = '2024-08-02T08:17:56.757Z';
31584
+ __info__.hash = '3f93d36';
@@ -744,6 +744,9 @@ function getPredicate(descr, isQuery) {
744
744
  return result;
745
745
  }
746
746
  function operandToRegExp(operand) {
747
+ if (operand === "*") {
748
+ return /.+/;
749
+ }
747
750
  let exp = "";
748
751
  let predecessor = "";
749
752
  for (let char of operand) {
@@ -767,9 +770,9 @@ function operandToRegExp(operand) {
767
770
  }
768
771
  return new RegExp("^" + exp + "$", "i");
769
772
  }
770
- function evaluatePredicate(value, criterion) {
773
+ function evaluatePredicate(value = "", criterion) {
771
774
  const { operator, operand } = criterion;
772
- if (value === undefined || operand === undefined) {
775
+ if (operand === undefined) {
773
776
  return false;
774
777
  }
775
778
  if (typeof operand === "number" && operator === "=") {
@@ -1352,7 +1355,7 @@ class DispatchResult {
1352
1355
  * Static helper which returns a successful DispatchResult
1353
1356
  */
1354
1357
  static get Success() {
1355
- return new DispatchResult();
1358
+ return SUCCESS;
1356
1359
  }
1357
1360
  get isSuccessful() {
1358
1361
  return this.reasons.length === 0;
@@ -1365,6 +1368,7 @@ class DispatchResult {
1365
1368
  return this.reasons.includes(reason);
1366
1369
  }
1367
1370
  }
1371
+ const SUCCESS = new DispatchResult();
1368
1372
  var CommandResult;
1369
1373
  (function (CommandResult) {
1370
1374
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9086,12 +9090,13 @@ class BordersPlugin extends CorePlugin {
9086
9090
  this.clearBorders(cmd.sheetId, cmd.target);
9087
9091
  break;
9088
9092
  case "REMOVE_COLUMNS_ROWS":
9089
- for (let el of cmd.elements) {
9093
+ cmd.elements.sort((a, b) => b - a);
9094
+ for (const group of groupConsecutive(cmd.elements)) {
9090
9095
  if (cmd.dimension === "COL") {
9091
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9096
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9092
9097
  }
9093
9098
  else {
9094
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9099
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9095
9100
  }
9096
9101
  }
9097
9102
  break;
@@ -11807,7 +11812,7 @@ class SheetPlugin extends CorePlugin {
11807
11812
  });
11808
11813
  }
11809
11814
  if (colIndex > deletedColumn) {
11810
- this.dispatch("UPDATE_CELL_POSITION", {
11815
+ this.updateCellPosition({
11811
11816
  sheetId: sheet.id,
11812
11817
  cellId: cell.id,
11813
11818
  cell: cell,
@@ -11823,7 +11828,7 @@ class SheetPlugin extends CorePlugin {
11823
11828
  * Move the cells after a column or rows insertion
11824
11829
  */
11825
11830
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11826
- const commands = [];
11831
+ const updates = [];
11827
11832
  for (const [index, row] of Object.entries(sheet.rows)) {
11828
11833
  const rowIndex = parseInt(index, 10);
11829
11834
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11832,8 +11837,7 @@ class SheetPlugin extends CorePlugin {
11832
11837
  const cell = row.cells[i];
11833
11838
  if (cell) {
11834
11839
  if (dimension === "rows" || colIndex >= addedElement) {
11835
- commands.push({
11836
- type: "UPDATE_CELL_POSITION",
11840
+ updates.push({
11837
11841
  sheetId: sheet.id,
11838
11842
  cellId: cell.id,
11839
11843
  cell: cell,
@@ -11845,8 +11849,8 @@ class SheetPlugin extends CorePlugin {
11845
11849
  }
11846
11850
  }
11847
11851
  }
11848
- for (let cmd of commands.reverse()) {
11849
- this.dispatch(cmd.type, cmd);
11852
+ for (let update of updates.reverse()) {
11853
+ this.updateCellPosition(update);
11850
11854
  }
11851
11855
  }
11852
11856
  /**
@@ -11879,7 +11883,7 @@ class SheetPlugin extends CorePlugin {
11879
11883
  const colIndex = parseInt(i, 10);
11880
11884
  const cell = row.cells[i];
11881
11885
  if (cell) {
11882
- this.dispatch("UPDATE_CELL_POSITION", {
11886
+ this.updateCellPosition({
11883
11887
  sheetId: sheet.id,
11884
11888
  cellId: cell.id,
11885
11889
  cell: cell,
@@ -31530,6 +31534,6 @@ const helpers = {
31530
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 };
31531
31535
 
31532
31536
 
31533
- __info__.version = '15.0.24';
31534
- __info__.date = '2024-07-02T08:44:51.424Z';
31535
- __info__.hash = 'd1f2791';
31537
+ __info__.version = '15.0.26';
31538
+ __info__.date = '2024-08-02T08:17:56.757Z';
31539
+ __info__.hash = '3f93d36';
@@ -764,6 +764,9 @@
764
764
  return result;
765
765
  }
766
766
  function operandToRegExp(operand) {
767
+ if (operand === "*") {
768
+ return /.+/;
769
+ }
767
770
  let exp = "";
768
771
  let predecessor = "";
769
772
  for (let char of operand) {
@@ -787,9 +790,9 @@
787
790
  }
788
791
  return new RegExp("^" + exp + "$", "i");
789
792
  }
790
- function evaluatePredicate(value, criterion) {
793
+ function evaluatePredicate(value = "", criterion) {
791
794
  const { operator, operand } = criterion;
792
- if (value === undefined || operand === undefined) {
795
+ if (operand === undefined) {
793
796
  return false;
794
797
  }
795
798
  if (typeof operand === "number" && operator === "=") {
@@ -1372,7 +1375,7 @@
1372
1375
  * Static helper which returns a successful DispatchResult
1373
1376
  */
1374
1377
  static get Success() {
1375
- return new DispatchResult();
1378
+ return SUCCESS;
1376
1379
  }
1377
1380
  get isSuccessful() {
1378
1381
  return this.reasons.length === 0;
@@ -1385,6 +1388,7 @@
1385
1388
  return this.reasons.includes(reason);
1386
1389
  }
1387
1390
  }
1391
+ const SUCCESS = new DispatchResult();
1388
1392
  exports.CommandResult = void 0;
1389
1393
  (function (CommandResult) {
1390
1394
  CommandResult[CommandResult["Success"] = 0] = "Success";
@@ -9106,12 +9110,13 @@
9106
9110
  this.clearBorders(cmd.sheetId, cmd.target);
9107
9111
  break;
9108
9112
  case "REMOVE_COLUMNS_ROWS":
9109
- for (let el of cmd.elements) {
9113
+ cmd.elements.sort((a, b) => b - a);
9114
+ for (const group of groupConsecutive(cmd.elements)) {
9110
9115
  if (cmd.dimension === "COL") {
9111
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
9116
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9112
9117
  }
9113
9118
  else {
9114
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
9119
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
9115
9120
  }
9116
9121
  }
9117
9122
  break;
@@ -11827,7 +11832,7 @@
11827
11832
  });
11828
11833
  }
11829
11834
  if (colIndex > deletedColumn) {
11830
- this.dispatch("UPDATE_CELL_POSITION", {
11835
+ this.updateCellPosition({
11831
11836
  sheetId: sheet.id,
11832
11837
  cellId: cell.id,
11833
11838
  cell: cell,
@@ -11843,7 +11848,7 @@
11843
11848
  * Move the cells after a column or rows insertion
11844
11849
  */
11845
11850
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
11846
- const commands = [];
11851
+ const updates = [];
11847
11852
  for (const [index, row] of Object.entries(sheet.rows)) {
11848
11853
  const rowIndex = parseInt(index, 10);
11849
11854
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -11852,8 +11857,7 @@
11852
11857
  const cell = row.cells[i];
11853
11858
  if (cell) {
11854
11859
  if (dimension === "rows" || colIndex >= addedElement) {
11855
- commands.push({
11856
- type: "UPDATE_CELL_POSITION",
11860
+ updates.push({
11857
11861
  sheetId: sheet.id,
11858
11862
  cellId: cell.id,
11859
11863
  cell: cell,
@@ -11865,8 +11869,8 @@
11865
11869
  }
11866
11870
  }
11867
11871
  }
11868
- for (let cmd of commands.reverse()) {
11869
- this.dispatch(cmd.type, cmd);
11872
+ for (let update of updates.reverse()) {
11873
+ this.updateCellPosition(update);
11870
11874
  }
11871
11875
  }
11872
11876
  /**
@@ -11899,7 +11903,7 @@
11899
11903
  const colIndex = parseInt(i, 10);
11900
11904
  const cell = row.cells[i];
11901
11905
  if (cell) {
11902
- this.dispatch("UPDATE_CELL_POSITION", {
11906
+ this.updateCellPosition({
11903
11907
  sheetId: sheet.id,
11904
11908
  cellId: cell.id,
11905
11909
  cell: cell,
@@ -31574,9 +31578,9 @@
31574
31578
  Object.defineProperty(exports, '__esModule', { value: true });
31575
31579
 
31576
31580
 
31577
- __info__.version = '15.0.24';
31578
- __info__.date = '2024-07-02T08:44:51.424Z';
31579
- __info__.hash = 'd1f2791';
31581
+ __info__.version = '15.0.26';
31582
+ __info__.date = '2024-08-02T08:17:56.757Z';
31583
+ __info__.hash = '3f93d36';
31580
31584
 
31581
31585
 
31582
31586
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);