@odoo/o-spreadsheet 19.2.13 → 19.2.14

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.2.13
6
- * @date 2026-05-15T07:07:37.391Z
7
- * @hash fece642
5
+ * @version 19.2.14
6
+ * @date 2026-05-27T05:57:14.898Z
7
+ * @hash 96730cd
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -6484,8 +6484,13 @@ function getApplyRangeChangeAddColRow(cmd) {
6484
6484
  changeType: "NONE",
6485
6485
  range
6486
6486
  };
6487
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
6488
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
6489
+ changeType: "RESIZE",
6490
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6491
+ };
6487
6492
  if (cmd.position === "after") {
6488
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
6493
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
6489
6494
  changeType: "RESIZE",
6490
6495
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6491
6496
  };
@@ -7429,6 +7434,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
7429
7434
  ROUNDDOWN: [{
7430
7435
  type: "NUMBER",
7431
7436
  value: 0
7437
+ }],
7438
+ IFERROR: [{
7439
+ type: "NUMBER",
7440
+ value: 0
7432
7441
  }]
7433
7442
  };
7434
7443
  /**
@@ -43306,7 +43315,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
43306
43315
  col,
43307
43316
  row
43308
43317
  };
43309
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
43318
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
43310
43319
  }
43311
43320
  return positions;
43312
43321
  }
@@ -45794,6 +45803,9 @@ const PIVOT_FUNCTIONS = [
45794
45803
  function getFirstPivotFunction(compiledFormula, getters) {
45795
45804
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
45796
45805
  }
45806
+ function getPivotFunctions(compiledFormula, getters) {
45807
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
45808
+ }
45797
45809
  /**
45798
45810
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
45799
45811
  * present in the given formula.
@@ -63706,6 +63718,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63706
63718
  "getFirstPivotFunction",
63707
63719
  "getPivotCellSortDirection",
63708
63720
  "getPivotIdFromPosition",
63721
+ "getPivotIdsFromPosition",
63709
63722
  "getPivotCellFromPosition",
63710
63723
  "generateNewCalculatedMeasureName",
63711
63724
  "isPivotUnused",
@@ -63765,37 +63778,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63765
63778
  }
63766
63779
  }
63767
63780
  /**
63768
- * Get the id of the pivot at the given position. Returns undefined if there
63781
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63769
63782
  * is no pivot at this position
63770
63783
  */
63771
63784
  getPivotIdFromPosition(position) {
63785
+ return this.getPivotIdsFromPosition(position)[0];
63786
+ }
63787
+ /**
63788
+ * Get all of the ids of the pivot present in the formula at the given position.
63789
+ */
63790
+ getPivotIdsFromPosition(position) {
63772
63791
  const cell = this.getters.getCorrespondingFormulaCell(position);
63773
- if (cell && cell.isFormula) {
63774
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
63775
- if (pivotFunction) {
63776
- const pivotId = pivotFunction.args[0]?.toString();
63777
- return pivotId && this.getters.getPivotId(pivotId);
63778
- }
63779
- }
63792
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63793
+ return [];
63794
+ }
63795
+ getPivotIdsFromFormula(sheetId, formula) {
63796
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
63797
+ const pivotId = pivotFunction.args[0]?.toString();
63798
+ return pivotId && this.getters.getPivotId(pivotId);
63799
+ }).filter(isDefined);
63780
63800
  }
63781
63801
  isSpillPivotFormula(position) {
63782
63802
  const cell = this.getters.getCorrespondingFormulaCell(position);
63783
63803
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
63784
63804
  return false;
63785
63805
  }
