@odoo/o-spreadsheet 18.3.48 → 18.3.49

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 18.3.48
6
- * @date 2026-05-15T07:05:43.612Z
7
- * @hash 76bed65
5
+ * @version 18.3.49
6
+ * @date 2026-05-27T05:57:05.809Z
7
+ * @hash fc34456
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -5518,8 +5518,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5518
5518
  changeType: "NONE",
5519
5519
  range
5520
5520
  };
5521
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5522
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5523
+ changeType: "RESIZE",
5524
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5525
+ };
5521
5526
  if (cmd.position === "after") {
5522
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5527
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5523
5528
  changeType: "RESIZE",
5524
5529
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5525
5530
  };
@@ -19911,6 +19916,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
19911
19916
  function getFirstPivotFunction(tokens) {
19912
19917
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19913
19918
  }
19919
+ function getPivotFunctions(tokens) {
19920
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19921
+ }
19914
19922
  /**
19915
19923
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19916
19924
  * present in the given formula.
@@ -26172,6 +26180,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
26172
26180
  ROUNDDOWN: [{
26173
26181
  type: "NUMBER",
26174
26182
  value: 0
26183
+ }],
26184
+ IFERROR: [{
26185
+ type: "NUMBER",
26186
+ value: 0
26175
26187
  }]
26176
26188
  };
26177
26189
  /**
@@ -34691,7 +34703,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
34691
34703
  col,
34692
34704
  row
34693
34705
  };
34694
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
34706
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
34695
34707
  }
34696
34708
  return positions;
34697
34709
  }
@@ -59129,6 +59141,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59129
59141
  "getPivot",
59130
59142
  "getFirstPivotFunction",
59131
59143
  "getPivotIdFromPosition",
59144
+ "getPivotIdsFromPosition",
59132
59145
  "getPivotCellFromPosition",
59133
59146
  "generateNewCalculatedMeasureName",
59134
59147
  "isPivotUnused",
@@ -59186,37 +59199,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59186
59199
  }
59187
59200
  }
59188
59201
  /**
59189
- * Get the id of the pivot at the given position. Returns undefined if there
59202
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
59190
59203
  * is no pivot at this position
59191
59204
  */
59192
59205
  getPivotIdFromPosition(position) {
59206
+ return this.getPivotIdsFromPosition(position)[0];
59207
+ }
59208
+ /**
59209
+ * Get all of the ids of the pivot present in the formula at the given position.
59210
+ */
59211
+ getPivotIdsFromPosition(position) {
59193
59212
  const cell = this.getters.getCorrespondingFormulaCell(position);
59194
- if (cell && cell.isFormula) {
59195
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
59196
- if (pivotFunction) {
59197
- const pivotId = pivotFunction.args[0]?.toString();
59198
- return pivotId && this.getters.getPivotId(pivotId);
59199
- }
59200
- }
59213
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
59214
+ return [];
59215
+ }
59216
+ getPivotIdsFromFormula(sheetId, formula) {
59217
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
59218
+ const pivotId = pivotFunction.args[0]?.toString();
59219
+ return pivotId && this.getters.getPivotId(pivotId);
59220
+ }).filter(isDefined);
59201
59221
  }
59202
59222
  isSpillPivotFormula(position) {
59203
59223
  const cell = this.getters.getCorrespondingFormulaCell(position);
59204
59224
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59205
59225
  return false;
59206
59226
  }
