@odoo/o-spreadsheet 17.0.33 → 17.0.34

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.33
6
- * @date 2024-08-02T08:18:55.061Z
7
- * @hash 4ad4049
5
+ * @version 17.0.34
6
+ * @date 2024-08-09T12:20:17.042Z
7
+ * @hash 1573912
8
8
  */
9
9
 
10
10
  'use strict';
@@ -38662,7 +38662,7 @@ class RangeAdapter {
38662
38662
  * @param sheetXC the string description of a range, in the form SheetName!XC:XC
38663
38663
  */
38664
38664
  getRangeFromSheetXC(defaultSheetId, sheetXC) {
38665
- if (!rangeReference.test(sheetXC)) {
38665
+ if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
38666
38666
  return new RangeImpl({
38667
38667
  sheetId: "",
38668
38668
  zone: { left: -1, top: -1, right: -1, bottom: -1 },
@@ -41604,15 +41604,16 @@ class Evaluator {
41604
41604
  this.evaluatedCells = new Map();
41605
41605
  this.evaluate(this.getAllCells());
41606
41606
  }
41607
- evaluateFormula(sheetId, formulaString) {
41608
- const compiledFormula = compile(formulaString);
41609
- const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41610
- this.updateCompilationParameters();
41611
- const array = compiledFormula.execute(ranges, ...this.compilationParams);
41612
- if (isMatrix(array)) {
41613
- return matrixMap(array, (cell) => cell.value);
41607
+ evaluateFormulaResult(sheetId, formulaString) {
41608
+ try {
41609
+ const compiledFormula = compile(formulaString);
41610
+ const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41611
+ this.updateCompilationParameters();
41612
+ return compiledFormula.execute(ranges, ...this.compilationParams);
41613
+ }
41614
+ catch (error) {
41615
+ return this.handleError(error);
41614
41616
  }
41615
- return array.value;
41616
41617
  }
41617
41618
  getAllCells() {
41618
41619
  const positionIds = new JetSet();
@@ -41688,7 +41689,7 @@ class Evaluator {
41688
41689
  : evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
41689
41690
  }
41690
41691
  catch (e) {
41691
- return this.handleError(e, cell);
41692
+ return this.handleError(e);
41692
41693
  }
41693
41694
  finally {
41694
41695
  this.cellsBeingComputed.delete(cellId);
@@ -41703,7 +41704,7 @@ class Evaluator {
41703
41704
  }
41704
41705
  return evaluatedCell;
41705
41706
  }
41706
- handleError(e, cell) {
41707
+ handleError(e) {
41707
41708
  if (!(e instanceof EvaluationError)) {
41708
41709
  e = new EvaluationError(CellErrorType.GenericError, e.message);
41709
41710
  }
@@ -42037,6 +42038,7 @@ class PositionBitsEncoder {
42037
42038
  class EvaluationPlugin extends UIPlugin {
42038
42039
  static getters = [
42039
42040
  "evaluateFormula",
42041
+ "evaluateFormulaResult",
42040
42042
  "getCorrespondingFormulaCell",
42041
42043
  "getRangeFormattedValues",
42042
42044
  "getRangeValues",
@@ -42094,12 +42096,14 @@ class EvaluationPlugin extends UIPlugin {
42094
42096
  // Getters
42095
42097
  // ---------------------------------------------------------------------------
42096
42098
  evaluateFormula(sheetId, formulaString) {
42097
- try {
42098
- return this.evaluator.evaluateFormula(sheetId, formulaString);
42099
- }
42100
- catch (error) {
42101
- return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
42099
+ const result = this.evaluateFormulaResult(sheetId, formulaString);
42100
+ if (isMatrix(result)) {
42101
+ return matrixMap(result, (cell) => cell.value);
42102
42102
  }
42103
+ return result.value;
42104
+ }
42105
+ evaluateFormulaResult(sheetId, formulaString) {
42106
+ return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
42103
42107
  }
42104
42108
  /**
42105
42109
  * Return the value of each cell in the range as they are displayed in the grid.
@@ -45899,6 +45903,7 @@ class FormatPlugin extends UIPlugin {
45899
45903
  * evaluated and updated with the number type.
45900
45904
  */
45901
45905
  setDecimal(sheetId, zones, step) {
45906
+ const positionsByFormat = {};
45902
45907
  // Find the each cell with a number value and get the format
45903
45908
  for (const zone of zones) {
45904
45909
  for (const position of positions(zone)) {
@@ -45908,15 +45913,20 @@ class FormatPlugin extends UIPlugin {
45908
45913
  // of the format
45909
45914
  this.getters.getLocale();
45910
45915
  const newFormat = changeDecimalPlaces(numberFormat, step);
45911
- // Apply the new format on the whole zone
45912
- this.dispatch("SET_FORMATTING", {
45913
- sheetId,
45914
- target: [positionToZone(position)],
45915
- format: newFormat,
45916
- });
45916
+ positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
45917
+ positionsByFormat[newFormat].push(position);
45917
45918
  }
45918
45919
  }
45919
45920
  }
45921
+ // consolidate all positions with the same format in bigger zones
45922
+ for (const newFormat in positionsByFormat) {
45923
+ const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
45924
+ this.dispatch("SET_FORMATTING", {
45925
+ sheetId,
45926
+ format: newFormat,
45927
+ target: zones,
45928
+ });
45929
+ }
45920
45930
  }
45921
45931
  /**
45922
45932
  * Take a range of cells and return the format of the first cell containing a
@@ -57586,6 +57596,6 @@ exports.setTranslationMethod = setTranslationMethod;
57586
57596
  exports.tokenize = tokenize;
57587
57597
 
57588
57598
 
57589
- __info__.version = "17.0.33";
57590
- __info__.date = "2024-08-02T08:18:55.061Z";
57591
- __info__.hash = "4ad4049";
57599
+ __info__.version = "17.0.34";
57600
+ __info__.date = "2024-08-09T12:20:17.042Z";
57601
+ __info__.hash = "1573912";
@@ -4134,7 +4134,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4134
4134
  }
4135
4135
 
4136
4136
  declare class EvaluationPlugin extends UIPlugin {
4137
- static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
4137
+ static getters: readonly ["evaluateFormula", "evaluateFormulaResult", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn", "isEmpty"];
4138
4138
  private shouldRebuildDependenciesGraph;
4139
4139
  private evaluator;
4140
4140
  private positionsToUpdate;
@@ -4143,6 +4143,7 @@ declare class EvaluationPlugin extends UIPlugin {
4143
4143
  handle(cmd: CoreViewCommand): void;
4144
4144
  finalize(): void;
4145
4145
  evaluateFormula(sheetId: UID, formulaString: string): CellValue | Matrix<CellValue>;
4146
+ evaluateFormulaResult(sheetId: UID, formulaString: string): ValueAndFormat | Matrix<ValueAndFormat>;
4146
4147
  /**
4147
4148
  * Return the value of each cell in the range as they are displayed in the grid.
4148
4149
  */
@@ -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.33
6
- * @date 2024-08-02T08:18:55.061Z
7
- * @hash 4ad4049
5
+ * @version 17.0.34
6
+ * @date 2024-08-09T12:20:17.042Z
7
+ * @hash 1573912
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -38660,7 +38660,7 @@ class RangeAdapter {
38660
38660
  * @param sheetXC the string description of a range, in the form SheetName!XC:XC
38661
38661
  */
38662
38662
  getRangeFromSheetXC(defaultSheetId, sheetXC) {
38663
- if (!rangeReference.test(sheetXC)) {
38663
+ if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
38664
38664
  return new RangeImpl({
38665
38665
  sheetId: "",
38666
38666
  zone: { left: -1, top: -1, right: -1, bottom: -1 },
@@ -41602,15 +41602,16 @@ class Evaluator {
41602
41602
  this.evaluatedCells = new Map();
41603
41603
  this.evaluate(this.getAllCells());
41604
41604
  }
41605
- evaluateFormula(sheetId, formulaString) {
41606
- const compiledFormula = compile(formulaString);
41607
- const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41608
- this.updateCompilationParameters();
41609
- const array = compiledFormula.execute(ranges, ...this.compilationParams);
41610
- if (isMatrix(array)) {
41611
- return matrixMap(array, (cell) => cell.value);
41605
+ evaluateFormulaResult(sheetId, formulaString) {
41606
+ try {
41607
+ const compiledFormula = compile(formulaString);
41608
+ const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41609
+ this.updateCompilationParameters();
41610
+ return compiledFormula.execute(ranges, ...this.compilationParams);
41611
+ }
41612
+ catch (error) {
41613
+ return this.handleError(error);
41612
41614
  }
41613
- return array.value;
41614
41615
  }
41615
41616
  getAllCells() {
41616
41617
  const positionIds = new JetSet();
@@ -41686,7 +41687,7 @@ class Evaluator {
41686
41687
  : evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
41687
41688
  }
41688
41689
  catch (e) {
41689
- return this.handleError(e, cell);
41690
+ return this.handleError(e);
41690
41691
  }
41691
41692
  finally {
41692
41693
  this.cellsBeingComputed.delete(cellId);
@@ -41701,7 +41702,7 @@ class Evaluator {
41701
41702
  }
41702
41703
  return evaluatedCell;
41703
41704
  }
41704
- handleError(e, cell) {
41705
+ handleError(e) {
41705
41706
  if (!(e instanceof EvaluationError)) {
41706
41707
  e = new EvaluationError(CellErrorType.GenericError, e.message);
41707
41708
  }
@@ -42035,6 +42036,7 @@ class PositionBitsEncoder {
42035
42036
  class EvaluationPlugin extends UIPlugin {
42036
42037
  static getters = [
42037
42038
  "evaluateFormula",
42039
+ "evaluateFormulaResult",
42038
42040
  "getCorrespondingFormulaCell",
42039
42041
  "getRangeFormattedValues",
42040
42042
  "getRangeValues",
@@ -42092,12 +42094,14 @@ class EvaluationPlugin extends UIPlugin {
42092
42094
  // Getters
42093
42095
  // ---------------------------------------------------------------------------
42094
42096
  evaluateFormula(sheetId, formulaString) {
42095
- try {
42096
- return this.evaluator.evaluateFormula(sheetId, formulaString);
42097
- }
42098
- catch (error) {
42099
- return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
42097
+ const result = this.evaluateFormulaResult(sheetId, formulaString);
42098
+ if (isMatrix(result)) {
42099
+ return matrixMap(result, (cell) => cell.value);
42100
42100
  }
42101
+ return result.value;
42102
+ }
42103
+ evaluateFormulaResult(sheetId, formulaString) {
42104
+ return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
42101
42105
  }
42102
42106
  /**
42103
42107
  * Return the value of each cell in the range as they are displayed in the grid.
@@ -45897,6 +45901,7 @@ class FormatPlugin extends UIPlugin {
45897
45901
  * evaluated and updated with the number type.
45898
45902
  */
45899
45903
  setDecimal(sheetId, zones, step) {
45904
+ const positionsByFormat = {};
45900
45905
  // Find the each cell with a number value and get the format
45901
45906
  for (const zone of zones) {
45902
45907
  for (const position of positions(zone)) {
@@ -45906,15 +45911,20 @@ class FormatPlugin extends UIPlugin {
45906
45911
  // of the format
45907
45912
  this.getters.getLocale();
45908
45913
  const newFormat = changeDecimalPlaces(numberFormat, step);
45909
- // Apply the new format on the whole zone
45910
- this.dispatch("SET_FORMATTING", {
45911
- sheetId,
45912
- target: [positionToZone(position)],
45913
- format: newFormat,
45914
- });
45914
+ positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
45915
+ positionsByFormat[newFormat].push(position);
45915
45916
  }
45916
45917
  }
45917
45918
  }
45919
+ // consolidate all positions with the same format in bigger zones
45920
+ for (const newFormat in positionsByFormat) {
45921
+ const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
45922
+ this.dispatch("SET_FORMATTING", {
45923
+ sheetId,
45924
+ format: newFormat,
45925
+ target: zones,
45926
+ });
45927
+ }
45918
45928
  }
45919
45929
  /**
45920
45930
  * Take a range of cells and return the format of the first cell containing a
@@ -57549,6 +57559,6 @@ const constants = {
57549
57559
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57550
57560
 
57551
57561
 
57552
- __info__.version = "17.0.33";
57553
- __info__.date = "2024-08-02T08:18:55.061Z";
57554
- __info__.hash = "4ad4049";
57562
+ __info__.version = "17.0.34";
57563
+ __info__.date = "2024-08-09T12:20:17.042Z";
57564
+ __info__.hash = "1573912";
@@ -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.33
6
- * @date 2024-08-02T08:18:55.061Z
7
- * @hash 4ad4049
5
+ * @version 17.0.34
6
+ * @date 2024-08-09T12:20:17.042Z
7
+ * @hash 1573912
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -38661,7 +38661,7 @@
38661
38661
  * @param sheetXC the string description of a range, in the form SheetName!XC:XC
38662
38662
  */
38663
38663
  getRangeFromSheetXC(defaultSheetId, sheetXC) {
38664
- if (!rangeReference.test(sheetXC)) {
38664
+ if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
38665
38665
  return new RangeImpl({
38666
38666
  sheetId: "",
38667
38667
  zone: { left: -1, top: -1, right: -1, bottom: -1 },
@@ -41603,15 +41603,16 @@
41603
41603
  this.evaluatedCells = new Map();
41604
41604
  this.evaluate(this.getAllCells());
41605
41605
  }
41606
- evaluateFormula(sheetId, formulaString) {
41607
- const compiledFormula = compile(formulaString);
41608
- const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41609
- this.updateCompilationParameters();
41610
- const array = compiledFormula.execute(ranges, ...this.compilationParams);
41611
- if (isMatrix(array)) {
41612
- return matrixMap(array, (cell) => cell.value);
41606
+ evaluateFormulaResult(sheetId, formulaString) {
41607
+ try {
41608
+ const compiledFormula = compile(formulaString);
41609
+ const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
41610
+ this.updateCompilationParameters();
41611
+ return compiledFormula.execute(ranges, ...this.compilationParams);
41612
+ }
41613
+ catch (error) {
41614
+ return this.handleError(error);
41613
41615
  }
41614
- return array.value;
41615
41616
  }
41616
41617
  getAllCells() {
41617
41618
  const positionIds = new JetSet();
@@ -41687,7 +41688,7 @@
41687
41688
  : evaluateLiteral(cell.content, { format: cell.format, locale: this.getters.getLocale() });
41688
41689
  }
41689
41690
  catch (e) {
41690
- return this.handleError(e, cell);
41691
+ return this.handleError(e);
41691
41692
  }
41692
41693
  finally {
41693
41694
  this.cellsBeingComputed.delete(cellId);
@@ -41702,7 +41703,7 @@
41702
41703
  }
41703
41704
  return evaluatedCell;
41704
41705
  }
41705
- handleError(e, cell) {
41706
+ handleError(e) {
41706
41707
  if (!(e instanceof EvaluationError)) {
41707
41708
  e = new EvaluationError(CellErrorType.GenericError, e.message);
41708
41709
  }
@@ -42036,6 +42037,7 @@
42036
42037
  class EvaluationPlugin extends UIPlugin {
42037
42038
  static getters = [
42038
42039
  "evaluateFormula",
42040
+ "evaluateFormulaResult",
42039
42041
  "getCorrespondingFormulaCell",
42040
42042
  "getRangeFormattedValues",
42041
42043
  "getRangeValues",
@@ -42093,12 +42095,14 @@
42093
42095
  // Getters
42094
42096
  // ---------------------------------------------------------------------------
42095
42097
  evaluateFormula(sheetId, formulaString) {
42096
- try {
42097
- return this.evaluator.evaluateFormula(sheetId, formulaString);
42098
- }
42099
- catch (error) {
42100
- return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
42098
+ const result = this.evaluateFormulaResult(sheetId, formulaString);
42099
+ if (isMatrix(result)) {
42100
+ return matrixMap(result, (cell) => cell.value);
42101
42101
  }
42102
+ return result.value;
42103
+ }
42104
+ evaluateFormulaResult(sheetId, formulaString) {
42105
+ return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
42102
42106
  }
42103
42107
  /**
42104
42108
  * Return the value of each cell in the range as they are displayed in the grid.
@@ -45898,6 +45902,7 @@
45898
45902
  * evaluated and updated with the number type.
45899
45903
  */
45900
45904
  setDecimal(sheetId, zones, step) {
45905
+ const positionsByFormat = {};
45901
45906
  // Find the each cell with a number value and get the format
45902
45907
  for (const zone of zones) {
45903
45908
  for (const position of positions(zone)) {
@@ -45907,15 +45912,20 @@
45907
45912
  // of the format
45908
45913
  this.getters.getLocale();
45909
45914
  const newFormat = changeDecimalPlaces(numberFormat, step);
45910
- // Apply the new format on the whole zone
45911
- this.dispatch("SET_FORMATTING", {
45912
- sheetId,
45913
- target: [positionToZone(position)],
45914
- format: newFormat,
45915
- });
45915
+ positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
45916
+ positionsByFormat[newFormat].push(position);
45916
45917
  }
45917
45918
  }
45918
45919
  }
45920
+ // consolidate all positions with the same format in bigger zones
45921
+ for (const newFormat in positionsByFormat) {
45922
+ const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
45923
+ this.dispatch("SET_FORMATTING", {
45924
+ sheetId,
45925
+ format: newFormat,
45926
+ target: zones,
45927
+ });
45928
+ }
45919
45929
  }
45920
45930
  /**
45921
45931
  * Take a range of cells and return the format of the first cell containing a
@@ -57585,9 +57595,9 @@
57585
57595
  exports.tokenize = tokenize;
57586
57596
 
57587
57597
 
57588
- __info__.version = "17.0.33";
57589
- __info__.date = "2024-08-02T08:18:55.061Z";
57590
- __info__.hash = "4ad4049";
57598
+ __info__.version = "17.0.34";
57599
+ __info__.date = "2024-08-09T12:20:17.042Z";
57600
+ __info__.hash = "1573912";
57591
57601
 
57592
57602
 
57593
57603
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);