63786
- getFirstPivotFunction(sheetId, compiledFormula) {
63787
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
63788
- if (!pivotFunction) return;
63789
- const { functionName, args } = pivotFunction;
63790
- return {
63791
- functionName,
63792
- args: args.map((argAst) => {
63806
+ getPivotFunctions(sheetId, formula) {
63807
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
63808
+ if (!pivotFunctions.length) return [];
63809
+ const evaluatedPivotFunctions = [];
63810
+ for (const pivotFunction of pivotFunctions) {
63811
+ const { functionName, args } = pivotFunction;
63812
+ const evaluatedArgs = args.map((argAst) => {
63793
63813
  if (argAst.type === "EMPTY") return;
63794
63814
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63795
63815
  const argsString = astToFormula(argAst);
63796
63816
  return this.getters.evaluateFormula(sheetId, argsString);
63797
- })
63798
- };
63817
+ });
63818
+ evaluatedPivotFunctions.push({
63819
+ functionName,
63820
+ args: evaluatedArgs
63821
+ });
63822
+ }
63823
+ return evaluatedPivotFunctions;
63824
+ }
63825
+ getFirstPivotFunction(sheetId, formula) {
63826
+ return this.getPivotFunctions(sheetId, formula)[0];
63799
63827
  }
63800
63828
  /**
63801
63829
  * Returns the domain args of a pivot formula from a position.
@@ -63901,8 +63929,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63901
63929
  const unusedPivots = new Set(this.getters.getPivotIds());
63902
63930
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
63903
63931
  const position = this.getters.getCellPosition(cell.id);
63904
- const pivotId = this.getPivotIdFromPosition(position);
63905
- if (pivotId) {
63932
+ const pivotIds = this.getPivotIdsFromPosition(position);
63933
+ for (const pivotId of pivotIds) {
63906
63934
  unusedPivots.delete(pivotId);
63907
63935
  if (!unusedPivots.size) {
63908
63936
  this.unusedPivotsInFormulas = [];
@@ -63910,6 +63938,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63910
63938
  }
63911
63939
  }
63912
63940
  }
63941
+ for (const pivotId of this.getters.getPivotIds()) {
63942
+ const pivot = this.getters.getPivot(pivotId);
63943
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
63944
+ const { sheetId } = measure.computedBy;
63945
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
63946
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
63947
+ for (const relatedPivotId of relatedPivotIds) {
63948
+ unusedPivots.delete(relatedPivotId);
63949
+ if (!unusedPivots.size) {
63950
+ this.unusedPivotsInFormulas = [];
63951
+ return [];
63952
+ }
63953
+ }
63954
+ }
63955
+ }
63913
63956
  this.unusedPivotsInFormulas = [...unusedPivots];
63914
63957
  return this.unusedPivotsInFormulas;
63915
63958
  }
@@ -81846,6 +81889,6 @@ exports.stores = stores;
81846
81889
  exports.tokenColors = tokenColors;
81847
81890
  exports.tokenize = tokenize;
81848
81891
 
81849
- __info__.version = "19.2.13";
81850
- __info__.date = "2026-05-15T07:07:37.391Z";
81851
- __info__.hash = "fece642";
81892
+ __info__.version = "19.2.14";
81893
+ __info__.date = "2026-05-27T05:57:14.898Z";
81894
+ __info__.hash = "96730cd";
@@ -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.2.13
6
- * @date 2026-05-15T07:07:39.096Z
7
- * @hash fece642
5
+ * @version 19.2.14
6
+ * @date 2026-05-27T05:57:16.585Z
7
+ * @hash 96730cd
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.2.13
6
- * @date 2026-05-15T07:07:37.391Z
7
- * @hash fece642
5
+ * @version 19.2.14
6
+ * @date 2026-05-27T05:57:14.898Z
7
+ * @hash 96730cd
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";
@@ -6483,8 +6483,13 @@ function getApplyRangeChangeAddColRow(cmd) {
6483
6483
  changeType: "NONE",
6484
6484
  range
6485
6485
  };
6486
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
6487
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
6488
+ changeType: "RESIZE",
6489
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6490
+ };
6486
6491
  if (cmd.position === "after") {
6487
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
6492
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
6488
6493
  changeType: "RESIZE",
6489
6494
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6490
6495
  };
@@ -7428,6 +7433,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
7428
7433
  ROUNDDOWN: [{
7429
7434
  type: "NUMBER",
7430
7435
  value: 0
7436
+ }],
7437
+ IFERROR: [{
7438
+ type: "NUMBER",
7439
+ value: 0
7431
7440
  }]
7432
7441
  };
7433
7442
  /**
@@ -43305,7 +43314,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
43305
43314
  col,
43306
43315
  row
43307
43316
  };
43308
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
43317
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
43309
43318
  }
43310
43319
  return positions;
43311
43320
  }
@@ -45793,6 +45802,9 @@ const PIVOT_FUNCTIONS = [
45793
45802
  function getFirstPivotFunction(compiledFormula, getters) {
45794
45803
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
45795
45804
  }
45805
+ function getPivotFunctions(compiledFormula, getters) {
45806
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
45807
+ }
45796
45808
  /**
45797
45809
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
45798
45810
  * present in the given formula.
@@ -63521,6 +63533,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63521
63533
  "getFirstPivotFunction",
63522
63534
  "getPivotCellSortDirection",
63523
63535
  "getPivotIdFromPosition",
63536
+ "getPivotIdsFromPosition",
63524
63537
  "getPivotCellFromPosition",
63525
63538
  "generateNewCalculatedMeasureName",
63526
63539
  "isPivotUnused",
@@ -63580,37 +63593,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63580
63593
  }
63581
63594
  }
63582
63595
  /**
63583
- * Get the id of the pivot at the given position. Returns undefined if there
63596
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63584
63597
  * is no pivot at this position
63585
63598
  */
63586
63599
  getPivotIdFromPosition(position) {
63600
+ return this.getPivotIdsFromPosition(position)[0];
63601
+ }
63602
+ /**
63603
+ * Get all of the ids of the pivot present in the formula at the given position.
63604
+ */
63605
+ getPivotIdsFromPosition(position) {
63587
63606
  const cell = this.getters.getCorrespondingFormulaCell(position);
63588
- if (cell && cell.isFormula) {
63589
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
63590
- if (pivotFunction) {
63591
- const pivotId = pivotFunction.args[0]?.toString();
63592
- return pivotId && this.getters.getPivotId(pivotId);
63593
- }
63594
- }
63607
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63608
+ return [];
63609
+ }
63610
+ getPivotIdsFromFormula(sheetId, formula) {
63611
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
63612
+ const pivotId = pivotFunction.args[0]?.toString();
63613
+ return pivotId && this.getters.getPivotId(pivotId);
63614
+ }).filter(isDefined);
63595
63615
  }
