@odoo/o-spreadsheet 17.0.38 → 17.0.40

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.38
6
- * @date 2024-10-14T07:50:35.534Z
7
- * @hash 8aa4b34
5
+ * @version 17.0.40
6
+ * @date 2024-11-13T15:03:13.024Z
7
+ * @hash a14bf60
8
8
  */
9
9
 
10
10
  'use strict';
@@ -8490,11 +8490,14 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
8490
8490
  function getChartLabelFormat(getters, range) {
8491
8491
  if (!range)
8492
8492
  return undefined;
8493
- return getters.getEvaluatedCell({
8494
- sheetId: range.sheetId,
8495
- col: range.zone.left,
8496
- row: range.zone.top,
8497
- }).format;
8493
+ const { sheetId, zone: { left, top, bottom }, } = range;
8494
+ for (let row = top; row <= bottom; row++) {
8495
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
8496
+ if (format) {
8497
+ return format;
8498
+ }
8499
+ }
8500
+ return undefined;
8498
8501
  }
8499
8502
  function getChartLabelValues(getters, dataSets, labelRange) {
8500
8503
  let labels = { values: [], formattedValues: [] };
@@ -9343,11 +9346,7 @@ function canBeDateChart(labelRange, getters) {
9343
9346
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
9344
9347
  return false;
9345
9348
  }
9346
- const labelFormat = getters.getEvaluatedCell({
9347
- sheetId: labelRange.sheetId,
9348
- col: labelRange.zone.left,
9349
- row: labelRange.zone.top,
9350
- }).format;
9349
+ const labelFormat = getChartLabelFormat(getters, labelRange);
9351
9350
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
9352
9351
  }
