@odoo/o-spreadsheet 18.4.40 → 18.4.42

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.4.40
6
- * @date 2026-05-15T07:04:46.418Z
7
- * @hash bb1e6d6
5
+ * @version 18.4.42
6
+ * @date 2026-06-06T06:21:28.088Z
7
+ * @hash bae6e25
8
8
  */
9
9
 
10
10
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
@@ -3401,6 +3401,7 @@ function emptyDataErrorMessage(argName) {
3401
3401
  //#endregion
3402
3402
  //#region src/helpers/format/format_tokenizer.ts
3403
3403
  function tokenizeFormat(str) {
3404
+ str = str.replace(/\s/g, " ");
3404
3405
  const chars = new TokenizingChars(str);
3405
3406
  const result = [];
3406
3407
  let currentFormatPart = [];
@@ -5663,8 +5664,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5663
5664
  changeType: "NONE",
5664
5665
  range
5665
5666
  };
5667
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5668
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5669
+ changeType: "RESIZE",
5670
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5671
+ };
5666
5672
  if (cmd.position === "after") {
5667
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5673
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5668
5674
  changeType: "RESIZE",
5669
5675
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5670
5676
  };
@@ -9198,6 +9204,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9198
9204
  ROUNDDOWN: [{
9199
9205
  type: "NUMBER",
9200
9206
  value: 0
9207
+ }],
9208
+ IFERROR: [{
9209
+ type: "NUMBER",
9210
+ value: 0
9201
9211
  }]
9202
9212
  };
9203
9213
  /**
@@ -37051,11 +37061,10 @@ const INSERT_TABLE = (env) => {
37051
37061
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
37052
37062
  };
37053
37063
  const DELETE_SELECTED_TABLE = (env) => {
37054
- const position = env.model.getters.getActivePosition();
37055
- const table = env.model.getters.getTable(position);
37064
+ const table = env.model.getters.getFirstTableInSelection();
37056
37065
  if (!table) return;
37057
37066
  env.model.dispatch("REMOVE_TABLE", {
37058
- sheetId: position.sheetId,
37067
+ sheetId: env.model.getters.getActiveSheetId(),
37059
37068
  target: [table.range.zone]
37060
37069
  });
37061
37070
  };
@@ -47731,7 +47740,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
47731
47740
  col,
47732
47741
  row
47733
47742
  };
47734
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
47743
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
47735
47744
  }
47736
47745
  return positions;
47737
47746
  }
@@ -48656,6 +48665,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
48656
48665
  function getFirstPivotFunction(tokens) {
48657
48666
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
48658
48667
  }
48668
+ function getPivotFunctions(tokens) {
48669
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
48670
+ }
48659
48671
  /**
48660
48672
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
48661
48673
  * present in the given formula.
@@ -60424,6 +60436,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60424
60436
  "getPivot",
60425
60437
  "getFirstPivotFunction",
60426
60438
  "getPivotIdFromPosition",
60439
+ "getPivotIdsFromPosition",
60427
60440
  "getPivotCellFromPosition",
60428
60441
  "generateNewCalculatedMeasureName",
60429
60442
  "isPivotUnused",
@@ -60448,9 +60461,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60448
60461
  this.refreshPivot(cmd.id);
60449
60462
  break;
60450
60463
  case "ADD_PIVOT":
60464
+ this.unusedPivots?.push(cmd.pivotId);
60451
60465
  this.setupPivot(cmd.pivotId);
60452
60466
  break;
60453
60467
  case "DUPLICATE_PIVOT":
60468
+ this.unusedPivots?.push(cmd.newPivotId);
60454
60469
  this.setupPivot(cmd.newPivotId);
60455
60470
  break;
60456
60471
  case "UPDATE_PIVOT":
@@ -60481,37 +60496,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60481
60496
  }
60482
60497
  }
60483
60498
  /**
60484
- * Get the id of the pivot at the given position. Returns undefined if there
60499
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
60485
60500
  * is no pivot at this position
60486
60501
  */
