@odoo/o-spreadsheet 16.0.53 → 16.0.55

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.
@@ -9974,6 +9974,9 @@ class ConditionalFormattingPanel extends owl.Component {
9974
9974
  }
9975
9975
  }
9976
9976
  setColorScaleColor(target, color) {
9977
+ if (!isColorValid(color)) {
9978
+ return;
9979
+ }
9977
9980
  const point = this.state.rules.colorScale[target];
9978
9981
  if (point) {
9979
9982
  point.color = Number.parseInt(color.substr(1), 16);
@@ -18638,7 +18641,10 @@ function parsePrefix(current, tokens) {
18638
18641
  return { type: "FUNCALL", value: current.value, args };
18639
18642
  }
18640
18643
  case "INVALID_REFERENCE":
18641
- throw new InvalidReferenceError();
18644
+ return {
18645
+ type: "REFERENCE",
18646
+ value: CellErrorType.InvalidReference,
18647
+ };
18642
18648
  case "REFERENCE":
18643
18649
  if (((_b = tokens[0]) === null || _b === void 0 ? void 0 : _b.value) === ":" && ((_c = tokens[1]) === null || _c === void 0 ? void 0 : _c.type) === "REFERENCE") {
18644
18650
  tokens.shift();
@@ -41860,13 +41866,14 @@ function addFormula(cell) {
41860
41866
  .filter((tk) => tk.type === "FUNCTION")
41861
41867
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41862
41868
  const type = getCellType(cell.value);
41869
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
41863
41870
  if (isExported) {
41864
41871
  const XlsxFormula = adaptFormulaToExcel(formula);
41865
41872
  node = escapeXml /*xml*/ `
41866
41873
  <f>
41867
41874
  ${XlsxFormula}
41868
41875
  </f>
41869
- ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41876
+ ${escapeXml /*xml*/ `<v>${exportedValue}</v>`}
41870
41877
  `;
41871
41878
  attrs.push(["t", type]);
41872
41879
  return { attrs, node };
@@ -41876,10 +41883,10 @@ function addFormula(cell) {
41876
41883
  // nothing* ,we don't export it.
41877
41884
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41878
41885
  // the empty string.
41879
- if (cell.value === "")
41886
+ if (exportedValue === "")
41880
41887
  return undefined;
41881
41888
  attrs.push(["t", type]);
41882
- node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41889
+ node = escapeXml /*xml*/ `<v>${exportedValue}</v>`;
41883
41890
  return { attrs, node };
41884
41891
  }
41885
41892
  }
@@ -41914,8 +41921,14 @@ function adaptFormulaToExcel(formulaText) {
41914
41921
  ast = addMissingRequiredArgs(ast);
41915
41922
  return ast;
41916
41923
  });
41924
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
41925
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
41926
+ });
41917
41927
  return ast ? astToFormula(ast) : formulaText;
41918
41928
  }
41929
+ function adaptFormulaValueToExcel(formulaValue) {
41930
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
41931
+ }
41919
41932
  /**
41920
41933
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
41921
41934
  * This adds those missing args.
@@ -43449,6 +43462,6 @@ exports.setTranslationMethod = setTranslationMethod;
43449
43462
  exports.tokenize = tokenize;
43450
43463
 
43451
43464
 
43452
- __info__.version = '16.0.53';
43453
- __info__.date = '2024-10-14T07:50:02.583Z';
43454
- __info__.hash = 'a9ad6d8';
43465
+ __info__.version = '16.0.55';
43466
+ __info__.date = '2024-11-13T15:02:56.109Z';
43467
+ __info__.hash = '6984990';
@@ -4961,6 +4961,7 @@ interface ColorPickerProps {
4961
4961
  dropdownDirection?: "left" | "right" | "center";
4962
4962
  onColorPicked: (color: Color) => void;
4963
4963
  currentColor: Color;
4964
+ disableNoColor?: boolean;
4964
4965
  }
4965
4966
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
4966
4967
  static template: string;
@@ -9970,6 +9970,9 @@ class ConditionalFormattingPanel extends Component {
9970
9970
  }
9971
9971
  }
9972
9972
  setColorScaleColor(target, color) {
9973
+ if (!isColorValid(color)) {
9974
+ return;
9975
+ }
9973
9976
  const point = this.state.rules.colorScale[target];
9974
9977
  if (point) {
9975
9978
  point.color = Number.parseInt(color.substr(1), 16);
@@ -18634,7 +18637,10 @@ function parsePrefix(current, tokens) {
18634
18637
  return { type: "FUNCALL", value: current.value, args };
18635
18638
  }
18636
18639
  case "INVALID_REFERENCE":
18637
- throw new InvalidReferenceError();
18640
+ return {
18641
+ type: "REFERENCE",
18642
+ value: CellErrorType.InvalidReference,
18643
+ };
18638
18644
  case "REFERENCE":
18639
18645
  if (((_b = tokens[0]) === null || _b === void 0 ? void 0 : _b.value) === ":" && ((_c = tokens[1]) === null || _c === void 0 ? void 0 : _c.type) === "REFERENCE") {
18640
18646
  tokens.shift();
@@ -41856,13 +41862,14 @@ function addFormula(cell) {
41856
41862
  .filter((tk) => tk.type === "FUNCTION")
41857
41863
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41858
41864
  const type = getCellType(cell.value);
41865
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
41859
41866
  if (isExported) {
41860
41867
  const XlsxFormula = adaptFormulaToExcel(formula);
41861
41868
  node = escapeXml /*xml*/ `
41862
41869
  <f>
41863
41870
  ${XlsxFormula}
41864
41871
  </f>
41865
- ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41872
+ ${escapeXml /*xml*/ `<v>${exportedValue}</v>`}
41866
41873
  `;
