@odoo/o-spreadsheet 18.3.48 → 18.3.50

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.50
6
+ * @date 2026-06-06T06:20:54.573Z
7
+ * @hash d8ca64d
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -4075,6 +4075,7 @@ function detectLink(value) {
4075
4075
  //#endregion
4076
4076
  //#region src/helpers/format/format_tokenizer.ts
4077
4077
  function tokenizeFormat(str) {
4078
+ str = str.replace(/\s/g, " ");
4078
4079
  const chars = new TokenizingChars(str);
4079
4080
  const result = [];
4080
4081
  let currentFormatPart = [];
@@ -5518,8 +5519,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5518
5519
  changeType: "NONE",
5519
5520
  range
5520
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
+ };
5521
5527
  if (cmd.position === "after") {
5522
- 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 {
5523
5529
  changeType: "RESIZE",
5524
5530
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5525
5531
  };
@@ -19911,6 +19917,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
19911
19917
  function getFirstPivotFunction(tokens) {
19912
19918
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19913
19919
  }
19920
+ function getPivotFunctions(tokens) {
19921
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19922
+ }
19914
19923
  /**
19915
19924
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19916
19925
  * present in the given formula.
@@ -26172,6 +26181,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
26172
26181
  ROUNDDOWN: [{
26173
26182
  type: "NUMBER",
26174
26183
  value: 0
26184
+ }],
26185
+ IFERROR: [{
26186
+ type: "NUMBER",
26187
+ value: 0
26175
26188
  }]
26176
26189
  };
26177
26190
  /**
@@ -32839,11 +32852,10 @@ const INSERT_TABLE = (env) => {
32839
32852
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
32840
32853
  };
32841
32854
  const DELETE_SELECTED_TABLE = (env) => {
32842
- const position = env.model.getters.getActivePosition();
32843
- const table = env.model.getters.getTable(position);
32855
+ const table = env.model.getters.getFirstTableInSelection();
32844
32856
  if (!table) return;
32845
32857
  env.model.dispatch("REMOVE_TABLE", {
32846
- sheetId: position.sheetId,
32858
+ sheetId: env.model.getters.getActiveSheetId(),
32847
32859
  target: [table.range.zone]
32848
32860
  });
32849
32861
  };
@@ -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",
@@ -59153,9 +59166,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59153
59166
  this.refreshPivot(cmd.id);
59154
59167
  break;
59155
59168
  case "ADD_PIVOT":
59169
+ this.unusedPivots?.push(cmd.pivotId);
59156
59170
  this.setupPivot(cmd.pivotId);
59157
59171
  break;
59158
59172
  case "DUPLICATE_PIVOT":
59173
+ this.unusedPivots?.push(cmd.newPivotId);
59159
59174
  this.setupPivot(cmd.newPivotId);
59160
59175
  break;
59161
59176
  case "UPDATE_PIVOT":
@@ -59186,37 +59201,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59186
59201
  }
59187
59202
  }
59188
59203
  /**
59189
- * Get the id of the pivot at the given position. Returns undefined if there
59204
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
59190
59205
  * is no pivot at this position
59191
59206
  */
59192
59207
  getPivotIdFromPosition(position) {
59208
+ return this.getPivotIdsFromPosition(position)[0];
59209
+ }
59210
+ /**
59211
+ * Get all of the ids of the pivot present in the formula at the given position.
59212
+ */
59213
+ getPivotIdsFromPosition(position) {
59193
59214
  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
- }
59215
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
59216
+ return [];
59217
+ }
59218
+ getPivotIdsFromFormula(sheetId, formula) {
59219
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
59220
+ const pivotId = pivotFunction.args[0]?.toString();
59221
+ return pivotId && this.getters.getPivotId(pivotId);
59222
+ }).filter(isDefined);
59201
59223
  }
