@odoo/o-spreadsheet 15.0.16 → 15.0.18

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.
@@ -8113,6 +8113,9 @@ const cellRegistry = new Registry();
8113
8113
  function formatValue(value, format) {
8114
8114
  switch (typeof value) {
8115
8115
  case "string":
8116
+ if (value.includes('\\"')) {
8117
+ return value.replace(/\\"/g, '"');
8118
+ }
8116
8119
  return value;
8117
8120
  case "boolean":
8118
8121
  return value ? "TRUE" : "FALSE";
@@ -18824,17 +18827,10 @@ class EvaluationPlugin extends UIPlugin {
18824
18827
  const evalContext = Object.assign(Object.create(functionMap), this.evalContext, {
18825
18828
  getters: this.getters,
18826
18829
  });
18827
- const sheets = this.getters.getEvaluationSheets();
18828
18830
  function readCell(range) {
18829
18831
  var _a;
18830
- let cell;
18831
- const s = sheets[range.sheetId];
18832
- if (s) {
18833
- cell = (_a = s.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18834
- }
18835
- else {
18836
- throw new Error(_lt("Invalid sheet name"));
18837
- }
18832
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18833
+ const cell = (_a = sheet.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18838
18834
  if (!cell || cell.isEmpty()) {
18839
18835
  // magic "empty" value
18840
18836
  // Returning null instead of undefined will ensure that we don't
@@ -18857,10 +18853,8 @@ class EvaluationPlugin extends UIPlugin {
18857
18853
  * that are actually present in the grid.
18858
18854
  */
18859
18855
  function _range(range) {
18860
- const sheet = sheets[range.sheetId];
18861
- if (!isZoneValid(range.zone)) {
18862
- throw new Error(_lt("Invalid reference"));
18863
- }
18856
+ assertRangeValid(range);
18857
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18864
18858
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
18865
18859
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
18866
18860
  const sheetZone = {
@@ -18899,21 +18893,16 @@ class EvaluationPlugin extends UIPlugin {
18899
18893
  */
18900
18894
  function refFn(position, references, sheetId, isMeta, functionName, paramNumber) {
18901
18895
  const range = references[position];
18896
+ assertRangeValid(range);
18902
18897
  if (isMeta) {
18903
18898
  return evalContext.getters.getRangeString(range, sheetId);
18904
18899
  }
18905
- if (!isZoneValid(range.zone)) {
18906
- throw new Error(_lt("Invalid reference"));
18907
- }
18908
18900
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
18909
18901
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
18910
18902
  throw new Error(paramNumber
18911
18903
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
18912
18904
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
18913
18905
  }
18914
- if (range.invalidSheetName) {
18915
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18916
- }
18917
18906
  return readCell(range);
18918
18907
  }
18919
18908
  /**
@@ -18926,6 +18915,14 @@ class EvaluationPlugin extends UIPlugin {
18926
18915
  function range(position, references, sheetId) {
18927
18916
  return _range(references[position]);
18928
18917
  }
18918
+ function assertRangeValid(range) {
18919
+ if (!isZoneValid(range.zone)) {
18920
+ throw new Error(_lt("Invalid reference"));
18921
+ }
18922
+ if (range.invalidSheetName) {
18923
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18924
+ }
18925
+ }
18929
18926
  return [refFn, range, evalContext];
18930
18927
  }
18931
18928
  /**
@@ -31508,6 +31505,6 @@ exports.registries = registries;
31508
31505
  exports.setTranslationMethod = setTranslationMethod;
31509
31506
 
31510
31507
 
31511
- __info__.version = '15.0.16';
31512
- __info__.date = '2024-01-17T10:23:17.942Z';
31513
- __info__.hash = '3a9ce19';
31508
+ __info__.version = '15.0.18';
31509
+ __info__.date = '2024-02-02T13:41:26.005Z';
31510
+ __info__.hash = 'd1605d8';
@@ -8090,6 +8090,9 @@ const cellRegistry = new Registry();
8090
8090
  function formatValue(value, format) {
8091
8091
  switch (typeof value) {
8092
8092
  case "string":
8093
+ if (value.includes('\\"')) {
8094
+ return value.replace(/\\"/g, '"');
8095
+ }
8093
8096
  return value;
8094
8097
  case "boolean":
8095
8098
  return value ? "TRUE" : "FALSE";
@@ -18801,17 +18804,10 @@ class EvaluationPlugin extends UIPlugin {
18801
18804
  const evalContext = Object.assign(Object.create(functionMap), this.evalContext, {
18802
18805
  getters: this.getters,
18803
18806
  });
18804
- const sheets = this.getters.getEvaluationSheets();
18805
18807
  function readCell(range) {
18806
18808
  var _a;
18807
- let cell;
18808
- const s = sheets[range.sheetId];
18809
- if (s) {
18810
- cell = (_a = s.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18811
- }
18812
- else {
18813
- throw new Error(_lt("Invalid sheet name"));
18814
- }
18809
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18810
+ const cell = (_a = sheet.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18815
18811
  if (!cell || cell.isEmpty()) {
18816
18812
  // magic "empty" value
18817
18813
  // Returning null instead of undefined will ensure that we don't
@@ -18834,10 +18830,8 @@ class EvaluationPlugin extends UIPlugin {
18834
18830
  * that are actually present in the grid.
18835
18831
  */
18836
18832
  function _range(range) {
18837
- const sheet = sheets[range.sheetId];
18838
- if (!isZoneValid(range.zone)) {
18839
- throw new Error(_lt("Invalid reference"));
18840
- }
18833
+ assertRangeValid(range);
18834
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18841
18835
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
18842
18836
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
18843
18837
  const sheetZone = {
@@ -18876,21 +18870,16 @@ class EvaluationPlugin extends UIPlugin {
18876
18870
  */
18877
18871
  function refFn(position, references, sheetId, isMeta, functionName, paramNumber) {
18878
18872
  const range = references[position];
18873
+ assertRangeValid(range);
18879
18874
  if (isMeta) {
18880
18875
  return evalContext.getters.getRangeString(range, sheetId);
18881
18876
  }
18882
- if (!isZoneValid(range.zone)) {
18883
- throw new Error(_lt("Invalid reference"));
18884
- }
18885
18877
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
18886
18878
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
18887
18879
  throw new Error(paramNumber
18888
18880
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
18889
18881
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
18890
18882
  }
18891
- if (range.invalidSheetName) {
18892
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18893
- }
18894
18883
  return readCell(range);
18895
18884
  }
18896
18885
  /**
@@ -18903,6 +18892,14 @@ class EvaluationPlugin extends UIPlugin {
18903
18892
  function range(position, references, sheetId) {
18904
18893
  return _range(references[position]);
18905
18894
  }
18895
+ function assertRangeValid(range) {
18896
+ if (!isZoneValid(range.zone)) {
18897
+ throw new Error(_lt("Invalid reference"));
18898
+ }
18899
+ if (range.invalidSheetName) {
18900
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18901
+ }
18902
+ }
18906
18903
  return [refFn, range, evalContext];
18907
18904
  }
18908
18905
  /**
@@ -31463,6 +31460,6 @@ const helpers = {
31463
31460
  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 };
31464
31461
 
31465
31462
 
31466
- __info__.version = '15.0.16';
31467
- __info__.date = '2024-01-17T10:23:17.942Z';
31468
- __info__.hash = '3a9ce19';
31463
+ __info__.version = '15.0.18';
31464
+ __info__.date = '2024-02-02T13:41:26.005Z';
31465
+ __info__.hash = 'd1605d8';
@@ -8110,6 +8110,9 @@
8110
8110
  function formatValue(value, format) {
8111
8111
  switch (typeof value) {
8112
8112
  case "string":
8113
+ if (value.includes('\\"')) {
8114
+ return value.replace(/\\"/g, '"');
8115
+ }
8113
8116
  return value;
8114
8117
  case "boolean":
8115
8118
  return value ? "TRUE" : "FALSE";
@@ -18821,17 +18824,10 @@
18821
18824
  const evalContext = Object.assign(Object.create(functionMap), this.evalContext, {
18822
18825
  getters: this.getters,
18823
18826
  });
18824
- const sheets = this.getters.getEvaluationSheets();
18825
18827
  function readCell(range) {
18826
18828
  var _a;
18827
- let cell;
18828
- const s = sheets[range.sheetId];
18829
- if (s) {
18830
- cell = (_a = s.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18831
- }
18832
- else {
18833
- throw new Error(_lt("Invalid sheet name"));
18834
- }
18829
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18830
+ const cell = (_a = sheet.rows[range.zone.top]) === null || _a === void 0 ? void 0 : _a.cells[range.zone.left];
18835
18831
  if (!cell || cell.isEmpty()) {
18836
18832
  // magic "empty" value
18837
18833
  // Returning null instead of undefined will ensure that we don't
@@ -18854,10 +18850,8 @@
18854
18850
  * that are actually present in the grid.
18855
18851
  */
18856
18852
  function _range(range) {
18857
- const sheet = sheets[range.sheetId];
18858
- if (!isZoneValid(range.zone)) {
18859
- throw new Error(_lt("Invalid reference"));
18860
- }
18853
+ assertRangeValid(range);
18854
+ const sheet = evalContext.getters.getSheet(range.sheetId);
18861
18855
  // Performance issue: Avoid fetching data on positions that are out of the spreadsheet
18862
18856
  // e.g. A1:ZZZ9999 in a sheet with 10 cols and 10 rows should ignore everything past J10 and return a 10x10 array
18863
18857
  const sheetZone = {
@@ -18896,21 +18890,16 @@
18896
18890
  */
18897
18891
  function refFn(position, references, sheetId, isMeta, functionName, paramNumber) {
18898
18892
  const range = references[position];
18893
+ assertRangeValid(range);
18899
18894
  if (isMeta) {
18900
18895
  return evalContext.getters.getRangeString(range, sheetId);
18901
18896
  }
18902
- if (!isZoneValid(range.zone)) {
18903
- throw new Error(_lt("Invalid reference"));
18904
- }
18905
18897
  // if the formula definition could have accepted a range, we would pass through the _range function and not here
18906
18898
  if (range.zone.bottom !== range.zone.top || range.zone.left !== range.zone.right) {
18907
18899
  throw new Error(paramNumber
18908
18900
  ? _lt("Function %s expects the parameter %s to be a single value or a single cell reference, not a range.", functionName.toString(), paramNumber.toString())
18909
18901
  : _lt("Function %s expects its parameters to be single values or single cell references, not ranges.", functionName.toString()));
18910
18902
  }
18911
- if (range.invalidSheetName) {
18912
- throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18913
- }
18914
18903
  return readCell(range);
18915
18904
  }
18916
18905
  /**
@@ -18923,6 +18912,14 @@
18923
18912
  function range(position, references, sheetId) {
18924
18913
  return _range(references[position]);
18925
18914
  }
18915
+ function assertRangeValid(range) {
18916
+ if (!isZoneValid(range.zone)) {
18917
+ throw new Error(_lt("Invalid reference"));
18918
+ }
18919
+ if (range.invalidSheetName) {
18920
+ throw new Error(_lt("Invalid sheet name: %s", range.invalidSheetName));
18921
+ }
18922
+ }
18926
18923
  return [refFn, range, evalContext];
18927
18924
  }
18928
18925
  /**
@@ -31507,9 +31504,9 @@
31507
31504
  Object.defineProperty(exports, '__esModule', { value: true });
31508
31505
 
31509
31506
 
31510
- __info__.version = '15.0.16';
31511
- __info__.date = '2024-01-17T10:23:17.942Z';
31512
- __info__.hash = '3a9ce19';
31507
+ __info__.version = '15.0.18';
31508
+ __info__.date = '2024-02-02T13:41:26.005Z';
31509
+ __info__.hash = 'd1605d8';
31513
31510
 
31514
31511
 
31515
31512
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);