63596
63616
  isSpillPivotFormula(position) {
63597
63617
  const cell = this.getters.getCorrespondingFormulaCell(position);
63598
63618
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
63599
63619
  return false;
63600
63620
  }
63601
- getFirstPivotFunction(sheetId, compiledFormula) {
63602
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
63603
- if (!pivotFunction) return;
63604
- const { functionName, args } = pivotFunction;
63605
- return {
63606
- functionName,
63607
- args: args.map((argAst) => {
63621
+ getPivotFunctions(sheetId, formula) {
63622
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
63623
+ if (!pivotFunctions.length) return [];
63624
+ const evaluatedPivotFunctions = [];
63625
+ for (const pivotFunction of pivotFunctions) {
63626
+ const { functionName, args } = pivotFunction;
63627
+ const evaluatedArgs = args.map((argAst) => {
63608
63628
  if (argAst.type === "EMPTY") return;
63609
63629
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63610
63630
  const argsString = astToFormula(argAst);
63611
63631
  return this.getters.evaluateFormula(sheetId, argsString);
63612
- })
63613
- };
63632
+ });
63633
+ evaluatedPivotFunctions.push({
63634
+ functionName,
63635
+ args: evaluatedArgs
63636
+ });
63637
+ }
63638
+ return evaluatedPivotFunctions;
63639
+ }
63640
+ getFirstPivotFunction(sheetId, formula) {
63641
+ return this.getPivotFunctions(sheetId, formula)[0];
63614
63642
  }
63615
63643
  /**
63616
63644
  * Returns the domain args of a pivot formula from a position.
@@ -63716,8 +63744,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63716
63744
  const unusedPivots = new Set(this.getters.getPivotIds());
63717
63745
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
63718
63746
  const position = this.getters.getCellPosition(cell.id);
63719
- const pivotId = this.getPivotIdFromPosition(position);
63720
- if (pivotId) {
63747
+ const pivotIds = this.getPivotIdsFromPosition(position);
63748
+ for (const pivotId of pivotIds) {
63721
63749
  unusedPivots.delete(pivotId);
63722
63750
  if (!unusedPivots.size) {
63723
63751
  this.unusedPivotsInFormulas = [];
@@ -63725,6 +63753,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
63725
63753
  }
63726
63754
  }
63727
63755
  }
63756
+ for (const pivotId of this.getters.getPivotIds()) {
63757
+ const pivot = this.getters.getPivot(pivotId);
63758
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
63759
+ const { sheetId } = measure.computedBy;
63760
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
63761
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
63762
+ for (const relatedPivotId of relatedPivotIds) {
63763
+ unusedPivots.delete(relatedPivotId);
63764
+ if (!unusedPivots.size) {
63765
+ this.unusedPivotsInFormulas = [];
63766
+ return [];
63767
+ }
63768
+ }
63769
+ }
63770
+ }
63728
63771
  this.unusedPivotsInFormulas = [...unusedPivots];
63729
63772
  return this.unusedPivotsInFormulas;
63730
63773
  }
@@ -81603,6 +81646,6 @@ const chartHelpers = {
81603
81646
  //#endregion
81604
81647
  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 };
81605
81648
 
81606
- __info__.version = "19.2.13";
81607
- __info__.date = "2026-05-15T07:07:37.391Z";
81608
- __info__.hash = "fece642";
81649
+ __info__.version = "19.2.14";
81650
+ __info__.date = "2026-05-27T05:57:14.898Z";
81651
+ __info__.hash = "96730cd";
@@ -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.2.13
6
- * @date 2026-05-15T07:07:37.391Z
7
- * @hash fece642
5
+ * @version 19.2.14
6
+ * @date 2026-05-27T05:57:14.898Z
7
+ * @hash 96730cd
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -6485,8 +6485,13 @@ stores.inject(MyMetaStore, storeInstance);
6485
6485
  changeType: "NONE",
6486
6486
  range
6487
6487
  };
6488
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
6489
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
6490
+ changeType: "RESIZE",
6491
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6492
+ };
6488
6493
  if (cmd.position === "after") {
6489
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
6494
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
6490
6495
  changeType: "RESIZE",
6491
6496
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6492
6497
  };
@@ -7430,6 +7435,10 @@ stores.inject(MyMetaStore, storeInstance);
7430
7435
  ROUNDDOWN: [{
7431
7436
  type: "NUMBER",
7432
7437
  value: 0
7438
+ }],
7439
+ IFERROR: [{
7440
+ type: "NUMBER",
7441
+ value: 0
7433
7442
  }]
7434
7443
  };
7435
7444
  /**
@@ -43307,7 +43316,7 @@ stores.inject(MyMetaStore, storeInstance);
43307
43316
  col,
43308
43317
  row
43309
43318
  };
43310
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
43319
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
43311
43320
  }
43312
43321
  return positions;
43313
43322
  }
@@ -45795,6 +45804,9 @@ stores.inject(MyMetaStore, storeInstance);
45795
45804
  function getFirstPivotFunction(compiledFormula, getters) {
45796
45805
  return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters)[0];
45797
45806
  }
45807
+ function getPivotFunctions(compiledFormula, getters) {
45808
+ return compiledFormula.getFunctionsFromTokens(PIVOT_FUNCTIONS, getters);
45809
+ }
45798
45810
  /**
45799
45811
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
45800
45812
  * present in the given formula.
@@ -63523,6 +63535,7 @@ stores.inject(MyMetaStore, storeInstance);
63523
63535
  "getFirstPivotFunction",
63524
63536
  "getPivotCellSortDirection",
63525
63537
  "getPivotIdFromPosition",
63538
+ "getPivotIdsFromPosition",
63526
63539
  "getPivotCellFromPosition",
63527
63540
  "generateNewCalculatedMeasureName",
63528
63541
  "isPivotUnused",
@@ -63582,37 +63595,52 @@ stores.inject(MyMetaStore, storeInstance);
63582
63595
  }
63583
63596
  }
63584
63597
  /**
63585
- * Get the id of the pivot at the given position. Returns undefined if there
63598
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63586
63599
  * is no pivot at this position
63587
63600
  */
63588
63601
  getPivotIdFromPosition(position) {
63602
+ return this.getPivotIdsFromPosition(position)[0];
63603
+ }
63604
+ /**
63605
+ * Get all of the ids of the pivot present in the formula at the given position.
63606
+ */
63607
+ getPivotIdsFromPosition(position) {
63589
63608
  const cell = this.getters.getCorrespondingFormulaCell(position);
63590
- if (cell && cell.isFormula) {
63591
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula);
63592
- if (pivotFunction) {
63593
- const pivotId = pivotFunction.args[0]?.toString();
63594
- return pivotId && this.getters.getPivotId(pivotId);
63595
- }
63596
- }
63609
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63610
+ return [];
63611
+ }
63612
+ getPivotIdsFromFormula(sheetId, formula) {
63613
+ return this.getPivotFunctions(sheetId, formula).map((pivotFunction) => {
63614
+ const pivotId = pivotFunction.args[0]?.toString();
63615
+ return pivotId && this.getters.getPivotId(pivotId);
63616
+ }).filter(isDefined);
63597
63617
  }