59202
59224
  isSpillPivotFormula(position) {
59203
59225
  const cell = this.getters.getCorrespondingFormulaCell(position);
59204
59226
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59205
59227
  return false;
59206
59228
  }
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) => {
59229
+ getPivotFunctions(sheetId, tokens) {
59230
+ const pivotFunctions = getPivotFunctions(tokens);
59231
+ if (!pivotFunctions.length) return [];
59232
+ const evaluatedPivotFunctions = [];
59233
+ for (const pivotFunction of pivotFunctions) {
59234
+ const { functionName, args } = pivotFunction;
59235
+ const evaluatedArgs = args.map((argAst) => {
59214
59236
  if (argAst.type === "EMPTY") return;
59215
59237
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59216
59238
  const argsString = astToFormula(argAst);
59217
59239
  return this.getters.evaluateFormula(sheetId, argsString);
59218
- })
59219
- };
59240
+ });
59241
+ evaluatedPivotFunctions.push({
59242
+ functionName,
59243
+ args: evaluatedArgs
59244
+ });
59245
+ }
59246
+ return evaluatedPivotFunctions;
59247
+ }
59248
+ getFirstPivotFunction(sheetId, tokens) {
59249
+ return this.getPivotFunctions(sheetId, tokens)[0];
59220
59250
  }
59221
59251
  /**
59222
59252
  * Returns the domain args of a pivot formula from a position.
@@ -59310,8 +59340,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59310
59340
  const unusedPivots = new Set(this.getters.getPivotIds());
59311
59341
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59312
59342
  const position = this.getters.getCellPosition(cellId);
59313
- const pivotId = this.getPivotIdFromPosition(position);
59314
- if (pivotId) {
59343
+ const pivotIds = this.getPivotIdsFromPosition(position);
59344
+ for (const pivotId of pivotIds) {
59315
59345
  unusedPivots.delete(pivotId);
59316
59346
  if (!unusedPivots.size) {
59317
59347
  this.unusedPivots = [];
@@ -59319,6 +59349,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59319
59349
  }
59320
59350
  }
59321
59351
  }
59352
+ for (const pivotId of this.getters.getPivotIds()) {
59353
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
59354
+ for (const measure of pivot.measures) if (measure.computedBy) {
59355
+ const { sheetId } = measure.computedBy;
59356
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
59357
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
59358
+ for (const relatedPivotId of relatedPivotIds) {
59359
+ unusedPivots.delete(relatedPivotId);
59360
+ if (!unusedPivots.size) {
59361
+ this.unusedPivots = [];
59362
+ return [];
59363
+ }
59364
+ }
59365
+ }
59366
+ }
59322
59367
  this.unusedPivots = [...unusedPivots];
59323
59368
  return this.unusedPivots;
59324
59369
  }
@@ -72409,6 +72454,6 @@ exports.stores = stores;
72409
72454
  exports.tokenColors = tokenColors;
72410
72455
  exports.tokenize = tokenize;
72411
72456
 
72412
- __info__.version = "18.3.48";
72413
- __info__.date = "2026-05-15T07:05:43.612Z";
72414
- __info__.hash = "76bed65";
72457
+ __info__.version = "18.3.50";
72458
+ __info__.date = "2026-06-06T06:20:54.573Z";
72459
+ __info__.hash = "d8ca64d";
@@ -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.50
6
+ * @date 2026-06-06T06:20:55.876Z
7
+ * @hash d8ca64d
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.50
6
+ * @date 2026-06-06T06:20:54.573Z
7
+ * @hash d8ca64d
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";
@@ -4074,6 +4074,7 @@ function detectLink(value) {
4074
4074
  //#endregion
4075
4075
  //#region src/helpers/format/format_tokenizer.ts
4076
4076
  function tokenizeFormat(str) {
4077
+ str = str.replace(/\s/g, " ");
4077
4078
  const chars = new TokenizingChars(str);
4078
4079
  const result = [];
4079
4080
  let currentFormatPart = [];
@@ -5517,8 +5518,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5517
5518
  changeType: "NONE",
5518
5519
  range
5519
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
+ };
5520
5526
  if (cmd.position === "after") {
5521
- 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 {
5522
5528
  changeType: "RESIZE",
5523
5529
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5524
5530
  };
@@ -19910,6 +19916,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
19910
19916
  function getFirstPivotFunction(tokens) {
19911
19917
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19912
19918
  }
19919
+ function getPivotFunctions(tokens) {
19920
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19921
+ }
19913
19922
  /**
19914
19923
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19915
19924
  * present in the given formula.
@@ -26171,6 +26180,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
26171
26180
  ROUNDDOWN: [{
26172
26181
  type: "NUMBER",
26173
26182
  value: 0
26183
+ }],
26184
+ IFERROR: [{
26185
+ type: "NUMBER",
26186
+ value: 0
26174
26187
  }]
26175
26188
  };
26176
26189
  /**
@@ -32838,11 +32851,10 @@ const INSERT_TABLE = (env) => {
32838
32851
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
32839
32852
  };
32840
32853
  const DELETE_SELECTED_TABLE = (env) => {
32841
- const position = env.model.getters.getActivePosition();
32842
- const table = env.model.getters.getTable(position);
32854
+ const table = env.model.getters.getFirstTableInSelection();
32843
32855
  if (!table) return;
32844
32856
  env.model.dispatch("REMOVE_TABLE", {
32845
- sheetId: position.sheetId,
32857
+ sheetId: env.model.getters.getActiveSheetId(),
32846
32858
  target: [table.range.zone]
32847
32859
  });
32848
32860
  };
@@ -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",
@@ -58968,9 +58981,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
58968
58981
  this.refreshPivot(cmd.id);
58969
58982
  break;
58970
58983
  case "ADD_PIVOT":
58984
+ this.unusedPivots?.push(cmd.pivotId);
58971
58985
  this.setupPivot(cmd.pivotId);
58972
58986
  break;
58973
58987
  case "DUPLICATE_PIVOT":
58988
+ this.unusedPivots?.push(cmd.newPivotId);
58974
58989
  this.setupPivot(cmd.newPivotId);
58975
58990
  break;
58976
58991
  case "UPDATE_PIVOT":
@@ -59001,37 +59016,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59001
59016
  }
59002
59017
  }
59003
59018
  /**
59004
- * 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
59005
59020
  * is no pivot at this position
59006
59021
  */
