@odoo/o-spreadsheet 16.2.4 → 16.2.5

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.
@@ -4273,6 +4273,8 @@ exports.CommandResult = void 0;
4273
4273
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
4274
4274
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
4275
4275
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
4276
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
4277
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4276
4278
  })(exports.CommandResult || (exports.CommandResult = {}));
4277
4279
 
4278
4280
  var DIRECTION;
@@ -29481,9 +29483,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29481
29483
  const elements = cmd.dimension === "COL"
29482
29484
  ? this.getters.getNumberCols(cmd.sheetId)
29483
29485
  : this.getters.getNumberRows(cmd.sheetId);
29484
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29485
- ? 0 /* CommandResult.Success */
29486
- : 66 /* CommandResult.TooManyHiddenElements */;
29486
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29487
+ if (hiddenElements.size >= elements) {
29488
+ return 66 /* CommandResult.TooManyHiddenElements */;
29489
+ }
29490
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29491
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29492
+ }
29493
+ else {
29494
+ return 0 /* CommandResult.Success */;
29495
+ }
29487
29496
  }
29488
29497
  case "REMOVE_COLUMNS_ROWS":
29489
29498
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -30656,6 +30665,28 @@ class SheetPlugin extends CorePlugin {
30656
30665
  return this.orderedSheetIds.length > 1
30657
30666
  ? 0 /* CommandResult.Success */
30658
30667
  : 9 /* CommandResult.NotEnoughSheets */;
30668
+ case "ADD_COLUMNS_ROWS":
30669
+ const elements = cmd.dimension === "COL"
30670
+ ? this.getNumberCols(cmd.sheetId)
30671
+ : this.getNumberRows(cmd.sheetId);
30672
+ if (cmd.base < 0 || cmd.base > elements) {
30673
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30674
+ }
30675
+ else if (cmd.quantity <= 0) {
30676
+ return 87 /* CommandResult.InvalidQuantity */;
30677
+ }
30678
+ return 0 /* CommandResult.Success */;
30679
+ case "REMOVE_COLUMNS_ROWS": {
30680
+ const elements = cmd.dimension === "COL"
30681
+ ? this.getNumberCols(cmd.sheetId)
30682
+ : this.getNumberRows(cmd.sheetId);
30683
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30684
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30685
+ }
30686
+ else {
30687
+ return 0 /* CommandResult.Success */;
30688
+ }
30689
+ }
30659
30690
  case "FREEZE_ROWS": {
30660
30691
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
30661
30692
  }
@@ -45204,6 +45235,6 @@ exports.setTranslationMethod = setTranslationMethod;
45204
45235
  exports.tokenize = tokenize;
45205
45236
 
45206
45237
 
45207
- __info__.version = '16.2.4';
45208
- __info__.date = '2023-04-21T07:30:02.765Z';
45209
- __info__.hash = '7169d69';
45238
+ __info__.version = '16.2.5';
45239
+ __info__.date = '2023-04-28T12:25:41.422Z';
45240
+ __info__.hash = 'cc60a52';
@@ -2135,7 +2135,9 @@ declare const enum CommandResult {
2135
2135
  DuplicatedFigureId = 82,
2136
2136
  InvalidSelectionStep = 83,
2137
2137
  DuplicatedChartId = 84,
2138
- ChartDoesNotExist = 85
2138
+ ChartDoesNotExist = 85,
2139
+ InvalidHeaderIndex = 86,
2140
+ InvalidQuantity = 87
2139
2141
  }
2140
2142
  interface CommandHandler<T> {
2141
2143
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -3386,7 +3388,7 @@ declare class HeaderSizePlugin extends CorePlugin<HeaderSizeState> implements He
3386
3388
  declare class HeaderVisibilityPlugin extends CorePlugin {
3387
3389
  static getters: readonly ["canRemoveHeaders", "getHiddenColsGroups", "getHiddenRowsGroups", "isRowHiddenByUser", "isColHiddenByUser"];
3388
3390
  private readonly hiddenHeaders;
3389
- allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements;
3391
+ allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements | CommandResult.InvalidHeaderIndex;
3390
3392
  handle(cmd: Command): void;
3391
3393
  canRemoveHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
3392
3394
  isRowHiddenByUser(sheetId: UID, index: HeaderIndex): boolean;
@@ -4269,6 +4269,8 @@ var CommandResult;
4269
4269
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
4270
4270
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
4271
4271
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
4272
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
4273
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4272
4274
  })(CommandResult || (CommandResult = {}));
4273
4275
 
4274
4276
  var DIRECTION;
@@ -29477,9 +29479,16 @@ class HeaderVisibilityPlugin extends CorePlugin {
29477
29479
  const elements = cmd.dimension === "COL"
29478
29480
  ? this.getters.getNumberCols(cmd.sheetId)
29479
29481
  : this.getters.getNumberRows(cmd.sheetId);
29480
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29481
- ? 0 /* CommandResult.Success */
29482
- : 66 /* CommandResult.TooManyHiddenElements */;
29482
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29483
+ if (hiddenElements.size >= elements) {
29484
+ return 66 /* CommandResult.TooManyHiddenElements */;
29485
+ }
29486
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29487
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29488
+ }
29489
+ else {
29490
+ return 0 /* CommandResult.Success */;
29491
+ }
29483
29492
  }
29484
29493
  case "REMOVE_COLUMNS_ROWS":
