@odoo/o-spreadsheet 18.4.40 → 18.4.43

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.43
6
+ * @date 2026-06-17T08:50:35.126Z
7
+ * @hash 5ab697a
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
  };
@@ -39665,8 +39674,12 @@ var CellComposerStore = class extends AbstractComposerStore {
39665
39674
  }
39666
39675
  stopEdition(direction) {
39667
39676
  if (this.canStopEdition()) {
39677
+ const { col, row } = this.currentEditedCell;
39668
39678
  this._stopEdition();
39669
- if (direction) this.model.selection.moveAnchorCell(direction, 1);
39679
+ if (direction) {
39680
+ this.model.selection.selectCell(col, row);
39681
+ this.model.selection.moveAnchorCell(direction, 1);
39682
+ }
39670
39683
  return;
39671
39684
  }
39672
39685
  const editedCell = this.currentEditedCell;
@@ -47012,9 +47025,9 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47012
47025
  allSheetsMatches = [];
47013
47026
  activeSheetMatches = [];
47014
47027
  specificRangeMatches = [];
47028
+ selectedMatchPosition = null;
47015
47029
  currentSearchRegex = null;
47016
47030
  initialShowFormulaState;
47017
- preserveSelectedMatchIndex = false;
47018
47031
  irreplaceableMatchCount = 0;
47019
47032
  isSearchDirty = false;
47020
47033
  shouldFinalizeUpdateSelection = false;
@@ -47136,7 +47149,10 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47136
47149
  */
47137
47150
  _updateSearch(toSearch, searchOptions) {
47138
47151
  this.searchOptions = searchOptions;
47139
- if (toSearch !== this.toSearch) this.selectedMatchIndex = null;
47152
+ if (toSearch !== this.toSearch) {
47153
+ this.selectedMatchIndex = null;
47154
+ this.selectedMatchPosition = null;
47155
+ }
47140
47156
  this.toSearch = toSearch;
47141
47157
  this.currentSearchRegex = getSearchRegex(this.toSearch, this.searchOptions);
47142
47158
  this.refreshSearch({
@@ -47148,8 +47164,14 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47148
47164
  * refresh the matches according to the current search options
47149
47165
  */
47150
47166
  refreshSearch(options) {
47151
- if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
47152
47167
  this.findMatches();
47168
+ if (this.selectedMatchPosition) if (this.selectedMatchPosition.sheetId !== this.getters.getActiveSheetId()) {
47169
+ this.selectedMatchIndex = null;
47170
+ this.selectedMatchPosition = null;
47171
+ } else {
47172
+ const index = this.searchMatches.findIndex((match) => match.sheetId === this.selectedMatchPosition?.sheetId && match.col === this.selectedMatchPosition?.col && match.row === this.selectedMatchPosition?.row);
47173
+ if (index !== -1) this.selectedMatchIndex = index;
47174
+ }
47153
47175
  this.selectNextCell(0, options);
47154
47176
  }
47155
47177
  getSheetsInSearchOrder() {
@@ -47217,6 +47239,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47217
47239
  const matches = this.searchMatches;
47218
47240
  if (!matches.length) {
47219
47241
  this.selectedMatchIndex = null;
47242
+ this.selectedMatchPosition = null;
47220
47243
  return;
47221
47244
  }
47222
47245
  let nextIndex;
@@ -47230,14 +47253,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47230
47253
  } else nextIndex = this.selectedMatchIndex + indexChange;
47231
47254
  nextIndex = (nextIndex + matches.length) % matches.length;
47232
47255
  this.selectedMatchIndex = nextIndex;
47256
+ this.selectedMatchPosition = matches[this.selectedMatchIndex];
47233
47257
  const selectedMatch = matches[nextIndex];
47234
47258
  if (options.jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
47235
- this.preserveSelectedMatchIndex = true;
47236
47259
  this.model.dispatch("ACTIVATE_SHEET", {
47237
47260
  sheetIdFrom: this.getters.getActiveSheetId(),
47238
47261
  sheetIdTo: selectedMatch.sheetId
47239
47262
  });
47240
- this.preserveSelectedMatchIndex = false;
47241
47263
  this.isSearchDirty = false;
47242
47264
  }
47243
47265
  this.model.selection.getBackToDefault();
@@ -47248,7 +47270,6 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47248
47270
  */
47249
47271
  replace() {
47250
47272
  if (this.selectedMatchIndex === null) return;
47251
- this.preserveSelectedMatchIndex = true;
47252
47273
  this.shouldFinalizeUpdateSelection = true;
47253
47274
  this.model.dispatch("REPLACE_SEARCH", {
47254
47275
  searchString: this.toSearch,
@@ -47256,7 +47277,6 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47256
47277
  matches: [this.searchMatches[this.selectedMatchIndex]],
47257
47278
  searchOptions: this.searchOptions
47258
47279
  });
47259
- this.preserveSelectedMatchIndex = false;
47260
47280
  }
47261
47281
  /**
47262
47282
  * Apply the replace function to all the matches one time.
@@ -47731,7 +47751,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
47731
47751
  col,
47732
47752
  row
47733
47753
  };
47734
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
47754
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
47735
47755
  }
47736
47756
  return positions;
47737
47757
  }
@@ -48656,6 +48676,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
48656
48676
  function getFirstPivotFunction(tokens) {
48657
48677
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
48658
48678
  }
48679
+ function getPivotFunctions(tokens) {
48680
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
48681
+ }
48659
48682
  /**
48660
48683
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
48661
48684
  * present in the given formula.
@@ -59515,7 +59538,7 @@ iconsOnCellRegistry.add("pivot_collapse", (getters, position) => {
59515
59538
  const definition = getters.getPivotCoreDefinition(pivotId);
59516
59539
  const isDashboard = getters.isDashboard();
59517
59540
  const fields = pivotCell.dimension === "COL" ? definition.columns : definition.rows;
59518
- const hasIcon = !isDashboard && pivotCell.domain.length !== fields.length;
59541
+ const hasIcon = !isDashboard && !getters.shouldShowFormulas() && pivotCell.domain.length !== fields.length;
59519
59542
  const isCollapsed = (definition.collapsedDomains?.[pivotCell.dimension] ?? []).some((domain) => deepEquals(domain, pivotCell.domain));
59520
59543
  const indent = pivotCell.dimension === "ROW" ? (pivotCell.domain.length - 1) * 15 : 0;
59521
59544
  return {
@@ -60424,6 +60447,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60424
60447
  "getPivot",
60425
60448
  "getFirstPivotFunction",
60426
60449
  "getPivotIdFromPosition",
60450
+ "getPivotIdsFromPosition",
60427
60451
  "getPivotCellFromPosition",
60428
60452
  "generateNewCalculatedMeasureName",
60429
60453
  "isPivotUnused",
@@ -60448,9 +60472,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60448
60472
  this.refreshPivot(cmd.id);
60449
60473
  break;
60450
60474
  case "ADD_PIVOT":
60475
+ this.unusedPivots?.push(cmd.pivotId);
60451
60476
  this.setupPivot(cmd.pivotId);
60452
60477
  break;
60453
60478
  case "DUPLICATE_PIVOT":
60479
+ this.unusedPivots?.push(cmd.newPivotId);
60454
60480
  this.setupPivot(cmd.newPivotId);
60455
60481
  break;
60456
60482
  case "UPDATE_PIVOT":
@@ -60481,37 +60507,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60481
60507
  }
60482
60508
  }
60483
60509
  /**
60484
- * Get the id of the pivot at the given position. Returns undefined if there
60510
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
60485
60511
  * is no pivot at this position
60486
60512
  */
60487
60513
  getPivotIdFromPosition(position) {
60514
+ return this.getPivotIdsFromPosition(position)[0];
60515
+ }
60516
+ /**
60517
+ * Get all of the ids of the pivot present in the formula at the given position.
60518
+ */
60519
+ getPivotIdsFromPosition(position) {
60488
60520
  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
- }
60521
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
60522
+ return [];
60523
+ }
60524
+ getPivotIdsFromFormula(sheetId, formula) {
60525
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
60526
+ const pivotId = pivotFunction.args[0]?.toString();
60527
+ return pivotId && this.getters.getPivotId(pivotId);
60528
+ }).filter(isDefined);
60496
60529
  }
60497
60530
  isSpillPivotFormula(position) {
60498
60531
  const cell = this.getters.getCorrespondingFormulaCell(position);
60499
60532
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
60500
60533
  return false;
60501
60534
  }
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) => {
60535
+ getPivotFunctions(sheetId, tokens) {
60536
+ const pivotFunctions = getPivotFunctions(tokens);
60537
+ if (!pivotFunctions.length) return [];
60538
+ const evaluatedPivotFunctions = [];
60539
+ for (const pivotFunction of pivotFunctions) {
60540
+ const { functionName, args } = pivotFunction;
60541
+ const evaluatedArgs = args.map((argAst) => {
60509
60542
  if (argAst.type === "EMPTY") return;
60510
60543
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
60511
60544
  const argsString = astToFormula(argAst);
60512
60545
  return this.getters.evaluateFormula(sheetId, argsString);
60513
- })
60514
- };
60546
+ });
60547
+ evaluatedPivotFunctions.push({
60548
+ functionName,
60549
+ args: evaluatedArgs
60550
+ });
60551
+ }
60552
+ return evaluatedPivotFunctions;
60553
+ }
60554
+ getFirstPivotFunction(sheetId, tokens) {
60555
+ return this.getPivotFunctions(sheetId, tokens)[0];
60515
60556
  }
