@odoo/o-spreadsheet 19.0.35 → 19.0.36

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.0.35
6
- * @date 2026-05-15T07:06:09.392Z
7
- * @hash 5de341b
5
+ * @version 19.0.36
6
+ * @date 2026-05-27T05:57:35.932Z
7
+ * @hash 3f73c94
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -5821,8 +5821,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5821
5821
  changeType: "NONE",
5822
5822
  range
5823
5823
  };
5824
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5825
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5826
+ changeType: "RESIZE",
5827
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5828
+ };
5824
5829
  if (cmd.position === "after") {
5825
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5830
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5826
5831
  changeType: "RESIZE",
5827
5832
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5828
5833
  };
@@ -9521,6 +9526,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9521
9526
  ROUNDDOWN: [{
9522
9527
  type: "NUMBER",
9523
9528
  value: 0
9529
+ }],
9530
+ IFERROR: [{
9531
+ type: "NUMBER",
9532
+ value: 0
9524
9533
  }]
9525
9534
  };
9526
9535
  /**
@@ -52126,7 +52135,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
52126
52135
  col,
52127
52136
  row
52128
52137
  };
52129
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
52138
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
52130
52139
  }
52131
52140
  return positions;
52132
52141
  }
@@ -53012,6 +53021,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
53012
53021
  function getFirstPivotFunction(tokens) {
53013
53022
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
53014
53023
  }
53024
+ function getPivotFunctions(tokens) {
53025
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
53026
+ }
53015
53027
  /**
53016
53028
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
53017
53029
  * present in the given formula.
@@ -64011,6 +64023,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64011
64023
  "getFirstPivotFunction",
64012
64024
  "getPivotCellSortDirection",
64013
64025
  "getPivotIdFromPosition",
64026
+ "getPivotIdsFromPosition",
64014
64027
  "getPivotCellFromPosition",
64015
64028
  "generateNewCalculatedMeasureName",
64016
64029
  "isPivotUnused",
@@ -64068,37 +64081,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64068
64081
  }
64069
64082
  }
64070
64083
  /**
64071
- * Get the id of the pivot at the given position. Returns undefined if there
64084
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
64072
64085
  * is no pivot at this position
64073
64086
  */
64074
64087
  getPivotIdFromPosition(position) {
64088
+ return this.getPivotIdsFromPosition(position)[0];
64089
+ }
64090
+ /**
64091
+ * Get all of the ids of the pivot present in the formula at the given position.
64092
+ */
64093
+ getPivotIdsFromPosition(position) {
64075
64094
  const cell = this.getters.getCorrespondingFormulaCell(position);
64076
- if (cell && cell.isFormula) {
64077
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
64078
- if (pivotFunction) {
64079
- const pivotId = pivotFunction.args[0]?.toString();
64080
- return pivotId && this.getters.getPivotId(pivotId);
64081
- }
64082
- }
64095
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
64096
+ return [];
64097
+ }
64098
+ getPivotIdsFromFormula(sheetId, formula) {
64099
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
64100
+ const pivotId = pivotFunction.args[0]?.toString();
64101
+ return pivotId && this.getters.getPivotId(pivotId);
64102
+ }).filter(isDefined);
64083
64103
  }
64084
64104
  isSpillPivotFormula(position) {
64085
64105
  const cell = this.getters.getCorrespondingFormulaCell(position);
64086
64106
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
64087
64107
  return false;
64088
64108
  }