59207
- getFirstPivotFunction(sheetId, tokens) {
59208
- const pivotFunction = getFirstPivotFunction(tokens);
59209
- if (!pivotFunction) return;
59210
- const { functionName, args } = pivotFunction;
59211
- return {
59212
- functionName,
59213
- args: args.map((argAst) => {
59227
+ getPivotFunctions(sheetId, tokens) {
59228
+ const pivotFunctions = getPivotFunctions(tokens);
59229
+ if (!pivotFunctions.length) return [];
59230
+ const evaluatedPivotFunctions = [];
59231
+ for (const pivotFunction of pivotFunctions) {
59232
+ const { functionName, args } = pivotFunction;
59233
+ const evaluatedArgs = args.map((argAst) => {
59214
59234
  if (argAst.type === "EMPTY") return;
59215
59235
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59216
59236
  const argsString = astToFormula(argAst);
59217
59237
  return this.getters.evaluateFormula(sheetId, argsString);
59218
- })
59219
- };
59238
+ });
59239
+ evaluatedPivotFunctions.push({
59240
+ functionName,
59241
+ args: evaluatedArgs
59242
+ });
59243
+ }
59244
+ return evaluatedPivotFunctions;
59245
+ }
59246
+ getFirstPivotFunction(sheetId, tokens) {
59247
+ return this.getPivotFunctions(sheetId, tokens)[0];
59220
59248
  }
59221
59249
  /**
59222
59250
  * Returns the domain args of a pivot formula from a position.
@@ -59310,8 +59338,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59310
59338
  const unusedPivots = new Set(this.getters.getPivotIds());
59311
59339
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59312
59340
  const position = this.getters.getCellPosition(cellId);
59313
- const pivotId = this.getPivotIdFromPosition(position);
59314
- if (pivotId) {
59341
+ const pivotIds = this.getPivotIdsFromPosition(position);
59342
+ for (const pivotId of pivotIds) {
59315
59343
  unusedPivots.delete(pivotId);
59316
59344
  if (!unusedPivots.size) {
59317
59345
  this.unusedPivots = [];
@@ -59319,6 +59347,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59319
59347
  }
59320
59348
  }
59321
59349
  }
59350
+ for (const pivotId of this.getters.getPivotIds()) {
59351
+ const pivot = this.getters.getPivot(pivotId);
59352
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
59353
+ const { sheetId } = measure.computedBy;
59354
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
59355
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
59356
+ for (const relatedPivotId of relatedPivotIds) {
59357
+ unusedPivots.delete(relatedPivotId);
59358
+ if (!unusedPivots.size) {
59359
+ this.unusedPivots = [];
59360
+ return [];
59361
+ }
59362
+ }
59363
+ }
59364
+ }
59322
59365
  this.unusedPivots = [...unusedPivots];
59323
59366
  return this.unusedPivots;
59324
59367
  }
@@ -72409,6 +72452,6 @@ exports.stores = stores;
72409
72452
  exports.tokenColors = tokenColors;
72410
72453
  exports.tokenize = tokenize;
72411
72454
 
72412
- __info__.version = "18.3.48";
72413
- __info__.date = "2026-05-15T07:05:43.612Z";
72414
- __info__.hash = "76bed65";
72455
+ __info__.version = "18.3.49";
72456
+ __info__.date = "2026-05-27T05:57:05.809Z";
72457
+ __info__.hash = "fc34456";
@@ -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 18.3.48
6
- * @date 2026-05-15T07:05:45.324Z
7
- * @hash 76bed65
5
+ * @version 18.3.49
6
+ * @date 2026-05-27T05:57:07.478Z
7
+ * @hash fc34456
8
8
  */
9
9
  /* Originates from src/components/top_bar/top_bar.scss */
10
10
  @media (max-width: 900px) {
@@ -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 18.3.48
6
- * @date 2026-05-15T07:05:43.612Z
7
- * @hash 76bed65
5
+ * @version 18.3.49
6
+ * @date 2026-05-27T05:57:05.809Z
7
+ * @hash fc34456
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";
@@ -5517,8 +5517,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5517
5517
  changeType: "NONE",
5518
5518
  range
5519
5519
  };
5520
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5521
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5522
+ changeType: "RESIZE",
5523
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5524
+ };
5520
5525
  if (cmd.position === "after") {
5521
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5526
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5522
5527
  changeType: "RESIZE",
5523
5528
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5524
5529
  };
@@ -19910,6 +19915,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
19910
19915
  function getFirstPivotFunction(tokens) {
19911
19916
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19912
19917
  }
