@odoo/o-spreadsheet 18.2.32 → 18.2.33

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.2.32
6
- * @date 2025-10-07T09:59:52.165Z
7
- * @hash a42c448
5
+ * @version 18.2.33
6
+ * @date 2025-10-16T06:39:40.421Z
7
+ * @hash 280596c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3915,7 +3915,17 @@
3915
3915
  return toMatrix(data).map((row) => {
3916
3916
  return row.map((cell) => {
3917
3917
  if (typeof cell.value !== "number") {
3918
- throw new EvaluationError(_t("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.", argName, typeof cell.value));
3918
+ let message = "";
3919
+ if (typeof cell === "object") {
3920
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got an empty value.", argName);
3921
+ }
3922
+ else if (typeof cell === "string") {
3923
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got a string.", argName);
3924
+ }
3925
+ else if (typeof cell === "boolean") {
3926
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got a boolean.", argName);
3927
+ }
3928
+ throw new EvaluationError(message);
3919
3929
  }
3920
3930
  return cell.value;
3921
3931
  });
@@ -8817,7 +8827,7 @@
8817
8827
  pasteCell(origin, target, clipboardOption) {
8818
8828
  const { sheetId, col, row } = target;
8819
8829
  const targetCell = this.getters.getEvaluatedCell(target);
8820
- const originFormat = origin?.format ?? origin.evaluatedCell.format;
8830
+ const originFormat = origin?.format || origin.evaluatedCell.format;
8821
8831
  if (clipboardOption?.pasteOption === "asValue") {
8822
8832
  this.dispatch("UPDATE_CELL", {
8823
8833
  ...target,
@@ -10438,6 +10448,10 @@ stores.inject(MyMetaStore, storeInstance);
10438
10448
  }
10439
10449
  const ctx = chart.ctx;
10440
10450
  ctx.save();
10451
+ const { left, top, height, width } = chart.chartArea;
10452
+ ctx.beginPath();
10453
+ ctx.rect(left, top, width, height);
10454
+ ctx.clip();
10441
10455
  ctx.textAlign = "center";
10442
10456
  ctx.textBaseline = "middle";
10443
10457
  ctx.miterLimit = 1; // Avoid sharp artifacts on strokeText
@@ -13643,7 +13657,7 @@ stores.inject(MyMetaStore, storeInstance);
13643
13657
  ],
13644
13658
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
13645
13659
  assertNonEmptyMatrix(knownDataY, "known_data_y");
13646
- return expM(predictLinearValues(logM(toNumberMatrix(knownDataY, "the first argument (known_data_y)")), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b)));
13660
+ return expM(predictLinearValues(logM(toNumberMatrix(knownDataY, "known_data_y")), toNumberMatrix(knownDataX, "known_data_x"), toNumberMatrix(newDataX, "new_data_y"), toBoolean(b)));
13647
13661
  },
13648
13662
  };
13649
13663
  // -----------------------------------------------------------------------------
@@ -13708,7 +13722,7 @@ stores.inject(MyMetaStore, storeInstance);
13708
13722
  ],
13709
13723
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
13710
13724
  assertNonEmptyMatrix(dataY, "data_y");
13711
- return fullLinearRegression(toNumberMatrix(dataX, "the first argument (data_y)"), toNumberMatrix(dataY, "the second argument (data_x)"), toBoolean(calculateB), toBoolean(verbose));
13725
+ return fullLinearRegression(toNumberMatrix(dataX, "data_x"), toNumberMatrix(dataY, "data_y"), toBoolean(calculateB), toBoolean(verbose));
13712
13726
  },
13713
13727
  isExported: true,
13714
13728
  };
@@ -13725,7 +13739,7 @@ stores.inject(MyMetaStore, storeInstance);
13725
13739
  ],
13726
13740
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
13727
13741
  assertNonEmptyMatrix(dataY, "data_y");
13728
- const coeffs = fullLinearRegression(toNumberMatrix(dataX, "the second argument (data_x)"), logM(toNumberMatrix(dataY, "the first argument (data_y)")), toBoolean(calculateB), toBoolean(verbose));
13742
+ const coeffs = fullLinearRegression(toNumberMatrix(dataX, "data_x"), logM(toNumberMatrix(dataY, "data_y")), toBoolean(calculateB), toBoolean(verbose));
13729
13743
  for (let i = 0; i < coeffs.length; i++) {
13730
13744
  coeffs[i][0] = Math.exp(coeffs[i][0]);
13731
13745
  }