60487
60502
  getPivotIdFromPosition(position) {
60503
+ return this.getPivotIdsFromPosition(position)[0];
60504
+ }
60505
+ /**
60506
+ * Get all of the ids of the pivot present in the formula at the given position.
60507
+ */
60508
+ getPivotIdsFromPosition(position) {
60488
60509
  const cell = this.getters.getCorrespondingFormulaCell(position);
60489
- if (cell && cell.isFormula) {
60490
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
60491
- if (pivotFunction) {
60492
- const pivotId = pivotFunction.args[0]?.toString();
60493
- return pivotId && this.getters.getPivotId(pivotId);
60494
- }
60495
- }
60510
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
60511
+ return [];
60512
+ }
60513
+ getPivotIdsFromFormula(sheetId, formula) {
60514
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
60515
+ const pivotId = pivotFunction.args[0]?.toString();
60516
+ return pivotId && this.getters.getPivotId(pivotId);
60517
+ }).filter(isDefined);
60496
60518
  }
60497
60519
  isSpillPivotFormula(position) {
60498
60520
  const cell = this.getters.getCorrespondingFormulaCell(position);
60499
60521
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
60500
60522
  return false;
60501
60523
  }
60502
- getFirstPivotFunction(sheetId, tokens) {
60503
- const pivotFunction = getFirstPivotFunction(tokens);
60504
- if (!pivotFunction) return;
60505
- const { functionName, args } = pivotFunction;
60506
- return {
60507
- functionName,
60508
- args: args.map((argAst) => {
60524
+ getPivotFunctions(sheetId, tokens) {
60525
+ const pivotFunctions = getPivotFunctions(tokens);
60526
+ if (!pivotFunctions.length) return [];
60527
+ const evaluatedPivotFunctions = [];
60528
+ for (const pivotFunction of pivotFunctions) {
60529
+ const { functionName, args } = pivotFunction;
60530
+ const evaluatedArgs = args.map((argAst) => {
60509
60531
  if (argAst.type === "EMPTY") return;
60510
60532
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
60511
60533
  const argsString = astToFormula(argAst);
60512
60534
  return this.getters.evaluateFormula(sheetId, argsString);
60513
- })
60514
- };
60535
+ });
60536
+ evaluatedPivotFunctions.push({
60537
+ functionName,
60538
+ args: evaluatedArgs
60539
+ });
60540
+ }
60541
+ return evaluatedPivotFunctions;
60542
+ }
60543
+ getFirstPivotFunction(sheetId, tokens) {
60544
+ return this.getPivotFunctions(sheetId, tokens)[0];
60515
60545
  }
60516
60546
  /**
60517
60547
  * Returns the domain args of a pivot formula from a position.
@@ -60615,8 +60645,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60615
60645
  const unusedPivots = new Set(this.getters.getPivotIds());
60616
60646
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
60617
60647
  const position = this.getters.getCellPosition(cellId);
60618
- const pivotId = this.getPivotIdFromPosition(position);
60619
- if (pivotId) {
60648
+ const pivotIds = this.getPivotIdsFromPosition(position);
60649
+ for (const pivotId of pivotIds) {
60620
60650
  unusedPivots.delete(pivotId);
60621
60651
  if (!unusedPivots.size) {
60622
60652
  this.unusedPivots = [];
@@ -60624,6 +60654,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60624
60654
  }
60625
60655
  }
60626
60656
  }
60657
+ for (const pivotId of this.getters.getPivotIds()) {
60658
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
60659
+ for (const measure of pivot.measures) if (measure.computedBy) {
60660
+ const { sheetId } = measure.computedBy;
60661
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
60662
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
60663
+ for (const relatedPivotId of relatedPivotIds) {
60664
+ unusedPivots.delete(relatedPivotId);
60665
+ if (!unusedPivots.size) {
60666
+ this.unusedPivots = [];
60667
+ return [];
60668
+ }
60669
+ }
60670
+ }
60671
+ }
60627
60672
  this.unusedPivots = [...unusedPivots];
60628
60673
  return this.unusedPivots;
60629
60674
  }
@@ -75553,6 +75598,6 @@ exports.stores = stores;
75553
75598
  exports.tokenColors = tokenColors;
75554
75599
  exports.tokenize = tokenize;
75555
75600
 
75556
- __info__.version = "18.4.40";
75557
- __info__.date = "2026-05-15T07:04:46.418Z";
75558
- __info__.hash = "bb1e6d6";
75601
+ __info__.version = "18.4.42";
75602
+ __info__.date = "2026-06-06T06:21:28.088Z";
75603
+ __info__.hash = "bae6e25";
@@ -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.4.40
6
- * @date 2026-05-15T07:04:47.982Z
7
- * @hash bb1e6d6
5
+ * @version 18.4.42
6
+ * @date 2026-06-06T06:21:29.595Z
7
+ * @hash bae6e25
8
8
  */
9
9
  /* Originates from src/components/top_bar/top_bar.scss */
10
10
  @media (max-width: 1200px) {
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.4.40
6
- * @date 2026-05-15T07:04:46.418Z
7
- * @hash bb1e6d6
5
+ * @version 18.4.42
6
+ * @date 2026-06-06T06:21:28.088Z
7
+ * @hash bae6e25
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";
@@ -3400,6 +3400,7 @@ function emptyDataErrorMessage(argName) {
3400
3400
  //#endregion
3401
3401
  //#region src/helpers/format/format_tokenizer.ts
3402
3402
  function tokenizeFormat(str) {
3403
+ str = str.replace(/\s/g, " ");
3403
3404
  const chars = new TokenizingChars(str);
3404
3405
  const result = [];
3405
3406
  let currentFormatPart = [];
@@ -5662,8 +5663,13 @@ function getApplyRangeChangeAddColRow(cmd) {
5662
5663
  changeType: "NONE",
5663
5664
  range
5664
5665
  };
5666
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5667
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5668
+ changeType: "RESIZE",
5669
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5670
+ };
5665
5671
  if (cmd.position === "after") {
5666
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5672
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5667
5673
  changeType: "RESIZE",
5668
5674
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5669
5675
  };
@@ -9197,6 +9203,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
9197
9203
  ROUNDDOWN: [{
9198
9204
  type: "NUMBER",
9199
9205
  value: 0
9206
+ }],
9207
+ IFERROR: [{
9208
+ type: "NUMBER",
9209
+ value: 0
9200
9210
  }]
9201
9211
  };
9202
9212
  /**
@@ -37050,11 +37060,10 @@ const INSERT_TABLE = (env) => {
37050
37060
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
37051
37061
  };
37052
37062
  const DELETE_SELECTED_TABLE = (env) => {
37053
- const position = env.model.getters.getActivePosition();
37054
- const table = env.model.getters.getTable(position);
37063
+ const table = env.model.getters.getFirstTableInSelection();
37055
37064
  if (!table) return;
37056
37065
  env.model.dispatch("REMOVE_TABLE", {
37057
- sheetId: position.sheetId,
37066
+ sheetId: env.model.getters.getActiveSheetId(),
37058
37067
  target: [table.range.zone]
37059
37068
  });
37060
37069
  };
@@ -47730,7 +47739,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
47730
47739
  col,
47731
47740
  row
47732
47741
  };
47733
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
47742
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
47734
47743
  }
47735
47744
  return positions;
47736
47745
  }
@@ -48655,6 +48664,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
48655
48664
  function getFirstPivotFunction(tokens) {
48656
48665
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
48657
48666
  }
48667
+ function getPivotFunctions(tokens) {
48668
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
48669
+ }
48658
48670
  /**
48659
48671
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
48660
48672
  * present in the given formula.
@@ -60239,6 +60251,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60239
60251
  "getPivot",
60240
60252
  "getFirstPivotFunction",
60241
60253
  "getPivotIdFromPosition",
60254
+ "getPivotIdsFromPosition",
60242
60255
  "getPivotCellFromPosition",
60243
60256
  "generateNewCalculatedMeasureName",
60244
60257
  "isPivotUnused",
@@ -60263,9 +60276,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60263
60276
  this.refreshPivot(cmd.id);
60264
60277
  break;
60265
60278
  case "ADD_PIVOT":
60279
+ this.unusedPivots?.push(cmd.pivotId);
60266
60280
  this.setupPivot(cmd.pivotId);
60267
60281
  break;
60268
60282
  case "DUPLICATE_PIVOT":
60283
+ this.unusedPivots?.push(cmd.newPivotId);
60269
60284
  this.setupPivot(cmd.newPivotId);
60270
60285
  break;
60271
60286
  case "UPDATE_PIVOT":
@@ -60296,37 +60311,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60296
60311
  }
60297
60312
  }
60298
60313
  /**
60299
- * Get the id of the pivot at the given position. Returns undefined if there
60314
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
60300
60315
  * is no pivot at this position
60301
60316
  */
60302
60317
  getPivotIdFromPosition(position) {
60318
+ return this.getPivotIdsFromPosition(position)[0];
60319
+ }
60320
+ /**
60321
+ * Get all of the ids of the pivot present in the formula at the given position.
60322
+ */
60323
+ getPivotIdsFromPosition(position) {
60303
60324
  const cell = this.getters.getCorrespondingFormulaCell(position);
60304
- if (cell && cell.isFormula) {
60305
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
60306
- if (pivotFunction) {
60307
- const pivotId = pivotFunction.args[0]?.toString();
60308
- return pivotId && this.getters.getPivotId(pivotId);
60309
- }
60310
- }
60325
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
60326
+ return [];
60327
+ }
60328
+ getPivotIdsFromFormula(sheetId, formula) {
60329
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
60330
+ const pivotId = pivotFunction.args[0]?.toString();
60331
+ return pivotId && this.getters.getPivotId(pivotId);
60332
+ }).filter(isDefined);
60311
60333
  }