19918
+ function getPivotFunctions(tokens) {
19919
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19920
+ }
19913
19921
  /**
19914
19922
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19915
19923
  * present in the given formula.
@@ -26171,6 +26179,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
26171
26179
  ROUNDDOWN: [{
26172
26180
  type: "NUMBER",
26173
26181
  value: 0
26182
+ }],
26183
+ IFERROR: [{
26184
+ type: "NUMBER",
26185
+ value: 0
26174
26186
  }]
26175
26187
  };
26176
26188
  /**
@@ -34690,7 +34702,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
34690
34702
  col,
34691
34703
  row
34692
34704
  };
34693
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
34705
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
34694
34706
  }
34695
34707
  return positions;
34696
34708
  }
@@ -58944,6 +58956,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58944
58956
  "getPivot",
58945
58957
  "getFirstPivotFunction",
58946
58958
  "getPivotIdFromPosition",
58959
+ "getPivotIdsFromPosition",
58947
58960
  "getPivotCellFromPosition",
58948
58961
  "generateNewCalculatedMeasureName",
58949
58962
  "isPivotUnused",
@@ -59001,37 +59014,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59001
59014
  }
59002
59015
  }
59003
59016
  /**
59004
- * Get the id of the pivot at the given position. Returns undefined if there
59017
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
59005
59018
  * is no pivot at this position
59006
59019
  */
59007
59020
  getPivotIdFromPosition(position) {
59021
+ return this.getPivotIdsFromPosition(position)[0];
59022
+ }
59023
+ /**
59024
+ * Get all of the ids of the pivot present in the formula at the given position.
59025
+ */
59026
+ getPivotIdsFromPosition(position) {
59008
59027
  const cell = this.getters.getCorrespondingFormulaCell(position);
59009
- if (cell && cell.isFormula) {
59010
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
59011
- if (pivotFunction) {
59012
- const pivotId = pivotFunction.args[0]?.toString();
59013
- return pivotId && this.getters.getPivotId(pivotId);
59014
- }
59015
- }
59028
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
59029
+ return [];
59030
+ }
59031
+ getPivotIdsFromFormula(sheetId, formula) {
59032
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
59033
+ const pivotId = pivotFunction.args[0]?.toString();
59034
+ return pivotId && this.getters.getPivotId(pivotId);
59035
+ }).filter(isDefined);
59016
59036
  }
59017
59037
  isSpillPivotFormula(position) {
59018
59038
  const cell = this.getters.getCorrespondingFormulaCell(position);
59019
59039
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59020
59040
  return false;
59021
59041
  }
