@odoo/o-spreadsheet 17.2.24 → 17.2.26

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.24
7
- * @date 2024-10-14T07:49:56.845Z
8
- * @hash 7e88bec
6
+ * @version 17.2.26
7
+ * @date 2024-11-13T15:04:03.710Z
8
+ * @hash 19b7478
9
9
  */
10
10
 
11
11
  'use strict';
@@ -6647,7 +6647,10 @@ function parseOperand(tokens) {
6647
6647
  case "STRING":
6648
6648
  return { type: "STRING", value: removeStringQuotes(current.value) };
6649
6649
  case "INVALID_REFERENCE":
6650
- throw new InvalidReferenceError();
6650
+ return {
6651
+ type: "REFERENCE",
6652
+ value: CellErrorType.InvalidReference,
6653
+ };
6651
6654
  case "REFERENCE":
6652
6655
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
6653
6656
  tokens.shift();
@@ -19692,11 +19695,14 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
19692
19695
  function getChartLabelFormat(getters, range) {
19693
19696
  if (!range)
19694
19697
  return undefined;
19695
- return getters.getEvaluatedCell({
19696
- sheetId: range.sheetId,
19697
- col: range.zone.left,
19698
- row: range.zone.top,
19699
- }).format;
19698
+ const { sheetId, zone: { left, top, bottom }, } = range;
19699
+ for (let row = top; row <= bottom; row++) {
19700
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
19701
+ if (format) {
19702
+ return format;
19703
+ }
19704
+ }
19705
+ return undefined;
19700
19706
  }
19701
19707
  function getChartLabelValues(getters, dataSets, labelRange) {
19702
19708
  let labels = { values: [], formattedValues: [] };
@@ -20412,11 +20418,7 @@ function canBeDateChart(labelRange, getters) {
20412
20418
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
20413
20419
  return false;
20414
20420
  }
20415
- const labelFormat = getters.getEvaluatedCell({
20416
- sheetId: labelRange.sheetId,
20417
- col: labelRange.zone.left,
20418
- row: labelRange.zone.top,
20419
- }).format;
20421
+ const labelFormat = getChartLabelFormat(getters, labelRange);
20420
20422
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
20421
20423
  }
20422
20424
  function canBeLinearChart(labelRange, getters) {
@@ -27215,6 +27217,7 @@ class ColorPicker extends owl.Component {
27215
27217
  currentColor: { type: String, optional: true },
27216
27218
  maxHeight: { type: Number, optional: true },
27217
27219
  anchorRect: Object,
27220
+ disableNoColor: { type: Boolean, optional: true },
27218
27221
  };
27219
27222
  static defaultProps = { currentColor: "" };
27220
27223
  static components = { Popover };
@@ -27398,6 +27401,7 @@ class ColorPickerWidget extends owl.Component {
27398
27401
  disabled: { type: Boolean, optional: true },
27399
27402
  dropdownMaxHeight: { type: Number, optional: true },
27400
27403
  class: { type: String, optional: true },
27404
+ disableNoColor: { type: Boolean, optional: true },
27401
27405
  };
27402
27406
  static components = { ColorPicker };
27403
27407
  colorPickerButtonRef = owl.useRef("colorPickerButton");
@@ -28956,6 +28960,9 @@ class ConditionalFormattingEditor extends owl.Component {
28956
28960
  }
28957
28961
  }
28958
28962
  setColorScaleColor(target, color) {
28963
+ if (!isColorValid(color)) {
28964
+ return;
28965
+ }
28959
28966
  const point = this.state.rules.colorScale[target];
28960
28967
  if (point) {
28961
28968
  point.color = Number.parseInt(color.substr(1), 16);
@@ -59052,7 +59059,8 @@ function addFormula(cell) {
59052
59059
  }
59053
59060
  const attrs = [["t", type]];
59054
59061
  const XlsxFormula = adaptFormulaToExcel(formula);
59055
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
59062
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
59063
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
59056
59064
  return { attrs, node };
59057
59065
  }
59058
59066
  function addContent(content, sharedStrings, forceString = false) {
@@ -59087,8 +59095,14 @@ function adaptFormulaToExcel(formulaText) {
59087
59095
  ast = addMissingRequiredArgs(ast);
59088
59096
  return ast;
59089
59097
  });
59098
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
59099
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
59100
+ });
59090
59101
  return ast ? astToFormula(ast) : formulaText;
