@odoo/o-spreadsheet 19.3.4 → 19.3.5

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.4
6
- * @date 2026-05-15T07:07:34.417Z
7
- * @hash 1dc7b42
5
+ * @version 19.3.5
6
+ * @date 2026-05-27T06:08:23.138Z
7
+ * @hash 0cf1540
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -5816,8 +5816,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5816
5816
  changeType: "NONE",
5817
5817
  range
5818
5818
  };
5819
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5820
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5821
+ changeType: "RESIZE",
5822
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5823
+ };
5819
5824
  if (cmd.position === "after") {
5820
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5825
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5821
5826
  changeType: "RESIZE",
5822
5827
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5823
5828
  };
@@ -9118,6 +9123,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9118
9123
  ROUNDDOWN: [{
9119
9124
  type: "NUMBER",
9120
9125
  value: 0
9126
+ }],
9127
+ IFERROR: [{
9128
+ type: "NUMBER",
9129
+ value: 0
9121
9130
  }]
9122
9131
  };
9123
9132
  /**
@@ -32874,11 +32883,12 @@ const ChartRangeDataSourceHandler = {
32874
32883
  type: "range",
32875
32884
  dataSets: [],
32876
32885
  dataSetsHaveTitle: false,
32886
+ labelRange: context.auxiliaryRange,
32877
32887
  ...context.dataSource
32878
32888
  };
32879
32889
  },
32880
32890
  fromHierarchicalContextCreation(context) {
32881
- if (context.dataSource?.type !== "range" || context.hierarchicalDataSource?.type !== "range") return {
32891
+ if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
32882
32892
  type: "range",
32883
32893
  dataSets: [],
32884
32894
  dataSetsHaveTitle: false
@@ -37545,7 +37555,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
37545
37555
  col,
37546
37556
  row
37547
37557
  };
37548
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
37558
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
37549
37559
  }
37550
37560
  return positions;
37551
37561
  }
@@ -39619,6 +39629,9 @@ const PIVOT_FUNCTIONS = [
39619
39629
  function getFirstPivotFunction(compiledFormula, getters) {
39620
39630
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
39621
39631
  }
39632
+ function getPivotFunctions(compiledFormula, getters) {
39633
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
39634
+ }
39622
39635
  /**
39623
39636
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
39624
39637
  * present in the given formula.
@@ -58017,6 +58030,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58017
58030
  "getFirstPivotFunction",
58018
58031
  "getPivotCellSortDirection",
58019
58032
  "getPivotIdFromPosition",
58033
+ "getPivotIdsFromPosition",
58020
58034
  "getPivotCellFromPosition",
58021
58035
  "generateNewCalculatedMeasureName",
58022
58036
  "isPivotUnused",
@@ -58076,37 +58090,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58076
58090
  }
58077
58091
  }
58078
58092
  /**
58079
- * Get the id of the pivot at the given position. Returns undefined if there
58093
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
58080
58094
  * is no pivot at this position
58081
58095
  */
58082
58096
  getPivotIdFromPosition(position) {
58097
+ return this.getPivotIdsFromPosition(position)[0];
58098
+ }
58099
+ /**
58100
+ * Get all of the ids of the pivot present in the formula at the given position.
58101
+ */
58102
+ getPivotIdsFromPosition(position) {
58083
58103
  const cell = this.getters.getCorrespondingFormulaCell(position);
58084
- if (cell && cell.isFormula) {
58085
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
58086
- if (pivotFunction) {
58087
- const pivotId = pivotFunction.args[0]?.toString();
58088
- return pivotId && this.getters.getPivotId(pivotId);
58089
- }
58090
- }
58104
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
58105
+ return [];
58106
+ }
58107
+ getPivotIdsFromFormula(sheetId, formula) {
58108
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
58109
+ const pivotId = pivotFunction.args[0]?.toString();
58110
+ return pivotId && this.getters.getPivotId(pivotId);
58111
+ }).filter(isDefined);
58091
58112
  }
