@odoo/o-spreadsheet 18.0.24 → 18.0.25

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 18.0.24
6
- * @date 2025-04-18T16:23:09.320Z
7
- * @hash aa18758
5
+ * @version 18.0.25
6
+ * @date 2025-04-25T08:08:43.377Z
7
+ * @hash 24aac2c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3664,11 +3664,13 @@
3664
3664
  NullError: "#NULL!",
3665
3665
  };
3666
3666
  const errorTypes = new Set(Object.values(CellErrorType));
3667
- class EvaluationError extends Error {
3667
+ class EvaluationError {
3668
+ message;
3668
3669
  value;
3669
3670
  constructor(message = _t("Error"), value = CellErrorType.GenericError) {
3670
- super(message);
3671
+ this.message = message;
3671
3672
  this.value = value;
3673
+ this.message = message.toString();
3672
3674
  }
3673
3675
  }
3674
3676
  class BadExpressionError extends EvaluationError {
@@ -15667,9 +15669,11 @@ stores.inject(MyMetaStore, storeInstance);
15667
15669
  const GAUGE_TITLE_PADDING_TOP = SCORECARD_GAUGE_CHART_PADDING;
15668
15670
  function drawGaugeChart(canvas, runtime) {
15669
15671
  const canvasBoundingRect = canvas.getBoundingClientRect();
15670
- canvas.width = canvasBoundingRect.width;
15671
- canvas.height = canvasBoundingRect.height;
15672
+ const dpr = window.devicePixelRatio || 1;
15673
+ canvas.width = dpr * canvasBoundingRect.width;
15674
+ canvas.height = dpr * canvasBoundingRect.height;
15672
15675
  const ctx = canvas.getContext("2d");
15676
+ ctx.scale(dpr, dpr);
15673
15677
  const config = getGaugeRenderingConfig(canvasBoundingRect, runtime, ctx);
15674
15678
  drawBackground(ctx, config);
15675
15679
  drawGauge(ctx, config);
@@ -16231,9 +16235,11 @@ stores.inject(MyMetaStore, storeInstance);
16231
16235
  };
16232
16236
  function drawScoreChart(structure, canvas) {
16233
16237
  const ctx = canvas.getContext("2d");
16234
- canvas.width = structure.canvas.width;
16235
- const availableWidth = canvas.width - DEFAULT_CHART_PADDING;
16236
- canvas.height = structure.canvas.height;
16238
+ const dpr = window.devicePixelRatio || 1;
16239
+ canvas.width = dpr * structure.canvas.width;
16240
+ canvas.height = dpr * structure.canvas.height;
16241
+ ctx.scale(dpr, dpr);
16242
+ const availableWidth = structure.canvas.width - DEFAULT_CHART_PADDING;
16237
16243
  ctx.fillStyle = structure.canvas.backgroundColor;
16238
16244
  ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
16239
16245
  if (structure.title) {
@@ -16944,6 +16950,10 @@ stores.inject(MyMetaStore, storeInstance);
16944
16950
  this.currentRuntime = runtime;
16945
16951
  }
16946
16952
  });
16953
+ owl.useEffect(() => {
16954
+ this.currentRuntime = this.chartRuntime;
16955
+ this.updateChartJs(deepCopy(this.currentRuntime));
16956
+ }, () => [window.devicePixelRatio]);
16947
16957
  }
16948
16958
  createChart(chartData) {
16949
16959
  const canvas = this.canvas.el;
@@ -16985,7 +16995,7 @@ stores.inject(MyMetaStore, storeInstance);
16985
16995
  owl.useEffect(this.createChart.bind(this), () => {
16986
16996
  const canvas = this.canvas.el;
16987
16997
  const rect = canvas.getBoundingClientRect();
16988
- return [rect.width, rect.height, this.runtime, this.canvas.el];
16998
+ return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
16989
16999
  });
16990
17000
  }
16991
17001
  createChart() {
@@ -17453,7 +17463,7 @@ stores.inject(MyMetaStore, storeInstance);
17453
17463
  assertSquareMatrix(_t("The argument square_matrix must have the same number of columns and rows."), _matrix);
17454
17464
  const { inverted } = invertMatrix(_matrix);
17455
17465
  if (!inverted) {
17456
- throw new EvaluationError(_t("The matrix is not invertible."));
17466
+ return new EvaluationError(_t("The matrix is not invertible."));
17457
17467
  }
17458
17468
  return inverted;
17459
17469
  },
@@ -17613,7 +17623,7 @@ stores.inject(MyMetaStore, storeInstance);
17613
17623
  .flat()
17614
17624
  .filter(shouldKeepValue(_ignore));
17615
17625
  if (result.length === 0) {
17616
- throw new NotAvailableError(_t("No results for the given arguments of TOCOL."));
17626
+ return new NotAvailableError(_t("No results for the given arguments of TOCOL."));
17617
17627
  }
17618
17628
  return [result];
17619
17629
  },
@@ -17634,7 +17644,7 @@ stores.inject(MyMetaStore, storeInstance);
17634
17644
  .filter(shouldKeepValue(_ignore))