@@ -14315,7 +14329,7 @@ stores.inject(MyMetaStore, storeInstance);
14315
14329
  ],
14316
14330
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
14317
14331
  assertNonEmptyMatrix(knownDataY, "known_data_y");
14318
- return predictLinearValues(toNumberMatrix(knownDataY, "the first argument (known_data_y)"), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b));
14332
+ return predictLinearValues(toNumberMatrix(knownDataY, "known_data_y"), toNumberMatrix(knownDataX, "known_data_x"), toNumberMatrix(newDataX, "new_data_y"), toBoolean(b));
14319
14333
  },
14320
14334
  };
14321
14335
  // -----------------------------------------------------------------------------
@@ -23746,6 +23760,74 @@ stores.inject(MyMetaStore, storeInstance);
23746
23760
  }
23747
23761
  });
23748
23762
 
23763
+ /**
23764
+ * Get the relative path between two files
23765
+ *
23766
+ * Eg.:
23767
+ * from "folder1/file1.txt" to "folder2/file2.txt" => "../folder2/file2.txt"
23768
+ */
23769
+ function getRelativePath(from, to) {
23770
+ const fromPathParts = from.split("/");
23771
+ const toPathParts = to.split("/");
23772
+ let relPath = "";
23773
+ let startIndex = 0;
23774
+ for (let i = 0; i < fromPathParts.length - 1; i++) {
23775
+ if (fromPathParts[i] === toPathParts[i]) {
23776
+ startIndex++;
23777
+ }
23778
+ else {
23779
+ relPath += "../";
23780
+ }
23781
+ }
23782
+ relPath += toPathParts.slice(startIndex).join("/");
23783
+ return relPath;
23784
+ }
23785
+ /**
23786
+ * Convert an array of element into an object where the objects keys were the elements position in the array.
23787
+ * Can give an offset as argument, and all the array indexes will we shifted by this offset in the returned object.
23788
+ *
23789
+ * eg. : ["a", "b"] => {0:"a", 1:"b"}
23790
+ */
23791
+ function arrayToObject(array, indexOffset = 0) {
23792
+ const obj = {};
23793
+ for (let i = 0; i < array.length; i++) {
23794
+ if (array[i]) {
23795
+ obj[i + indexOffset] = array[i];
23796
+ }
23797
+ }
23798
+ return obj;
23799
+ }
23800
+ /**
23801
+ * In xlsx we can have string with unicode characters with the format _x00fa_.
23802
+ * Replace with characters understandable by JS
23803
+ */
23804
+ function fixXlsxUnicode(str) {
23805
+ return str.replace(/_x([0-9a-zA-Z]{4})_/g, (match, code) => {
23806
+ return String.fromCharCode(parseInt(code, 16));
23807
+ });
23808
+ }
23809
+ /** Get a header in the SheetData. Create the header if it doesn't exist in the SheetData */
23810
+ function getSheetDataHeader(sheetData, dimension, index) {
23811
+ if (dimension === "COL") {
23812
+ if (!sheetData.cols[index]) {
23813
+ sheetData.cols[index] = {};
23814
+ }
23815
+ return sheetData.cols[index];
23816
+ }
23817
+ if (!sheetData.rows[index]) {
23818
+ sheetData.rows[index] = {};
23819
+ }
23820
+ return sheetData.rows[index];
23821
+ }
23822
+ /** Prefix the string by "=" if the string looks like a formula */
23823
+ function prefixFormulaWithEqual(formula) {
23824
+ if (formula[0] === "=") {
23825
+ return formula;
23826
+ }
23827
+ const tokens = tokenize(formula);
23828
+ return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
23829
+ }
23830
+
23749
23831
  /**
23750
23832
  * Map of the different types of conversions warnings and their name in error messages
23751
23833
  */
@@ -24253,66 +24335,6 @@ stores.inject(MyMetaStore, storeInstance);
24253
24335
  */
24254
24336
  const DEFAULT_SYSTEM_COLOR = "FF000000";
24255
24337
 