58092
58113
  isSpillPivotFormula(position) {
58093
58114
  const cell = this.getters.getCorrespondingFormulaCell(position);
58094
58115
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
58095
58116
  return false;
58096
58117
  }
58097
- getFirstPivotFunction(sheetId, compiledFormula) {
58098
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
58099
- if (!pivotFunction) return;
58100
- const { functionName, args } = pivotFunction;
58101
- return {
58102
- functionName,
58103
- args: args.map((argAst) => {
58118
+ getPivotFunctions(sheetId, formula) {
58119
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
58120
+ if (!pivotFunctions.length) return [];
58121
+ const evaluatedPivotFunctions = [];
58122
+ for (const pivotFunction of pivotFunctions) {
58123
+ const { functionName, args } = pivotFunction;
58124
+ const evaluatedArgs = args.map((argAst) => {
58104
58125
  if (argAst.type === "EMPTY") return;
58105
58126
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
58106
58127
  const argsString = astToFormula(argAst);
58107
58128
  return this.getters.evaluateFormula(sheetId, argsString);
58108
- })
58109
- };
58129
+ });
58130
+ evaluatedPivotFunctions.push({
58131
+ functionName,
58132
+ args: evaluatedArgs
58133
+ });
58134
+ }
58135
+ return evaluatedPivotFunctions;
58136
+ }
58137
+ getFirstPivotFunction(sheetId, formula) {
58138
+ return this.getPivotFunctions(sheetId, formula)[0];
58110
58139
  }
58111
58140
  /**
58112
58141
  * Returns the domain args of a pivot formula from a position.
@@ -58212,8 +58241,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58212
58241
  const unusedPivots = new Set(this.getters.getPivotIds());
58213
58242
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
58214
58243
  const position = this.getters.getCellPosition(cell.id);
58215
- const pivotId = this.getPivotIdFromPosition(position);
58216
- if (pivotId) {
58244
+ const pivotIds = this.getPivotIdsFromPosition(position);
58245
+ for (const pivotId of pivotIds) {
58217
58246
  unusedPivots.delete(pivotId);
58218
58247
  if (!unusedPivots.size) {
58219
58248
  this.unusedPivotsInFormulas = [];
@@ -58221,6 +58250,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58221
58250
  }
58222
58251
  }
58223
58252
  }
58253
+ for (const pivotId of this.getters.getPivotIds()) {
58254
+ const pivot = this.getters.getPivot(pivotId);
58255
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
58256
+ const { sheetId } = measure.computedBy;
58257
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
58258
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
58259
+ for (const relatedPivotId of relatedPivotIds) {
58260
+ unusedPivots.delete(relatedPivotId);
58261
+ if (!unusedPivots.size) {
58262
+ this.unusedPivotsInFormulas = [];
58263
+ return [];
58264
+ }
58265
+ }
58266
+ }
58267
+ }
58224
58268
  this.unusedPivotsInFormulas = [...unusedPivots];
58225
58269
  return this.unusedPivotsInFormulas;
58226
58270
  }
@@ -84687,6 +84731,6 @@ exports.stores = stores;
84687
84731
  exports.tokenColors = tokenColors;
84688
84732
  exports.tokenize = tokenize;
84689
84733
 
84690
- __info__.version = "19.3.4";
84691
- __info__.date = "2026-05-15T07:07:34.417Z";
84692
- __info__.hash = "1dc7b42";
84734
+ __info__.version = "19.3.5";
84735
+ __info__.date = "2026-05-27T06:08:23.138Z";
84736
+ __info__.hash = "0cf1540";
@@ -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.4
6
- * @date 2026-05-15T07:07:36.246Z
7
- * @hash 1dc7b42
5
+ * @version 19.3.5
6
+ * @date 2026-05-27T06:08:24.964Z
7
+ * @hash 0cf1540
8
8
  */
9
9
  :root {
10
10
  --os-gray-100: light-dark(#f9fafb, #1b1d26);
@@ -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.4
6
- * @date 2026-05-15T07:07:34.417Z
7
- * @hash 1dc7b42
5
+ * @version 19.3.5
6
+ * @date 2026-05-27T06:08:23.138Z
7
+ * @hash 0cf1540
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, whenReady, xml } from "@odoo/owl";
@@ -5815,8 +5815,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5815
5815
  changeType: "NONE",
5816
5816
  range
5817
5817
  };
5818
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5819
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5820
+ changeType: "RESIZE",
5821
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5822
+ };
5818
5823
  if (cmd.position === "after") {
5819
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5824
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5820
5825
  changeType: "RESIZE",
5821
5826
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5822
5827
  };
