@odoo/o-spreadsheet 18.0.45 → 18.0.47

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.45
6
- * @date 2025-09-19T07:24:19.143Z
7
- * @hash 54e799a
5
+ * @version 18.0.47
6
+ * @date 2025-10-16T06:38:31.658Z
7
+ * @hash 0216b06
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -870,9 +870,7 @@
870
870
  return newArray;
871
871
  }
872
872
  function insertItemsAtIndex(array, items, index) {
873
- const newArray = [...array];
874
- newArray.splice(index, 0, ...items);
875
- return newArray;
873
+ return array.slice(0, index).concat(items).concat(array.slice(index));
876
874
  }
877
875
  function replaceItemAtIndex(array, newItem, index) {
878
876
  const newArray = [...array];
@@ -3739,7 +3737,17 @@
3739
3737
  return toMatrix(data).map((row) => {
3740
3738
  return row.map((cell) => {
3741
3739
  if (typeof cell.value !== "number") {
3742
- throw new EvaluationError(_t("Function [[FUNCTION_NAME]] expects number values for %s, but got a %s.", argName, typeof cell.value));
3740
+ let message = "";
3741
+ if (typeof cell === "object") {
3742
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got an empty value.", argName);
3743
+ }
3744
+ else if (typeof cell === "string") {
3745
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got a string.", argName);
3746
+ }
3747
+ else if (typeof cell === "boolean") {
3748
+ message = _t("Function [[FUNCTION_NAME]] expects number values for %s, but got a boolean.", argName);
3749
+ }
3750
+ throw new EvaluationError(message);
3743
3751
  }
3744
3752
  return cell.value;
3745
3753
  });
@@ -4939,7 +4947,7 @@
4939
4947
  * Replace in place tokens "mm" and "m" that denote minutes in date format with "MM" to avoid confusion with months.
4940
4948
  *
4941
4949
  * As per OpenXML specification, in date formats if a date token "m" or "mm" is followed by a date token "s" or
4942
- * preceded by a data token "h", then it's not a month but an minute.
4950
+ * preceded by a data token "h", then it's not a month but a minute.
4943
4951
  */
4944
4952
  function convertTokensToMinutesInDateFormat(tokens) {
4945
4953
  const dateParts = tokens.filter((token) => token.type === "DATE_PART");
@@ -4982,6 +4990,9 @@
4982
4990
  case "REPEATED_CHAR":
4983
4991
  format += "*" + token.value;
4984
4992
  break;
4993
+ case "DATE_PART":
4994
+ format += token.value === "MM" ? "mm" : token.value; // Convert "MM" back to "mm" for minutes
4995
+ break;
4985
4996
  default:
4986
4997
  format += token.value;
4987
4998
  }
@@ -8604,7 +8615,7 @@
8604
8615
  pasteCell(origin, target, clipboardOption) {
8605
8616
  const { sheetId, col, row } = target;
8606
8617
  const targetCell = this.getters.getEvaluatedCell(target);
8607
- const originFormat = origin?.format ?? origin.evaluatedCell.format;
8618
+ const originFormat = origin?.format || origin.evaluatedCell.format;
8608
8619
  if (clipboardOption?.pasteOption === "asValue") {
8609
8620
  this.dispatch("UPDATE_CELL", {
8610
8621
  ...target,
@@ -10169,6 +10180,10 @@ stores.inject(MyMetaStore, storeInstance);
10169
10180
  }
10170
10181
  const ctx = chart.ctx;
10171
10182
  ctx.save();
10183
+ const { left, top, height, width } = chart.chartArea;
10184
+ ctx.beginPath();
10185
+ ctx.rect(left, top, width, height);
10186
+ ctx.clip();
10172
10187
  ctx.textAlign = "center";
10173
10188
  ctx.textBaseline = "middle";
10174
10189
  ctx.miterLimit = 1; // Avoid sharp artifacts on strokeText
@@ -13107,7 +13122,7 @@ stores.inject(MyMetaStore, storeInstance);
13107
13122
  ],
13108
13123
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
13109
13124
  assertNonEmptyMatrix(knownDataY, "known_data_y");
13110
- 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)));
13125
+ return expM(predictLinearValues(logM(toNumberMatrix(knownDataY, "known_data_y")), toNumberMatrix(knownDataX, "known_data_x"), toNumberMatrix(newDataX, "new_data_y"), toBoolean(b)));
13111
13126
  },
13112
13127
  };
13113
13128
  // -----------------------------------------------------------------------------
@@ -13172,7 +13187,7 @@ stores.inject(MyMetaStore, storeInstance);
13172
13187
  ],
13173
13188
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
13174
13189
  assertNonEmptyMatrix(dataY, "data_y");