24256
- /**
24257
- * Get the relative path between two files
24258
- *
24259
- * Eg.:
24260
- * from "folder1/file1.txt" to "folder2/file2.txt" => "../folder2/file2.txt"
24261
- */
24262
- function getRelativePath(from, to) {
24263
- const fromPathParts = from.split("/");
24264
- const toPathParts = to.split("/");
24265
- let relPath = "";
24266
- let startIndex = 0;
24267
- for (let i = 0; i < fromPathParts.length - 1; i++) {
24268
- if (fromPathParts[i] === toPathParts[i]) {
24269
- startIndex++;
24270
- }
24271
- else {
24272
- relPath += "../";
24273
- }
24274
- }
24275
- relPath += toPathParts.slice(startIndex).join("/");
24276
- return relPath;
24277
- }
24278
- /**
24279
- * Convert an array of element into an object where the objects keys were the elements position in the array.
24280
- * Can give an offset as argument, and all the array indexes will we shifted by this offset in the returned object.
24281
- *
24282
- * eg. : ["a", "b"] => {0:"a", 1:"b"}
24283
- */
24284
- function arrayToObject(array, indexOffset = 0) {
24285
- const obj = {};
24286
- for (let i = 0; i < array.length; i++) {
24287
- if (array[i]) {
24288
- obj[i + indexOffset] = array[i];
24289
- }
24290
- }
24291
- return obj;
24292
- }
24293
- /**
24294
- * In xlsx we can have string with unicode characters with the format _x00fa_.
24295
- * Replace with characters understandable by JS
24296
- */
24297
- function fixXlsxUnicode(str) {
24298
- return str.replace(/_x([0-9a-zA-Z]{4})_/g, (match, code) => {
24299
- return String.fromCharCode(parseInt(code, 16));
24300
- });
24301
- }
24302
- /** Get a header in the SheetData. Create the header if it doesn't exist in the SheetData */
24303
- function getSheetDataHeader(sheetData, dimension, index) {
24304
- if (dimension === "COL") {
24305
- if (!sheetData.cols[index]) {
24306
- sheetData.cols[index] = {};
24307
- }
24308
- return sheetData.cols[index];
24309
- }
24310
- if (!sheetData.rows[index]) {
24311
- sheetData.rows[index] = {};
24312
- }
24313
- return sheetData.rows[index];
24314
- }
24315
-
24316
24338
  const XLSX_DATE_FORMAT_REGEX = /^(yy|yyyy|m{1,5}|d{1,4}|h{1,2}|s{1,2}|am\/pm|a\/m|\s|-|\/|\.|:)+$/i;
24317
24339
  /**
24318
24340
  * Convert excel format to o_spreadsheet format
@@ -24522,9 +24544,9 @@ stores.inject(MyMetaStore, storeInstance);
24522
24544
  if (!rule.operator || !rule.formula || rule.formula.length === 0)
24523
24545
  continue;
24524
24546
  operator = convertCFCellIsOperator(rule.operator);
24525
- values.push(prefixFormula(rule.formula[0]));
24547
+ values.push(prefixFormulaWithEqual(rule.formula[0]));
24526
24548
  if (rule.formula.length === 2) {
24527
- values.push(prefixFormula(rule.formula[1]));
24549
+ values.push(prefixFormulaWithEqual(rule.formula[1]));
24528
24550
  }
24529
24551
  break;
24530
24552
  }
@@ -24682,11 +24704,6 @@ stores.inject(MyMetaStore, storeInstance);
24682
24704
  ? ICON_SETS[iconSet].neutral
24683
24705
  : ICON_SETS[iconSet].good;
24684
24706
  }
24685
- /** Prefix the string by "=" if the string looks like a formula */
24686
- function prefixFormula(formula) {
24687
- const tokens = tokenize(formula);
24688
- return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
24689
- }
24690
24707
  // ---------------------------------------------------------------------------
24691
24708
  // Warnings
24692
24709
  // ---------------------------------------------------------------------------
@@ -25107,7 +25124,7 @@ stores.inject(MyMetaStore, storeInstance);
25107
25124
  dvRules.push(decimalRule);
25108
25125
  break;
25109
25126
  case "list":
25110
- const listRule = convertListrule(dvId++, dv);
25127
+ const listRule = convertListRule(dvId++, dv);
25111
25128
  dvRules.push(listRule);
25112
25129
  break;