63598
63618
  isSpillPivotFormula(position) {
63599
63619
  const cell = this.getters.getCorrespondingFormulaCell(position);
63600
63620
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula)?.functionName === "PIVOT";
63601
63621
  return false;
63602
63622
  }
63603
- getFirstPivotFunction(sheetId, compiledFormula) {
63604
- const pivotFunction = getFirstPivotFunction(compiledFormula, this.getters);
63605
- if (!pivotFunction) return;
63606
- const { functionName, args } = pivotFunction;
63607
- return {
63608
- functionName,
63609
- args: args.map((argAst) => {
63623
+ getPivotFunctions(sheetId, formula) {
63624
+ const pivotFunctions = getPivotFunctions(formula, this.getters);
63625
+ if (!pivotFunctions.length) return [];
63626
+ const evaluatedPivotFunctions = [];
63627
+ for (const pivotFunction of pivotFunctions) {
63628
+ const { functionName, args } = pivotFunction;
63629
+ const evaluatedArgs = args.map((argAst) => {
63610
63630
  if (argAst.type === "EMPTY") return;
63611
63631
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63612
63632
  const argsString = astToFormula(argAst);
63613
63633
  return this.getters.evaluateFormula(sheetId, argsString);
63614
- })
63615
- };
63634
+ });
63635
+ evaluatedPivotFunctions.push({
63636
+ functionName,
63637
+ args: evaluatedArgs
63638
+ });
63639
+ }
63640
+ return evaluatedPivotFunctions;
63641
+ }
63642
+ getFirstPivotFunction(sheetId, formula) {
63643
+ return this.getPivotFunctions(sheetId, formula)[0];
63616
63644
  }
63617
63645
  /**
63618
63646
  * Returns the domain args of a pivot formula from a position.
@@ -63718,8 +63746,8 @@ stores.inject(MyMetaStore, storeInstance);
63718
63746
  const unusedPivots = new Set(this.getters.getPivotIds());
63719
63747
  for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) {
63720
63748
  const position = this.getters.getCellPosition(cell.id);
63721
- const pivotId = this.getPivotIdFromPosition(position);
63722
- if (pivotId) {
63749
+ const pivotIds = this.getPivotIdsFromPosition(position);
63750
+ for (const pivotId of pivotIds) {
63723
63751
  unusedPivots.delete(pivotId);
63724
63752
  if (!unusedPivots.size) {
63725
63753
  this.unusedPivotsInFormulas = [];
@@ -63727,6 +63755,21 @@ stores.inject(MyMetaStore, storeInstance);
63727
63755
  }
63728
63756
  }
63729
63757
  }
63758
+ for (const pivotId of this.getters.getPivotIds()) {
63759
+ const pivot = this.getters.getPivot(pivotId);
63760
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
63761
+ const { sheetId } = measure.computedBy;
63762
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
63763
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
63764
+ for (const relatedPivotId of relatedPivotIds) {
63765
+ unusedPivots.delete(relatedPivotId);
63766
+ if (!unusedPivots.size) {
63767
+ this.unusedPivotsInFormulas = [];
63768
+ return [];
63769
+ }
63770
+ }
63771
+ }
63772
+ }
63730
63773
  this.unusedPivotsInFormulas = [...unusedPivots];
63731
63774
  return this.unusedPivotsInFormulas;
63732
63775
  }
@@ -81663,8 +81706,8 @@ exports.stores = stores;
81663
81706
  exports.tokenColors = tokenColors;
81664
81707
  exports.tokenize = tokenize;
81665
81708
 
81666
- __info__.version = "19.2.13";
81667
- __info__.date = "2026-05-15T07:07:37.391Z";
81668
- __info__.hash = "fece642";
81709
+ __info__.version = "19.2.14";
81710
+ __info__.date = "2026-05-27T05:57:14.898Z";
81711
+ __info__.hash = "96730cd";
81669
81712
 
81670
81713
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);