59007
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) {
59008
59029
  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
- }
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);
59016
59038
  }
59017
59039
  isSpillPivotFormula(position) {
59018
59040
  const cell = this.getters.getCorrespondingFormulaCell(position);
59019
59041
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59020
59042
  return false;
59021
59043
  }
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) => {
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) => {
59029
59051
  if (argAst.type === "EMPTY") return;
59030
59052
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59031
59053
  const argsString = astToFormula(argAst);
59032
59054
  return this.getters.evaluateFormula(sheetId, argsString);
59033
- })
59034
- };
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];
59035
59065
  }
59036
59066
  /**
59037
59067
  * Returns the domain args of a pivot formula from a position.
@@ -59125,8 +59155,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59125
59155
  const unusedPivots = new Set(this.getters.getPivotIds());
59126
59156
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59127
59157
  const position = this.getters.getCellPosition(cellId);
59128
- const pivotId = this.getPivotIdFromPosition(position);
59129
- if (pivotId) {
59158
+ const pivotIds = this.getPivotIdsFromPosition(position);
59159
+ for (const pivotId of pivotIds) {
59130
59160
  unusedPivots.delete(pivotId);
59131
59161
  if (!unusedPivots.size) {
59132
59162
  this.unusedPivots = [];
@@ -59134,6 +59164,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
59134
59164
  }
59135
59165
  }
59136
59166
  }
59167
+ for (const pivotId of this.getters.getPivotIds()) {
59168
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
59169
+ for (const measure of pivot.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
+ }
59137
59182
  this.unusedPivots = [...unusedPivots];
59138
59183
  return this.unusedPivots;
59139
59184
  }
@@ -72177,6 +72222,6 @@ const chartHelpers = {
72177
72222
  //#endregion
72178
72223
  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
72224
 
72180
- __info__.version = "18.3.48";
72181
- __info__.date = "2026-05-15T07:05:43.612Z";
72182
- __info__.hash = "76bed65";
72225
+ __info__.version = "18.3.50";
72226
+ __info__.date = "2026-06-06T06:20:54.573Z";
72227
+ __info__.hash = "d8ca64d";
@@ -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.50
6
+ * @date 2026-06-06T06:20:54.573Z
7
+ * @hash d8ca64d
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -4076,6 +4076,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4076
4076
  //#endregion
4077
4077
  //#region src/helpers/format/format_tokenizer.ts
4078
4078
  function tokenizeFormat(str) {
4079
+ str = str.replace(/\s/g, " ");
4079
4080
  const chars = new TokenizingChars(str);
4080
4081
  const result = [];
4081
4082
  let currentFormatPart = [];
@@ -5519,8 +5520,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5519
5520
  changeType: "NONE",
5520
5521
  range
5521
5522
  };
5523
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5524
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5525
+ changeType: "RESIZE",
5526
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5527
+ };
5522
5528
  if (cmd.position === "after") {
5523
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5529
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5524
5530
  changeType: "RESIZE",
5525
5531
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5526
5532
  };
@@ -19912,6 +19918,9 @@ stores.inject(MyMetaStore, storeInstance);
19912
19918
  function getFirstPivotFunction(tokens) {
19913
19919
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
19914
19920
  }
19921
+ function getPivotFunctions(tokens) {
19922
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
19923
+ }
19915
19924
  /**
19916
19925
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
19917
19926
  * present in the given formula.
@@ -26173,6 +26182,10 @@ stores.inject(MyMetaStore, storeInstance);
26173
26182
  ROUNDDOWN: [{
26174
26183
  type: "NUMBER",
26175
26184
  value: 0
26185
+ }],
26186
+ IFERROR: [{
26187
+ type: "NUMBER",
26188
+ value: 0
26176
26189
  }]
26177
26190
  };
26178
26191
  /**
@@ -32840,11 +32853,10 @@ stores.inject(MyMetaStore, storeInstance);
32840
32853
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
32841
32854
  };
32842
32855
  const DELETE_SELECTED_TABLE = (env) => {
32843
- const position = env.model.getters.getActivePosition();
32844
- const table = env.model.getters.getTable(position);
32856
+ const table = env.model.getters.getFirstTableInSelection();
32845
32857
  if (!table) return;
32846
32858
  env.model.dispatch("REMOVE_TABLE", {
32847
- sheetId: position.sheetId,
32859
+ sheetId: env.model.getters.getActiveSheetId(),
32848
32860
  target: [table.range.zone]
32849
32861
  });
32850
32862
  };
@@ -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",
@@ -58970,9 +58983,11 @@ stores.inject(MyMetaStore, storeInstance);
58970
58983
  this.refreshPivot(cmd.id);
58971
58984
  break;
58972
58985
  case "ADD_PIVOT":
58986
+ this.unusedPivots?.push(cmd.pivotId);
58973
58987
  this.setupPivot(cmd.pivotId);
58974
58988
  break;
58975
58989
  case "DUPLICATE_PIVOT":
58990
+ this.unusedPivots?.push(cmd.newPivotId);
58976
58991
  this.setupPivot(cmd.newPivotId);
58977
58992
  break;
58978
58993
  case "UPDATE_PIVOT":
@@ -59003,37 +59018,52 @@ stores.inject(MyMetaStore, storeInstance);
59003
59018
  }
59004
59019
  }
59005
59020
  /**
59006
- * Get the id of the pivot at the given position. Returns undefined if there
59021
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
59007
59022
  * is no pivot at this position
59008
59023
  */