17635
17645
  .map((item) => [item]);
17636
17646
  if (result.length === 0 || result[0].length === 0) {
17637
- throw new NotAvailableError(_t("No results for the given arguments of TOROW."));
17647
+ return new NotAvailableError(_t("No results for the given arguments of TOROW."));
17638
17648
  }
17639
17649
  return result;
17640
17650
  },
@@ -18481,7 +18491,7 @@ stores.inject(MyMetaStore, storeInstance);
18481
18491
  count += 1;
18482
18492
  }
18483
18493
  if (isEvaluationError(f)) {
18484
- throw j;
18494
+ return j;
18485
18495
  }
18486
18496
  }
18487
18497
  }
@@ -19384,7 +19394,7 @@ stores.inject(MyMetaStore, storeInstance);
19384
19394
  const flatY = dataY.flat();
19385
19395
  assertSameNumberOfElements(flatX, flatY);
19386
19396
  if (flatX.length === 0) {
19387
- throw new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
19397
+ return new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
19388
19398
  }
19389
19399
  const n = flatX.length;
19390
19400
  let trueN = 0, trueP = 0, falseP = 0, falseN = 0;
@@ -19747,7 +19757,7 @@ stores.inject(MyMetaStore, storeInstance);
19747
19757
  }
19748
19758
  }
19749
19759
  if (!found) {
19750
- throw new NotAvailableError(_t("Value not found in the given data."));
19760
+ return new NotAvailableError(_t("Value not found in the given data."));
19751
19761
  }
19752
19762
  return rank;
19753
19763
  },
@@ -21372,7 +21382,7 @@ stores.inject(MyMetaStore, storeInstance);
21372
21382
  }
21373
21383
  }
21374
21384
  if (!result.length) {
21375
- throw new NotAvailableError(_t("No match found in FILTER evaluation"));
21385
+ return new NotAvailableError(_t("No match found in FILTER evaluation"));
21376
21386
  }
21377
21387
  return mode === "row" ? transposeMatrix(result) : result;
21378
21388
  },
@@ -21501,7 +21511,7 @@ stores.inject(MyMetaStore, storeInstance);
21501
21511
  result.push(row.data);
21502
21512
  }
21503
21513
  if (!result.length)
21504
- throw new EvaluationError(_t("No unique values found"));
21514
+ return new EvaluationError(_t("No unique values found"));
21505
21515
  return _byColumn ? result : transposeMatrix(result);
21506
21516
  },
21507
21517
  isExported: true,
@@ -24427,7 +24437,7 @@ stores.inject(MyMetaStore, storeInstance);
24427
24437
  return result;
24428
24438
  }
24429
24439
  }
24430
- throw new EvaluationError(_t("No match."));
24440
+ return new EvaluationError(_t("No match."));
24431
24441
  },
24432
24442
  isExported: true,
24433
24443
  };
@@ -24618,7 +24628,7 @@ stores.inject(MyMetaStore, storeInstance);
24618
24628
  ],