9353
9352
  function canBeLinearChart(labelRange, getters) {
@@ -22269,6 +22268,7 @@ ColorPicker.props = {
22269
22268
  currentColor: { type: String, optional: true },
22270
22269
  maxHeight: { type: Number, optional: true },
22271
22270
  anchorRect: Object,
22271
+ disableNoColor: { type: Boolean, optional: true },
22272
22272
  };
22273
22273
 
22274
22274
  css /* scss */ `
@@ -22335,6 +22335,7 @@ ColorPickerWidget.props = {
22335
22335
  disabled: { type: Boolean, optional: true },
22336
22336
  dropdownMaxHeight: { type: Number, optional: true },
22337
22337
  class: { type: String, optional: true },
22338
+ disableNoColor: { type: Boolean, optional: true },
22338
22339
  };
22339
22340
 
22340
22341
  class LineBarPieDesignPanel extends owl.Component {
@@ -23745,6 +23746,9 @@ class ConditionalFormattingEditor extends owl.Component {
23745
23746
  }
23746
23747
  }
23747
23748
  setColorScaleColor(target, color) {
23749
+ if (!isColorValid(color)) {
23750
+ return;
23751
+ }
23748
23752
  const point = this.state.rules.colorScale[target];
23749
23753
  if (point) {
23750
23754
  point.color = Number.parseInt(color.substr(1), 16);
@@ -35090,7 +35094,10 @@ function parseOperand(tokens) {
35090
35094
  case "STRING":
35091
35095
  return { type: "STRING", value: removeStringQuotes(current.value) };
35092
35096
  case "INVALID_REFERENCE":
35093
- throw new InvalidReferenceError();
35097
+ return {
35098
+ type: "REFERENCE",
35099
+ value: CellErrorType.InvalidReference,
35100
+ };
35094
35101
  case "REFERENCE":
35095
35102
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
35096
35103
  tokens.shift();
@@ -55815,7 +55822,8 @@ function addFormula(cell) {
55815
55822
  }
55816
55823
  const attrs = [["t", type]];
55817
55824
  const XlsxFormula = adaptFormulaToExcel(formula);
55818
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
55825
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
55826
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
55819
55827
  return { attrs, node };
55820
55828
  }
55821
55829
  function addContent(content, sharedStrings, forceString = false) {
@@ -55850,8 +55858,14 @@ function adaptFormulaToExcel(formulaText) {
55850
55858
  ast = addMissingRequiredArgs(ast);
55851
55859
  return ast;
55852
55860
  });
55861
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
55862
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
55863
+ });
55853
55864
  return ast ? astToFormula(ast) : formulaText;
55854
55865
  }
55866
+ function adaptFormulaValueToExcel(formulaValue) {
55867
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
55868
+ }
55855
55869
  /**
55856
55870
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
55857
55871
  * This adds those missing args.
@@ -57647,6 +57661,6 @@ exports.setTranslationMethod = setTranslationMethod;
57647
57661
  exports.tokenize = tokenize;
57648
57662
 
57649
57663
 
57650
- __info__.version = "17.0.38";
57651
- __info__.date = "2024-10-14T07:50:35.534Z";
57652
- __info__.hash = "8aa4b34";
57664
+ __info__.version = "17.0.40";
57665
+ __info__.date = "2024-11-13T15:03:13.024Z";
57666
+ __info__.hash = "a14bf60";
@@ -5648,6 +5648,7 @@ interface ColorPickerProps {
5648
5648
  maxHeight?: Pixel;
5649
5649
  onColorPicked: (color: Color) => void;
5650
5650
  currentColor: Color;
5651
+ disableNoColor?: boolean;
5651
5652
  }
5652
5653
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
5653
5654
  static template: string;
@@ -5690,6 +5691,7 @@ interface Props$H {
5690
5691
  disabled?: boolean;
5691
5692
  dropdownMaxHeight?: Pixel;
5692
5693
  class?: string;
5694
+ disableNoColor?: boolean;
5693
5695
  }
5694
5696
  declare class ColorPickerWidget extends Component<Props$H, SpreadsheetChildEnv> {
5695
5697
  static template: string;
@@ -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.38
6
- * @date 2024-10-14T07:50:35.534Z
7
- * @hash 8aa4b34
5
+ * @version 17.0.40
6
+ * @date 2024-11-13T15:03:13.024Z
7
+ * @hash a14bf60
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';
@@ -8488,11 +8488,14 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
8488
8488
  function getChartLabelFormat(getters, range) {
8489
8489
  if (!range)
8490
8490
  return undefined;
8491
- return getters.getEvaluatedCell({
8492
- sheetId: range.sheetId,
8493
- col: range.zone.left,
8494
- row: range.zone.top,
8495
- }).format;
8491
+ const { sheetId, zone: { left, top, bottom }, } = range;
8492
+ for (let row = top; row <= bottom; row++) {
8493
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
8494
+ if (format) {
8495
+ return format;
8496
+ }
8497
+ }
8498
+ return undefined;
8496
8499
  }
8497
8500
  function getChartLabelValues(getters, dataSets, labelRange) {
8498
8501
  let labels = { values: [], formattedValues: [] };
@@ -9341,11 +9344,7 @@ function canBeDateChart(labelRange, getters) {
9341
9344
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
9342
9345
  return false;
9343
9346
  }
9344
- const labelFormat = getters.getEvaluatedCell({
9345
- sheetId: labelRange.sheetId,
9346
- col: labelRange.zone.left,
9347
- row: labelRange.zone.top,
9348
- }).format;
9347
+ const labelFormat = getChartLabelFormat(getters, labelRange);
9349
9348
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
9350
9349
  }
9351
9350
  function canBeLinearChart(labelRange, getters) {
@@ -22267,6 +22266,7 @@ ColorPicker.props = {
22267
22266
  currentColor: { type: String, optional: true },
22268
22267
  maxHeight: { type: Number, optional: true },
22269
22268
  anchorRect: Object,
22269
+ disableNoColor: { type: Boolean, optional: true },
22270
22270
  };
22271
22271
 
22272
22272
  css /* scss */ `
@@ -22333,6 +22333,7 @@ ColorPickerWidget.props = {
22333
22333
  disabled: { type: Boolean, optional: true },
22334
22334
  dropdownMaxHeight: { type: Number, optional: true },
22335
22335
  class: { type: String, optional: true },
22336
+ disableNoColor: { type: Boolean, optional: true },
22336
22337
  };
22337
22338
 
22338
22339
  class LineBarPieDesignPanel extends Component {
@@ -23743,6 +23744,9 @@ class ConditionalFormattingEditor extends Component {
23743
23744
  }
23744
23745
  }
23745
23746
  setColorScaleColor(target, color) {
23747
+ if (!isColorValid(color)) {
23748
+ return;
23749
+ }
23746
23750
  const point = this.state.rules.colorScale[target];
23747
23751
  if (point) {
23748
23752
  point.color = Number.parseInt(color.substr(1), 16);
@@ -35088,7 +35092,10 @@ function parseOperand(tokens) {
35088
35092
  case "STRING":
35089
35093
  return { type: "STRING", value: removeStringQuotes(current.value) };
35090
35094
  case "INVALID_REFERENCE":
35091
- throw new InvalidReferenceError();
35095
+ return {
35096
+ type: "REFERENCE",
35097
+ value: CellErrorType.InvalidReference,
35098
+ };
35092
35099
  case "REFERENCE":
35093
35100
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
35094
35101
  tokens.shift();
@@ -55813,7 +55820,8 @@ function addFormula(cell) {
55813
55820
  }
55814
55821
  const attrs = [["t", type]];
55815
55822
  const XlsxFormula = adaptFormulaToExcel(formula);
55816
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
55823
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
55824
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
55817
55825
  return { attrs, node };
55818
55826
  }
55819
55827
  function addContent(content, sharedStrings, forceString = false) {
@@ -55848,8 +55856,14 @@ function adaptFormulaToExcel(formulaText) {
55848
55856
  ast = addMissingRequiredArgs(ast);
55849
55857
  return ast;
55850
55858
  });
55859
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
55860
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
55861
+ });
55851
55862
  return ast ? astToFormula(ast) : formulaText;
55852
55863
  }