60312
60334
  isSpillPivotFormula(position) {
60313
60335
  const cell = this.getters.getCorrespondingFormulaCell(position);
60314
60336
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
60315
60337
  return false;
60316
60338
  }
60317
- getFirstPivotFunction(sheetId, tokens) {
60318
- const pivotFunction = getFirstPivotFunction(tokens);
60319
- if (!pivotFunction) return;
60320
- const { functionName, args } = pivotFunction;
60321
- return {
60322
- functionName,
60323
- args: args.map((argAst) => {
60339
+ getPivotFunctions(sheetId, tokens) {
60340
+ const pivotFunctions = getPivotFunctions(tokens);
60341
+ if (!pivotFunctions.length) return [];
60342
+ const evaluatedPivotFunctions = [];
60343
+ for (const pivotFunction of pivotFunctions) {
60344
+ const { functionName, args } = pivotFunction;
60345
+ const evaluatedArgs = args.map((argAst) => {
60324
60346
  if (argAst.type === "EMPTY") return;
60325
60347
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
60326
60348
  const argsString = astToFormula(argAst);
60327
60349
  return this.getters.evaluateFormula(sheetId, argsString);
60328
- })
60329
- };
60350
+ });
60351
+ evaluatedPivotFunctions.push({
60352
+ functionName,
60353
+ args: evaluatedArgs
60354
+ });
60355
+ }
60356
+ return evaluatedPivotFunctions;
60357
+ }
60358
+ getFirstPivotFunction(sheetId, tokens) {
60359
+ return this.getPivotFunctions(sheetId, tokens)[0];
60330
60360
  }
60331
60361
  /**
60332
60362
  * Returns the domain args of a pivot formula from a position.
@@ -60430,8 +60460,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60430
60460
  const unusedPivots = new Set(this.getters.getPivotIds());
60431
60461
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
60432
60462
  const position = this.getters.getCellPosition(cellId);
60433
- const pivotId = this.getPivotIdFromPosition(position);
60434
- if (pivotId) {
60463
+ const pivotIds = this.getPivotIdsFromPosition(position);
60464
+ for (const pivotId of pivotIds) {
60435
60465
  unusedPivots.delete(pivotId);
60436
60466
  if (!unusedPivots.size) {
60437
60467
  this.unusedPivots = [];
@@ -60439,6 +60469,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60439
60469
  }
60440
60470
  }
60441
60471
  }
60472
+ for (const pivotId of this.getters.getPivotIds()) {
60473
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
60474
+ for (const measure of pivot.measures) if (measure.computedBy) {
60475
+ const { sheetId } = measure.computedBy;
60476
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
60477
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
60478
+ for (const relatedPivotId of relatedPivotIds) {
60479
+ unusedPivots.delete(relatedPivotId);
60480
+ if (!unusedPivots.size) {
60481
+ this.unusedPivots = [];
60482
+ return [];
60483
+ }
60484
+ }
60485
+ }
60486
+ }
60442
60487
  this.unusedPivots = [...unusedPivots];
60443
60488
  return this.unusedPivots;
60444
60489
  }
@@ -75319,6 +75364,6 @@ const chartHelpers = {
75319
75364
  //#endregion
75320
75365
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
75321
75366
 
75322
- __info__.version = "18.4.40";
75323
- __info__.date = "2026-05-15T07:04:46.418Z";
75324
- __info__.hash = "bb1e6d6";
75367
+ __info__.version = "18.4.42";
75368
+ __info__.date = "2026-06-06T06:21:28.088Z";
75369
+ __info__.hash = "bae6e25";
@@ -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.4.40
6
- * @date 2026-05-15T07:04:46.418Z
7
- * @hash bb1e6d6
5
+ * @version 18.4.42
6
+ * @date 2026-06-06T06:21:28.088Z
7
+ * @hash bae6e25
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -3402,6 +3402,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3402
3402
  //#endregion
3403
3403
  //#region src/helpers/format/format_tokenizer.ts
3404
3404
  function tokenizeFormat(str) {
3405
+ str = str.replace(/\s/g, " ");
3405
3406
  const chars = new TokenizingChars(str);
3406
3407
  const result = [];
3407
3408
  let currentFormatPart = [];
@@ -5664,8 +5665,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5664
5665
  changeType: "NONE",
5665
5666
  range
5666
5667
  };
5668
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5669
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5670
+ changeType: "RESIZE",
5671
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5672
+ };
5667
5673
  if (cmd.position === "after") {
5668
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5674
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5669
5675
  changeType: "RESIZE",
5670
5676
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5671
5677
  };
@@ -9199,6 +9205,10 @@ stores.inject(MyMetaStore, storeInstance);
9199
9205
  ROUNDDOWN: [{
9200
9206
  type: "NUMBER",
9201
9207
  value: 0
9208
+ }],
9209
+ IFERROR: [{
9210
+ type: "NUMBER",
9211
+ value: 0
9202
9212
  }]
9203
9213
  };
9204
9214
  /**
@@ -37052,11 +37062,10 @@ stores.inject(MyMetaStore, storeInstance);
37052
37062
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
37053
37063
  };
37054
37064
  const DELETE_SELECTED_TABLE = (env) => {
37055
- const position = env.model.getters.getActivePosition();
37056
- const table = env.model.getters.getTable(position);
37065
+ const table = env.model.getters.getFirstTableInSelection();
37057
37066
  if (!table) return;
37058
37067
  env.model.dispatch("REMOVE_TABLE", {
37059
- sheetId: position.sheetId,
37068
+ sheetId: env.model.getters.getActiveSheetId(),
37060
37069
  target: [table.range.zone]
37061
37070
  });
37062
37071
  };
@@ -47732,7 +47741,7 @@ stores.inject(MyMetaStore, storeInstance);
47732
47741
  col,
47733
47742
  row
47734
47743
  };
47735
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
47744
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
47736
47745
  }
47737
47746
  return positions;
47738
47747
  }
@@ -48657,6 +48666,9 @@ stores.inject(MyMetaStore, storeInstance);
48657
48666
  function getFirstPivotFunction(tokens) {
48658
48667
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
48659
48668
  }
48669
+ function getPivotFunctions(tokens) {
48670
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
48671
+ }
48660
48672
  /**
48661
48673
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
48662
48674
  * present in the given formula.
@@ -60241,6 +60253,7 @@ stores.inject(MyMetaStore, storeInstance);
60241
60253
  "getPivot",
60242
60254
  "getFirstPivotFunction",
60243
60255
  "getPivotIdFromPosition",
60256
+ "getPivotIdsFromPosition",
60244
60257
  "getPivotCellFromPosition",
60245
60258
  "generateNewCalculatedMeasureName",
60246
60259
  "isPivotUnused",
@@ -60265,9 +60278,11 @@ stores.inject(MyMetaStore, storeInstance);
60265
60278
  this.refreshPivot(cmd.id);
60266
60279
  break;
60267
60280
  case "ADD_PIVOT":
60281
+ this.unusedPivots?.push(cmd.pivotId);
60268
60282
  this.setupPivot(cmd.pivotId);
60269
60283
  break;
60270
60284
  case "DUPLICATE_PIVOT":
60285
+ this.unusedPivots?.push(cmd.newPivotId);
60271
60286
  this.setupPivot(cmd.newPivotId);
60272
60287
  break;
60273
60288
  case "UPDATE_PIVOT":
@@ -60298,37 +60313,52 @@ stores.inject(MyMetaStore, storeInstance);
60298
60313
  }
60299
60314
  }
60300
60315
  /**
60301
- * Get the id of the pivot at the given position. Returns undefined if there
60316
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
60302
60317
  * is no pivot at this position
60303
60318
  */
60304
60319
  getPivotIdFromPosition(position) {
60320
+ return this.getPivotIdsFromPosition(position)[0];
60321
+ }
60322
+ /**
60323
+ * Get all of the ids of the pivot present in the formula at the given position.
60324
+ */
60325
+ getPivotIdsFromPosition(position) {
60305
60326
  const cell = this.getters.getCorrespondingFormulaCell(position);
60306
- if (cell && cell.isFormula) {
60307
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
60308
- if (pivotFunction) {
60309
- const pivotId = pivotFunction.args[0]?.toString();
60310
- return pivotId && this.getters.getPivotId(pivotId);
60311
- }
60312
- }
60327
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
60328
+ return [];
60329
+ }
60330
+ getPivotIdsFromFormula(sheetId, formula) {
60331
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
60332
+ const pivotId = pivotFunction.args[0]?.toString();
60333
+ return pivotId && this.getters.getPivotId(pivotId);
60334
+ }).filter(isDefined);
60313
60335
  }
