@odoo/o-spreadsheet 19.1.3 → 19.1.4

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,8 +3,8 @@
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
5
  * @version 19.1.0-alpha.3
6
- * @date 2026-01-14T10:01:54.190Z
7
- * @hash 52a3e52
6
+ * @date 2026-01-21T11:06:38.842Z
7
+ * @hash ceae12a
8
8
  */
9
9
 
10
10
  class FunctionCodeBuilder {
@@ -2517,7 +2517,11 @@ function evaluatePredicate(value = "", criterion, locale) {
2517
2517
  if (operator === "<>" || operator === "=") {
2518
2518
  let result;
2519
2519
  if (typeof value === typeof operand) {
2520
- if (typeof value === "string" && typeof operand === "string") {
2520
+ if (value === "" && operand === "") {
2521
+ // fast path to avoid regex evaluation
2522
+ result = true;
2523
+ }
2524
+ else if (typeof value === "string" && typeof operand === "string") {
2521
2525
  result = wildcardToRegExp(operand).test(value);
2522
2526
  }
2523
2527
  else {
@@ -2871,7 +2875,16 @@ function createComputeFunction(descr) {
2871
2875
  }
2872
2876
  acceptToVectorize.push(!argDefinition.acceptMatrix);
2873
2877
  }
2874
- return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
2878
+ return replaceErrorPlaceholderInResult(applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize));
2879
+ }
2880
+ function replaceErrorPlaceholderInResult(result) {
2881
+ if (!isMatrix(result)) {
2882
+ replaceFunctionNamePlaceholder(result, descr.name);
2883
+ }
2884
+ else {
2885
+ matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
2886
+ }
2887
+ return result;
2875
2888
  }
2876
2889
  function errorHandlingCompute(...args) {
2877
2890
  for (let i = 0; i < args.length; i++) {
@@ -2900,13 +2913,12 @@ function createComputeFunction(descr) {
2900
2913
  const result = descr.compute.apply(this, args);
2901
2914
  if (!isMatrix(result)) {
2902
2915
  if (typeof result === "object" && result !== null && "value" in result) {
2903
- replaceFunctionNamePlaceholder(result, descr.name);
2904
2916
  return result;
2905
2917
  }
2918
+ descr.name;
2906
2919
  return { value: result };
2907
2920
  }
2908
2921
  if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
2909
- matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, descr.name));
2910
2922
  return result;
2911
2923
  }
2912
2924
  return matrixMap(result, (row) => ({ value: row }));
@@ -18418,7 +18430,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
18418
18430
  const groups = groupConsecutive(elements);
18419
18431
  return (range) => {
18420
18432
  if (range.sheetId !== cmd.sheetId) {
18421
- return { changeType: "NONE" };
18433
+ return { changeType: "NONE", range };
18422
18434
  }
18423
18435
  let newRange = range;
18424
18436
  let changeType = "NONE";
@@ -18445,10 +18457,7 @@ function getApplyRangeChangeRemoveColRow(cmd) {
18445
18457
  newRange = createAdaptedRange(newRange, dimension, changeType, -(max - min + 1));
18446
18458
  }
18447
18459
  }
18448
- if (changeType !== "NONE") {
18449
- return { changeType, range: newRange };
18450
- }
18451
- return { changeType: "NONE" };
18460
+ return { changeType, range: newRange };
18452
18461
  };
18453
18462
  }
18454
18463
  function getApplyRangeChangeAddColRow(cmd) {
@@ -18457,7 +18466,7 @@ function getApplyRangeChangeAddColRow(cmd) {
18457
18466
  const dimension = cmd.dimension === "COL" ? "columns" : "rows";
18458
18467
  return (range) => {
18459
18468
  if (range.sheetId !== cmd.sheetId) {
18460
- return { changeType: "NONE" };
18469
+ return { changeType: "NONE", range };
18461
18470
  }
18462
18471
  if (cmd.position === "after") {
18463
18472
  if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) {
@@ -18487,13 +18496,13 @@ function getApplyRangeChangeAddColRow(cmd) {
18487
18496
  };
18488
18497
  }
18489
18498
  }
18490
- return { changeType: "NONE" };
18499
+ return { changeType: "NONE", range };
18491
18500
  };
18492
18501
  }
18493
18502
  function getApplyRangeChangeDeleteSheet(cmd) {
18494
18503
  return (range) => {
18495
18504
  if (range.sheetId !== cmd.sheetId && range.invalidSheetName !== cmd.sheetName) {
18496
- return { changeType: "NONE" };
18505
+ return { changeType: "NONE", range };
18497
18506
  }
18498
18507
  const invalidSheetName = cmd.sheetName;
18499
18508
  range = {
@@ -18520,14 +18529,14 @@ function getApplyRangeChangeRenameSheet(cmd) {
18520
18529
  const newRange = { ...range, sheetId, invalidSheetName };
18521
18530
  return { changeType: "CHANGE", range: newRange };
18522
18531
  }
18523
- return { changeType: "NONE" };
18532
+ return { changeType: "NONE", range };
18524
18533
  };
18525
18534
  }
18526
18535
  function getApplyRangeChangeMoveRange(cmd) {
18527
18536
  const originZone = cmd.target[0];
18528
18537
  return (range) => {
18529
18538
  if (range.sheetId !== cmd.sheetId || !isZoneInside(range.zone, originZone)) {
18530
- return { changeType: "NONE" };
18539
+ return { changeType: "NONE", range };
18531
18540
  }
18532
18541
  const targetSheetId = cmd.targetSheetId;
18533
18542
  const offsetX = cmd.col - originZone.left;
@@ -20059,7 +20068,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
20059
20068
  continue;
20060
20069
  }
20061
20070
  const sheetXC = tokens[tokenIdx].value;
20062
- const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange);
20071
+ const newSheetXC = adaptStringRange(defaultSheetId, sheetXC, applyChange).range;
20063
20072
  if (sheetXC !== newSheetXC) {
20064
20073
  tokens[tokenIdx] = {
20065
20074
  value: newSheetXC,
@@ -20069,23 +20078,30 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
20069
20078
  }
20070
20079
  return concat(tokens.map((token) => token.value));
20071
20080
  }
20072
- function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
20081
+ function adaptStringRange(defaultSheetId, sheetXC, rangeAdapter) {
20073
20082
  const sheetName = splitReference(sheetXC).sheetName;
20074
20083
  if (sheetName
20075
- ? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
20076
- : defaultSheetId !== applyChange.sheetId) {
20077
- return sheetXC;
20084
+ ? !isSheetNameEqual(sheetName, rangeAdapter.sheetName.old)
20085
+ : defaultSheetId !== rangeAdapter.sheetId) {
20086
+ return { changeType: "NONE", range: sheetXC };
20078
20087
  }
20079
- const sheetId = sheetName ? applyChange.sheetId : defaultSheetId;
20088
+ const sheetId = sheetName ? rangeAdapter.sheetId : defaultSheetId;
20080
20089
  const range = getRange(sheetXC, sheetId);
20081
20090
  if (range.invalidXc) {
20082
- return sheetXC;
20091
+ return { changeType: "NONE", range: sheetXC };
20083
20092
  }
20084
- const change = applyChange.applyChange(range);
20093
+ const change = rangeAdapter.applyChange(range);
20085
20094
  if (change.changeType === "NONE" || change.changeType === "REMOVE") {
20086
- return sheetXC;
20095
+ return { changeType: change.changeType, range: sheetXC };
20087
20096
  }
20088
- return getRangeString(change.range, defaultSheetId, getSheetNameGetter(applyChange));
20097
+ const rangeStr = getRangeString(change.range, defaultSheetId, getSheetNameGetter(rangeAdapter));
20098
+ if (rangeStr === CellErrorType.InvalidReference) {
20099
+ return { changeType: "REMOVE", range: rangeStr };
20100
+ }
20101
+ return {
20102
+ changeType: change.changeType,
20103
+ range: rangeStr,
20104
+ };
20089
20105
  }
20090
20106
  function getSheetNameGetter(applyChange) {
20091
20107
  return (sheetId) => {
@@ -20300,7 +20316,7 @@ function addConditionalFormatCommandAdaptRange(cmd, applyChange) {
20300
20316
  cmd.cf.rule = {
20301
20317
  ...rule,
20302
20318
  rangeValues: rule.rangeValues
20303
- ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange)
20319
+ ? adaptStringRange(cmd.sheetId, rule.rangeValues, applyChange).range
20304
20320
  : undefined,
20305
20321
  };
20306
20322
  }
@@ -22962,6 +22978,7 @@ function extractStyle(data, content, styleId, formatId, borderId) {
22962
22978
  : undefined,
22963
22979
  wrapText: style.wrapping === "wrap" || content?.includes(NEWLINE) ? true : undefined,
22964
22980
  textRotation: style.rotation ? rotationToXLSX(style.rotation) : undefined,
22981
+ shrinkToFit: style.wrapping === "clip" ? true : undefined,
22965
22982
  },
22966
22983
  };
22967
22984
  styles.font["strike"] = !!style?.strikethrough || undefined;
@@ -23006,6 +23023,7 @@ function normalizeStyle(construct, styles) {
23006
23023
  horizontal: styles.alignment.horizontal,
23007
23024
  wrapText: styles.alignment.wrapText,
23008
23025
  textRotation: styles.alignment.textRotation,
23026
+ shrinkToFit: styles.alignment.shrinkToFit,
23009
23027
  },
23010
23028
  };
23011
23029
  return pushElement(style, construct.styles);
@@ -27570,7 +27588,7 @@ class CorePlugin extends BasePlugin {
27570
27588
  * @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
27571
27589
  * @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
27572
27590
  */
27573
- adaptRanges(applyChange, sheetId, sheetName) { }
27591
+ adaptRanges(rangeAdapterFunctions, sheetId, sheetName) { }
27574
27592
  }
27575
27593
 
27576
27594
  class BordersPlugin extends CorePlugin {
@@ -27644,7 +27662,7 @@ class BordersPlugin extends CorePlugin {
27644
27662
  }
27645
27663
  }
27646
27664
  }
