@odoo/o-spreadsheet 19.3.11 → 19.3.12

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 19.3.11
6
- * @date 2026-07-13T06:26:28.422Z
7
- * @hash 35c06d3
5
+ * @version 19.3.12
6
+ * @date 2026-07-20T11:02:44.416Z
7
+ * @hash 2b42707
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -5569,7 +5569,7 @@ stores.inject(MyMetaStore, storeInstance);
5569
5569
  if (prefixSheet && !sheetName) return CellErrorType.InvalidReference;
5570
5570
  let rangeString = getRangePartString(range, 0, options);
5571
5571
  if (range.parts && range.parts.length === 2) {
5572
- if (range.zone.top !== range.zone.bottom || range.zone.left !== range.zone.right || range.parts[0].rowFixed || range.parts[0].colFixed || range.parts[1].rowFixed || range.parts[1].colFixed) {
5572
+ if (range.zone.top !== range.zone.bottom || range.zone.left !== range.zone.right || range.parts[0].rowFixed || range.parts[0].colFixed || range.parts[1].rowFixed || range.parts[1].colFixed || options.doNotSimplifyRange) {
5573
5573
  rangeString += ":";
5574
5574
  rangeString += getRangePartString(range, 1, options);
5575
5575
  }
@@ -6291,6 +6291,11 @@ stores.inject(MyMetaStore, storeInstance);
6291
6291
  const params = compileTokens(rangeTokenize(formula));
6292
6292
  return new CompiledFormula(sheetId, params.tokens, params.literalValues, params.symbols, params.dependencies.map((xc) => getters.getRangeFromSheetXC(sheetId, xc)), params.isBadExpression, params.normalizedFormula, params.execute);
6293
6293
  }
6294
+ areRangeShapesInLineWithNormalizedFormula() {
6295
+ return Array.from(this.normalizedFormula.matchAll(/\|C\||\|R\|/g)).every((value, index) => {
6296
+ return this.rangeDependencies[index].parts.length === 1 && value[0] === "|C|" || this.rangeDependencies[index].parts.length === 2 && value[0] === "|R|" || this.rangeDependencies[index].invalidXc || this.rangeDependencies[index].invalidSheetName;
6297
+ });
6298
+ }
6294
6299
  };
