@odoo/o-spreadsheet 17.0.2 → 17.0.3

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 17.0.2
6
- * @date 2023-11-03T12:22:44.945Z
7
- * @hash 3184728
5
+ * @version 17.0.3
6
+ * @date 2023-11-16T11:59:49.524Z
7
+ * @hash 8bd0fb2
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -4540,14 +4540,14 @@ function drawDecoratedText(context, text, position, underline = false, strikethr
4540
4540
  switch (context.textBaseline) {
4541
4541
  case "top":
4542
4542
  underlineY += boxHeight - 2 * strokeWidth;
4543
- strikeY += boxHeight - textHeight;
4543
+ strikeY += boxHeight / 2 - strokeWidth;
4544
4544
  break;
4545
4545
  case "middle":
4546
4546
  underlineY += boxHeight / 2 - strokeWidth;
4547
4547
  break;
4548
4548
  case "alphabetic":
4549
4549
  underlineY += 2 * strokeWidth;
4550
- strikeY -= textHeight / 2 - strokeWidth / 2;
4550
+ strikeY -= 3 * strokeWidth;
4551
4551
  break;
4552
4552
  case "bottom":
4553
4553
  underlineY = y;
@@ -5966,7 +5966,7 @@ autofillModifiersRegistry
5966
5966
  return { cellData: {} };
5967
5967
  }
5968
5968
  const sheetId = data.sheetId;
5969
- const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula, cell.dependencies);
5969
+ const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula);
5970
5970
  return {
5971
5971
  cellData: {
5972
5972
  border: data.border,
@@ -10693,6 +10693,17 @@ const SELECTION_CONTAINS_FILTER = (env) => {
10693
10693
  const IS_ONLY_ONE_RANGE = (env) => {
10694
10694
  return env.model.getters.getSelectedZones().length === 1;
10695
10695
  };
10696
+ const CAN_INSERT_HEADER = (env, dimension) => {
10697
+ if (!IS_ONLY_ONE_RANGE(env)) {
10698
+ return false;
10699
+ }
10700
+ const activeHeaders = dimension === "COL" ? env.model.getters.getActiveCols() : env.model.getters.getActiveRows();
10701
+ const ortogonalActiveHeaders = dimension === "COL" ? env.model.getters.getActiveRows() : env.model.getters.getActiveCols();
10702
+ const sheetId = env.model.getters.getActiveSheetId();
10703
+ const zone = env.model.getters.getSelectedZone();
10704
+ const allSheetSelected = isEqual(zone, env.model.getters.getSheetZone(sheetId));
10705
+ return isConsecutive(activeHeaders) && (ortogonalActiveHeaders.size === 0 || allSheetSelected);
10706
+ };
10696
10707
 
10697
10708
  const undo = {
10698
10709
  name: _t("Undo"),
@@ -19370,9 +19381,7 @@ const insertRow = {
19370
19381
  const number = getRowsNumber(env);
19371
19382
  return number === 1 ? _t("Insert row") : _t("Insert %s rows", number.toString());
19372
19383
  },
19373
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19374
- IS_ONLY_ONE_RANGE(env) &&
19375
- env.model.getters.getActiveCols().size === 0,
19384
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19376
19385
  icon: "o-spreadsheet-Icon.INSERT_ROW",
19377
19386
  };
19378
19387
  const rowInsertRowBefore = {
@@ -19381,9 +19390,7 @@ const rowInsertRowBefore = {
19381
19390
  return number === 1 ? _t("Insert row above") : _t("Insert %s rows above", number.toString());
19382
19391
  },
19383
19392
  execute: INSERT_ROWS_BEFORE_ACTION,
19384
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19385
- IS_ONLY_ONE_RANGE(env) &&
19386
- env.model.getters.getActiveCols().size === 0,
19393
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19387
19394
  icon: "o-spreadsheet-Icon.INSERT_ROW_BEFORE",
19388
19395
  };
19389
19396
  const topBarInsertRowsBefore = {
@@ -19414,9 +19421,7 @@ const rowInsertRowsAfter = {
19414
19421
  const number = getRowsNumber(env);
19415
19422
  return number === 1 ? _t("Insert row below") : _t("Insert %s rows below", number.toString());
19416
19423
  },
19417
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19418
- IS_ONLY_ONE_RANGE(env) &&
19419
- env.model.getters.getActiveCols().size === 0,
19424
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19420
19425
  icon: "o-spreadsheet-Icon.INSERT_ROW_AFTER",
19421
19426
  };
19422
19427
  const topBarInsertRowsAfter = {
@@ -19434,9 +19439,7 @@ const insertCol = {
19434
19439
  const number = getColumnsNumber(env);
19435
19440
  return number === 1 ? _t("Insert column") : _t("Insert %s columns", number.toString());
19436
19441
  },
19437
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19438
- IS_ONLY_ONE_RANGE(env) &&
19439
- env.model.getters.getActiveRows().size === 0,
19442
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19440
19443
  icon: "o-spreadsheet-Icon.INSERT_COL",
19441
19444
  };
19442
19445
  const colInsertColsBefore = {
@@ -19447,9 +19450,7 @@ const colInsertColsBefore = {
19447
19450
  : _t("Insert %s columns left", number.toString());
19448
19451
  },
19449
19452
  execute: INSERT_COLUMNS_BEFORE_ACTION,
19450
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19451
- IS_ONLY_ONE_RANGE(env) &&
19452
- env.model.getters.getActiveRows().size === 0,
19453
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19453
19454
  icon: "o-spreadsheet-Icon.INSERT_COL_BEFORE",
19454
19455
  };
19455
19456
  const topBarInsertColsBefore = {
@@ -19482,9 +19483,7 @@ const colInsertColsAfter = {
19482
19483
  : _t("Insert %s columns right", number.toString());
19483
19484
  },
19484
19485
  execute: INSERT_COLUMNS_AFTER_ACTION,
19485
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19486
- IS_ONLY_ONE_RANGE(env) &&
19487
- env.model.getters.getActiveRows().size === 0,
19486
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19488
19487
  icon: "o-spreadsheet-Icon.INSERT_COL_AFTER",
19489
19488
  };
19490
19489
  const topBarInsertColsAfter = {
@@ -23825,7 +23824,7 @@ css /* scss */ `
23825
23824
  }
23826
23825
  .o-input-count {
23827
23826
  width: fit-content;
23828
- padding: 4 0 4 4;
23827
+ padding: 4px 0 4px 4px;
23829
23828
  }
23830
23829
  }
23831
23830
  }
@@ -34946,6 +34945,9 @@ const functionCache = {};
34946
34945
  // -----------------------------------------------------------------------------
34947
34946
  function compile(formula) {
34948
34947
  const tokens = rangeTokenize(formula);
34948
+ return compileTokens(tokens);
34949
+ }
34950
+ function compileTokens(tokens) {
34949
34951
  const { dependencies, constantValues } = formulaArguments(tokens);
34950
34952
  const cacheKey = compilationCacheKey(tokens, dependencies, constantValues);
34951
34953
  if (!functionCache[cacheKey]) {
@@ -35312,11 +35314,11 @@ class CellPlugin extends CorePlugin {
35312
35314
  for (const sheet of Object.keys(this.cells)) {
35313
35315
  for (const cell of Object.values(this.cells[sheet] || {})) {
35314
35316
  if (cell.isFormula) {
35315
- for (const range of cell.dependencies) {
35317
+ for (const range of cell.compiledFormula.dependencies) {
35316
35318
  if (!sheetId || range.sheetId === sheetId) {
35317
35319
  const change = applyChange(range);
35318
35320
  if (change.changeType !== "NONE") {
35319
- this.history.update("cells", sheet, cell.id, "dependencies", cell.dependencies.indexOf(range), change.range);
35321
+ this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
35320
35322
  }
35321
35323
  }
35322
35324
  }
@@ -35512,10 +35514,10 @@ class CellPlugin extends CorePlugin {
35512
35514
  /*
35513
35515
  * Reconstructs the original formula string based on a normalized form and its dependencies
35514
35516
  */
35515
- getFormulaCellContent(sheetId, cell, dependencies) {
35516
- const ranges = dependencies || cell.dependencies;
35517
+ getFormulaCellContent(sheetId, compiledFormula, dependencies) {
35518
+ const ranges = dependencies || compiledFormula.dependencies;
35517
35519
  let rangeIndex = 0;
35518
- return concat(cell.compiledFormula.tokens.map((token) => {
35520
+ return concat(compiledFormula.tokens.map((token) => {
35519
35521
  if (token.type === "REFERENCE") {
35520
35522
  const range = ranges[rangeIndex++];
35521
35523
  return this.getters.getRangeString(range, sheetId);
@@ -35526,12 +35528,9 @@ class CellPlugin extends CorePlugin {
35526
35528
  /*
35527
35529
  * Constructs a formula string based on an initial formula and a translation vector
35528
35530
  */
35529
- getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula, dependencies) {
35530
- const adaptedDependencies = this.getters.createAdaptedRanges(dependencies, offsetX, offsetY, sheetId);
35531
- return this.getFormulaCellContent(sheetId, {
35532
- compiledFormula,
35533
- dependencies: adaptedDependencies,
35534
- });
35531
+ getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula) {
35532
+ const adaptedDependencies = this.getters.createAdaptedRanges(compiledFormula.dependencies, offsetX, offsetY, sheetId);
35533
+ return this.getFormulaCellContent(sheetId, compiledFormula, adaptedDependencies);
35535
35534
  }
35536
35535
  getCellStyle(position) {
35537
35536
  return this.getters.getCell(position)?.style || {};
@@ -35711,8 +35710,10 @@ class CellPlugin extends CorePlugin {
35711
35710
  style,
35712
35711
  format,
35713
35712
  isFormula: true,
35714
- compiledFormula,
35715
- dependencies: [],
35713
+ compiledFormula: {
35714
+ ...compiledFormula,
35715
+ dependencies: [],
35716
+ },
35716
35717
  };
35717
35718
  }
35718
35719
  /**
@@ -35721,7 +35722,7 @@ class CellPlugin extends CorePlugin {
35721
35722
  */
35722
35723
  createFormulaCellWithDependencies(id, compiledFormula, format, style, sheetId) {
35723
35724
  const dependencies = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
35724
- return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.getFormulaCellContent.bind(this));
35725
+ return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.getters.getRangeString.bind(this));
35725
35726
  }
35726
35727
  createErrorFormula(id, content, format, style, error) {
35727
35728
  return {
@@ -35731,13 +35732,12 @@ class CellPlugin extends CorePlugin {
35731
35732
  format,
35732
35733
  isFormula: true,
35733
35734
  compiledFormula: {
35734
- dependencies: [],
35735
35735
  tokens: tokenize(content),
35736
+ dependencies: [],
35736
35737
  execute: function () {
35737
35738
  throw error;
35738
35739
  },
35739
35740
  },
35740
- dependencies: [],
35741
35741
  };
35742
35742
  }
35743
35743
  checkCellOutOfSheet(sheetId, col, row) {
@@ -35750,27 +35750,44 @@ class CellPlugin extends CorePlugin {
35750
35750
  }
35751
35751
  class FormulaCellWithDependencies {
35752
35752
  id;
35753
- compiledFormula;
35754
35753
  format;
35755
35754
  style;
35756
- dependencies;
35757
35755
  sheetId;
35758
- getFormulaCellContent;
35756
+ getRangeString;
35759
35757
  isFormula = true;
35760
- constructor(id, compiledFormula, format, style, dependencies, sheetId, getFormulaCellContent) {
35758
+ compiledFormula;
35759
+ constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
35761
35760
  this.id = id;
35762
- this.compiledFormula = compiledFormula;
35763
35761
  this.format = format;
35764
35762
  this.style = style;
35765
- this.dependencies = dependencies;
35766
35763
  this.sheetId = sheetId;
35767
- this.getFormulaCellContent = getFormulaCellContent;
35764
+ this.getRangeString = getRangeString;
35765
+ let rangeIndex = 0;
35766
+ const tokens = compiledFormula.tokens.map((token) => {
35767
+ if (token.type === "REFERENCE") {
35768
+ const index = rangeIndex++;
35769
+ return new RangeReferenceToken(() => this.getRangeString(dependencies[index], this.sheetId));
35770
+ }
35771
+ return token;
35772
+ });
35773
+ this.compiledFormula = {
35774
+ ...compiledFormula,
35775
+ dependencies,
35776
+ tokens,
35777
+ };
35768
35778
  }
35769
35779
  get content() {
35770
- return this.getFormulaCellContent(this.sheetId, {
35771
- dependencies: this.dependencies,
35772
- compiledFormula: this.compiledFormula,
35773
- });
35780
+ return concat(this.compiledFormula.tokens.map((token) => token.value));
35781
+ }
35782
+ }
35783
+ class RangeReferenceToken {
35784
+ getValue;
35785
+ type = "REFERENCE";
35786
+ constructor(getValue) {
35787
+ this.getValue = getValue;
35788
+ }
35789
+ get value() {
35790
+ return this.getValue();
35774
35791
  }
35775
35792
  }
35776
35793
 
@@ -36915,6 +36932,13 @@ class FiltersPlugin extends CorePlugin {
36915
36932
  }
36916
36933
  onDeleteColumnsRows(cmd) {
36917
36934
  for (const table of this.getFilterTables(cmd.sheetId)) {
36935
+ // Remove the filter tables whose data filter headers are in the removed rows.
36936
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
36937
+ const tables = { ...this.tables[cmd.sheetId] };
36938
+ delete tables[table.id];
36939
+ this.history.update("tables", cmd.sheetId, tables);
36940
+ continue;
36941
+ }
36918
36942
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
36919
36943
  if (!zone) {
36920
36944
  const tables = { ...this.tables[cmd.sheetId] };
@@ -39963,6 +39987,13 @@ class Evaluator {
39963
39987
  return (this.evaluatedCells.get(this.encodePosition(position)) ||
39964
39988
  createEvaluatedCell("", { locale: this.getters.getLocale() }));
39965
39989
  }
39990
+ getSpreadPositionsOf(position) {
39991
+ const positionId = this.encodePosition(position);
39992
+ if (!this.spreadingRelations.isArrayFormula(positionId)) {
39993
+ return [];
39994
+ }
39995
+ return Array.from(this.spreadingRelations.getArrayResultPositionIds(positionId)).map(this.decodePosition.bind(this));
39996
+ }
39966
39997
  getArrayFormulaSpreadingOn(position) {
39967
39998
  const positionId = this.encodePosition(position);
39968
39999
  const formulaPosition = this.getArrayFormulaSpreadingOnId(positionId);
@@ -40121,7 +40152,7 @@ class Evaluator {
40121
40152
  const position = this.compilationParams[2].getters.getCellPosition(cellId);
40122
40153
  return toXC(position.col, position.row);
40123
40154
  };
40124
- const formulaReturn = cellData.compiledFormula.execute(cellData.dependencies, ...this.compilationParams);
40155
+ const formulaReturn = cellData.compiledFormula.execute(cellData.compiledFormula.dependencies, ...this.compilationParams);
40125
40156
  if (!isMatrix(formulaReturn)) {
40126
40157
  return createEvaluatedCell(formulaReturn.value, {
40127
40158
  format: cellData.format || formulaReturn.format,
@@ -40221,7 +40252,7 @@ class Evaluator {
40221
40252
  return [];
40222
40253
  }
40223
40254
  const dependencies = [];
40224
- for (const range of cell.dependencies) {
40255
+ for (const range of cell.compiledFormula.dependencies) {
40225
40256
  if (range.invalidSheetName || range.invalidXc) {
40226
40257
  continue;
40227
40258
  }
@@ -40427,6 +40458,7 @@ class EvaluationPlugin extends UIPlugin {
40427
40458
  "getEvaluatedCell",
40428
40459
  "getEvaluatedCells",
40429
40460
  "getEvaluatedCellsInZone",
40461
+ "getSpreadPositionsOf",
40430
40462
  ];
40431
40463
  shouldRebuildDependenciesGraph = true;
40432
40464
  evaluator;
@@ -40536,6 +40568,9 @@ class EvaluationPlugin extends UIPlugin {
40536
40568
  getEvaluatedCellsInZone(sheetId, zone) {
40537
40569
  return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
40538
40570
  }
40571
+ getSpreadPositionsOf(position) {
40572
+ return this.evaluator.getSpreadPositionsOf(position);
40573
+ }
40539
40574
  // ---------------------------------------------------------------------------
40540
40575
  // Export
40541
40576
  // ---------------------------------------------------------------------------
@@ -40573,10 +40608,10 @@ class EvaluationPlugin extends UIPlugin {
40573
40608
  */
40574
40609
  getCorrespondingFormulaCell(position) {
40575
40610
  const cell = this.getters.getCell(position);
40576
- if (cell && cell.content) {
40577
- if (cell.isFormula && !isBadExpression(cell.content)) {
40578
- return cell;
40579
- }
40611
+ if (cell && cell.isFormula) {
40612
+ return isBadExpression(cell.compiledFormula.tokens) ? undefined : cell;
40613
+ }
40614
+ else if (cell && cell.content) {
40580
40615
  return undefined;
40581
40616
  }
40582
40617
  const spreadingFormulaPosition = this.evaluator.getArrayFormulaSpreadingOn(position);
@@ -40593,9 +40628,9 @@ class EvaluationPlugin extends UIPlugin {
40593
40628
  return buildCompilationParameters(this.config.custom, this.getters, (position) => this.evaluator.getEvaluatedCell(position));
40594
40629
  }
40595
40630
  }
40596
- function isBadExpression(formula) {
40631
+ function isBadExpression(tokens) {
40597
40632
  try {
40598
- compile(formula);
40633
+ compileTokens(tokens);
40599
40634
  return false;
40600
40635
  }
40601
40636
  catch (error) {
@@ -40764,22 +40799,20 @@ class EvaluationChartPlugin extends UIPlugin {
40764
40799
  invalidateCFEvaluationCommands.has(cmd.type) ||
40765
40800
  cmd.type === "EVALUATE_CELLS" ||
40766
40801
  cmd.type === "UPDATE_CELL") {
40767
- if (cmd.type !== "UNDO" && cmd.type !== "REDO") {
40768
- for (const chartId in this.charts) {
40769
- this.history.update("charts", chartId, undefined);
40770
- }
40802
+ for (const chartId in this.charts) {
40803
+ this.charts[chartId] = undefined;
40771
40804
  }
40772
40805
  }
40773
40806
  switch (cmd.type) {
40774
40807
  case "UPDATE_CHART":
40775
40808
  case "CREATE_CHART":
40776
40809
  case "DELETE_FIGURE":
40777
- this.history.update("charts", cmd.id, undefined);
40810
+ this.charts[cmd.id] = undefined;
40778
40811
  break;
40779
40812
  case "DELETE_SHEET":
40780
40813
  for (let chartId in this.charts) {
40781
40814
  if (!this.getters.isChartDefined(chartId)) {
40782
- this.history.update("charts", chartId, undefined);
40815
+ this.charts[chartId] = undefined;
40783
40816
  }
40784
40817
  }
40785
40818
  break;
@@ -40791,8 +40824,7 @@ class EvaluationChartPlugin extends UIPlugin {
40791
40824
  if (!chart) {
40792
40825
  throw new Error(`No chart for the given id: ${figureId}`);
40793
40826
  }
40794
- const runtime = this.createRuntimeChart(chart);
40795
- this.history.update("charts", figureId, runtime);
40827
+ this.charts[figureId] = this.createRuntimeChart(chart);
40796
40828
  }
40797
40829
  return this.charts[figureId];
40798
40830
  }
@@ -40944,7 +40976,10 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
40944
40976
  const values = cf.rule.values.map((value, i) => {
40945
40977
  const compiledFormula = formulas[i];
40946
40978
  if (compiledFormula) {
40947
- return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top, compiledFormula, compiledFormula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)));
40979
+ return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top, {
40980
+ ...compiledFormula,
40981
+ dependencies: compiledFormula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
40982
+ });
40948
40983
  }
40949
40984
  return value;
40950
40985
  });
@@ -41316,7 +41351,10 @@ class EvaluationDataValidationPlugin extends UIPlugin {
41316
41351
  }
41317
41352
  try {
41318
41353
  const formula = compile(value);
41319
- const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, formula, formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)));
41354
+ const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, {
41355
+ ...formula,
41356
+ dependencies: formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
41357
+ });
41320
41358
  const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
41321
41359
  return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
41322
41360
  }
@@ -43568,7 +43606,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
43568
43606
  }
43569
43607
  let content = origin.cell.content;
43570
43608
  if (origin.cell.isFormula && operation === "COPY") {
43571
- content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula, origin.cell.dependencies);
43609
+ content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula);
43572
43610
  }
43573
43611
  this.dispatch("UPDATE_CELL", {
43574
43612
  ...target,
@@ -44100,20 +44138,29 @@ class FindAndReplacePlugin extends UIPlugin {
44100
44138
  const sheetId = this.getters.getActiveSheetId();
44101
44139
  const cells = this.getters.getCells(sheetId);
44102
44140
  const matches = [];
44103
- if (this.toSearch) {
44141
+ if (this.toSearch && this.currentSearchRegex) {
44104
44142
  for (const cell of Object.values(cells)) {
44105
44143
  const { col, row } = this.getters.getCellPosition(cell.id);
44144
+ const cellPosition = { sheetId, col, row };
44106
44145
  const isColHidden = this.getters.isColHidden(sheetId, col);
44107
44146
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
44108
44147
  if (isColHidden || isRowHidden) {
44109
44148
  continue;
44110
44149
  }
44111
- if (cell &&
44112
- this.currentSearchRegex &&
44113
- this.currentSearchRegex.test(this.getSearchableString({ sheetId, col, row }))) {
44150
+ if (this.currentSearchRegex.test(this.getSearchableString(cellPosition))) {
44114
44151
  const match = { col, row, selected: false };
44115
44152
  matches.push(match);
44116
44153
  }
44154
+ for (const spreadPosition of this.getters.getSpreadPositionsOf(cellPosition)) {
44155
+ if (this.currentSearchRegex.test(this.getSearchableString(spreadPosition))) {
44156
+ const match = {
44157
+ col: spreadPosition.col,
44158
+ row: spreadPosition.row,
44159
+ selected: false,
44160
+ };
44161
+ matches.push(match);
44162
+ }
44163
+ }
44117
44164
  }
44118
44165
  }
44119
44166
  return matches.sort(this.sortByRowThenColumn);
@@ -44172,16 +44219,19 @@ class FindAndReplacePlugin extends UIPlugin {
44172
44219
  return;
44173
44220
  }
44174
44221
  const sheetId = this.getters.getActiveSheetId();
44175
- const cell = this.getters.getCell({ sheetId, ...selectedMatch });
44176
- const { col, row } = selectedMatch;
44222
+ const position = { sheetId, ...selectedMatch };
44223
+ const cell = this.getters.getCell(position);
44224
+ if (!cell?.content) {
44225
+ return;
44226
+ }
44177
44227
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
44178
44228
  return;
44179
44229
  }
44180
44230
  const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
44181
- const toReplace = this.getSearchableString({ sheetId, col, row });
44231
+ const toReplace = this.getSearchableString(position);
44182
44232
  const content = toReplace.replace(replaceRegex, replaceWith);
44183
44233
  const canonicalContent = canonicalizeNumberContent(content, this.getters.getLocale());
44184
- this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
44234
+ this.dispatch("UPDATE_CELL", { ...position, content: canonicalContent });
44185
44235
  }
44186
44236
  /**
44187
44237
  * Replace the value of the currently selected match
@@ -45756,7 +45806,7 @@ class SortPlugin extends UIPlugin {
45756
45806
  if (cell.isFormula) {
45757
45807
  const position = this.getters.getCellPosition(cell.id);
45758
45808
  // we only have a vertical offset
45759
- content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula, cell.dependencies);
45809
+ content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula);
45760
45810
  }
45761
45811
  newCellValues.style = cell.style;
45762
45812
  newCellValues.content = content;
@@ -47819,6 +47869,8 @@ class FilterEvaluationPlugin extends UIPlugin {
47819
47869
  case "EVALUATE_CELLS":
47820
47870
  case "ACTIVATE_SHEET":
47821
47871
  case "REMOVE_FILTER_TABLE":
47872
+ case "ADD_COLUMNS_ROWS":
47873
+ case "REMOVE_COLUMNS_ROWS":
47822
47874
  this.isEvaluationDirty = true;
47823
47875
  break;
47824
47876
  case "START":
@@ -55828,9 +55880,9 @@ const constants = {
55828
55880
  DEFAULT_LOCALE,
55829
55881
  };
55830
55882
 
55831
- export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
55883
+ export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
55832
55884
 
55833
55885
 
55834
- __info__.version = "17.0.2";
55835
- __info__.date = "2023-11-03T12:22:44.945Z";
55836
- __info__.hash = "3184728";
55886
+ __info__.version = "17.0.3";
55887
+ __info__.date = "2023-11-16T11:59:49.524Z";
55888
+ __info__.hash = "8bd0fb2";