64089
- getFirstPivotFunction(sheetId, tokens) {
64090
- const pivotFunction = getFirstPivotFunction(tokens);
64091
- if (!pivotFunction) return;
64092
- const { functionName, args } = pivotFunction;
64093
- return {
64094
- functionName,
64095
- args: args.map((argAst) => {
64109
+ getPivotFunctions(sheetId, tokens) {
64110
+ const pivotFunctions = getPivotFunctions(tokens);
64111
+ if (!pivotFunctions.length) return [];
64112
+ const evaluatedPivotFunctions = [];
64113
+ for (const pivotFunction of pivotFunctions) {
64114
+ const { functionName, args } = pivotFunction;
64115
+ const evaluatedArgs = args.map((argAst) => {
64096
64116
  if (argAst.type === "EMPTY") return;
64097
64117
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
64098
64118
  const argsString = astToFormula(argAst);
64099
64119
  return this.getters.evaluateFormula(sheetId, argsString);
64100
- })
64101
- };
64120
+ });
64121
+ evaluatedPivotFunctions.push({
64122
+ functionName,
64123
+ args: evaluatedArgs
64124
+ });
64125
+ }
64126
+ return evaluatedPivotFunctions;
64127
+ }
64128
+ getFirstPivotFunction(sheetId, tokens) {
64129
+ return this.getPivotFunctions(sheetId, tokens)[0];
64102
64130
  }
64103
64131
  /**
64104
64132
  * Returns the domain args of a pivot formula from a position.
@@ -64212,8 +64240,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64212
64240
  const unusedPivots = new Set(this.getters.getPivotIds());
64213
64241
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
64214
64242
  const position = this.getters.getCellPosition(cellId);
64215
- const pivotId = this.getPivotIdFromPosition(position);
64216
- if (pivotId) {
64243
+ const pivotIds = this.getPivotIdsFromPosition(position);
64244
+ for (const pivotId of pivotIds) {
64217
64245
  unusedPivots.delete(pivotId);
64218
64246
  if (!unusedPivots.size) {
64219
64247
  this.unusedPivots = [];
@@ -64221,6 +64249,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64221
64249
  }
64222
64250
  }
64223
64251
  }
64252
+ for (const pivotId of this.getters.getPivotIds()) {
64253
+ const pivot = this.getters.getPivot(pivotId);
64254
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
64255
+ const { sheetId } = measure.computedBy;
64256
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
64257
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
64258
+ for (const relatedPivotId of relatedPivotIds) {
64259
+ unusedPivots.delete(relatedPivotId);
64260
+ if (!unusedPivots.size) {
64261
+ this.unusedPivots = [];
64262
+ return [];
64263
+ }
64264
+ }
64265
+ }
64266
+ }
64224
64267
  this.unusedPivots = [...unusedPivots];
64225
64268
  return this.unusedPivots;
64226
64269
  }
@@ -79516,6 +79559,6 @@ exports.stores = stores;
79516
79559
  exports.tokenColors = tokenColors;
79517
79560
  exports.tokenize = tokenize;
79518
79561
 
79519
- __info__.version = "19.0.35";
79520
- __info__.date = "2026-05-15T07:06:09.392Z";
79521
- __info__.hash = "5de341b";
79562
+ __info__.version = "19.0.36";
79563
+ __info__.date = "2026-05-27T05:57:35.932Z";
79564
+ __info__.hash = "3f73c94";
@@ -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.0.35
6
- * @date 2026-05-15T07:06:11.153Z
7
- * @hash 5de341b
5
+ * @version 19.0.36
6
+ * @date 2026-05-27T05:57:37.639Z
7
+ * @hash 3f73c94
8
8
  */
9
9
  /* Originates from src/components/top_bar/top_bar.scss */
10
10
  @media (max-width: 1200px) {
@@ -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.0.35
6
- * @date 2026-05-15T07:06:09.392Z
7
- * @hash 5de341b
5
+ * @version 19.0.36
6
+ * @date 2026-05-27T05:57:35.932Z
7
+ * @hash 3f73c94
8
8
  */
9
9
 
10
10
  import { App, Component, blockDom, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, xml } from "@odoo/owl";
@@ -5820,8 +5820,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5820
5820
  changeType: "NONE",
5821
5821
  range
5822
5822
  };
5823
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5824
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5825
+ changeType: "RESIZE",
5826
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5827
+ };
5823
5828
  if (cmd.position === "after") {
5824
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5829
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5825
5830
  changeType: "RESIZE",
5826
5831
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5827
5832
  };
@@ -9520,6 +9525,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9520
9525
  ROUNDDOWN: [{
9521
9526
  type: "NUMBER",
9522
9527
  value: 0
9528
+ }],
9529
+ IFERROR: [{
9530
+ type: "NUMBER",
9531
+ value: 0
9523
9532
  }]
9524
9533
  };