60314
60336
  isSpillPivotFormula(position) {
60315
60337
  const cell = this.getters.getCorrespondingFormulaCell(position);
60316
60338
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
60317
60339
  return false;
60318
60340
  }
60319
- getFirstPivotFunction(sheetId, tokens) {
60320
- const pivotFunction = getFirstPivotFunction(tokens);
60321
- if (!pivotFunction) return;
60322
- const { functionName, args } = pivotFunction;
60323
- return {
60324
- functionName,
60325
- args: args.map((argAst) => {
60341
+ getPivotFunctions(sheetId, tokens) {
60342
+ const pivotFunctions = getPivotFunctions(tokens);
60343
+ if (!pivotFunctions.length) return [];
60344
+ const evaluatedPivotFunctions = [];
60345
+ for (const pivotFunction of pivotFunctions) {
60346
+ const { functionName, args } = pivotFunction;
60347
+ const evaluatedArgs = args.map((argAst) => {
60326
60348
  if (argAst.type === "EMPTY") return;
60327
60349
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
60328
60350
  const argsString = astToFormula(argAst);
60329
60351
  return this.getters.evaluateFormula(sheetId, argsString);
60330
- })
60331
- };
60352
+ });
60353
+ evaluatedPivotFunctions.push({
60354
+ functionName,
60355
+ args: evaluatedArgs
60356
+ });
60357
+ }
60358
+ return evaluatedPivotFunctions;
60359
+ }
60360
+ getFirstPivotFunction(sheetId, tokens) {
60361
+ return this.getPivotFunctions(sheetId, tokens)[0];
60332
60362
  }
60333
60363
  /**
60334
60364
  * Returns the domain args of a pivot formula from a position.
@@ -60432,8 +60462,8 @@ stores.inject(MyMetaStore, storeInstance);
60432
60462
  const unusedPivots = new Set(this.getters.getPivotIds());
60433
60463
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
60434
60464
  const position = this.getters.getCellPosition(cellId);
60435
- const pivotId = this.getPivotIdFromPosition(position);
60436
- if (pivotId) {
60465
+ const pivotIds = this.getPivotIdsFromPosition(position);
60466
+ for (const pivotId of pivotIds) {
60437
60467
  unusedPivots.delete(pivotId);
60438
60468
  if (!unusedPivots.size) {
60439
60469
  this.unusedPivots = [];
@@ -60441,6 +60471,21 @@ stores.inject(MyMetaStore, storeInstance);
60441
60471
  }
60442
60472
  }
60443
60473
  }
60474
+ for (const pivotId of this.getters.getPivotIds()) {
60475
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
60476
+ for (const measure of pivot.measures) if (measure.computedBy) {
60477
+ const { sheetId } = measure.computedBy;
60478
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
60479
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
60480
+ for (const relatedPivotId of relatedPivotIds) {
60481
+ unusedPivots.delete(relatedPivotId);
60482
+ if (!unusedPivots.size) {
60483
+ this.unusedPivots = [];
60484
+ return [];
60485
+ }
60486
+ }
60487
+ }
60488
+ }
60444
60489
  this.unusedPivots = [...unusedPivots];
60445
60490
  return this.unusedPivots;
60446
60491
  }
@@ -75370,8 +75415,8 @@ exports.stores = stores;
75370
75415
  exports.tokenColors = tokenColors;
75371
75416
  exports.tokenize = tokenize;
75372
75417
 
75373
- __info__.version = "18.4.40";
75374
- __info__.date = "2026-05-15T07:04:46.418Z";
75375
- __info__.hash = "bb1e6d6";
75418
+ __info__.version = "18.4.42";
75419
+ __info__.date = "2026-06-06T06:21:28.088Z";
75420
+ __info__.hash = "bae6e25";
75376
75421
 
75377
75422
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);