60516
60557
  /**
60517
60558
  * Returns the domain args of a pivot formula from a position.
@@ -60615,8 +60656,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60615
60656
  const unusedPivots = new Set(this.getters.getPivotIds());
60616
60657
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
60617
60658
  const position = this.getters.getCellPosition(cellId);
60618
- const pivotId = this.getPivotIdFromPosition(position);
60619
- if (pivotId) {
60659
+ const pivotIds = this.getPivotIdsFromPosition(position);
60660
+ for (const pivotId of pivotIds) {
60620
60661
  unusedPivots.delete(pivotId);
60621
60662
  if (!unusedPivots.size) {
60622
60663
  this.unusedPivots = [];
@@ -60624,6 +60665,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60624
60665
  }
60625
60666
  }
60626
60667
  }
60668
+ for (const pivotId of this.getters.getPivotIds()) {
60669
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
60670
+ for (const measure of pivot.measures) if (measure.computedBy) {
60671
+ const { sheetId } = measure.computedBy;
60672
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
60673
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
60674
+ for (const relatedPivotId of relatedPivotIds) {
60675
+ unusedPivots.delete(relatedPivotId);
60676
+ if (!unusedPivots.size) {
60677
+ this.unusedPivots = [];
60678
+ return [];
60679
+ }
60680
+ }
60681
+ }
60682
+ }
60627
60683
  this.unusedPivots = [...unusedPivots];
60628
60684
  return this.unusedPivots;
60629
60685
  }
@@ -75553,6 +75609,6 @@ exports.stores = stores;
75553
75609
  exports.tokenColors = tokenColors;
75554
75610
  exports.tokenize = tokenize;
75555
75611
 
75556
- __info__.version = "18.4.40";
75557
- __info__.date = "2026-05-15T07:04:46.418Z";
75558
- __info__.hash = "bb1e6d6";
75612
+ __info__.version = "18.4.43";
75613
+ __info__.date = "2026-06-17T08:50:35.126Z";
75614
+ __info__.hash = "5ab697a";
@@ -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.43
6
+ * @date 2026-06-17T08:50:36.790Z
7
+ * @hash 5ab697a
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.43
6
+ * @date 2026-06-17T08:50:35.126Z
7
+ * @hash 5ab697a
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
  };
@@ -39664,8 +39673,12 @@ var CellComposerStore = class extends AbstractComposerStore {
39664
39673
  }
39665
39674
  stopEdition(direction) {
39666
39675
  if (this.canStopEdition()) {
39676
+ const { col, row } = this.currentEditedCell;
39667
39677
  this._stopEdition();
39668
- if (direction) this.model.selection.moveAnchorCell(direction, 1);
39678
+ if (direction) {
39679
+ this.model.selection.selectCell(col, row);
39680
+ this.model.selection.moveAnchorCell(direction, 1);
39681
+ }
39669
39682
  return;
39670
39683
  }
39671
39684
  const editedCell = this.currentEditedCell;
@@ -47011,9 +47024,9 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47011
47024
  allSheetsMatches = [];
47012
47025
  activeSheetMatches = [];
47013
47026
  specificRangeMatches = [];
47027
+ selectedMatchPosition = null;
47014
47028
  currentSearchRegex = null;
47015
47029
  initialShowFormulaState;
47016
- preserveSelectedMatchIndex = false;
47017
47030
  irreplaceableMatchCount = 0;
47018
47031
  isSearchDirty = false;
47019
47032
  shouldFinalizeUpdateSelection = false;
@@ -47135,7 +47148,10 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47135
47148
  */