6295
6300
  function compileTokens(tokens) {
6296
6301
  try {
@@ -33916,7 +33921,7 @@ stores.inject(MyMetaStore, storeInstance);
33916
33921
  return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
33917
33922
  }
33918
33923
  get isBaselineInvalid() {
33919
- return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
33924
+ return !!this.state.baselineDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
33920
33925
  }
33921
33926
  onKeyValueRangeChanged(ranges) {
33922
33927
  this.keyValue = ranges[0];
@@ -49719,6 +49724,7 @@ stores.inject(MyMetaStore, storeInstance);
49719
49724
  alreadyAppliedNumberOffsets = [];
49720
49725
  previousStrings = [];
49721
49726
  baseFormulaWasTransformed = false;
49727
+ rangeToStringOptions = { doNotSimplifyRange: true };
49722
49728
  baseNumber = void 0;
49723
49729
  constructor(getters) {
49724
49730
  this.getters = getters;
@@ -49774,9 +49780,9 @@ stores.inject(MyMetaStore, storeInstance);
49774
49780
  let references = [];
49775
49781
  if (!this.baseFormula || this.baseFormula.normalizedFormula !== cell.compiledFormula.normalizedFormula) {
49776
49782
  this.resetBaseTo(cell.compiledFormula);
49777
- return cell.compiledFormula.toFormulaString(this.getters);
49783
+ return cell.compiledFormula.toFormulaString(this.getters, this.rangeToStringOptions);
49778
49784
  } else {
49779
- if (!this.baseFormulaWasTransformed && deepEquals(cell.compiledFormula.literalValues, this.baseFormula.literalValues) && deepEquals(cell.compiledFormula.rangeDependencies, this.baseFormula.rangeDependencies)) return cell.compiledFormula.toFormulaString(this.getters);
49785
+ if (!this.baseFormulaWasTransformed && deepEquals(cell.compiledFormula.literalValues, this.baseFormula.literalValues) && deepEquals(cell.compiledFormula.rangeDependencies, this.baseFormula.rangeDependencies)) return cell.compiledFormula.toFormulaString(this.getters, this.rangeToStringOptions);
49780
49786
  numbers = this.squishNumbers(cell.compiledFormula.literalValues.numbers);
49781
49787
  strings = this.squishStrings(cell.compiledFormula.literalValues.strings);
49782
49788
  references = this.squishReferences(cell.compiledFormula.rangeDependencies, forSheetId);
@@ -49853,23 +49859,23 @@ stores.inject(MyMetaStore, storeInstance);
49853
49859
  squishOneReference(reference, previousReferences, index, forSheetId) {
49854
49860
  const previousReference = previousReferences[index];
49855
49861
  if (deepEquals(previousReference, reference)) return "=";
49856
- if (previousReference.sheetId !== reference.sheetId || previousReference.prefixSheet !== reference.prefixSheet || previousReference.invalidSheetName !== reference.invalidSheetName || previousReference.invalidXc !== reference.invalidXc) {
49862
+ if (previousReference.sheetId !== reference.sheetId || previousReference.prefixSheet !== reference.prefixSheet || previousReference.invalidSheetName !== reference.invalidSheetName || previousReference.invalidXc !== reference.invalidXc || previousReference.parts.length !== reference.parts.length) {
49857
49863
  previousReferences[index] = deepCopy(reference);
49858
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49864
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49859
49865
  }
49860
49866
  if (previousReference.unboundedZone.bottom === void 0 || previousReference.unboundedZone.right === void 0 || reference.unboundedZone.bottom === void 0 || reference.unboundedZone.right === void 0) {
49861
49867
  previousReferences[index] = deepCopy(reference);
49862
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49868
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49863
49869
  }
49864
49870
  for (let i = 0; i < reference.parts.length; i++) if (previousReference.parts[i].colFixed !== reference.parts[i].colFixed || previousReference.parts[i].rowFixed !== reference.parts[i].rowFixed) {
49865
49871
  previousReferences[index] = deepCopy(reference);
49866
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49872
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49867
49873
  }
49868
49874
  const currentZone = reference.zone;
49869
49875
  const previousZone = previousReference.zone;
49870
49876
  if (currentZone.top !== currentZone.bottom || currentZone.left !== currentZone.right || previousZone.top !== previousZone.bottom || previousZone.left !== previousZone.right) {
49871
49877
  previousReferences[index] = deepCopy(reference);
49872
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49878
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49873
49879
  }
49874
49880
  const diffCol = reference.zone.left - previousReference.zone.left;
49875
49881
  const diffRow = reference.zone.top - previousReference.zone.top;
@@ -49877,7 +49883,7 @@ stores.inject(MyMetaStore, storeInstance);
49877
49883
  previousReference.unboundedZone = deepCopy(reference.unboundedZone);
49878
49884
  if (diffCol !== 0 && diffRow === 0) return `${diffCol > 0 ? "+" : "-"}C${Math.abs(diffCol)}`;
49879
49885
  else if (diffRow !== 0 && diffCol === 0) return `${diffRow > 0 ? "+" : "-"}R${Math.abs(diffRow)}`;
49880
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49886
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49881
49887
  }
49882
49888
  /**
49883
49889
  * Squish the number parameters. Result for each parameter should be compared the previous formula.
@@ -50086,10 +50092,19 @@ stores.inject(MyMetaStore, storeInstance);
50086
50092
  case "FIRST_OFFSET": {
50087
50093
  const currentOffset = current;
50088
50094
  this.previousOffset = currentOffset;
50089
- for (const position of targetPositions) yield {
50090
- position,
50091
- compiled: this.unsquishFormula(currentOffset, sheetId, getters)
50092
- };
50095
+ for (const position of targetPositions) {
50096
+ const result = this.unsquishFormula(currentOffset, sheetId, getters);
50097
+ if (!result.areRangeShapesInLineWithNormalizedFormula()) {
50098
+ const formulaString = result.toFormulaString(getters);
50099
+ yield {
50100
+ position,
50101
+ compiled: CompiledFormula.Compile(formulaString, sheetId, getters)
50102
+ };
50103
+ } else yield {
50104
+ position,
50105
+ compiled: result
50106
+ };
50107
+ }
50093
50108
  break;
50094
50109
  }
50095
50110
  case "COMBINE_OFFSET": {
@@ -50098,10 +50113,19 @@ stores.inject(MyMetaStore, storeInstance);
50098
50113
  this.previousOffset.N = currentOffset.N ?? this.previousOffset.N;
50099
50114
  this.previousOffset.S = currentOffset.S ?? this.previousOffset.S;
50100
50115
  this.previousOffset.R = currentOffset.R ?? this.previousOffset.R;
50101
- for (const position of targetPositions) yield {
50102
- position,
50103
- compiled: this.unsquishFormula(this.previousOffset, sheetId, getters)
50104
- };
50116
+ for (const position of targetPositions) {
50117
+ const result = this.unsquishFormula(this.previousOffset, sheetId, getters);
50118
+ if (!result.areRangeShapesInLineWithNormalizedFormula()) {
50119
+ const formulaString = result.toFormulaString(getters);
50120
+ yield {
50121
+ position,
50122
+ compiled: CompiledFormula.Compile(formulaString, sheetId, getters)
50123
+ };
50124
+ } else yield {
50125
+ position,
50126
+ compiled: result
50127
+ };
50128
+ }
50105
50129
  break;
50106
50130
  }
50107
50131
  case "NEW_NUMBER":
@@ -57862,6 +57886,8 @@ stores.inject(MyMetaStore, storeInstance);
57862
57886
  pivots = {};
57863
57887
  unusedPivotsInFormulas;
57864
57888
  custom;
57889
+ pivotPositionCache = new PositionMap();
57890
+ shouldInvalidateCache = false;
57865
57891
  constructor(config) {
57866
57892
  super(config);
57867
57893
  this.custom = config.custom;
@@ -57872,7 +57898,11 @@ stores.inject(MyMetaStore, storeInstance);
57872
57898
  }
57873
57899
  }
57874
57900
  handle(cmd) {
57875
- if (invalidateEvaluationCommands.has(cmd.type)) for (const pivotId of this.getters.getPivotIds()) this.setupPivot(pivotId, { recreate: true });
57901
+ if (invalidateEvaluationCommands.has(cmd.type)) {
57902
+ this.shouldInvalidateCache = true;
57903
+ for (const pivotId of this.getters.getPivotIds()) this.setupPivot(pivotId, { recreate: true });
57904
+ }
57905
+ if (cmd.type === "UPDATE_CELL") this.shouldInvalidateCache = true;
57876
57906
  switch (cmd.type) {
57877
57907
  case "REFRESH_PIVOT":
57878
57908
  this.refreshPivot(cmd.id);
@@ -57912,6 +57942,12 @@ stores.inject(MyMetaStore, storeInstance);
57912
57942
  break;
57913
57943
  }
57914
57944
  }
57945
+ finalize() {
57946
+ if (this.shouldInvalidateCache) {
57947
+ this.pivotPositionCache = new PositionMap();
57948
+ this.shouldInvalidateCache = false;
57949
+ }
57950
+ }
57915
57951
  /**
57916
57952
  * Get the id of the first pivot in the formula at the given position. Returns undefined if there
57917
57953
  * is no pivot at this position
@@ -57923,9 +57959,14 @@ stores.inject(MyMetaStore, storeInstance);
57923
57959
  * Get all of the ids of the pivot present in the formula at the given position.
57924
57960
  */
57925
57961
  getPivotIdsFromPosition(position) {
57926
- const cell = this.getters.getCorrespondingFormulaCell(position);
57927
- if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57928
- return [];
57962
+ if (!this.pivotPositionCache.has(position)) {
57963
+ const cell = this.getters.getCorrespondingFormulaCell(position);
57964
+ if (cell && cell.isFormula) {
57965
+ const pivotIds = this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57966
+ this.pivotPositionCache.set(position, pivotIds);
57967
+ }
57968
+ }
57969
+ return this.pivotPositionCache.get(position) || [];
57929
57970
  }
57930
57971
  getPivotIdsFromFormula(sheetId, formula) {
57931
57972
  return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
@@ -59680,7 +59721,12 @@ stores.inject(MyMetaStore, storeInstance);
59680
59721
  computeTableStyle(sheetId, table) {
59681
59722
  return lazy(() => {
59682
59723
  const style = this.getters.getTableStyle(table.config.styleId);
59683
- const { tableMetaData, config } = this.getTableMetaData(sheetId, table);
59724
+ const tableMetaDataAndConfig = this.getTableMetaData(sheetId, table);
59725
+ if (!tableMetaDataAndConfig) return {
59726
+ borders: {},
59727
+ styles: {}
59728
+ };
59729
+ const { tableMetaData, config } = tableMetaDataAndConfig;
59684
59730
  const relativeTableStyle = getComputedTableStyle(config, style, tableMetaData);
59685
59731
  const mapping = this.getTableMapping(sheetId, table);
59686
59732
  const absoluteTableStyle = {
@@ -59718,6 +59764,7 @@ stores.inject(MyMetaStore, storeInstance);
59718
59764
  const pivotInfo = this.getters.getPivotStyleAtPosition(mainPosition);
59719
59765
  if (!pivotInfo) throw new Error("No dynamic pivot info found at pivot table position");
59720
59766
  const pivot = this.getters.getPivot(pivotInfo.pivotId);
59767
+ if (!pivot.isValid()) return;
59721
59768
  const pivotStyle = pivotInfo.pivotStyle;
59722
59769
  const maxRowDepth = pivot.getExpandedTableStructure().getNumberOfRowGroupBys();
59723
59770
  const pivotTable = pivot.getCollapsedTableStructure();
@@ -84426,7 +84473,8 @@ stores.inject(MyMetaStore, storeInstance);
84426
84473
  parseFormat,
84427
84474
  isFormula,
84428
84475
  domainToColRowDomain,
84429
- collapseHierarchicalDisplayName
84476
+ collapseHierarchicalDisplayName,
84477
+ PositionMap
84430
84478
  };
84431
84479
  const links = {
84432
84480
  isMarkdownLink,
@@ -84606,8 +84654,8 @@ exports.stores = stores;
84606
84654
  exports.tokenColors = tokenColors;
84607
84655
  exports.tokenize = tokenize;
84608
84656
 
84609
- __info__.version = "19.3.11";
84610
- __info__.date = "2026-07-13T06:26:28.422Z";
84611
- __info__.hash = "35c06d3";
84657
+ __info__.version = "19.3.12";
84658
+ __info__.date = "2026-07-20T11:02:44.416Z";
84659
+ __info__.hash = "2b42707";
84612
84660
 
84613
84661
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);