9525
9534
  /**
@@ -52125,7 +52134,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
52125
52134
  col,
52126
52135
  row
52127
52136
  };
52128
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
52137
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
52129
52138
  }
52130
52139
  return positions;
52131
52140
  }
@@ -53011,6 +53020,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
53011
53020
  function getFirstPivotFunction(tokens) {
53012
53021
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
53013
53022
  }
53023
+ function getPivotFunctions(tokens) {
53024
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
53025
+ }
53014
53026
  /**
53015
53027
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
53016
53028
  * present in the given formula.
@@ -63826,6 +63838,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63826
63838
  "getFirstPivotFunction",
63827
63839
  "getPivotCellSortDirection",
63828
63840
  "getPivotIdFromPosition",
63841
+ "getPivotIdsFromPosition",
63829
63842
  "getPivotCellFromPosition",
63830
63843
  "generateNewCalculatedMeasureName",
63831
63844
  "isPivotUnused",
@@ -63883,37 +63896,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63883
63896
  }
63884
63897
  }
63885
63898
  /**
63886
- * Get the id of the pivot at the given position. Returns undefined if there
63899
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63887
63900
  * is no pivot at this position
63888
63901
  */
63889
63902
  getPivotIdFromPosition(position) {
63903
+ return this.getPivotIdsFromPosition(position)[0];
63904
+ }
63905
+ /**
63906
+ * Get all of the ids of the pivot present in the formula at the given position.
63907
+ */
63908
+ getPivotIdsFromPosition(position) {
63890
63909
  const cell = this.getters.getCorrespondingFormulaCell(position);
63891
- if (cell && cell.isFormula) {
63892
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
63893
- if (pivotFunction) {
63894
- const pivotId = pivotFunction.args[0]?.toString();
63895
- return pivotId && this.getters.getPivotId(pivotId);
63896
- }
63897
- }
63910
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63911
+ return [];
63912
+ }
63913
+ getPivotIdsFromFormula(sheetId, formula) {
63914
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
63915
+ const pivotId = pivotFunction.args[0]?.toString();
63916
+ return pivotId && this.getters.getPivotId(pivotId);
63917
+ }).filter(isDefined);
63898
63918
  }
63899
63919
  isSpillPivotFormula(position) {
63900
63920
  const cell = this.getters.getCorrespondingFormulaCell(position);
63901
63921
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
63902
63922
  return false;
63903
63923
  }
