@odoo/o-spreadsheet 19.3.11 → 19.3.13

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.13
6
+ * @date 2026-07-23T07:41:06.182Z
7
+ * @hash 2059bd0
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];
@@ -44152,7 +44157,8 @@ stores.inject(MyMetaStore, storeInstance);
44152
44157
  const { x, y } = this.state.handler ? this.state.position : this.props.position;
44153
44158
  return cssPropertiesToCss({
44154
44159
  top: `${y}px`,
44155
- left: `${x}px`
44160
+ left: `${x}px`,
44161
+ visibility: this.props.isVisible ? "visible" : "hidden"
44156
44162
  });
44157
44163
  }
44158
44164
  get styleNextValue() {
@@ -44573,7 +44579,7 @@ stores.inject(MyMetaStore, storeInstance);
44573
44579
  this._cancelEdition();
44574
44580
  this.resetContent();
44575
44581
  }
44576
- if (cmd.sheetIdFrom !== cmd.sheetIdTo) {
44582
+ if (this.model.selection.isListening(this) && cmd.sheetIdFrom !== cmd.sheetIdTo) {
44577
44583
  const activePosition = this.getters.getActivePosition();
44578
44584
  const { col, row } = this.getters.getNextVisibleCellPosition({
44579
44585
  sheetId: cmd.sheetIdTo,
@@ -48715,6 +48721,10 @@ stores.inject(MyMetaStore, storeInstance);
48715
48721
  get displaySelectionHandler() {
48716
48722
  return this.env.isMobile() && this.composerFocusStore.activeComposer.editionMode === "inactive";
48717
48723
  }
48724
+ get clientsToDisplay() {
48725
+ const sheetId = this.env.model.getters.getActiveSheetId();
48726
+ return this.env.model.getters.getClientsToDisplay(sheetId);
48727
+ }
48718
48728
  };
48719
48729
 
48720
48730
  //#endregion
@@ -49719,6 +49729,7 @@ stores.inject(MyMetaStore, storeInstance);
49719
49729
  alreadyAppliedNumberOffsets = [];
49720
49730
  previousStrings = [];
49721
49731
  baseFormulaWasTransformed = false;
49732
+ rangeToStringOptions = { doNotSimplifyRange: true };
49722
49733
  baseNumber = void 0;
49723
49734
  constructor(getters) {
49724
49735
  this.getters = getters;
@@ -49774,9 +49785,9 @@ stores.inject(MyMetaStore, storeInstance);
49774
49785
  let references = [];
49775
49786
  if (!this.baseFormula || this.baseFormula.normalizedFormula !== cell.compiledFormula.normalizedFormula) {
49776
49787
  this.resetBaseTo(cell.compiledFormula);
49777
- return cell.compiledFormula.toFormulaString(this.getters);
49788
+ return cell.compiledFormula.toFormulaString(this.getters, this.rangeToStringOptions);
49778
49789
  } 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);
49790
+ 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
49791
  numbers = this.squishNumbers(cell.compiledFormula.literalValues.numbers);
49781
49792
  strings = this.squishStrings(cell.compiledFormula.literalValues.strings);
49782
49793
  references = this.squishReferences(cell.compiledFormula.rangeDependencies, forSheetId);
@@ -49853,23 +49864,23 @@ stores.inject(MyMetaStore, storeInstance);
49853
49864
  squishOneReference(reference, previousReferences, index, forSheetId) {
49854
49865
  const previousReference = previousReferences[index];
49855
49866
  if (deepEquals(previousReference, reference)) return "=";
49856
- if (previousReference.sheetId !== reference.sheetId || previousReference.prefixSheet !== reference.prefixSheet || previousReference.invalidSheetName !== reference.invalidSheetName || previousReference.invalidXc !== reference.invalidXc) {
49867
+ if (previousReference.sheetId !== reference.sheetId || previousReference.prefixSheet !== reference.prefixSheet || previousReference.invalidSheetName !== reference.invalidSheetName || previousReference.invalidXc !== reference.invalidXc || previousReference.parts.length !== reference.parts.length) {
49857
49868
  previousReferences[index] = deepCopy(reference);
49858
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49869
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49859
49870
  }
49860
49871
  if (previousReference.unboundedZone.bottom === void 0 || previousReference.unboundedZone.right === void 0 || reference.unboundedZone.bottom === void 0 || reference.unboundedZone.right === void 0) {
49861
49872
  previousReferences[index] = deepCopy(reference);
49862
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49873
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49863
49874
  }
49864
49875
  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
49876
  previousReferences[index] = deepCopy(reference);
49866
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49877
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49867
49878
  }
49868
49879
  const currentZone = reference.zone;
49869
49880
  const previousZone = previousReference.zone;
49870
49881
  if (currentZone.top !== currentZone.bottom || currentZone.left !== currentZone.right || previousZone.top !== previousZone.bottom || previousZone.left !== previousZone.right) {
49871
49882
  previousReferences[index] = deepCopy(reference);
49872
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49883
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49873
49884
  }
49874
49885
  const diffCol = reference.zone.left - previousReference.zone.left;
49875
49886
  const diffRow = reference.zone.top - previousReference.zone.top;
@@ -49877,7 +49888,7 @@ stores.inject(MyMetaStore, storeInstance);
49877
49888
  previousReference.unboundedZone = deepCopy(reference.unboundedZone);
49878
49889
  if (diffCol !== 0 && diffRow === 0) return `${diffCol > 0 ? "+" : "-"}C${Math.abs(diffCol)}`;
49879
49890
  else if (diffRow !== 0 && diffCol === 0) return `${diffRow > 0 ? "+" : "-"}R${Math.abs(diffRow)}`;
49880
- return getRangeString(reference, forSheetId, this.getters.getSheetName);
49891
+ return getRangeString(reference, forSheetId, this.getters.getSheetName, this.rangeToStringOptions);
49881
49892
  }
49882
49893
  /**
49883
49894
  * Squish the number parameters. Result for each parameter should be compared the previous formula.
@@ -50086,10 +50097,19 @@ stores.inject(MyMetaStore, storeInstance);
50086
50097
  case "FIRST_OFFSET": {
50087
50098
  const currentOffset = current;
50088
50099
  this.previousOffset = currentOffset;
50089
- for (const position of targetPositions) yield {
50090
- position,
50091
- compiled: this.unsquishFormula(currentOffset, sheetId, getters)
50092
- };
50100
+ for (const position of targetPositions) {
50101
+ const result = this.unsquishFormula(currentOffset, sheetId, getters);
50102
+ if (!result.areRangeShapesInLineWithNormalizedFormula()) {
50103
+ const formulaString = result.toFormulaString(getters);
50104
+ yield {
50105
+ position,
50106
+ compiled: CompiledFormula.Compile(formulaString, sheetId, getters)
50107
+ };
50108
+ } else yield {
50109
+ position,
50110
+ compiled: result
50111
+ };
50112
+ }
50093
50113
  break;
50094
50114
  }
50095
50115
  case "COMBINE_OFFSET": {
@@ -50098,10 +50118,19 @@ stores.inject(MyMetaStore, storeInstance);
50098
50118
  this.previousOffset.N = currentOffset.N ?? this.previousOffset.N;
50099
50119
  this.previousOffset.S = currentOffset.S ?? this.previousOffset.S;
50100
50120
  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
- };
50121
+ for (const position of targetPositions) {
50122
+ const result = this.unsquishFormula(this.previousOffset, sheetId, getters);
50123
+ if (!result.areRangeShapesInLineWithNormalizedFormula()) {
50124
+ const formulaString = result.toFormulaString(getters);
50125
+ yield {
50126
+ position,
50127
+ compiled: CompiledFormula.Compile(formulaString, sheetId, getters)
50128
+ };
50129
+ } else yield {
50130
+ position,
50131
+ compiled: result
50132
+ };
50133
+ }
50105
50134
  break;
50106
50135
  }
50107
50136
  case "NEW_NUMBER":
@@ -57862,6 +57891,8 @@ stores.inject(MyMetaStore, storeInstance);
57862
57891
  pivots = {};
57863
57892
  unusedPivotsInFormulas;
57864
57893
  custom;
57894
+ pivotPositionCache = new PositionMap();
57895
+ shouldInvalidateCache = false;
57865
57896
  constructor(config) {
57866
57897
  super(config);
57867
57898
  this.custom = config.custom;
@@ -57872,7 +57903,11 @@ stores.inject(MyMetaStore, storeInstance);
57872
57903
  }
57873
57904
  }
57874
57905
  handle(cmd) {
57875
- if (invalidateEvaluationCommands.has(cmd.type)) for (const pivotId of this.getters.getPivotIds()) this.setupPivot(pivotId, { recreate: true });
57906
+ if (invalidateEvaluationCommands.has(cmd.type)) {
57907
+ this.shouldInvalidateCache = true;
57908
+ for (const pivotId of this.getters.getPivotIds()) this.setupPivot(pivotId, { recreate: true });
57909
+ }
57910
+ if (cmd.type === "UPDATE_CELL") this.shouldInvalidateCache = true;
57876
57911
  switch (cmd.type) {
57877
57912
  case "REFRESH_PIVOT":
57878
57913
  this.refreshPivot(cmd.id);
@@ -57912,6 +57947,12 @@ stores.inject(MyMetaStore, storeInstance);
57912
57947
  break;
57913
57948
  }
57914
57949
  }
57950
+ finalize() {
57951
+ if (this.shouldInvalidateCache) {
57952
+ this.pivotPositionCache = new PositionMap();
57953
+ this.shouldInvalidateCache = false;
57954
+ }
57955
+ }
57915
57956
  /**
57916
57957
  * Get the id of the first pivot in the formula at the given position. Returns undefined if there
57917
57958
  * is no pivot at this position
@@ -57923,9 +57964,14 @@ stores.inject(MyMetaStore, storeInstance);
57923
57964
  * Get all of the ids of the pivot present in the formula at the given position.
57924
57965
  */
57925
57966
  getPivotIdsFromPosition(position) {
57926
- const cell = this.getters.getCorrespondingFormulaCell(position);
57927
- if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57928
- return [];
57967
+ if (!this.pivotPositionCache.has(position)) {
57968
+ const cell = this.getters.getCorrespondingFormulaCell(position);
57969
+ if (cell && cell.isFormula) {
57970
+ const pivotIds = this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57971
+ this.pivotPositionCache.set(position, pivotIds);
57972
+ }
57973
+ }
57974
+ return this.pivotPositionCache.get(position) || [];
57929
57975
  }
57930
57976
  getPivotIdsFromFormula(sheetId, formula) {
57931
57977
  return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
@@ -59670,17 +59716,32 @@ stores.inject(MyMetaStore, storeInstance);
59670
59716
  getCellTableStyle(position) {
59671
59717
  const table = this.getters.getTable(position);
59672
59718
  if (!table) return;
59673
- return this.tableStyles[position.sheetId][table.id]().styles[position.col]?.[position.row];
59719
+ try {
59720
+ return this.tableStyles[position.sheetId][table.id]().styles[position.col]?.[position.row];
59721
+ } catch (e) {
59722
+ if (isEvaluationError(e) || e instanceof EvaluationError) return;
59723
+ throw e;
59724
+ }
59674
59725
  }
59675
59726
  getCellTableBorder(position) {
59676
59727
  const table = this.getters.getTable(position);
59677
59728
  if (!table) return;
59678
- return this.tableStyles[position.sheetId][table.id]().borders[position.col]?.[position.row];
59729
+ try {
59730
+ return this.tableStyles[position.sheetId][table.id]().borders[position.col]?.[position.row];
59731
+ } catch (e) {
59732
+ if (isEvaluationError(e) || e instanceof EvaluationError) return;
59733
+ throw e;
59734
+ }
59679
59735
  }
59680
59736
  computeTableStyle(sheetId, table) {
59681
59737
  return lazy(() => {
59682
59738
  const style = this.getters.getTableStyle(table.config.styleId);
59683
- const { tableMetaData, config } = this.getTableMetaData(sheetId, table);
59739
+ const tableMetaDataAndConfig = this.getTableMetaData(sheetId, table);
59740
+ if (!tableMetaDataAndConfig) return {
59741
+ borders: {},
59742
+ styles: {}
59743
+ };
59744
+ const { tableMetaData, config } = tableMetaDataAndConfig;
59684
59745
  const relativeTableStyle = getComputedTableStyle(config, style, tableMetaData);
59685
59746
  const mapping = this.getTableMapping(sheetId, table);
59686
59747
  const absoluteTableStyle = {
@@ -59718,6 +59779,7 @@ stores.inject(MyMetaStore, storeInstance);
59718
59779
  const pivotInfo = this.getters.getPivotStyleAtPosition(mainPosition);
59719
59780
  if (!pivotInfo) throw new Error("No dynamic pivot info found at pivot table position");
59720
59781
  const pivot = this.getters.getPivot(pivotInfo.pivotId);
59782
+ if (!pivot.isValid()) return;
59721
59783
  const pivotStyle = pivotInfo.pivotStyle;
59722
59784
  const maxRowDepth = pivot.getExpandedTableStructure().getNumberOfRowGroupBys();
59723
59785
  const pivotTable = pivot.getCollapsedTableStructure();
@@ -61012,14 +61074,13 @@ stores.inject(MyMetaStore, storeInstance);
61012
61074
  * Get the list of others connected clients which are present in the same sheet
61013
61075
  * and with a valid position
61014
61076
  */
61015
- getClientsToDisplay() {
61077
+ getClientsToDisplay(sheetId) {
61016
61078
  try {
61017
61079
  this.getters.getCurrentClient();
61018
61080
  } catch (e) {
61019
61081
  if (e instanceof ClientDisconnectedError) return [];
61020
61082
  else throw e;
61021
61083
  }
61022
- const sheetId = this.getters.getActiveSheetId();
61023
61084
  const clients = [];
61024
61085
  for (const client of this.getters.getConnectedClients()) if (client.id !== this.getters.getCurrentClient().id && client.position && client.position.sheetId === sheetId && this.isPositionValid(client.position)) clients.push({
61025
61086
  ...client,
@@ -61030,7 +61091,7 @@ stores.inject(MyMetaStore, storeInstance);
61030
61091
  drawLayer(renderingContext) {
61031
61092
  if (this.getters.isDashboard()) return;
61032
61093
  const { ctx, thinLineWidth, viewports, sheetId } = renderingContext;
61033
- for (const client of this.getClientsToDisplay()) {
61094
+ for (const client of this.getClientsToDisplay(sheetId)) {
61034
61095
  const { row, col } = client.position;
61035
61096
  const zone = this.getters.expandZone(sheetId, {
61036
61097
  top: row,
@@ -61333,8 +61394,8 @@ stores.inject(MyMetaStore, storeInstance);
61333
61394
  getNextVisibleCellPosition({ sheetId, col, row }) {
61334
61395
  return {
61335
61396
  sheetId,
61336
- col: this.findVisibleHeader(sheetId, "COL", col, this.getters.getNumberCols(sheetId) - 1),
61337
- row: this.findVisibleHeader(sheetId, "ROW", row, this.getters.getNumberRows(sheetId) - 1)
61397
+ col: this.findVisibleHeader(sheetId, "COL", col, this.getters.getNumberCols(sheetId) - 1) || this.findVisibleHeader(sheetId, "COL", col, 0) || 0,
61398
+ row: this.findVisibleHeader(sheetId, "ROW", row, this.getters.getNumberRows(sheetId) - 1) || this.findVisibleHeader(sheetId, "ROW", row, 0) || 0
61338
61399
  };
61339
61400
  }
61340
61401
  /**
@@ -84426,7 +84487,8 @@ stores.inject(MyMetaStore, storeInstance);
84426
84487
  parseFormat,
84427
84488
  isFormula,
84428
84489
  domainToColRowDomain,
84429
- collapseHierarchicalDisplayName
84490
+ collapseHierarchicalDisplayName,
84491
+ PositionMap
84430
84492
  };
84431
84493
  const links = {
84432
84494
  isMarkdownLink,
@@ -84606,8 +84668,8 @@ exports.stores = stores;
84606
84668
  exports.tokenColors = tokenColors;
84607
84669
  exports.tokenize = tokenize;
84608
84670
 
84609
- __info__.version = "19.3.11";
84610
- __info__.date = "2026-07-13T06:26:28.422Z";
84611
- __info__.hash = "35c06d3";
84671
+ __info__.version = "19.3.13";
84672
+ __info__.date = "2026-07-23T07:41:06.182Z";
84673
+ __info__.hash = "2059bd0";
84612
84674
 
84613
84675
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);