59022
- getFirstPivotFunction(sheetId, tokens) {
59023
- const pivotFunction = getFirstPivotFunction(tokens);
59024
- if (!pivotFunction) return;
59025
- const { functionName, args } = pivotFunction;
59026
- return {
59027
- functionName,
59028
- args: args.map((argAst) => {
59042
+ getPivotFunctions(sheetId, tokens) {
59043
+ const pivotFunctions = getPivotFunctions(tokens);
59044
+ if (!pivotFunctions.length) return [];
59045
+ const evaluatedPivotFunctions = [];
59046
+ for (const pivotFunction of pivotFunctions) {
59047
+ const { functionName, args } = pivotFunction;
59048
+ const evaluatedArgs = args.map((argAst) => {
59029
59049
  if (argAst.type === "EMPTY") return;
59030
59050
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59031
59051
  const argsString = astToFormula(argAst);
59032
59052
  return this.getters.evaluateFormula(sheetId, argsString);
59033
- })
59034
- };
59053
+ });
59054
+ evaluatedPivotFunctions.push({
59055
+ functionName,
59056
+ args: evaluatedArgs
59057
+ });
59058
+ }
59059
+ return evaluatedPivotFunctions;
59060
+ }
59061
+ getFirstPivotFunction(sheetId, tokens) {
59062
+ return this.getPivotFunctions(sheetId, tokens)[0];
59035
59063
  }
59036
59064
  /**
59037
59065
  * Returns the domain args of a pivot formula from a position.
@@ -59125,8 +59153,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59125
59153
  const unusedPivots = new Set(this.getters.getPivotIds());
59126
59154
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59127
59155
  const position = this.getters.getCellPosition(cellId);
59128
- const pivotId = this.getPivotIdFromPosition(position);
59129
- if (pivotId) {
59156
+ const pivotIds = this.getPivotIdsFromPosition(position);
59157
+ for (const pivotId of pivotIds) {
59130
59158
  unusedPivots.delete(pivotId);
59131
59159
  if (!unusedPivots.size) {
59132
59160
  this.unusedPivots = [];
@@ -59134,6 +59162,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59134
59162
  }
59135
59163
  }
59136
59164
  }
59165
+ for (const pivotId of this.getters.getPivotIds()) {
59166
+ const pivot = this.getters.getPivot(pivotId);
59167
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
59168
+ const { sheetId } = measure.computedBy;
59169
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
59170
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
59171
+ for (const relatedPivotId of relatedPivotIds) {
59172
+ unusedPivots.delete(relatedPivotId);
59173
+ if (!unusedPivots.size) {
59174
+ this.unusedPivots = [];
59175
+ return [];
59176
+ }
59177
+ }
59178
+ }
59179
+ }
59137
59180
  this.unusedPivots = [...unusedPivots];
59138
59181
  return this.unusedPivots;
59139
59182
  }
@@ -72177,6 +72220,6 @@ const chartHelpers = {
72177
72220
  //#endregion
72178
72221
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
72179
72222
 
72180
- __info__.version = "18.3.48";
72181
- __info__.date = "2026-05-15T07:05:43.612Z";
72182
- __info__.hash = "76bed65";
72223
+ __info__.version = "18.3.49";
72224
+ __info__.date = "2026-05-27T05:57:05.809Z";
72225
+ __info__.hash = "fc34456";
@@ -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 18.3.48
6
- * @date 2026-05-15T07:05:43.612Z
7
- * @hash 76bed65
5
+ * @version 18.3.49
6
+ * @date 2026-05-27T05:57:05.809Z
7
+ * @hash fc34456
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -5519,8 +5519,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5519
5519
  changeType: "NONE",
5520
5520
  range
5521
5521
  };
5522
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5523
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5524
+ changeType: "RESIZE",
5525
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5526
+ };
5522
5527
  if (cmd.position === "after") {
5523
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5528
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5524
5529
  changeType: "RESIZE",
5525
5530
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5526
5531
  };
@@ -19912,6 +19917,9 @@ stores.inject(MyMetaStore, storeInstance);
19912
19917
  function getFirstPivotFunction(tokens) {
19913
19918
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19914
19919
  }
19920
+ function getPivotFunctions(tokens) {
19921
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19922
+ }
19915
19923
  /**
19916
19924
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19917
19925
  * present in the given formula.
@@ -26173,6 +26181,10 @@ stores.inject(MyMetaStore, storeInstance);
26173
26181
  ROUNDDOWN: [{
26174
26182
  type: "NUMBER",
26175
26183
  value: 0
26184
+ }],
26185
+ IFERROR: [{
26186
+ type: "NUMBER",
26187
+ value: 0
26176
26188
  }]
26177
26189
  };
26178
26190
  /**
@@ -34692,7 +34704,7 @@ stores.inject(MyMetaStore, storeInstance);
34692
34704
  col,
34693
34705
  row
34694
34706
  };
34695
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
34707
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
34696
34708
  }
34697
34709
  return positions;
34698
34710
  }
@@ -58946,6 +58958,7 @@ stores.inject(MyMetaStore, storeInstance);
58946
58958
  "getPivot",
58947
58959
  "getFirstPivotFunction",
58948
58960
  "getPivotIdFromPosition",
58961
+ "getPivotIdsFromPosition",
58949
58962
  "getPivotCellFromPosition",
58950
58963
  "generateNewCalculatedMeasureName",
58951
58964
  "isPivotUnused",
@@ -59003,37 +59016,52 @@ stores.inject(MyMetaStore, storeInstance);
59003
59016
  }
59004
59017
  }
59005
59018
  /**
59006
- * Get the id of the pivot at the given position. Returns undefined if there
59019
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
59007
59020
  * is no pivot at this position
59008
59021
  */
59009
59022
  getPivotIdFromPosition(position) {
59023
+ return this.getPivotIdsFromPosition(position)[0];
59024
+ }
59025
+ /**
59026
+ * Get all of the ids of the pivot present in the formula at the given position.
59027
+ */
59028
+ getPivotIdsFromPosition(position) {
59010
59029
  const cell = this.getters.getCorrespondingFormulaCell(position);
59011
- if (cell && cell.isFormula) {
59012
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
59013
- if (pivotFunction) {
59014
- const pivotId = pivotFunction.args[0]?.toString();
59015
- return pivotId && this.getters.getPivotId(pivotId);
59016
- }
59017
- }
59030
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
59031
+ return [];
59032
+ }
59033
+ getPivotIdsFromFormula(sheetId, formula) {
59034
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
59035
+ const pivotId = pivotFunction.args[0]?.toString();
59036
+ return pivotId && this.getters.getPivotId(pivotId);
59037
+ }).filter(isDefined);
59018
59038
  }