59091
59102
  }
59103
+ function adaptFormulaValueToExcel(formulaValue) {
59104
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
59105
+ }
59092
59106
  /**
59093
59107
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
59094
59108
  * This adds those missing args.
@@ -60959,6 +60973,6 @@ exports.tokenColors = tokenColors;
60959
60973
  exports.tokenize = tokenize;
60960
60974
 
60961
60975
 
60962
- __info__.version = "17.2.24";
60963
- __info__.date = "2024-10-14T07:49:56.845Z";
60964
- __info__.hash = "7e88bec";
60976
+ __info__.version = "17.2.26";
60977
+ __info__.date = "2024-11-13T15:04:03.710Z";
60978
+ __info__.hash = "19b7478";
@@ -5932,6 +5932,7 @@ interface ColorPickerProps {
5932
5932
  maxHeight?: Pixel;
5933
5933
  onColorPicked: (color: Color) => void;
5934
5934
  currentColor: Color;
5935
+ disableNoColor?: boolean;
5935
5936
  }
5936
5937
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
5937
5938
  static template: string;
@@ -5946,6 +5947,10 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
5946
5947
  optional: boolean;
5947
5948
  };
5948
5949
  anchorRect: ObjectConstructor;
5950
+ disableNoColor: {
5951
+ type: BooleanConstructor;
5952
+ optional: boolean;
5953
+ };
5949
5954
  };
5950
5955
  static defaultProps: {
5951
5956
  currentColor: string;
@@ -5986,6 +5991,7 @@ interface Props$I {
5986
5991
  disabled?: boolean;
5987
5992
  dropdownMaxHeight?: Pixel;
5988
5993
  class?: string;
5994
+ disableNoColor?: boolean;
5989
5995
  }
5990
5996
  declare class ColorPickerWidget extends Component<Props$I, SpreadsheetChildEnv> {
5991
5997
  static template: string;
@@ -6014,6 +6020,10 @@ declare class ColorPickerWidget extends Component<Props$I, SpreadsheetChildEnv>
6014
6020
  type: StringConstructor;
6015
6021
  optional: boolean;
6016
6022
  };
6023
+ disableNoColor: {
6024
+ type: BooleanConstructor;
6025
+ optional: boolean;
6026
+ };
6017
6027
  };
6018
6028
  static components: {
6019
6029
  ColorPicker: typeof ColorPicker;
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.24
7
- * @date 2024-10-14T07:49:56.845Z
8
- * @hash 7e88bec
6
+ * @version 17.2.26
7
+ * @date 2024-11-13T15:04:03.710Z
8
+ * @hash 19b7478
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
@@ -6645,7 +6645,10 @@ function parseOperand(tokens) {
6645
6645
  case "STRING":
6646
6646
  return { type: "STRING", value: removeStringQuotes(current.value) };
6647
6647
  case "INVALID_REFERENCE":
6648
- throw new InvalidReferenceError();
6648
+ return {
6649
+ type: "REFERENCE",
6650
+ value: CellErrorType.InvalidReference,
6651
+ };
6649
6652
  case "REFERENCE":
6650
6653
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
6651
6654
  tokens.shift();
@@ -19690,11 +19693,14 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
19690
19693
  function getChartLabelFormat(getters, range) {
19691
19694
  if (!range)
19692
19695
  return undefined;
19693
- return getters.getEvaluatedCell({
19694
- sheetId: range.sheetId,
19695
- col: range.zone.left,
19696
- row: range.zone.top,
19697
- }).format;
19696
+ const { sheetId, zone: { left, top, bottom }, } = range;
19697
+ for (let row = top; row <= bottom; row++) {
19698
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
19699
+ if (format) {
19700
+ return format;
19701
+ }
19702
+ }
19703
+ return undefined;
19698
19704
  }
19699
19705
  function getChartLabelValues(getters, dataSets, labelRange) {
19700
19706
  let labels = { values: [], formattedValues: [] };
@@ -20410,11 +20416,7 @@ function canBeDateChart(labelRange, getters) {
20410
20416
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
20411
20417
  return false;
20412
20418
  }
20413
- const labelFormat = getters.getEvaluatedCell({
20414
- sheetId: labelRange.sheetId,
20415
- col: labelRange.zone.left,
20416
- row: labelRange.zone.top,
20417
- }).format;
20419
+ const labelFormat = getChartLabelFormat(getters, labelRange);
20418
20420
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
20419
20421
  }
20420
20422
  function canBeLinearChart(labelRange, getters) {
@@ -27213,6 +27215,7 @@ class ColorPicker extends Component {
27213
27215
  currentColor: { type: String, optional: true },
27214
27216
  maxHeight: { type: Number, optional: true },
27215
27217
  anchorRect: Object,
27218
+ disableNoColor: { type: Boolean, optional: true },
27216
27219
  };
27217
27220
  static defaultProps = { currentColor: "" };
27218
27221
  static components = { Popover };
@@ -27396,6 +27399,7 @@ class ColorPickerWidget extends Component {
27396
27399
  disabled: { type: Boolean, optional: true },
27397
27400
  dropdownMaxHeight: { type: Number, optional: true },
27398
27401
  class: { type: String, optional: true },
27402
+ disableNoColor: { type: Boolean, optional: true },
27399
27403
  };
27400
27404
  static components = { ColorPicker };
27401
27405
  colorPickerButtonRef = useRef("colorPickerButton");
@@ -28954,6 +28958,9 @@ class ConditionalFormattingEditor extends Component {
28954
28958
  }
28955
28959
  }
28956
28960
  setColorScaleColor(target, color) {
28961
+ if (!isColorValid(color)) {
28962
+ return;
28963
+ }
28957
28964
  const point = this.state.rules.colorScale[target];
28958
28965
  if (point) {
28959
28966
  point.color = Number.parseInt(color.substr(1), 16);
@@ -59050,7 +59057,8 @@ function addFormula(cell) {
59050
59057
  }
59051
59058
  const attrs = [["t", type]];
59052
59059
  const XlsxFormula = adaptFormulaToExcel(formula);
59053
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
59060
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
59061
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
59054
59062
  return { attrs, node };
59055
59063
  }
59056
59064
  function addContent(content, sharedStrings, forceString = false) {
@@ -59085,8 +59093,14 @@ function adaptFormulaToExcel(formulaText) {
59085
59093
  ast = addMissingRequiredArgs(ast);
59086
59094
  return ast;
59087
59095
  });
59096
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
59097
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
59098
+ });
59088
59099
  return ast ? astToFormula(ast) : formulaText;
59089
59100
  }
59101
+ function adaptFormulaValueToExcel(formulaValue) {
59102
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
59103
+ }
59090
59104
  /**
59091
59105
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
59092
59106
  * This adds those missing args.
@@ -60916,6 +60930,6 @@ const constants = {
60916
60930
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
60917
60931
 
60918
60932
 
60919
- __info__.version = "17.2.24";
60920
- __info__.date = "2024-10-14T07:49:56.845Z";
60921
- __info__.hash = "7e88bec";
60933
+ __info__.version = "17.2.26";
60934
+ __info__.date = "2024-11-13T15:04:03.710Z";
60935
+ __info__.hash = "19b7478";
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.24
7
- * @date 2024-10-14T07:49:56.845Z
8
- * @hash 7e88bec
6
+ * @version 17.2.26
7
+ * @date 2024-11-13T15:04:03.710Z
8
+ * @hash 19b7478
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -6646,7 +6646,10 @@
6646
6646
  case "STRING":
6647
6647
  return { type: "STRING", value: removeStringQuotes(current.value) };
6648
6648
  case "INVALID_REFERENCE":
6649
- throw new InvalidReferenceError();
6649
+ return {
6650
+ type: "REFERENCE",
6651
+ value: CellErrorType.InvalidReference,
6652
+ };
6650
6653
  case "REFERENCE":
6651
6654
  if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
6652
6655
  tokens.shift();
@@ -19691,11 +19694,14 @@ stores.inject(MyMetaStore, storeInstance);
19691
19694
  function getChartLabelFormat(getters, range) {
19692
19695
  if (!range)
19693
19696
  return undefined;
19694
- return getters.getEvaluatedCell({
19695
- sheetId: range.sheetId,
19696
- col: range.zone.left,
19697
- row: range.zone.top,
19698
- }).format;
19697
+ const { sheetId, zone: { left, top, bottom }, } = range;
19698
+ for (let row = top; row <= bottom; row++) {
19699
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
19700
+ if (format) {
19701
+ return format;
19702
+ }
19703
+ }
19704
+ return undefined;
19699
19705
  }
19700
19706
  function getChartLabelValues(getters, dataSets, labelRange) {
19701
19707
  let labels = { values: [], formattedValues: [] };
@@ -20411,11 +20417,7 @@ stores.inject(MyMetaStore, storeInstance);
20411
20417
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
20412
20418
  return false;
20413
20419
  }
20414
- const labelFormat = getters.getEvaluatedCell({
20415
- sheetId: labelRange.sheetId,
20416
- col: labelRange.zone.left,
20417
- row: labelRange.zone.top,
20418
- }).format;
20420
+ const labelFormat = getChartLabelFormat(getters, labelRange);
20419
20421
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
20420
20422
  }
20421
20423
  function canBeLinearChart(labelRange, getters) {
@@ -27214,6 +27216,7 @@ stores.inject(MyMetaStore, storeInstance);
27214
27216
  currentColor: { type: String, optional: true },
27215
27217
  maxHeight: { type: Number, optional: true },
27216
27218
  anchorRect: Object,
27219
+ disableNoColor: { type: Boolean, optional: true },
27217
27220
  };
27218
27221
  static defaultProps = { currentColor: "" };
27219
27222
  static components = { Popover };
@@ -27397,6 +27400,7 @@ stores.inject(MyMetaStore, storeInstance);
27397
27400
  disabled: { type: Boolean, optional: true },
27398
27401
  dropdownMaxHeight: { type: Number, optional: true },
27399
27402
  class: { type: String, optional: true },
27403
+ disableNoColor: { type: Boolean, optional: true },
27400
27404
  };
27401
27405
  static components = { ColorPicker };
27402
27406
  colorPickerButtonRef = owl.useRef("colorPickerButton");
@@ -28955,6 +28959,9 @@ stores.inject(MyMetaStore, storeInstance);
28955
28959
  }
28956
28960
  }
28957
28961
  setColorScaleColor(target, color) {
28962
+ if (!isColorValid(color)) {
28963
+ return;
28964
+ }
28958
28965
  const point = this.state.rules.colorScale[target];
28959
28966
  if (point) {
28960
28967
  point.color = Number.parseInt(color.substr(1), 16);
@@ -59051,7 +59058,8 @@ stores.inject(MyMetaStore, storeInstance);
59051
59058
  }
59052
59059
  const attrs = [["t", type]];
59053
59060
  const XlsxFormula = adaptFormulaToExcel(formula);
59054
- const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
59061
+ const exportedValue = adaptFormulaValueToExcel(cell.value);
59062
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
59055
59063
  return { attrs, node };
59056
59064
  }
59057
59065
  function addContent(content, sharedStrings, forceString = false) {
@@ -59086,8 +59094,14 @@ stores.inject(MyMetaStore, storeInstance);
59086
59094
  ast = addMissingRequiredArgs(ast);
59087
59095
  return ast;
59088
59096
  });
59097
+ ast = convertAstNodes(ast, "REFERENCE", (ast) => {
59098
+ return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
59099
+ });
59089
59100
  return ast ? astToFormula(ast) : formulaText;
59090
59101
  }
59102
+ function adaptFormulaValueToExcel(formulaValue) {
59103
+ return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
59104
+ }
59091
59105
  /**
59092
59106
  * Some Excel function need required args that might not be mandatory in o-spreadsheet.
59093
59107
  * This adds those missing args.
@@ -60958,9 +60972,9 @@ stores.inject(MyMetaStore, storeInstance);
60958
60972
  exports.tokenize = tokenize;
60959
60973
 
60960
60974
 
60961
- __info__.version = "17.2.24";
60962
- __info__.date = "2024-10-14T07:49:56.845Z";
60963
- __info__.hash = "7e88bec";
60975
+ __info__.version = "17.2.26";
60976
+ __info__.date = "2024-11-13T15:04:03.710Z";
60977
+ __info__.hash = "19b7478";
60964
60978
 
60965
60979
 
60966
60980
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);