13175
- return fullLinearRegression(toNumberMatrix(dataX, "the first argument (data_y)"), toNumberMatrix(dataY, "the second argument (data_x)"), toBoolean(calculateB), toBoolean(verbose));
13190
+ return fullLinearRegression(toNumberMatrix(dataX, "data_x"), toNumberMatrix(dataY, "data_y"), toBoolean(calculateB), toBoolean(verbose));
13176
13191
  },
13177
13192
  isExported: true,
13178
13193
  };
@@ -13189,7 +13204,7 @@ stores.inject(MyMetaStore, storeInstance);
13189
13204
  ],
13190
13205
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
13191
13206
  assertNonEmptyMatrix(dataY, "data_y");
13192
- const coeffs = fullLinearRegression(toNumberMatrix(dataX, "the second argument (data_x)"), logM(toNumberMatrix(dataY, "the first argument (data_y)")), toBoolean(calculateB), toBoolean(verbose));
13207
+ const coeffs = fullLinearRegression(toNumberMatrix(dataX, "data_x"), logM(toNumberMatrix(dataY, "data_y")), toBoolean(calculateB), toBoolean(verbose));
13193
13208
  for (let i = 0; i < coeffs.length; i++) {
13194
13209
  coeffs[i][0] = Math.exp(coeffs[i][0]);
13195
13210
  }
@@ -13779,7 +13794,7 @@ stores.inject(MyMetaStore, storeInstance);
13779
13794
  ],
13780
13795
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
13781
13796
  assertNonEmptyMatrix(knownDataY, "known_data_y");
13782
- 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));
13797
+ return predictLinearValues(toNumberMatrix(knownDataY, "known_data_y"), toNumberMatrix(knownDataX, "known_data_x"), toNumberMatrix(newDataX, "new_data_y"), toBoolean(b));
13783
13798
  },
13784
13799
  };
13785
13800
  // -----------------------------------------------------------------------------
@@ -29723,6 +29738,7 @@ stores.inject(MyMetaStore, storeInstance);
29723
29738
  parser: luxonFormat,
29724
29739
  displayFormats,
29725
29740
  unit: timeUnit ?? false,
29741
+ tooltipFormat: luxonFormat,
29726
29742
  };
29727
29743
  }
29728
29744
  /**
@@ -42175,12 +42191,13 @@ stores.inject(MyMetaStore, storeInstance);
42175
42191
  onCloseSidePanel: { type: Function, optional: true },
42176
42192
  };
42177
42193
  state = owl.useState({ rule: this.defaultDataValidationRule });
42194
+ editingSheetId;
42178
42195
  setup() {
42196
+ this.editingSheetId = this.env.model.getters.getActiveSheetId();
42179
42197
  if (this.props.rule) {
42180
- const sheetId = this.env.model.getters.getActiveSheetId();
42181
42198
  this.state.rule = {
42182
42199
  ...this.props.rule,
42183
- ranges: this.props.rule.ranges.map((range) => this.env.model.getters.getRangeString(range, sheetId)),
42200
+ ranges: this.props.rule.ranges.map((range) => this.env.model.getters.getRangeString(range, this.editingSheetId)),
42184
42201
  };
42185
42202
  this.state.rule.criterion.type = this.props.rule.criterion.type;
42186
42203
  }
@@ -42214,7 +42231,6 @@ stores.inject(MyMetaStore, storeInstance);
42214
42231
  const locale = this.env.model.getters.getLocale();
42215
42232
  const criterion = rule.criterion;
42216
42233
  const criterionEvaluator = dataValidationEvaluatorRegistry.get(criterion.type);
42217
- const sheetId = this.env.model.getters.getActiveSheetId();
42218
42234
  const values = criterion.values
42219
42235
  .slice(0, criterionEvaluator.numberOfValues(criterion))
42220
42236
  .map((value) => value?.trim())
@@ -42222,8 +42238,8 @@ stores.inject(MyMetaStore, storeInstance);
42222
42238
  .map((value) => canonicalizeContent(value, locale));
42223
42239
  rule.criterion = { ...criterion, values };
42224
42240
  return {
42225
- sheetId,
42226
- ranges: this.state.rule.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(sheetId, xc)),
42241
+ sheetId: this.editingSheetId,
42242
+ ranges: this.state.rule.ranges.map((xc) => this.env.model.getters.getRangeDataFromXc(this.editingSheetId, xc)),
42227
42243
  rule,
42228
42244
  };
42229
42245
  }
@@ -54049,7 +54065,7 @@ stores.inject(MyMetaStore, storeInstance);
54049
54065
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
54050
54066
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
54051
54067
  const baseSize = sizes[cmd.base];
54052
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
54068
+ sizes = insertItemsAtIndex(sizes, Array(cmd.quantity).fill(baseSize), addIndex);
54053
54069
  this.history.update("sizes", cmd.sheetId, cmd.dimension, sizes);
54054
54070
  break;
54055
54071
  }
@@ -54201,9 +54217,8 @@ stores.inject(MyMetaStore, storeInstance);
54201
54217
  break;
54202
54218
  }
54203
54219
  case "ADD_COLUMNS_ROWS": {
54204
- const hiddenHeaders = [...this.hiddenHeaders[cmd.sheetId][cmd.dimension]];
54205
54220
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
54206
- hiddenHeaders.splice(addIndex, 0, ...Array(cmd.quantity).fill(false));
54221
+ const hiddenHeaders = insertItemsAtIndex([...this.hiddenHeaders[cmd.sheetId][cmd.dimension]], Array(cmd.quantity).fill(false), addIndex);
54207
54222
  this.history.update("hiddenHeaders", cmd.sheetId, cmd.dimension, hiddenHeaders);
54208
54223
  break;
54209
54224
  }
@@ -58460,12 +58475,12 @@ stores.inject(MyMetaStore, storeInstance);
58460
58475
  this.rTrees[sheetId].remove(item, this.rtreeItemComparer);
58461
58476
  }
58462
58477
  rtreeItemComparer(left, right) {
58463
- return (left.data == right.data &&
58464
- left.boundingBox.sheetId === right.boundingBox.sheetId &&
58478
+ return (left.boundingBox.sheetId === right.boundingBox.sheetId &&
58465
58479
  left.boundingBox?.zone.left === right.boundingBox.zone.left &&
58466
58480
  left.boundingBox?.zone.top === right.boundingBox.zone.top &&
58467
58481
  left.boundingBox?.zone.right === right.boundingBox.zone.right &&
58468
- left.boundingBox?.zone.bottom === right.boundingBox.zone.bottom);
58482
+ left.boundingBox?.zone.bottom === right.boundingBox.zone.bottom &&
58483
+ deepEquals(left.data, right.data));
58469
58484
  }
58470
58485
  }
58471
58486
  /**
@@ -58538,7 +58553,7 @@ stores.inject(MyMetaStore, storeInstance);
58538
58553
  * in the correct order they should be evaluated.
58539
58554
  * This is called a topological ordering (excluding cycles)
58540
58555
  */