@@ -9117,6 +9122,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9117
9122
  ROUNDDOWN: [{
9118
9123
  type: "NUMBER",
9119
9124
  value: 0
9125
+ }],
9126
+ IFERROR: [{
9127
+ type: "NUMBER",
9128
+ value: 0
9120
9129
  }]
9121
9130
  };
9122
9131
  /**
@@ -32873,11 +32882,12 @@ const ChartRangeDataSourceHandler = {
32873
32882
  type: "range",
32874
32883
  dataSets: [],
32875
32884
  dataSetsHaveTitle: false,
32885
+ labelRange: context.auxiliaryRange,
32876
32886
  ...context.dataSource
32877
32887
  };
32878
32888
  },
32879
32889
  fromHierarchicalContextCreation(context) {
32880
- if (context.dataSource?.type !== "range" || context.hierarchicalDataSource?.type !== "range") return {
32890
+ if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
32881
32891
  type: "range",
32882
32892
  dataSets: [],
32883
32893
  dataSetsHaveTitle: false
@@ -37544,7 +37554,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
37544
37554
  col,
37545
37555
  row
37546
37556
  };
37547
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
37557
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
37548
37558
  }
37549
37559
  return positions;
37550
37560
  }
@@ -39618,6 +39628,9 @@ const PIVOT_FUNCTIONS = [
39618
39628
  function getFirstPivotFunction(compiledFormula, getters) {
39619
39629
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
39620
39630
  }
39631
+ function getPivotFunctions(compiledFormula, getters) {
39632
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
39633
+ }
39621
39634
  /**
39622
39635
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
39623
39636
  * present in the given formula.
@@ -57832,6 +57845,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
57832
57845
  "getFirstPivotFunction",
57833
57846
  "getPivotCellSortDirection",
57834
57847
  "getPivotIdFromPosition",
57848
+ "getPivotIdsFromPosition",
57835
57849
  "getPivotCellFromPosition",
57836
57850
  "generateNewCalculatedMeasureName",
57837
57851
  "isPivotUnused",
@@ -57891,37 +57905,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
57891
57905
  }
57892
57906
  }
57893
57907
  /**
57894
- * Get the id of the pivot at the given position. Returns undefined if there
57908
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
57895
57909
  * is no pivot at this position
57896
57910
  */
57897
57911
  getPivotIdFromPosition(position) {
57912
+ return this.getPivotIdsFromPosition(position)[0];
57913
+ }
57914
+ /**
57915
+ * Get all of the ids of the pivot present in the formula at the given position.
57916
+ */
57917
+ getPivotIdsFromPosition(position) {
57898
57918
  const cell = this.getters.getCorrespondingFormulaCell(position);
57899
- if (cell && cell.isFormula) {
57900
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
57901
- if (pivotFunction) {
57902
- const pivotId = pivotFunction.args[0]?.toString();
57903
- return pivotId && this.getters.getPivotId(pivotId);
57904
- }
57905
- }
57919
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57920
+ return [];
57921
+ }
57922
+ getPivotIdsFromFormula(sheetId, formula) {
57923
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
57924
+ const pivotId = pivotFunction.args[0]?.toString();
57925
+ return pivotId && this.getters.getPivotId(pivotId);
57926
+ }).filter(isDefined);
57906
57927
  }