63904
- getFirstPivotFunction(sheetId, tokens) {
63905
- const pivotFunction = getFirstPivotFunction(tokens);
63906
- if (!pivotFunction) return;
63907
- const { functionName, args } = pivotFunction;
63908
- return {
63909
- functionName,
63910
- args: args.map((argAst) => {
63924
+ getPivotFunctions(sheetId, tokens) {
63925
+ const pivotFunctions = getPivotFunctions(tokens);
63926
+ if (!pivotFunctions.length) return [];
63927
+ const evaluatedPivotFunctions = [];
63928
+ for (const pivotFunction of pivotFunctions) {
63929
+ const { functionName, args } = pivotFunction;
63930
+ const evaluatedArgs = args.map((argAst) => {
63911
63931
  if (argAst.type === "EMPTY") return;
63912
63932
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63913
63933
  const argsString = astToFormula(argAst);
63914
63934
  return this.getters.evaluateFormula(sheetId, argsString);
63915
- })
63916
- };
63935
+ });
63936
+ evaluatedPivotFunctions.push({
63937
+ functionName,
63938
+ args: evaluatedArgs
63939
+ });
63940
+ }
63941
+ return evaluatedPivotFunctions;
63942
+ }
63943
+ getFirstPivotFunction(sheetId, tokens) {
63944
+ return this.getPivotFunctions(sheetId, tokens)[0];
63917
63945
  }
63918
63946
  /**
63919
63947
  * Returns the domain args of a pivot formula from a position.
@@ -64027,8 +64055,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64027
64055
  const unusedPivots = new Set(this.getters.getPivotIds());
64028
64056
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
64029
64057
  const position = this.getters.getCellPosition(cellId);
64030
- const pivotId = this.getPivotIdFromPosition(position);
64031
- if (pivotId) {
64058
+ const pivotIds = this.getPivotIdsFromPosition(position);
64059
+ for (const pivotId of pivotIds) {
64032
64060
  unusedPivots.delete(pivotId);
64033
64061
  if (!unusedPivots.size) {
64034
64062
  this.unusedPivots = [];
@@ -64036,6 +64064,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
64036
64064
  }
64037
64065
  }
64038
64066
  }
64067
+ for (const pivotId of this.getters.getPivotIds()) {
64068
+ const pivot = this.getters.getPivot(pivotId);
64069
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
64070
+ const { sheetId } = measure.computedBy;
64071
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
64072
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
64073
+ for (const relatedPivotId of relatedPivotIds) {
64074
+ unusedPivots.delete(relatedPivotId);
64075
+ if (!unusedPivots.size) {
64076
+ this.unusedPivots = [];
64077
+ return [];
64078
+ }
64079
+ }
64080
+ }
64081
+ }
64039
64082
  this.unusedPivots = [...unusedPivots];
64040
64083
  return this.unusedPivots;
64041
64084
  }
@@ -79280,6 +79323,6 @@ const chartHelpers = {
79280
79323
  //#endregion
79281
79324
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
79282
79325
 
79283
- __info__.version = "19.0.35";
79284
- __info__.date = "2026-05-15T07:06:09.392Z";
79285
- __info__.hash = "5de341b";
79326
+ __info__.version = "19.0.36";
79327
+ __info__.date = "2026-05-27T05:57:35.932Z";
79328
+ __info__.hash = "3f73c94";
@@ -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.0.35
6
- * @date 2026-05-15T07:06:09.392Z
7
- * @hash 5de341b
5
+ * @version 19.0.36
6
+ * @date 2026-05-27T05:57:35.932Z
7
+ * @hash 3f73c94
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -5822,8 +5822,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5822
5822
  changeType: "NONE",
5823
5823
  range
5824
5824
  };
5825
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5826
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5827
+ changeType: "RESIZE",
5828
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5829
+ };
5825
5830
  if (cmd.position === "after") {
5826
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5831
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5827
5832
  changeType: "RESIZE",
5828
5833
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5829
5834
  };
@@ -9522,6 +9527,10 @@ stores.inject(MyMetaStore, storeInstance);
9522
9527
  ROUNDDOWN: [{
9523
9528
  type: "NUMBER",
9524
9529
  value: 0
9530
+ }],
9531
+ IFERROR: [{
9532
+ type: "NUMBER",
9533
+ value: 0
9525
9534
  }]
9526
9535
  };
9527
9536
  /**
@@ -52127,7 +52136,7 @@ stores.inject(MyMetaStore, storeInstance);
52127
52136
  col,
52128
52137
  row
52129
52138
  };
52130
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
52139
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
52131
52140
  }
52132
52141
  return positions;
52133
52142
  }
@@ -53013,6 +53022,9 @@ stores.inject(MyMetaStore, storeInstance);
53013
53022
  function getFirstPivotFunction(tokens) {
53014
53023
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
53015
53024
  }
53025
+ function getPivotFunctions(tokens) {
53026
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
53027
+ }
53016
53028
  /**
53017
53029
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
53018
53030
  * present in the given formula.
@@ -63828,6 +63840,7 @@ stores.inject(MyMetaStore, storeInstance);
63828
63840
  "getFirstPivotFunction",
63829
63841
  "getPivotCellSortDirection",
63830
63842
  "getPivotIdFromPosition",
63843
+ "getPivotIdsFromPosition",
63831
63844
  "getPivotCellFromPosition",
63832
63845
  "generateNewCalculatedMeasureName",
63833
63846
  "isPivotUnused",
@@ -63885,37 +63898,52 @@ stores.inject(MyMetaStore, storeInstance);
63885
63898
  }
63886
63899
  }
63887
63900
  /**
63888
- * Get the id of the pivot at the given position. Returns undefined if there
63901
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63889
63902
  * is no pivot at this position
63890
63903
  */
63891
63904
  getPivotIdFromPosition(position) {
63905
+ return this.getPivotIdsFromPosition(position)[0];
63906
+ }
63907
+ /**
63908
+ * Get all of the ids of the pivot present in the formula at the given position.
63909
+ */
63910
+ getPivotIdsFromPosition(position) {
63892
63911
  const cell = this.getters.getCorrespondingFormulaCell(position);
63893
- if (cell && cell.isFormula) {
63894
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
63895
- if (pivotFunction) {
63896
- const pivotId = pivotFunction.args[0]?.toString();
63897
- return pivotId && this.getters.getPivotId(pivotId);
63898
- }
63899
- }
63912
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63913
+ return [];
63914
+ }
63915
+ getPivotIdsFromFormula(sheetId, formula) {
63916
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
63917
+ const pivotId = pivotFunction.args[0]?.toString();
63918
+ return pivotId && this.getters.getPivotId(pivotId);
63919
+ }).filter(isDefined);
63900
63920
  }