55864
+ function adaptFormulaValueToExcel(formulaValue) {
55865
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
55866
+ }
55853
55867
  /**
55854
55868
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
55855
55869
  * This adds those missing args.
@@ -57610,6 +57624,6 @@ const constants = {
57610
57624
  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 };
57611
57625
 
57612
57626
 
57613
- __info__.version = "17.0.38";
57614
- __info__.date = "2024-10-14T07:50:35.534Z";
57615
- __info__.hash = "8aa4b34";
57627
+ __info__.version = "17.0.40";
57628
+ __info__.date = "2024-11-13T15:03:13.024Z";
57629
+ __info__.hash = "a14bf60";
@@ -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.38
6
- * @date 2024-10-14T07:50:35.534Z
7
- * @hash 8aa4b34
5
+ * @version 17.0.40
6
+ * @date 2024-11-13T15:03:13.024Z
7
+ * @hash a14bf60
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -8489,11 +8489,14 @@
8489
8489
  function getChartLabelFormat(getters, range) {
8490
8490
  if (!range)
8491
8491
  return undefined;
8492
- return getters.getEvaluatedCell({
8493
- sheetId: range.sheetId,
8494
- col: range.zone.left,
8495
- row: range.zone.top,
8496
- }).format;
8492
+ const { sheetId, zone: { left, top, bottom }, } = range;
8493
+ for (let row = top; row <= bottom; row++) {
8494
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
8495
+ if (format) {
8496
+ return format;
8497
+ }
8498
+ }
8499
+ return undefined;
8497
8500
  }
8498
8501
  function getChartLabelValues(getters, dataSets, labelRange) {
8499
8502
  let labels = { values: [], formattedValues: [] };
@@ -9342,11 +9345,7 @@
9342
9345
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
9343
9346
  return false;
9344
9347
  }
9345
- const labelFormat = getters.getEvaluatedCell({
9346
- sheetId: labelRange.sheetId,
9347
- col: labelRange.zone.left,
9348
- row: labelRange.zone.top,
9349
- }).format;
9348
+ const labelFormat = getChartLabelFormat(getters, labelRange);
9350
9349
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
9351
9350
  }
9352
9351
  function canBeLinearChart(labelRange, getters) {
@@ -22268,6 +22267,7 @@
22268
22267
  currentColor: { type: String, optional: true },
22269
22268
  maxHeight: { type: Number, optional: true },
22270
22269
  anchorRect: Object,
22270
+ disableNoColor: { type: Boolean, optional: true },
22271
22271
  };
22272
22272
 
22273
22273
  css /* scss */ `
@@ -22334,6 +22334,7 @@
22334
22334
  disabled: { type: Boolean, optional: true },
22335
22335
  dropdownMaxHeight: { type: Number, optional: true },
22336
22336
  class: { type: String, optional: true },
22337
+ disableNoColor: { type: Boolean, optional: true },
22337
22338
  };
22338
22339
 
22339
22340
  class LineBarPieDesignPanel extends owl.Component {
@@ -23744,6 +23745,9 @@
23744
23745
  }
23745
23746
  }
23746
23747
  setColorScaleColor(target, color) {
23748
+ if (!isColorValid(color)) {
23749
+ return;
23750
+ }
23747
23751
  const point = this.state.rules.colorScale[target];
23748
23752
  if (point) {
23749
23753
  point.color = Number.parseInt(color.substr(1), 16);
@@ -35089,7 +35093,10 @@
35089
35093
  case "STRING":
35090
35094
  return { type: "STRING", value: removeStringQuotes(current.value) };
35091
35095
  case "INVALID_REFERENCE":
35092
- throw new InvalidReferenceError();
35096
+ return {
35097
+ type: "REFERENCE",
35098
+ value: CellErrorType.InvalidReference,
35099
+ };
35093
35100
  case "REFERENCE":
35094
35101
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
35095
35102
  tokens.shift();
@@ -55814,7 +55821,8 @@
55814
55821
  }
55815
55822
  const attrs = [["t", type]];
55816
55823
  const XlsxFormula = adaptFormulaToExcel(formula);
55817
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
55824
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
55825
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
55818
55826
  return { attrs, node };
55819
55827
  }
55820
55828
  function addContent(content, sharedStrings, forceString = false) {
@@ -55849,8 +55857,14 @@
55849
55857
  ast = addMissingRequiredArgs(ast);
55850
55858
  return ast;
55851
55859
  });
55860
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
55861
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
55862
+ });
55852
55863
  return ast ? astToFormula(ast) : formulaText;
55853
55864
  }
55865
+ function adaptFormulaValueToExcel(formulaValue) {
55866
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
55867
+ }
55854
55868
  /**
55855
55869
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
55856
55870
  * This adds those missing args.
@@ -57646,9 +57660,9 @@
57646
57660
  exports.tokenize = tokenize;
57647
57661
 
57648
57662
 
57649
- __info__.version = "17.0.38";
57650
- __info__.date = "2024-10-14T07:50:35.534Z";
57651
- __info__.hash = "8aa4b34";
57663
+ __info__.version = "17.0.40";
57664
+ __info__.date = "2024-11-13T15:03:13.024Z";
57665
+ __info__.hash = "a14bf60";
57652
57666
 
57653
57667
 
57654
57668
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);