57907
57928
  isSpillPivotFormula(position) {
57908
57929
  const cell = this.getters.getCorrespondingFormulaCell(position);
57909
57930
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
57910
57931
  return false;
57911
57932
  }
57912
- getFirstPivotFunction(sheetId, compiledFormula) {
57913
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
57914
- if (!pivotFunction) return;
57915
- const { functionName, args } = pivotFunction;
57916
- return {
57917
- functionName,
57918
- args: args.map((argAst) => {
57933
+ getPivotFunctions(sheetId, formula) {
57934
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
57935
+ if (!pivotFunctions.length) return [];
57936
+ const evaluatedPivotFunctions = [];
57937
+ for (const pivotFunction of pivotFunctions) {
57938
+ const { functionName, args } = pivotFunction;
57939
+ const evaluatedArgs = args.map((argAst) => {
57919
57940
  if (argAst.type === "EMPTY") return;
57920
57941
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
57921
57942
  const argsString = astToFormula(argAst);
57922
57943
  return this.getters.evaluateFormula(sheetId, argsString);
57923
- })
57924
- };
57944
+ });
57945
+ evaluatedPivotFunctions.push({
57946
+ functionName,
57947
+ args: evaluatedArgs
57948
+ });
57949
+ }
57950
+ return evaluatedPivotFunctions;
57951
+ }
57952
+ getFirstPivotFunction(sheetId, formula) {
57953
+ return this.getPivotFunctions(sheetId, formula)[0];
57925
57954
  }
57926
57955
  /**
57927
57956
  * Returns the domain args of a pivot formula from a position.
@@ -58027,8 +58056,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58027
58056
  const unusedPivots = new Set(this.getters.getPivotIds());
58028
58057
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
58029
58058
  const position = this.getters.getCellPosition(cell.id);
58030
- const pivotId = this.getPivotIdFromPosition(position);
58031
- if (pivotId) {
58059
+ const pivotIds = this.getPivotIdsFromPosition(position);
58060
+ for (const pivotId of pivotIds) {
58032
58061
  unusedPivots.delete(pivotId);
58033
58062
  if (!unusedPivots.size) {
58034
58063
  this.unusedPivotsInFormulas = [];
@@ -58036,6 +58065,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58036
58065
  }
58037
58066
  }
58038
58067
  }
58068
+ for (const pivotId of this.getters.getPivotIds()) {
58069
+ const pivot = this.getters.getPivot(pivotId);
58070
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
58071
+ const { sheetId } = measure.computedBy;
58072
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
58073
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
58074
+ for (const relatedPivotId of relatedPivotIds) {
58075
+ unusedPivots.delete(relatedPivotId);
58076
+ if (!unusedPivots.size) {
58077
+ this.unusedPivotsInFormulas = [];
58078
+ return [];
58079
+ }
58080
+ }
58081
+ }
58082
+ }
58039
58083
  this.unusedPivotsInFormulas = [...unusedPivots];
58040
58084
  return this.unusedPivotsInFormulas;
58041
58085
  }
@@ -84444,6 +84488,6 @@ const chartHelpers = {
84444
84488
  //#endregion
84445
84489
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, canExecuteInReadonly, categories, chartHelpers, components, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isSheetDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
84446
84490
 
84447
- __info__.version = "19.3.4";
84448
- __info__.date = "2026-05-15T07:07:34.417Z";
84449
- __info__.hash = "1dc7b42";
84491
+ __info__.version = "19.3.5";
84492
+ __info__.date = "2026-05-27T06:08:23.138Z";
84493
+ __info__.hash = "0cf1540";
@@ -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.4
6
- * @date 2026-05-15T07:07:34.417Z
7
- * @hash 1dc7b42
5
+ * @version 19.3.5
6
+ * @date 2026-05-27T06:08:23.138Z
7
+ * @hash 0cf1540
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -5817,8 +5817,13 @@ stores.inject(MyMetaStore, storeInstance);
5817
5817
  changeType: "NONE",
5818
5818
  range
5819
5819
  };
5820
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5821
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5822
+ changeType: "RESIZE",
5823
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5824
+ };
5820
5825
  if (cmd.position === "after") {
5821
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5826
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5822
5827
  changeType: "RESIZE",
5823
5828
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5824
5829
  };
@@ -9119,6 +9124,10 @@ stores.inject(MyMetaStore, storeInstance);
9119
9124
  ROUNDDOWN: [{
9120
9125
  type: "NUMBER",
9121
9126
  value: 0
9127
+ }],
9128
+ IFERROR: [{
9129
+ type: "NUMBER",
9130
+ value: 0
9122
9131
  }]
9123
9132
  };
9124
9133
  /**
@@ -32875,11 +32884,12 @@ stores.inject(MyMetaStore, storeInstance);
32875
32884
  type: "range",
32876
32885
  dataSets: [],
32877
32886
  dataSetsHaveTitle: false,
32887
+ labelRange: context.auxiliaryRange,
32878
32888
  ...context.dataSource
32879
32889
  };
32880
32890
  },
32881
32891
  fromHierarchicalContextCreation(context) {
32882
- if (context.dataSource?.type !== "range" || context.hierarchicalDataSource?.type !== "range") return {
32892
+ if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
32883
32893
  type: "range",
32884
32894
  dataSets: [],
32885
32895
  dataSetsHaveTitle: false
@@ -37546,7 +37556,7 @@ stores.inject(MyMetaStore, storeInstance);
37546
37556
  col,
37547
37557
  row
37548
37558
  };
37549
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
37559
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
37550
37560
  }
37551
37561
  return positions;
37552
37562
  }
@@ -39620,6 +39630,9 @@ stores.inject(MyMetaStore, storeInstance);
39620
39630
  function getFirstPivotFunction(compiledFormula, getters) {
39621
39631
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
39622
39632
  }
39633
+ function getPivotFunctions(compiledFormula, getters) {
39634
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
39635
+ }
39623
39636
  /**
39624
39637
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
39625
39638
  * present in the given formula.
@@ -57834,6 +57847,7 @@ stores.inject(MyMetaStore, storeInstance);
57834
57847
  "getFirstPivotFunction",
57835
57848
  "getPivotCellSortDirection",
57836
57849
  "getPivotIdFromPosition",
57850
+ "getPivotIdsFromPosition",
57837
57851
  "getPivotCellFromPosition",
57838
57852
  "generateNewCalculatedMeasureName",
57839
57853
  "isPivotUnused",
@@ -57893,37 +57907,52 @@ stores.inject(MyMetaStore, storeInstance);
57893
57907
  }
57894
57908
  }
57895
57909
  /**
57896
- * Get the id of the pivot at the given position. Returns undefined if there
57910
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
57897
57911
  * is no pivot at this position
57898
57912
  */
57899
57913
  getPivotIdFromPosition(position) {
57914
+ return this.getPivotIdsFromPosition(position)[0];
57915
+ }
57916
+ /**
57917
+ * Get all of the ids of the pivot present in the formula at the given position.
57918
+ */
57919
+ getPivotIdsFromPosition(position) {
57900
57920
  const cell = this.getters.getCorrespondingFormulaCell(position);
57901
- if (cell && cell.isFormula) {
57902
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
57903
- if (pivotFunction) {
57904
- const pivotId = pivotFunction.args[0]?.toString();
57905
- return pivotId && this.getters.getPivotId(pivotId);
57906
- }
57907
- }
57921
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
57922
+ return [];
57923
+ }
57924
+ getPivotIdsFromFormula(sheetId, formula) {
57925
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
57926
+ const pivotId = pivotFunction.args[0]?.toString();
57927
+ return pivotId && this.getters.getPivotId(pivotId);
57928
+ }).filter(isDefined);
57908
57929
  }