63901
63921
  isSpillPivotFormula(position) {
63902
63922
  const cell = this.getters.getCorrespondingFormulaCell(position);
63903
63923
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
63904
63924
  return false;
63905
63925
  }
63906
- getFirstPivotFunction(sheetId, tokens) {
63907
- const pivotFunction = getFirstPivotFunction(tokens);
63908
- if (!pivotFunction) return;
63909
- const { functionName, args } = pivotFunction;
63910
- return {
63911
- functionName,
63912
- args: args.map((argAst) => {
63926
+ getPivotFunctions(sheetId, tokens) {
63927
+ const pivotFunctions = getPivotFunctions(tokens);
63928
+ if (!pivotFunctions.length) return [];
63929
+ const evaluatedPivotFunctions = [];
63930
+ for (const pivotFunction of pivotFunctions) {
63931
+ const { functionName, args } = pivotFunction;
63932
+ const evaluatedArgs = args.map((argAst) => {
63913
63933
  if (argAst.type === "EMPTY") return;
63914
63934
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63915
63935
  const argsString = astToFormula(argAst);
63916
63936
  return this.getters.evaluateFormula(sheetId, argsString);
63917
- })
63918
- };
63937
+ });
63938
+ evaluatedPivotFunctions.push({
63939
+ functionName,
63940
+ args: evaluatedArgs
63941
+ });
63942
+ }
63943
+ return evaluatedPivotFunctions;
63944
+ }
63945
+ getFirstPivotFunction(sheetId, tokens) {
63946
+ return this.getPivotFunctions(sheetId, tokens)[0];
63919
63947
  }
63920
63948
  /**
63921
63949
  * Returns the domain args of a pivot formula from a position.
@@ -64029,8 +64057,8 @@ stores.inject(MyMetaStore, storeInstance);
64029
64057
  const unusedPivots = new Set(this.getters.getPivotIds());
64030
64058
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
64031
64059
  const position = this.getters.getCellPosition(cellId);
64032
- const pivotId = this.getPivotIdFromPosition(position);
64033
- if (pivotId) {
64060
+ const pivotIds = this.getPivotIdsFromPosition(position);
64061
+ for (const pivotId of pivotIds) {
64034
64062
  unusedPivots.delete(pivotId);
64035
64063
  if (!unusedPivots.size) {
64036
64064
  this.unusedPivots = [];
@@ -64038,6 +64066,21 @@ stores.inject(MyMetaStore, storeInstance);
64038
64066
  }
64039
64067
  }
64040
64068
  }
64069
+ for (const pivotId of this.getters.getPivotIds()) {
64070
+ const pivot = this.getters.getPivot(pivotId);
64071
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
64072
+ const { sheetId } = measure.computedBy;
64073
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
64074
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
64075
+ for (const relatedPivotId of relatedPivotIds) {
64076
+ unusedPivots.delete(relatedPivotId);
64077
+ if (!unusedPivots.size) {
64078
+ this.unusedPivots = [];
64079
+ return [];
64080
+ }
64081
+ }
64082
+ }
64083
+ }
64041
64084
  this.unusedPivots = [...unusedPivots];
64042
64085
  return this.unusedPivots;
64043
64086
  }
@@ -79333,8 +79376,8 @@ exports.stores = stores;
79333
79376
  exports.tokenColors = tokenColors;
79334
79377
  exports.tokenize = tokenize;
79335
79378
 
79336
- __info__.version = "19.0.35";
79337
- __info__.date = "2026-05-15T07:06:09.392Z";
79338
- __info__.hash = "5de341b";
79379
+ __info__.version = "19.0.36";
79380
+ __info__.date = "2026-05-27T05:57:35.932Z";
79381
+ __info__.hash = "3f73c94";
79339
79382
 
79340
79383
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);