47136
47149
  _updateSearch(toSearch, searchOptions) {
47137
47150
  this.searchOptions = searchOptions;
47138
- if (toSearch !== this.toSearch) this.selectedMatchIndex = null;
47151
+ if (toSearch !== this.toSearch) {
47152
+ this.selectedMatchIndex = null;
47153
+ this.selectedMatchPosition = null;
47154
+ }
47139
47155
  this.toSearch = toSearch;
47140
47156
  this.currentSearchRegex = getSearchRegex(this.toSearch, this.searchOptions);
47141
47157
  this.refreshSearch({
@@ -47147,8 +47163,14 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47147
47163
  * refresh the matches according to the current search options
47148
47164
  */
47149
47165
  refreshSearch(options) {
47150
- if (!this.preserveSelectedMatchIndex) this.selectedMatchIndex = null;
47151
47166
  this.findMatches();
47167
+ if (this.selectedMatchPosition) if (this.selectedMatchPosition.sheetId !== this.getters.getActiveSheetId()) {
47168
+ this.selectedMatchIndex = null;
47169
+ this.selectedMatchPosition = null;
47170
+ } else {
47171
+ const index = this.searchMatches.findIndex((match) => match.sheetId === this.selectedMatchPosition?.sheetId && match.col === this.selectedMatchPosition?.col && match.row === this.selectedMatchPosition?.row);
47172
+ if (index !== -1) this.selectedMatchIndex = index;
47173
+ }
47152
47174
  this.selectNextCell(0, options);
47153
47175
  }
47154
47176
  getSheetsInSearchOrder() {
@@ -47216,6 +47238,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47216
47238
  const matches = this.searchMatches;
47217
47239
  if (!matches.length) {
47218
47240
  this.selectedMatchIndex = null;
47241
+ this.selectedMatchPosition = null;
47219
47242
  return;
47220
47243
  }
47221
47244
  let nextIndex;
@@ -47229,14 +47252,13 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47229
47252
  } else nextIndex = this.selectedMatchIndex + indexChange;
47230
47253
  nextIndex = (nextIndex + matches.length) % matches.length;
47231
47254
  this.selectedMatchIndex = nextIndex;
47255
+ this.selectedMatchPosition = matches[this.selectedMatchIndex];
47232
47256
  const selectedMatch = matches[nextIndex];
47233
47257
  if (options.jumpToMatchSheet && this.getters.getActiveSheetId() !== selectedMatch.sheetId) {
47234
- this.preserveSelectedMatchIndex = true;
47235
47258
  this.model.dispatch("ACTIVATE_SHEET", {
47236
47259
  sheetIdFrom: this.getters.getActiveSheetId(),
47237
47260
  sheetIdTo: selectedMatch.sheetId
47238
47261
  });
47239
- this.preserveSelectedMatchIndex = false;
47240
47262
  this.isSearchDirty = false;
47241
47263
  }
47242
47264
  this.model.selection.getBackToDefault();
@@ -47247,7 +47269,6 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47247
47269
  */
47248
47270
  replace() {
47249
47271
  if (this.selectedMatchIndex === null) return;
47250
- this.preserveSelectedMatchIndex = true;
47251
47272
  this.shouldFinalizeUpdateSelection = true;
47252
47273
  this.model.dispatch("REPLACE_SEARCH", {
47253
47274
  searchString: this.toSearch,
@@ -47255,7 +47276,6 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
47255
47276
  matches: [this.searchMatches[this.selectedMatchIndex]],
47256
47277
  searchOptions: this.searchOptions
47257
47278
  });
47258
- this.preserveSelectedMatchIndex = false;
47259
47279
  }
47260
47280
  /**
47261
47281
  * Apply the replace function to all the matches one time.
@@ -47730,7 +47750,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
47730
47750
  col,
47731
47751
  row
47732
47752
  };
47733
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
47753
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
47734
47754
  }
47735
47755
  return positions;
47736
47756
  }
@@ -48655,6 +48675,9 @@ function extractFormulaIdFromToken(tokenAtCursor) {
48655
48675
  function getFirstPivotFunction(tokens) {
48656
48676
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
48657
48677
  }
48678
+ function getPivotFunctions(tokens) {
48679
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
48680
+ }
48658
48681
  /**
48659
48682
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
48660
48683
  * present in the given formula.
@@ -59330,7 +59353,7 @@ iconsOnCellRegistry.add("pivot_collapse", (getters, position) => {
59330
59353
  const definition = getters.getPivotCoreDefinition(pivotId);
59331
59354
  const isDashboard = getters.isDashboard();
59332
59355
  const fields = pivotCell.dimension === "COL" ? definition.columns : definition.rows;
59333
- const hasIcon = !isDashboard && pivotCell.domain.length !== fields.length;
59356
+ const hasIcon = !isDashboard && !getters.shouldShowFormulas() && pivotCell.domain.length !== fields.length;
59334
59357
  const isCollapsed = (definition.collapsedDomains?.[pivotCell.dimension] ?? []).some((domain) => deepEquals(domain, pivotCell.domain));
59335
59358
  const indent = pivotCell.dimension === "ROW" ? (pivotCell.domain.length - 1) * 15 : 0;
59336
59359
  return {
@@ -60239,6 +60262,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60239
60262
  "getPivot",
60240
60263
  "getFirstPivotFunction",
60241
60264
  "getPivotIdFromPosition",
60265
+ "getPivotIdsFromPosition",
60242
60266
  "getPivotCellFromPosition",
60243
60267
  "generateNewCalculatedMeasureName",
60244
60268
  "isPivotUnused",
@@ -60263,9 +60287,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60263
60287
  this.refreshPivot(cmd.id);
60264
60288
  break;
60265
60289
  case "ADD_PIVOT":
60290
+ this.unusedPivots?.push(cmd.pivotId);
60266
60291
  this.setupPivot(cmd.pivotId);
60267
60292
  break;
60268
60293
  case "DUPLICATE_PIVOT":
60294
+ this.unusedPivots?.push(cmd.newPivotId);
60269
60295
  this.setupPivot(cmd.newPivotId);
60270
60296
  break;
60271
60297
  case "UPDATE_PIVOT":
@@ -60296,37 +60322,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60296
60322
  }
60297
60323
  }
60298
60324
  /**
60299
- * Get the id of the pivot at the given position. Returns undefined if there
60325
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
60300
60326
  * is no pivot at this position
60301
60327
  */
60302
60328
  getPivotIdFromPosition(position) {
60329
+ return this.getPivotIdsFromPosition(position)[0];
60330
+ }
60331
+ /**
60332
+ * Get all of the ids of the pivot present in the formula at the given position.
60333
+ */
60334
+ getPivotIdsFromPosition(position) {
60303
60335
  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
- }
60336
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
60337
+ return [];
60338
+ }
60339
+ getPivotIdsFromFormula(sheetId, formula) {
60340
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
60341
+ const pivotId = pivotFunction.args[0]?.toString();
60342
+ return pivotId && this.getters.getPivotId(pivotId);
60343
+ }).filter(isDefined);
60311
60344
  }