41867
41874
  attrs.push(["t", type]);
41868
41875
  return { attrs, node };
@@ -41872,10 +41879,10 @@ function addFormula(cell) {
41872
41879
  // nothing* ,we don't export it.
41873
41880
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41874
41881
  // the empty string.
41875
- if (cell.value === "")
41882
+ if (exportedValue === "")
41876
41883
  return undefined;
41877
41884
  attrs.push(["t", type]);
41878
- node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41885
+ node = escapeXml /*xml*/ `<v>${exportedValue}</v>`;
41879
41886
  return { attrs, node };
41880
41887
  }
41881
41888
  }
@@ -41910,8 +41917,14 @@ function adaptFormulaToExcel(formulaText) {
41910
41917
  ast = addMissingRequiredArgs(ast);
41911
41918
  return ast;
41912
41919
  });
41920
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
41921
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
41922
+ });
41913
41923
  return ast ? astToFormula(ast) : formulaText;
41914
41924
  }
41925
+ function adaptFormulaValueToExcel(formulaValue) {
41926
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
41927
+ }
41915
41928
  /**
41916
41929
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
41917
41930
  * This adds those missing args.
@@ -43417,6 +43430,6 @@ function addFunction(functionName, functionDescription) {
43417
43430
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43418
43431
 
43419
43432
 
43420
- __info__.version = '16.0.53';
43421
- __info__.date = '2024-10-14T07:50:02.583Z';
43422
- __info__.hash = 'a9ad6d8';
43433
+ __info__.version = '16.0.55';
43434
+ __info__.date = '2024-11-13T15:02:56.109Z';
43435
+ __info__.hash = '6984990';
@@ -9971,6 +9971,9 @@
9971
9971
  }
9972
9972
  }
9973
9973
  setColorScaleColor(target, color) {
9974
+ if (!isColorValid(color)) {
9975
+ return;
9976
+ }
9974
9977
  const point = this.state.rules.colorScale[target];
9975
9978
  if (point) {
9976
9979
  point.color = Number.parseInt(color.substr(1), 16);
@@ -18635,7 +18638,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
18635
18638
  return { type: "FUNCALL", value: current.value, args };
18636
18639
  }
18637
18640
  case "INVALID_REFERENCE":
18638
- throw new InvalidReferenceError();
18641
+ return {
18642
+ type: "REFERENCE",
18643
+ value: CellErrorType.InvalidReference,
18644
+ };
18639
18645
  case "REFERENCE":
18640
18646
  if (((_b = tokens[0]) === null || _b === void 0 ? void 0 : _b.value) === ":" && ((_c = tokens[1]) === null || _c === void 0 ? void 0 : _c.type) === "REFERENCE") {
18641
18647
  tokens.shift();
@@ -41857,13 +41863,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41857
41863
  .filter((tk) => tk.type === "FUNCTION")
41858
41864
  .every((tk) => functions[tk.value.toUpperCase()].isExported);
41859
41865
  const type = getCellType(cell.value);
41866
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
41860
41867
  if (isExported) {
41861
41868
  const XlsxFormula = adaptFormulaToExcel(formula);
41862
41869
  node = escapeXml /*xml*/ `
41863
41870
  <f>
41864
41871
  ${XlsxFormula}
41865
41872
  </f>
41866
- ${escapeXml /*xml*/ `<v>${cell.value}</v>`}
41873
+ ${escapeXml /*xml*/ `<v>${exportedValue}</v>`}
41867
41874
  `;
41868
41875
  attrs.push(["t", type]);
41869
41876
  return { attrs, node };
@@ -41873,10 +41880,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41873
41880
  // nothing* ,we don't export it.
41874
41881
  // * non-falsy value are relevant and so are 0 and FALSE, which only leaves
41875
41882
  // the empty string.
41876
- if (cell.value === "")
41883
+ if (exportedValue === "")
41877
41884
  return undefined;
41878
41885
  attrs.push(["t", type]);
41879
- node = escapeXml /*xml*/ `<v>${cell.value}</v>`;
41886
+ node = escapeXml /*xml*/ `<v>${exportedValue}</v>`;
41880
41887
  return { attrs, node };
41881
41888
  }
41882
41889
  }
@@ -41911,8 +41918,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41911
41918
  ast = addMissingRequiredArgs(ast);
41912
41919
  return ast;
41913
41920
  });
41921
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
41922
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
41923
+ });
41914
41924
  return ast ? astToFormula(ast) : formulaText;
41915
41925
  }
41926
+ function adaptFormulaValueToExcel(formulaValue) {
41927
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
41928
+ }
41916
41929
  /**
41917
41930
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
41918
41931
  * This adds those missing args.
@@ -43448,9 +43461,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43448
43461
  Object.defineProperty(exports, '__esModule', { value: true });
43449
43462
 
43450
43463
 
43451
- __info__.version = '16.0.53';
43452
- __info__.date = '2024-10-14T07:50:02.583Z';
43453
- __info__.hash = 'a9ad6d8';
43464
+ __info__.version = '16.0.55';
43465
+ __info__.date = '2024-11-13T15:02:56.109Z';
43466
+ __info__.hash = '6984990';
43454
43467
 
43455
43468
 
43456
43469
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);