59019
59039
  isSpillPivotFormula(position) {
59020
59040
  const cell = this.getters.getCorrespondingFormulaCell(position);
59021
59041
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59022
59042
  return false;
59023
59043
  }
59024
- getFirstPivotFunction(sheetId, tokens) {
59025
- const pivotFunction = getFirstPivotFunction(tokens);
59026
- if (!pivotFunction) return;
59027
- const { functionName, args } = pivotFunction;
59028
- return {
59029
- functionName,
59030
- args: args.map((argAst) => {
59044
+ getPivotFunctions(sheetId, tokens) {
59045
+ const pivotFunctions = getPivotFunctions(tokens);
59046
+ if (!pivotFunctions.length) return [];
59047
+ const evaluatedPivotFunctions = [];
59048
+ for (const pivotFunction of pivotFunctions) {
59049
+ const { functionName, args } = pivotFunction;
59050
+ const evaluatedArgs = args.map((argAst) => {
59031
59051
  if (argAst.type === "EMPTY") return;
59032
59052
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59033
59053
  const argsString = astToFormula(argAst);
59034
59054
  return this.getters.evaluateFormula(sheetId, argsString);
59035
- })
59036
- };
59055
+ });
59056
+ evaluatedPivotFunctions.push({
59057
+ functionName,
59058
+ args: evaluatedArgs
59059
+ });
59060
+ }
59061
+ return evaluatedPivotFunctions;
59062
+ }
59063
+ getFirstPivotFunction(sheetId, tokens) {
59064
+ return this.getPivotFunctions(sheetId, tokens)[0];
59037
59065
  }
59038
59066
  /**
59039
59067
  * Returns the domain args of a pivot formula from a position.
@@ -59127,8 +59155,8 @@ stores.inject(MyMetaStore, storeInstance);
59127
59155
  const unusedPivots = new Set(this.getters.getPivotIds());
59128
59156
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59129
59157
  const position = this.getters.getCellPosition(cellId);
59130
- const pivotId = this.getPivotIdFromPosition(position);
59131
- if (pivotId) {
59158
+ const pivotIds = this.getPivotIdsFromPosition(position);
59159
+ for (const pivotId of pivotIds) {
59132
59160
  unusedPivots.delete(pivotId);
59133
59161
  if (!unusedPivots.size) {
59134
59162
  this.unusedPivots = [];
@@ -59136,6 +59164,21 @@ stores.inject(MyMetaStore, storeInstance);
59136
59164
  }
59137
59165
  }
59138
59166
  }
59167
+ for (const pivotId of this.getters.getPivotIds()) {
59168
+ const pivot = this.getters.getPivot(pivotId);
59169
+ for (const measure of pivot.definition.measures) if (measure.computedBy) {
59170
+ const { sheetId } = measure.computedBy;
59171
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
59172
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
59173
+ for (const relatedPivotId of relatedPivotIds) {
59174
+ unusedPivots.delete(relatedPivotId);
59175
+ if (!unusedPivots.size) {
59176
+ this.unusedPivots = [];
59177
+ return [];
59178
+ }
59179
+ }
59180
+ }
59181
+ }
59139
59182
  this.unusedPivots = [...unusedPivots];
59140
59183
  return this.unusedPivots;
59141
59184
  }
@@ -72226,8 +72269,8 @@ exports.stores = stores;
72226
72269
  exports.tokenColors = tokenColors;
72227
72270
  exports.tokenize = tokenize;
72228
72271
 
72229
- __info__.version = "18.3.48";
72230
- __info__.date = "2026-05-15T07:05:43.612Z";
72231
- __info__.hash = "76bed65";
72272
+ __info__.version = "18.3.49";
72273
+ __info__.date = "2026-05-27T05:57:05.809Z";
72274
+ __info__.hash = "fc34456";
72232
72275
 
72233
72276
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);