57909
57930
  isSpillPivotFormula(position) {
57910
57931
  const cell = this.getters.getCorrespondingFormulaCell(position);
57911
57932
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
57912
57933
  return false;
57913
57934
  }
57914
- getFirstPivotFunction(sheetId, compiledFormula) {
57915
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
57916
- if (!pivotFunction) return;
57917
- const { functionName, args } = pivotFunction;
57918
- return {
57919
- functionName,
57920
- args: args.map((argAst) => {
57935
+ getPivotFunctions(sheetId, formula) {
57936
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
57937
+ if (!pivotFunctions.length) return [];
57938
+ const evaluatedPivotFunctions = [];
57939
+ for (const pivotFunction of pivotFunctions) {
57940
+ const { functionName, args } = pivotFunction;
57941
+ const evaluatedArgs = args.map((argAst) => {
57921
57942
  if (argAst.type === "EMPTY") return;
57922
57943
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
57923
57944
  const argsString = astToFormula(argAst);
57924
57945
  return this.getters.evaluateFormula(sheetId, argsString);
57925
- })
57926
- };
57946
+ });
57947
+ evaluatedPivotFunctions.push({
57948
+ functionName,
57949
+ args: evaluatedArgs
57950
+ });
57951
+ }
57952
+ return evaluatedPivotFunctions;
57953
+ }
57954
+ getFirstPivotFunction(sheetId, formula) {
57955
+ return this.getPivotFunctions(sheetId, formula)[0];
57927
57956
  }
57928
57957
  /**
57929
57958
  * Returns the domain args of a pivot formula from a position.
@@ -58029,8 +58058,8 @@ stores.inject(MyMetaStore, storeInstance);
58029
58058
  const unusedPivots = new Set(this.getters.getPivotIds());
58030
58059
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
58031
58060
  const position = this.getters.getCellPosition(cell.id);
58032
- const pivotId = this.getPivotIdFromPosition(position);
58033
- if (pivotId) {
58061
+ const pivotIds = this.getPivotIdsFromPosition(position);
58062
+ for (const pivotId of pivotIds) {
58034
58063
  unusedPivots.delete(pivotId);
58035
58064
  if (!unusedPivots.size) {
58036
58065
  this.unusedPivotsInFormulas = [];
@@ -58038,6 +58067,21 @@ stores.inject(MyMetaStore, storeInstance);
58038
58067
  }
58039
58068
  }
58040
58069
  }
58070
+ for (const pivotId of this.getters.getPivotIds()) {
58071
+ const pivot = this.getters.getPivot(pivotId);
58072
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
58073
+ const { sheetId } = measure.computedBy;
58074
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
58075
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
58076
+ for (const relatedPivotId of relatedPivotIds) {
58077
+ unusedPivots.delete(relatedPivotId);
58078
+ if (!unusedPivots.size) {
58079
+ this.unusedPivotsInFormulas = [];
58080
+ return [];
58081
+ }
58082
+ }
58083
+ }
58084
+ }
58041
58085
  this.unusedPivotsInFormulas = [...unusedPivots];
58042
58086
  return this.unusedPivotsInFormulas;
58043
58087
  }
@@ -84504,8 +84548,8 @@ exports.stores = stores;
84504
84548
  exports.tokenColors = tokenColors;
84505
84549
  exports.tokenize = tokenize;
84506
84550
 
84507
- __info__.version = "19.3.4";
84508
- __info__.date = "2026-05-15T07:07:34.417Z";
84509
- __info__.hash = "1dc7b42";
84551
+ __info__.version = "19.3.5";
84552
+ __info__.date = "2026-05-27T06:08:23.138Z";
84553
+ __info__.hash = "0cf1540";
84510
84554
 
84511
84555
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);