60312
60345
  isSpillPivotFormula(position) {
60313
60346
  const cell = this.getters.getCorrespondingFormulaCell(position);
60314
60347
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
60315
60348
  return false;
60316
60349
  }
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) => {
60350
+ getPivotFunctions(sheetId, tokens) {
60351
+ const pivotFunctions = getPivotFunctions(tokens);
60352
+ if (!pivotFunctions.length) return [];
60353
+ const evaluatedPivotFunctions = [];
60354
+ for (const pivotFunction of pivotFunctions) {
60355
+ const { functionName, args } = pivotFunction;
60356
+ const evaluatedArgs = args.map((argAst) => {
60324
60357
  if (argAst.type === "EMPTY") return;
60325
60358
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
60326
60359
  const argsString = astToFormula(argAst);
60327
60360
  return this.getters.evaluateFormula(sheetId, argsString);
60328
- })
60329
- };
60361
+ });
60362
+ evaluatedPivotFunctions.push({
60363
+ functionName,
60364
+ args: evaluatedArgs
60365
+ });
60366
+ }
60367
+ return evaluatedPivotFunctions;
60368
+ }
60369
+ getFirstPivotFunction(sheetId, tokens) {
60370
+ return this.getPivotFunctions(sheetId, tokens)[0];
60330
60371
  }