59009
59024
  getPivotIdFromPosition(position) {
59025
+ return this.getPivotIdsFromPosition(position)[0];
59026
+ }
59027
+ /**
59028
+ * Get all of the ids of the pivot present in the formula at the given position.
59029
+ */
59030
+ getPivotIdsFromPosition(position) {
59010
59031
  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
- }
59032
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
59033
+ return [];
59034
+ }
59035
+ getPivotIdsFromFormula(sheetId, formula) {
59036
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
59037
+ const pivotId = pivotFunction.args[0]?.toString();
59038
+ return pivotId && this.getters.getPivotId(pivotId);
59039
+ }).filter(isDefined);
59018
59040
  }
59019
59041
  isSpillPivotFormula(position) {
59020
59042
  const cell = this.getters.getCorrespondingFormulaCell(position);
59021
59043
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
59022
59044
  return false;
59023
59045
  }
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) => {
59046
+ getPivotFunctions(sheetId, tokens) {
59047
+ const pivotFunctions = getPivotFunctions(tokens);
59048
+ if (!pivotFunctions.length) return [];
59049
+ const evaluatedPivotFunctions = [];
59050
+ for (const pivotFunction of pivotFunctions) {
59051
+ const { functionName, args } = pivotFunction;
59052
+ const evaluatedArgs = args.map((argAst) => {
59031
59053
  if (argAst.type === "EMPTY") return;
59032
59054
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
59033
59055
  const argsString = astToFormula(argAst);
59034
59056
  return this.getters.evaluateFormula(sheetId, argsString);
59035
- })
59036
- };
59057
+ });
59058
+ evaluatedPivotFunctions.push({
59059
+ functionName,
59060
+ args: evaluatedArgs
59061
+ });
59062
+ }
59063
+ return evaluatedPivotFunctions;
59064
+ }
59065
+ getFirstPivotFunction(sheetId, tokens) {
59066
+ return this.getPivotFunctions(sheetId, tokens)[0];
59037
59067
  }