58541
- getCellsDependingOn(ranges) {
58556
+ getCellsDependingOn(ranges, ignore) {
58542
58557
  const visited = this.createEmptyPositionSet();
58543
58558
  const queue = Array.from(ranges).reverse();
58544
58559
  while (queue.length > 0) {
@@ -58553,7 +58568,7 @@ stores.inject(MyMetaStore, storeInstance);
58553
58568
  const impactedPositions = this.rTree.search(range).map((dep) => dep.data);
58554
58569
  const nextInQueue = {};
58555
58570
  for (const position of impactedPositions) {
58556
- if (!visited.has(position)) {
58571
+ if (!visited.has(position) && !ignore.has(position)) {
58557
58572
  if (!nextInQueue[position.sheetId]) {
58558
58573
  nextInQueue[position.sheetId] = [];
58559
58574
  }
@@ -59106,7 +59121,7 @@ stores.inject(MyMetaStore, storeInstance);
59106
59121
  }
59107
59122
  invalidatePositionsDependingOnSpread(sheetId, resultZone) {
59108
59123
  // the result matrix is split in 2 zones to exclude the array formula position
59109
- const invalidatedPositions = this.formulaDependencies().getCellsDependingOn(excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone })));
59124
+ const invalidatedPositions = this.formulaDependencies().getCellsDependingOn(excludeTopLeft(resultZone).map((zone) => ({ sheetId, zone })), this.nextPositionsToUpdate);
59110
59125
  invalidatedPositions.delete({ sheetId, col: resultZone.left, row: resultZone.top });
59111
59126
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
59112
59127
  }
@@ -59221,7 +59236,7 @@ stores.inject(MyMetaStore, storeInstance);
59221
59236
  for (const sheetId in zonesBySheetIds) {
59222
59237
  ranges.push(...zonesBySheetIds[sheetId].map((zone) => ({ sheetId, zone })));
59223
59238
  }
59224
- return this.formulaDependencies().getCellsDependingOn(ranges);
59239
+ return this.formulaDependencies().getCellsDependingOn(ranges, this.nextPositionsToUpdate);
59225
59240
  }
59226
59241
  }
59227
59242
  function forEachSpreadPositionInMatrix(nbColumns, nbRows, callback) {
@@ -74747,9 +74762,9 @@ stores.inject(MyMetaStore, storeInstance);
74747
74762
  exports.tokenize = tokenize;
74748
74763
 
74749
74764
 
74750
- __info__.version = "18.0.45";
74751
- __info__.date = "2025-09-19T07:24:19.143Z";
74752
- __info__.hash = "54e799a";
74765
+ __info__.version = "18.0.47";
74766
+ __info__.date = "2025-10-16T06:38:31.658Z";
74767
+ __info__.hash = "0216b06";
74753
74768
 
74754
74769
 
74755
74770
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);