60331
60372
  /**
60332
60373
  * Returns the domain args of a pivot formula from a position.
@@ -60430,8 +60471,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60430
60471
  const unusedPivots = new Set(this.getters.getPivotIds());
60431
60472
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
60432
60473
  const position = this.getters.getCellPosition(cellId);
60433
- const pivotId = this.getPivotIdFromPosition(position);
60434
- if (pivotId) {
60474
+ const pivotIds = this.getPivotIdsFromPosition(position);
60475
+ for (const pivotId of pivotIds) {
60435
60476
  unusedPivots.delete(pivotId);
60436
60477
  if (!unusedPivots.size) {
60437
60478
  this.unusedPivots = [];
@@ -60439,6 +60480,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
60439
60480
  }
60440
60481
  }
60441
60482
  }
60483
+ for (const pivotId of this.getters.getPivotIds()) {
60484
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
60485
+ for (const measure of pivot.measures) if (measure.computedBy) {
60486
+ const { sheetId } = measure.computedBy;
60487
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
60488
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
60489
+ for (const relatedPivotId of relatedPivotIds) {
60490
+ unusedPivots.delete(relatedPivotId);
60491
+ if (!unusedPivots.size) {
60492
+ this.unusedPivots = [];
60493
+ return [];
60494
+ }
60495
+ }
60496
+ }
60497
+ }
60442
60498
  this.unusedPivots = [...unusedPivots];
60443
60499
  return this.unusedPivots;
60444
60500
  }
@@ -75319,6 +75375,6 @@ const chartHelpers = {
75319
75375
  //#endregion
75320
75376
  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
75377
 
75322
- __info__.version = "18.4.40";
75323
- __info__.date = "2026-05-15T07:04:46.418Z";
75324
- __info__.hash = "bb1e6d6";
75378
+ __info__.version = "18.4.43";
75379
+ __info__.date = "2026-06-17T08:50:35.126Z";
75380
+ __info__.hash = "5ab697a";