59038
59068
  /**
59039
59069
  * Returns the domain args of a pivot formula from a position.
@@ -59127,8 +59157,8 @@ stores.inject(MyMetaStore, storeInstance);
59127
59157
  const unusedPivots = new Set(this.getters.getPivotIds());
59128
59158
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
59129
59159
  const position = this.getters.getCellPosition(cellId);
59130
- const pivotId = this.getPivotIdFromPosition(position);
59131
- if (pivotId) {
59160
+ const pivotIds = this.getPivotIdsFromPosition(position);
59161
+ for (const pivotId of pivotIds) {
59132
59162
  unusedPivots.delete(pivotId);
59133
59163
  if (!unusedPivots.size) {
59134
59164
  this.unusedPivots = [];
@@ -59136,6 +59166,21 @@ stores.inject(MyMetaStore, storeInstance);
59136
59166
  }
59137
59167
  }
59138
59168
  }
59169
+ for (const pivotId of this.getters.getPivotIds()) {
59170
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
59171
+ for (const measure of pivot.measures) if (measure.computedBy) {
59172
+ const { sheetId } = measure.computedBy;
59173
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
59174
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
59175
+ for (const relatedPivotId of relatedPivotIds) {
59176
+ unusedPivots.delete(relatedPivotId);
59177
+ if (!unusedPivots.size) {
59178
+ this.unusedPivots = [];
59179
+ return [];
59180
+ }
59181
+ }
59182
+ }
59183
+ }
59139
59184
  this.unusedPivots = [...unusedPivots];
59140
59185
  return this.unusedPivots;
59141
59186
  }
@@ -72226,8 +72271,8 @@ exports.stores = stores;
72226
72271
  exports.tokenColors = tokenColors;
72227
72272
  exports.tokenize = tokenize;
72228
72273
 
72229
- __info__.version = "18.3.48";
72230
- __info__.date = "2026-05-15T07:05:43.612Z";
72231
- __info__.hash = "76bed65";
72274
+ __info__.version = "18.3.50";
72275
+ __info__.date = "2026-06-06T06:20:54.573Z";
72276
+ __info__.hash = "d8ca64d";
72232
72277
 
72233
72278
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);