25113
25130
  case "date":
@@ -25127,9 +25144,9 @@ stores.inject(MyMetaStore, storeInstance);
25127
25144
  return dvRules;
25128
25145
  }
25129
25146
  function convertDecimalRule(id, dv) {
25130
- const values = [dv.formula1.toString()];
25147
+ const values = [prefixFormulaWithEqual(dv.formula1.toString())];
25131
25148
  if (dv.formula2) {
25132
- values.push(dv.formula2.toString());
25149
+ values.push(prefixFormulaWithEqual(dv.formula2.toString()));
25133
25150
  }
25134
25151
  return {
25135
25152
  id: id.toString(),
@@ -25141,7 +25158,7 @@ stores.inject(MyMetaStore, storeInstance);
25141
25158
  },
25142
25159
  };
25143
25160
  }
25144
- function convertListrule(id, dv) {
25161
+ function convertListRule(id, dv) {
25145
25162
  const formula1 = dv.formula1.toString();
25146
25163
  const isRangeRule = rangeReference.test(formula1);
25147
25164
  return {
@@ -25157,9 +25174,9 @@ stores.inject(MyMetaStore, storeInstance);
25157
25174
  }
25158
25175
  function convertDateRule(id, dv) {
25159
25176
  let criterion;
25160
- const values = [dv.formula1.toString()];
25177
+ const values = [prefixFormulaWithEqual(dv.formula1.toString())];
25161
25178
  if (dv.formula2) {
25162
- values.push(dv.formula2.toString());
25179
+ values.push(prefixFormulaWithEqual(dv.formula2.toString()));
25163
25180
  criterion = {
25164
25181
  type: XLSX_DV_DATE_OPERATOR_TO_DV_TYPE_MAPPING[dv.operator],
25165
25182
  values: getDateCriterionFormattedValues(values, DEFAULT_LOCALE),
@@ -25186,7 +25203,7 @@ stores.inject(MyMetaStore, storeInstance);
25186
25203
  isBlocking: dv.errorStyle !== "warning",
25187
25204
  criterion: {
25188
25205
  type: "customFormula",
25189
- values: [`=${dv.formula1.toString()}`],
25206
+ values: [prefixFormulaWithEqual(dv.formula1.toString())],
25190
25207
  },
25191
25208
  };
25192
25209
  }
@@ -28918,6 +28935,7 @@ stores.inject(MyMetaStore, storeInstance);
28918
28935
  parser: luxonFormat,
28919
28936
  displayFormats,
28920
28937
  unit: timeUnit ?? false,
28938
+ tooltipFormat: luxonFormat,
28921
28939
  };
28922
28940
  }
28923
28941
  /**
@@ -30096,6 +30114,7 @@ stores.inject(MyMetaStore, storeInstance);
30096
30114
  };
30097
30115
  Object.assign(scales.x, axis);
30098
30116
  scales.x.ticks.maxTicksLimit = 15;
30117
+ delete scales?.x?.ticks?.callback;
30099
30118
  }
30100
30119
  else if (axisType === "linear") {
30101
30120
  scales.x.type = "linear";
@@ -44551,12 +44570,13 @@ stores.inject(MyMetaStore, storeInstance);
44551
44570
  onCloseSidePanel: { type: Function, optional: true },
44552
44571
  };
44553
44572
  state = owl.useState({ rule: this.defaultDataValidationRule, errors: [] });
44573
+ editingSheetId;
44554
44574
  setup() {
44575
+ this.editingSheetId = this.env.model.getters.getActiveSheetId();
44555
44576
  if (this.props.rule) {
44556
- const sheetId = this.env.model.getters.getActiveSheetId();
44557
44577
  this.state.rule = {
44558
44578
  ...this.props.rule,
44559
- ranges: this.props.rule.ranges.map((range) => this.env.model.getters.getRangeString(range, sheetId)),
44579
+ ranges: this.props.rule.ranges.map((range) => this.env.model.getters.getRangeString(range, this.editingSheetId)),
44560
44580
  };
44561
44581
  this.state.rule.criterion.type = this.props.rule.criterion.type;
44562
44582
  }
@@ -44590,7 +44610,6 @@ stores.inject(MyMetaStore, storeInstance);
44590
44610
  const locale = this.env.model.getters.getLocale();
44591
44611
  const criterion = rule.criterion;
44592
44612
  const criterionEvaluator = dataValidationEvaluatorRegistry.get(criterion.type);
44593
- const sheetId = this.env.model.getters.getActiveSheetId();
44594
44613
  const values = criterion.values
44595
44614
  .slice(0, criterionEvaluator.numberOfValues(criterion))
44596
44615
  .map((value) => value?.trim())
@@ -44598,8 +44617,8 @@ stores.inject(MyMetaStore, storeInstance);
44598
44617
  .map((value) => canonicalizeContent(value, locale));
44599
44618
  rule.criterion = { ...criterion, values };
44600
44619
  return {
44601
- sheetId,
44602
- ranges: this.state.rule.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
44620
+ sheetId: this.editingSheetId,
44621
+ ranges: this.state.rule.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(this.editingSheetId, xc)),
44603
44622
  rule,
44604
44623
  };
44605
44624
  }
@@ -45129,6 +45148,7 @@ stores.inject(MyMetaStore, storeInstance);
45129
45148
  .o-button {
45130
45149
  height: 19px;
45131
45150
  width: 19px;
45151
+ box-sizing: content-box;
45132
45152
  .o-icon {
45133
45153
  height: 14px;
45134
45154
  width: 14px;
@@ -61138,7 +61158,7 @@ stores.inject(MyMetaStore, storeInstance);
61138
61158
  * in the correct order they should be evaluated.
61139
61159
  * This is called a topological ordering (excluding cycles)
61140
61160
  */
61141
- getCellsDependingOn(ranges) {
61161
+ getCellsDependingOn(ranges, ignore) {
61142
61162
  const visited = this.createEmptyPositionSet();
61143
61163
  const queue = Array.from(ranges).reverse();
61144
61164
  while (queue.length > 0) {
@@ -61153,7 +61173,7 @@ stores.inject(MyMetaStore, storeInstance);
61153
61173
  const impactedPositions = this.rTree.search(range).map((dep) => dep.data);
61154
61174
  const nextInQueue = {};
61155
61175
  for (const position of impactedPositions) {
61156
- if (!visited.has(position)) {
61176
+ if (!visited.has(position) && !ignore.has(position)) {
61157
61177
  if (!nextInQueue[position.sheetId]) {
61158
61178
  nextInQueue[position.sheetId] = [];
61159
61179
  }
@@ -61710,7 +61730,7 @@ stores.inject(MyMetaStore, storeInstance);
61710
61730
  }
61711
61731
  invalidatePositionsDependingOnSpread(sheetId, resultZone) {
61712
61732
  // the result matrix is split in 2 zones to exclude the array formula position
61713
- const invalidatedPositions = this.formulaDependencies().getCellsDependingOn(excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone })));
61733
+ const invalidatedPositions = this.formulaDependencies().getCellsDependingOn(excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone })), this.nextPositionsToUpdate);
61714
61734
  invalidatedPositions.delete({ sheetId, col: resultZone.left, row: resultZone.top });
61715
61735
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
61716
61736
  }
@@ -61828,7 +61848,7 @@ stores.inject(MyMetaStore, storeInstance);
61828
61848
  for (const sheetId in zonesBySheetIds) {
61829
61849
  ranges.push(...zonesBySheetIds[sheetId].map((zone) => ({ sheetId, zone })));
61830
61850
  }
61831
- return this.formulaDependencies().getCellsDependingOn(ranges);
61851
+ return this.formulaDependencies().getCellsDependingOn(ranges, this.nextPositionsToUpdate);
61832
61852
  }
61833
61853
  }
61834
61854
  function forEachSpreadPositionInMatrix(nbColumns, nbRows, callback) {
@@ -77352,9 +77372,9 @@ stores.inject(MyMetaStore, storeInstance);
77352
77372
  exports.tokenize = tokenize;
77353
77373
 
77354
77374
 
77355
- __info__.version = "18.2.32";
77356
- __info__.date = "2025-10-07T09:59:52.165Z";
77357
- __info__.hash = "a42c448";
77375
+ __info__.version = "18.2.33";
77376
+ __info__.date = "2025-10-16T06:39:40.421Z";
77377
+ __info__.hash = "280596c";
77358
77378
 
77359
77379
 
77360
77380
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);