29485
29494
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -30652,6 +30661,28 @@ class SheetPlugin extends CorePlugin {
30652
30661
  return this.orderedSheetIds.length > 1
30653
30662
  ? 0 /* CommandResult.Success */
30654
30663
  : 9 /* CommandResult.NotEnoughSheets */;
30664
+ case "ADD_COLUMNS_ROWS":
30665
+ const elements = cmd.dimension === "COL"
30666
+ ? this.getNumberCols(cmd.sheetId)
30667
+ : this.getNumberRows(cmd.sheetId);
30668
+ if (cmd.base < 0 || cmd.base > elements) {
30669
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30670
+ }
30671
+ else if (cmd.quantity <= 0) {
30672
+ return 87 /* CommandResult.InvalidQuantity */;
30673
+ }
30674
+ return 0 /* CommandResult.Success */;
30675
+ case "REMOVE_COLUMNS_ROWS": {
30676
+ const elements = cmd.dimension === "COL"
30677
+ ? this.getNumberCols(cmd.sheetId)
30678
+ : this.getNumberRows(cmd.sheetId);
30679
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30680
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30681
+ }
30682
+ else {
30683
+ return 0 /* CommandResult.Success */;
30684
+ }
30685
+ }
30655
30686
  case "FREEZE_ROWS": {
30656
30687
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
30657
30688
  }
@@ -45172,6 +45203,6 @@ function addFunction(functionName, functionDescription) {
45172
45203
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
45173
45204
 
45174
45205
 
45175
- __info__.version = '16.2.4';
45176
- __info__.date = '2023-04-21T07:30:02.765Z';
45177
- __info__.hash = '7169d69';
45206
+ __info__.version = '16.2.5';
45207
+ __info__.date = '2023-04-28T12:25:41.422Z';
45208
+ __info__.hash = 'cc60a52';
@@ -4270,6 +4270,8 @@
4270
4270
  CommandResult[CommandResult["InvalidSelectionStep"] = 83] = "InvalidSelectionStep";
4271
4271
  CommandResult[CommandResult["DuplicatedChartId"] = 84] = "DuplicatedChartId";
4272
4272
  CommandResult[CommandResult["ChartDoesNotExist"] = 85] = "ChartDoesNotExist";
4273
+ CommandResult[CommandResult["InvalidHeaderIndex"] = 86] = "InvalidHeaderIndex";
4274
+ CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4273
4275
  })(exports.CommandResult || (exports.CommandResult = {}));
4274
4276
 
4275
4277
  var DIRECTION;
@@ -29478,9 +29480,16 @@
29478
29480
  const elements = cmd.dimension === "COL"
29479
29481
  ? this.getters.getNumberCols(cmd.sheetId)
29480
29482
  : this.getters.getNumberRows(cmd.sheetId);
29481
- return (hiddenGroup || []).flat().concat(cmd.elements).length < elements
29482
- ? 0 /* CommandResult.Success */
29483
- : 66 /* CommandResult.TooManyHiddenElements */;
29483
+ const hiddenElements = new Set((hiddenGroup || []).flat().concat(cmd.elements));
29484
+ if (hiddenElements.size >= elements) {
29485
+ return 66 /* CommandResult.TooManyHiddenElements */;
29486
+ }
29487
+ else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29488
+ return 86 /* CommandResult.InvalidHeaderIndex */;
29489
+ }
29490
+ else {
29491
+ return 0 /* CommandResult.Success */;
29492
+ }
29484
29493
  }
29485
29494
  case "REMOVE_COLUMNS_ROWS":
29486
29495
  if (!this.getters.tryGetSheet(cmd.sheetId)) {
@@ -30653,6 +30662,28 @@
30653
30662
  return this.orderedSheetIds.length > 1
30654
30663
  ? 0 /* CommandResult.Success */
30655
30664
  : 9 /* CommandResult.NotEnoughSheets */;
30665
+ case "ADD_COLUMNS_ROWS":
30666
+ const elements = cmd.dimension === "COL"
30667
+ ? this.getNumberCols(cmd.sheetId)
30668
+ : this.getNumberRows(cmd.sheetId);
30669
+ if (cmd.base < 0 || cmd.base > elements) {
30670
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30671
+ }
30672
+ else if (cmd.quantity <= 0) {
30673
+ return 87 /* CommandResult.InvalidQuantity */;
30674
+ }
30675
+ return 0 /* CommandResult.Success */;
30676
+ case "REMOVE_COLUMNS_ROWS": {
30677
+ const elements = cmd.dimension === "COL"
30678
+ ? this.getNumberCols(cmd.sheetId)
30679
+ : this.getNumberRows(cmd.sheetId);
30680
+ if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30681
+ return 86 /* CommandResult.InvalidHeaderIndex */;
30682
+ }
30683
+ else {
30684
+ return 0 /* CommandResult.Success */;
30685
+ }
30686
+ }
30656
30687
  case "FREEZE_ROWS": {
30657
30688
  return this.checkValidations(cmd, this.checkRowFreezeQuantity, this.checkRowFreezeOverlapMerge);
30658
30689
  }
@@ -45203,9 +45234,9 @@
45203
45234
  Object.defineProperty(exports, '__esModule', { value: true });
45204
45235
 
45205
45236
 
45206
- __info__.version = '16.2.4';
45207
- __info__.date = '2023-04-21T07:30:02.765Z';
45208
- __info__.hash = '7169d69';
45237
+ __info__.version = '16.2.5';
45238
+ __info__.date = '2023-04-28T12:25:41.422Z';
45239
+ __info__.hash = 'cc60a52';
45209
45240
 
45210
45241
 
45211
45242
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);