24619
24629
  compute: function (cellReference) {
24620
24630
  if (isEvaluationError(cellReference?.value)) {
24621
- throw cellReference;
24631
+ return cellReference;
24622
24632
  }
24623
24633
  const column = cellReference === undefined
24624
24634
  ? this.__originCellPosition?.col
@@ -24636,7 +24646,7 @@ stores.inject(MyMetaStore, storeInstance);
24636
24646
  args: [arg("range (meta)", _t("The range whose column count will be returned."))],
24637
24647
  compute: function (range) {
24638
24648
  if (isEvaluationError(range?.value)) {
24639
- throw range;
24649
+ return range;
24640
24650
  }
24641
24651
  const zone = toZone(range.value);
24642
24652
  return zone.right - zone.left + 1;
@@ -24714,11 +24724,11 @@ stores.inject(MyMetaStore, storeInstance);
24714
24724
  compute: function (reference, useA1Notation = { value: true }) {
24715
24725
  let _reference = reference?.value?.toString();
24716
24726
  if (!_reference) {
24717
- throw new InvalidReferenceError(_t("Reference should be defined."));
24727
+ return new InvalidReferenceError(_t("Reference should be defined."));
24718
24728
  }
24719
24729
  const _useA1Notation = toBoolean(useA1Notation);
24720
24730
  if (!_useA1Notation) {
24721
- throw new EvaluationError(_t("R1C1 notation is not supported."));
24731
+ return new EvaluationError(_t("R1C1 notation is not supported."));
24722
24732
  }
24723
24733
  const sheetId = this.__originSheetId;
24724
24734
  const originPosition = this.__originCellPosition;
@@ -24730,7 +24740,7 @@ stores.inject(MyMetaStore, storeInstance);
24730
24740
  }
24731
24741
  const range = this.getters.getRangeFromSheetXC(sheetId, _reference);
24732
24742
  if (range === undefined || range.invalidXc || range.invalidSheetName) {
24733
- throw new InvalidReferenceError();
24743
+ return new InvalidReferenceError();
24734
24744
  }
24735
24745
  if (originPosition) {
24736
24746
  this.addDependencies?.(originPosition, [range]);
@@ -24841,7 +24851,7 @@ stores.inject(MyMetaStore, storeInstance);
24841
24851
  ],
24842
24852
  compute: function (cellReference) {
24843
24853
  if (isEvaluationError(cellReference?.value)) {
24844
- throw cellReference;
24854
+ return cellReference;
24845
24855
  }
24846
24856
  const row = cellReference === undefined
24847
24857
  ? this.__originCellPosition?.row
@@ -24859,7 +24869,7 @@ stores.inject(MyMetaStore, storeInstance);
24859
24869
  args: [arg("range (meta)", _t("The range whose row count will be returned."))],
24860
24870
  compute: function (range) {
24861
24871
  if (isEvaluationError(range?.value)) {
24862
- throw range;
24872
+ return range;
24863
24873
  }
24864
24874
  const zone = toZone(range.value);
24865
24875
  return zone.bottom - zone.top + 1;
@@ -25045,11 +25055,11 @@ stores.inject(MyMetaStore, storeInstance);
25045
25055
  const _pivotFormulaId = toString(pivotFormulaId);
25046
25056
  const _rowCount = toNumber(rowCount, this.locale);
25047
25057
  if (_rowCount < 0) {
25048
- throw new EvaluationError(_t("The number of rows must be positive."));
25058
+ return new EvaluationError(_t("The number of rows must be positive."));
25049
25059
  }
25050
25060
  const _columnCount = toNumber(columnCount, this.locale);
25051
25061
  if (_columnCount < 0) {
25052
- throw new EvaluationError(_t("The number of columns must be positive."));
25062
+ return new EvaluationError(_t("The number of columns must be positive."));
25053
25063
  }
25054
25064
  const _includeColumnHeaders = toBoolean(includeColumnHeaders);
25055
25065
  const _includedTotal = toBoolean(includeTotal);
@@ -25117,7 +25127,7 @@ stores.inject(MyMetaStore, storeInstance);
25117
25127
  }
25118
25128
  const _cellReference = cellReference?.value;
25119
25129
  if (!_cellReference) {
25120
- throw new Error("In this context, the function OFFSET needs to have a cell or range in parameter.");
25130
+ return new EvaluationError("In this context, the function OFFSET needs to have a cell or range in parameter.");
25121
25131
  }
25122
25132
  const zone = toZone(_cellReference);
25123
25133
  let offsetHeight = zone.bottom - zone.top + 1;
@@ -28923,7 +28933,7 @@ stores.inject(MyMetaStore, storeInstance);
28923
28933
  owl.useEffect(() => drawGaugeChart(this.canvas.el, this.runtime), () => {
28924
28934
  const canvas = this.canvas.el;
28925
28935
  const rect = canvas.getBoundingClientRect();
28926
- return [rect.width, rect.height, this.runtime, this.canvas.el];
28936
+ return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
28927
28937
  });
28928
28938
  }
28929
28939
  }
@@ -37481,7 +37491,7 @@ stores.inject(MyMetaStore, storeInstance);
37481
37491
  }
37482
37492
  setHexColor(ev) {
37483
37493
  // only support HEX code input
37484
- const val = ev.target.value.slice(0, 7);
37494
+ const val = ev.target.value.replace("##", "#").slice(0, 7);
37485
37495
  this.state.customHexColor = val;
37486
37496
  if (!isColorValid(val)) ;
37487
37497
  else {
@@ -59897,6 +59907,16 @@ stores.inject(MyMetaStore, storeInstance);
59897
59907
  }
59898
59908
  return values;
59899
59909
  }
59910
+ else if (rowDomain.length === this.definition.rows.length &&
59911
+ colDomain.length &&
59912
+ colDomain.length < this.definition.columns.length) {
59913
+ const colSubTree = this.getSubTreeMatchingDomain(table.getColTree(), colDomain);
59914
+ const domains = this.treeToLeafDomains(colSubTree, colDomain);
59915
+ for (const domain of domains) {
59916
+ values.push(this._getPivotCellValueAndFormat(measure.id, rowDomain.concat(domain)));
59917
+ }
59918
+ return values;
59919
+ }
59900
59920
  else {
59901
59921
  const tree = table.getRowTree();
59902
59922
  const subTree = this.getSubTreeMatchingDomain(tree, rowDomain);
@@ -73756,9 +73776,9 @@ stores.inject(MyMetaStore, storeInstance);
73756
73776
  exports.tokenize = tokenize;
73757
73777
 
73758
73778
 
73759
- __info__.version = "18.0.24";
73760
- __info__.date = "2025-04-18T16:23:09.320Z";
73761
- __info__.hash = "aa18758";
73779
+ __info__.version = "18.0.25";
73780
+ __info__.date = "2025-04-25T08:08:43.377Z";
73781
+ __info__.hash = "24aac2c";
73762
73782
 
73763
73783
 
73764
73784
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);