27647
- adaptRanges(applyChange, sheetId) {
27665
+ adaptRanges({ applyChange }, sheetId) {
27648
27666
  const newBorders = [];
27649
27667
  for (const border of this.borders[sheetId] ?? []) {
27650
27668
  const change = applyChange(this.getters.getRangeFromZone(sheetId, border.zone));
@@ -28125,7 +28143,7 @@ class CellPlugin extends CorePlugin {
28125
28143
  ];
28126
28144
  nextId = 1;
28127
28145
  cells = {};
28128
- adaptRanges(applyChange, sheetId, sheetName) {
28146
+ adaptRanges({ applyChange }, sheetId, sheetName) {
28129
28147
  for (const sheet of Object.keys(this.cells)) {
28130
28148
  for (const cell of Object.values(this.cells[sheet] || {})) {
28131
28149
  if (cell.isFormula) {
@@ -28686,12 +28704,12 @@ class ChartPlugin extends CorePlugin {
28686
28704
  charts = {};
28687
28705
  createChart = chartFactory(this.getters);
28688
28706
  validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
28689
- adaptRanges(applyChange, sheetId, adaptSheetName) {
28707
+ adaptRanges(rangeAdapters) {
28690
28708
  for (const [chartId, chart] of Object.entries(this.charts)) {
28691
28709
  if (!chart) {
28692
28710
  continue;
28693
28711
  }
28694
- const newChart = chart.chart.updateRanges(applyChange, sheetId, adaptSheetName);
28712
+ const newChart = chart.chart.updateRanges(rangeAdapters);
28695
28713
  this.history.update("charts", chartId, newChart ? { figureId: chart.figureId, chart: newChart } : undefined);
28696
28714
  }
28697
28715
  }
@@ -29512,7 +29530,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29512
29530
  "getAdaptedCfRanges",
29513
29531
  ];
29514
29532
  cfRules = {};
29515
- adaptCFFormulas(applyChange) {
29533
+ adaptCFFormulas({ applyChange, adaptFormulaString }) {
29516
29534
  for (const sheetId in this.cfRules) {
29517
29535
  for (const rule of this.cfRules[sheetId]) {
29518
29536
  if (rule.rule.type === "DataBarRule" && rule.rule.rangeValues) {
@@ -29536,7 +29554,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29536
29554
  for (let i = 0; i < rule.rule.values.length; i++) {
29537
29555
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
29538
29556
  //@ts-expect-error
29539
- "values", i, this.getters.adaptFormulaStringDependencies(sheetId, rule.rule.values[i], applyChange));
29557
+ "values", i, adaptFormulaString(sheetId, rule.rule.values[i]));
29540
29558
  }
29541
29559
  }
29542
29560
  else if (rule.rule.type === "IconSetRule") {
@@ -29544,7 +29562,7 @@ class ConditionalFormatPlugin extends CorePlugin {
29544
29562
  if (rule.rule[inflectionPoint].type === "formula") {
29545
29563
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
29546
29564
  //@ts-expect-error
29547
- inflectionPoint, "value", this.getters.adaptFormulaStringDependencies(sheetId, rule.rule[inflectionPoint].value, applyChange));
29565
+ inflectionPoint, "value", adaptFormulaString(sheetId, rule.rule[inflectionPoint].value));
29548
29566
  }
29549
29567
  }
29550
29568
  }
@@ -29554,14 +29572,14 @@ class ConditionalFormatPlugin extends CorePlugin {
29554
29572
  if (ruleValue?.type === "formula" && ruleValue?.value) {
29555
29573
  this.history.update("cfRules", sheetId, this.cfRules[sheetId].indexOf(rule), "rule",
29556
29574
  //@ts-expect-error
29557
- value, "value", this.getters.adaptFormulaStringDependencies(sheetId, ruleValue.value, applyChange));
29575
+ value, "value", adaptFormulaString(sheetId, ruleValue.value));
29558
29576
  }
29559
29577
  }
29560
29578
  }
29561
29579
  }
29562
29580
  }
29563
29581
  }
29564
- adaptCFRanges(sheetId, applyChange) {
29582
+ adaptCFRanges(sheetId, { applyChange }) {
29565
29583
  for (const rule of this.cfRules[sheetId]) {
29566
29584
  for (const range of rule.ranges) {
29567
29585
  const change = applyChange(range);
@@ -29585,12 +29603,12 @@ class ConditionalFormatPlugin extends CorePlugin {
29585
29603
  }
29586
29604
  }
29587
29605
  }
29588
- adaptRanges(applyChange, sheetId) {
29606
+ adaptRanges(rangeAdapters, sheetId) {
29589
29607
  const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
29590
29608
  for (const sheetId of sheetIds) {
29591
- this.adaptCFRanges(sheetId, applyChange);
29609
+ this.adaptCFRanges(sheetId, rangeAdapters);
29592
29610
  }
29593
- this.adaptCFFormulas(applyChange);
29611
+ this.adaptCFFormulas(rangeAdapters);
29594
29612
  }
29595
29613
  // ---------------------------------------------------------------------------
29596
29614
  // Command Handling
@@ -29967,23 +29985,23 @@ class DataValidationPlugin extends CorePlugin {
29967
29985
  "getValidationRuleForCell",
29968
29986
  ];
29969
29987
  rules = {};
29970
- adaptRanges(applyChange, sheetId) {
29971
- this.adaptDVRanges(sheetId, applyChange);
29972
- this.adaptDVFormulas(applyChange);
29988
+ adaptRanges(rangeAdapters, sheetId) {
29989
+ this.adaptDVRanges(sheetId, rangeAdapters);
29990
+ this.adaptDVFormulas(rangeAdapters);
29973
29991
  }
29974
- adaptDVFormulas(applyChange) {
29992
+ adaptDVFormulas({ adaptFormulaString }) {
29975
29993
  for (const sheetId in this.rules) {
29976
29994
  const rules = this.rules[sheetId];
29977
29995
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
29978
29996
  const rule = this.rules[sheetId][ruleIndex];
29979
29997
  for (let valueIndex = 0; valueIndex < rule.criterion.values.length; valueIndex++) {
29980
- const value = this.getters.adaptFormulaStringDependencies(sheetId, rule.criterion.values[valueIndex], applyChange);
29998
+ const value = adaptFormulaString(sheetId, rule.criterion.values[valueIndex]);
29981
29999
  this.history.update("rules", sheetId, ruleIndex, "criterion", "values", valueIndex, value);
29982
30000
  }
29983
30001
  }
29984
30002
  }
29985
30003
  }
29986
- adaptDVRanges(sheetId, applyChange) {
30004
+ adaptDVRanges(sheetId, { applyChange }) {
29987
30005
  const rules = this.rules[sheetId];
29988
30006
  for (let ruleIndex = rules.length - 1; ruleIndex >= 0; ruleIndex--) {
29989
30007
  const rule = this.rules[sheetId][ruleIndex];
@@ -30257,7 +30275,7 @@ class FigurePlugin extends CorePlugin {
30257
30275
  // ---------------------------------------------------------------------------
30258
30276
  // Command Handling
30259
30277
  // ---------------------------------------------------------------------------
30260
- adaptRanges(applyChange, sheetId) {
30278
+ adaptRanges({ applyChange }, sheetId) {
30261
30279
  for (const figure of this.getFigures(sheetId)) {
30262
30280
  const change = applyChange(this.getters.getRangeFromZone(sheetId, {
30263
30281
  left: figure.col,
@@ -31497,8 +31515,8 @@ class MergePlugin extends CorePlugin {
31497
31515
  break;
31498
31516
  }
31499
31517
  }
31500
- adaptRanges(applyChange, sheetId) {
31501
- this.applyRangeChangeOnSheet(sheetId, applyChange);
31518
+ adaptRanges(rangeAdapters, sheetId) {
31519
+ this.applyRangeChangeOnSheet(sheetId, rangeAdapters);
31502
31520
  }
31503
31521
  // ---------------------------------------------------------------------------
31504
31522
  // Getters
@@ -31798,7 +31816,7 @@ class MergePlugin extends CorePlugin {
31798
31816
  /**
31799
31817
  * Apply a range change on merges of a particular sheet.
31800
31818
  */
31801
- applyRangeChangeOnSheet(sheetId, applyChange) {
31819
+ applyRangeChangeOnSheet(sheetId, { applyChange }) {
31802
31820
  const merges = Object.entries(this.merges[sheetId] || {});
31803
31821
  for (const [mergeId, range] of merges) {
31804
31822
  if (range) {
@@ -33417,8 +33435,6 @@ function adaptPivotRange(range, applyChange) {
33417
33435
  }
33418
33436
  const change = applyChange(range);
33419
33437
  switch (change.changeType) {
33420
- case "NONE":
33421
- return range;
33422
33438
  case "REMOVE":
33423
33439
  return undefined;
33424
33440
  default:
@@ -33527,7 +33543,7 @@ class PivotCorePlugin extends CorePlugin {
33527
33543
  }
33528
33544
  }
33529
33545
  }
33530
- adaptRanges(applyChange) {
33546
+ adaptRanges({ applyChange, adaptFormulaString }) {
33531
33547
  for (const pivotId in this.pivots) {
33532
33548
  const definition = deepCopy(this.pivots[pivotId]?.definition);
33533
33549
  if (!definition) {
@@ -33547,19 +33563,13 @@ class PivotCorePlugin extends CorePlugin {
33547
33563
  continue;
33548
33564
  }
33549
33565
  const sheetId = measure.computedBy.sheetId;
33550
- const compiledFormula = this.compiledMeasureFormulas[pivotId][measureId].formula;
33551
- const newDependencies = [];
33552
- for (const range of compiledFormula.dependencies) {
33553
- const change = applyChange(range);
33554
- if (change.changeType === "NONE") {
33555
- newDependencies.push(range);
33556
- }
33557
- else {
33558
- newDependencies.push(change.range);
33559
- }
33560
- }
33561
- const newFormulaString = this.getters.getFormulaString(sheetId, compiledFormula.tokens, newDependencies);
33566
+ const { formula: compiledFormula, dependencies: indirectDependencies } = this.compiledMeasureFormulas[pivotId][measureId];
33567
+ // adapt direct dependencies
33568
+ this.history.update("compiledMeasureFormulas", pivotId, measureId, "formula", "dependencies", compiledFormula.dependencies.map((range) => applyChange(range).range));
33569
+ // adapt all dependencies (including indirect)
33570
+ this.history.update("compiledMeasureFormulas", pivotId, measure.id, "dependencies", indirectDependencies.map((range) => applyChange(range).range));
33562
33571
  const oldFormulaString = measure.computedBy.formula;
33572
+ const newFormulaString = adaptFormulaString(sheetId, oldFormulaString);
33563
33573
  if (newFormulaString !== oldFormulaString) {
33564
33574
  this.replaceMeasureFormula(pivotId, measure, newFormulaString);
33565
33575
  }
@@ -33721,7 +33731,6 @@ class PivotCorePlugin extends CorePlugin {
33721
33731
  formula: newFormulaString,
33722
33732
  sheetId: measure.computedBy.sheetId,
33723
33733
  });
33724
- this.compileCalculatedMeasures(pivotId, pivot.definition.measures);
33725
33734
  }
33726
33735
  checkSortedColumnInMeasures(definition) {
33727
33736
  const measures = definition.measures.map((measure) => measure.id);
@@ -34808,7 +34817,7 @@ class StylePlugin extends CorePlugin {
34808
34817
  break;
34809
34818
  }
34810
34819
  }
34811
- adaptRanges(applyChange, sheetId) {
34820
+ adaptRanges({ applyChange }, sheetId) {
34812
34821
  const newStyles = [];
34813
34822
  for (const style of this.styles[sheetId] ?? []) {
34814
34823
  const change = applyChange(this.getters.getRangeFromZone(sheetId, style.zone));
@@ -35314,7 +35323,7 @@ class TablePlugin extends CorePlugin {
35314
35323
  static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
35315
35324
  tables = {};
35316
35325
  nextTableId = 1;
35317
- adaptRanges(applyChange, sheetId) {
35326
+ adaptRanges({ applyChange }, sheetId) {
35318
35327
  for (const table of this.getCoreTables(sheetId)) {
35319
35328
  this.applyRangeChangeOnTable(sheetId, table, applyChange);
35320
35329
  }
@@ -37180,11 +37189,16 @@ class SpreadingRelation {
37180
37189
  return this.arrayFormulasToResults.get(formulasPosition);
37181
37190
  }
37182
37191
  /**
37183
- * Remove a node, also remove it from other nodes adjacency list
37192
+ * Remove a spreading relation for a given array formula position
37193
+ * and its result zone
37184
37194
  */
37185
37195
  removeNode(position) {
37196
+ const resultZone = this.arrayFormulasToResults.get(position);
37197
+ if (!resultZone) {
37198
+ return;
37199
+ }
37186
37200
  this.resultsToArrayFormulas.remove({
37187
- boundingBox: { sheetId: position.sheetId, zone: positionToZone(position) },
37201
+ boundingBox: { sheetId: position.sheetId, zone: resultZone },
37188
37202
  data: position,
37189
37203
  });
37190
37204
  this.arrayFormulasToResults.delete(position);
@@ -37511,6 +37525,10 @@ class Evaluator {
37511
37525
  // empty matrix
37512
37526
  return createEvaluatedCell({ value: 0 }, this.getters.getLocale(), cellData);
37513
37527
  }
37528
+ if (nbRows === 1 && nbColumns === 1) {
37529
+ // single value matrix
37530
+ return createEvaluatedCell(validateNumberValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
37531
+ }
37514
37532
  const resultZone = {
37515
37533
  top: formulaPosition.row,
37516
37534
  bottom: formulaPosition.row + nbRows - 1,
@@ -38026,11 +38044,20 @@ function getCanvas(width = 100, height = 100) {
38026
38044
  /**
38027
38045
  * Get the default height of the cell given its style.
38028
38046
  */
38029
- function getDefaultCellHeight(ctx, cell, style, colSize) {
38047
+ function getDefaultCellHeight(ctx, cell, style, locale, colSize) {
38030
38048
  if (!cell || (!cell.isFormula && !cell.content)) {
38031
38049
  return DEFAULT_CELL_HEIGHT;
38032
38050
  }
38033
- const content = cell.isFormula ? "" : cell.content;
38051
+ let content = "";
38052
+ try {
38053
+ if (!cell.isFormula) {
38054
+ const localeFormat = { format: cell.format, locale };
38055
+ content = formatValue(parseLiteral(cell.content, locale), localeFormat);
38056
+ }
38057
+ }
38058
+ catch {
38059
+ content = CellErrorType.GenericError;
38060
+ }
38034
38061
  return getCellContentHeight(ctx, content, style, colSize);
38035
38062
  }
38036
38063
  function getCellContentHeight(ctx, content, style, colSize) {
@@ -39609,15 +39636,15 @@ async function chartToImageUrl(runtime, figure, type) {
39609
39636
  if (!extensionsLoaded) {
39610
39637
  registerChartJSExtensions();
39611
39638
  }
39612
- if (!globalThis.Chart.registry.controllers.get(type)) {
39613
- console.log(`Chart of type "${type}" is not registered in Chart.js library.`);
39639
+ const config = deepCopy(runtime.chartJsConfig);
39640
+ config.plugins = [backgroundColorChartJSPlugin];
39641
+ if (!globalThis.Chart.registry.controllers.get(config.type)) {
39642
+ console.log(`Chart of type "${config.type}" is not registered in Chart.js library.`);
39614
39643
  if (!extensionsLoaded) {
39615
39644
  unregisterChartJsExtensions();
39616
39645
  }
39617
39646
  return imageUrl;
39618
39647
  }
39619
- const config = deepCopy(runtime.chartJsConfig);
39620
- config.plugins = [backgroundColorChartJSPlugin];
39621
39648
  const chart = new globalThis.Chart(canvas, config);
39622
39649
  try {
39623
39650
  imageUrl = await canvasToObjectUrl(canvas);
@@ -40283,6 +40310,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
40283
40310
  handle(cmd) {
40284
40311
  switch (cmd.type) {
40285
40312
  case "START":
40313
+ case "UPDATE_LOCALE":
40286
40314
  for (const sheetId of this.getters.getSheetIds()) {
40287
40315
  this.initializeSheet(sheetId);
40288
40316
  }
@@ -40420,7 +40448,7 @@ class HeaderSizeUIPlugin extends CoreViewPlugin {
40420
40448
  const cell = this.getters.getCell(position);
40421
40449
  const style = this.getters.getCellStyle(position);
40422
40450
  const colSize = this.getters.getColSize(position.sheetId, position.col);
40423
- return getDefaultCellHeight(this.ctx, cell, style, colSize);
40451
+ return getDefaultCellHeight(this.ctx, cell, style, this.getters.getLocale(), colSize);
40424
40452
  }
40425
40453
  isInMultiRowMerge(position) {
40426
40454
  const merge = this.getters.getMerge(position);
@@ -47663,7 +47691,7 @@ const coreViewsPluginRegistry = new Registry$1()
47663
47691
  .add("pivot_ui", PivotUIPlugin)
47664
47692
  .add("cell_icon", CellIconPlugin);
47665
47693
 
47666
- class RangeAdapter {
47694
+ class RangeAdapterPlugin {
47667
47695
  getters;
47668
47696
  providers = [];
47669
47697
  isAdaptingRanges = false;
@@ -47671,7 +47699,6 @@ class RangeAdapter {
47671
47699
  this.getters = getters;
47672
47700
  }
47673
47701
  static getters = [
47674
- "adaptFormulaStringDependencies",
47675
47702
  "copyFormulaStringForSheet",
47676
47703
  "extendRange",
47677
47704
  "getRangeString",
@@ -47702,8 +47729,8 @@ class RangeAdapter {
47702
47729
  throw new Error("Plugins cannot dispatch commands during adaptRanges phase");
47703
47730
  }
47704
47731
  const rangeAdapter = getRangeAdapter(cmd);
47705
- if (rangeAdapter?.applyChange) {
47706
- this.executeOnAllRanges(rangeAdapter.applyChange, rangeAdapter.sheetId, rangeAdapter.sheetName);
47732
+ if (rangeAdapter) {
47733
+ this.executeOnAllRanges(rangeAdapter);
47707
47734
  }
47708
47735
  }
47709
47736
  finalize() { }
@@ -47722,11 +47749,15 @@ class RangeAdapter {
47722
47749
  return result;
47723
47750
  };
47724
47751
  }
47725
- executeOnAllRanges(adaptRange, sheetId, sheetName) {
47752
+ executeOnAllRanges(rangeAdapter) {
47726
47753
  this.isAdaptingRanges = true;
47727
- const func = this.verifyRangeRemoved(adaptRange);
47754
+ const adapterFunctions = {
47755
+ applyChange: this.verifyRangeRemoved(rangeAdapter.applyChange),
47756
+ adaptRangeString: (defaultSheetId, sheetXC) => adaptStringRange(defaultSheetId, sheetXC, rangeAdapter),
47757
+ adaptFormulaString: (defaultSheetId, formula) => adaptFormulaStringRanges(defaultSheetId, formula, rangeAdapter),
47758
+ };
47728
47759
  for (const provider of this.providers) {
47729
- provider(func, sheetId, sheetName);
47760
+ provider(adapterFunctions, rangeAdapter.sheetId, rangeAdapter.sheetName);
47730
47761
  }
47731
47762
  this.isAdaptingRanges = false;
47732
47763
  }
@@ -47894,18 +47925,6 @@ class RangeAdapter {
47894
47925
  const unionOfZones = unionUnboundedZones(...zones);
47895
47926
  return this.getRangeFromZone(ranges[0].sheetId, unionOfZones);
47896
47927
  }
47897
- adaptFormulaStringDependencies(sheetId, formula, applyChange) {
47898
- if (!formula.startsWith("=")) {
47899
- return formula;
47900
- }
47901
- const compiledFormula = compile(formula);
47902
- const updatedDependencies = compiledFormula.dependencies.map((dep) => {
47903
- const range = this.getters.getRangeFromSheetXC(sheetId, dep);
47904
- const changedRange = applyChange(range);
47905
- return changedRange.changeType === "NONE" ? range : changedRange.range;
47906
- });
47907
- return this.getters.getFormulaString(sheetId, compiledFormula.tokens, updatedDependencies);
47908
- }
47909
47928
  /**
47910
47929
  * Copy a formula string to another sheet.
47911
47930
  *
@@ -50350,6 +50369,9 @@ function addStyles(styles) {
50350
50369
  if (style.alignment && style.alignment.textRotation) {
50351
50370
  alignAttrs.push(["textRotation", style.alignment.textRotation]);
50352
50371
  }
50372
+ if (style.alignment && style.alignment.shrinkToFit) {
50373
+ alignAttrs.push(["shrinkToFit", "1"]);
50374
+ }
50353
50375
  if (alignAttrs.length > 0) {
50354
50376
  attributes.push(["applyAlignment", "1"]); // for Libre Office
50355
50377
  styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
@@ -51144,7 +51166,7 @@ class Model extends EventBus {
51144
51166
  this.config = this.setupConfig(config);
51145
51167
  this.session = this.setupSession(workbookData.revisionId);
51146
51168
  this.coreGetters = {};
51147
- this.range = new RangeAdapter(this.coreGetters);
51169
+ this.range = new RangeAdapterPlugin(this.coreGetters);
51148
51170
  this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
51149
51171
  this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
51150
51172
  this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
@@ -51158,8 +51180,6 @@ class Model extends EventBus {
51158
51180
  this.coreGetters.extendRange = this.range.extendRange.bind(this.range);
51159
51181
  this.coreGetters.getRangesUnion = this.range.getRangesUnion.bind(this.range);
51160
51182
  this.coreGetters.removeRangesSheetPrefix = this.range.removeRangesSheetPrefix.bind(this.range);
51161
- this.coreGetters.adaptFormulaStringDependencies =
51162
- this.range.adaptFormulaStringDependencies.bind(this.range);
51163
51183
  this.coreGetters.copyFormulaStringForSheet = this.range.copyFormulaStringForSheet.bind(this.range);
51164
51184
  this.getters = {
51165
51185
  isReadonly: () => this.config.mode === "readonly" || this.config.mode === "dashboard",
@@ -51630,5 +51650,5 @@ export { BadExpressionError, BasePlugin, CellErrorType, CircularDependencyError,
51630
51650
 
51631
51651
 
51632
51652
  __info__.version = "19.1.0-alpha.3";
51633
- __info__.date = "2026-01-14T10:01:54.190Z";
51634
- __info__.hash = "52a3e52";
51653
+ __info__.date = "2026-01-21T11:06:38.842Z";
51654
+ __info__.hash = "ceae12a";