@odoo/o-spreadsheet 17.0.1 → 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.1
6
- * @date 2023-11-02T09:35:50.522Z
7
- * @hash 0887d5b
5
+ * @version 17.0.3
6
+ * @date 2023-11-16T11:59:49.524Z
7
+ * @hash 8bd0fb2
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -4541,14 +4541,14 @@
4541
4541
  switch (context.textBaseline) {
4542
4542
  case "top":
4543
4543
  underlineY += boxHeight - 2 * strokeWidth;
4544
- strikeY += boxHeight - textHeight;
4544
+ strikeY += boxHeight / 2 - strokeWidth;
4545
4545
  break;
4546
4546
  case "middle":
4547
4547
  underlineY += boxHeight / 2 - strokeWidth;
4548
4548
  break;
4549
4549
  case "alphabetic":
4550
4550
  underlineY += 2 * strokeWidth;
4551
- strikeY -= textHeight / 2 - strokeWidth / 2;
4551
+ strikeY -= 3 * strokeWidth;
4552
4552
  break;
4553
4553
  case "bottom":
4554
4554
  underlineY = y;
@@ -5967,7 +5967,7 @@
5967
5967
  return { cellData: {} };
5968
5968
  }
5969
5969
  const sheetId = data.sheetId;
5970
- const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula, cell.dependencies);
5970
+ const content = getters.getTranslatedCellFormula(sheetId, x, y, cell.compiledFormula);
5971
5971
  return {
5972
5972
  cellData: {
5973
5973
  border: data.border,
@@ -10694,6 +10694,17 @@
10694
10694
  const IS_ONLY_ONE_RANGE = (env) => {
10695
10695
  return env.model.getters.getSelectedZones().length === 1;
10696
10696
  };
10697
+ const CAN_INSERT_HEADER = (env, dimension) => {
10698
+ if (!IS_ONLY_ONE_RANGE(env)) {
10699
+ return false;
10700
+ }
10701
+ const activeHeaders = dimension === "COL" ? env.model.getters.getActiveCols() : env.model.getters.getActiveRows();
10702
+ const ortogonalActiveHeaders = dimension === "COL" ? env.model.getters.getActiveRows() : env.model.getters.getActiveCols();
10703
+ const sheetId = env.model.getters.getActiveSheetId();
10704
+ const zone = env.model.getters.getSelectedZone();
10705
+ const allSheetSelected = isEqual(zone, env.model.getters.getSheetZone(sheetId));
10706
+ return isConsecutive(activeHeaders) && (ortogonalActiveHeaders.size === 0 || allSheetSelected);
10707
+ };
10697
10708
 
10698
10709
  const undo = {
10699
10710
  name: _t("Undo"),
@@ -19371,9 +19382,7 @@
19371
19382
  const number = getRowsNumber(env);
19372
19383
  return number === 1 ? _t("Insert row") : _t("Insert %s rows", number.toString());
19373
19384
  },
19374
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19375
- IS_ONLY_ONE_RANGE(env) &&
19376
- env.model.getters.getActiveCols().size === 0,
19385
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19377
19386
  icon: "o-spreadsheet-Icon.INSERT_ROW",
19378
19387
  };
19379
19388
  const rowInsertRowBefore = {
@@ -19382,9 +19391,7 @@
19382
19391
  return number === 1 ? _t("Insert row above") : _t("Insert %s rows above", number.toString());
19383
19392
  },
19384
19393
  execute: INSERT_ROWS_BEFORE_ACTION,
19385
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19386
- IS_ONLY_ONE_RANGE(env) &&
19387
- env.model.getters.getActiveCols().size === 0,
19394
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19388
19395
  icon: "o-spreadsheet-Icon.INSERT_ROW_BEFORE",
19389
19396
  };
19390
19397
  const topBarInsertRowsBefore = {
@@ -19415,9 +19422,7 @@
19415
19422
  const number = getRowsNumber(env);
19416
19423
  return number === 1 ? _t("Insert row below") : _t("Insert %s rows below", number.toString());
19417
19424
  },
19418
- isVisible: (env) => isConsecutive(env.model.getters.getActiveRows()) &&
19419
- IS_ONLY_ONE_RANGE(env) &&
19420
- env.model.getters.getActiveCols().size === 0,
19425
+ isVisible: (env) => CAN_INSERT_HEADER(env, "ROW"),
19421
19426
  icon: "o-spreadsheet-Icon.INSERT_ROW_AFTER",
19422
19427
  };
19423
19428
  const topBarInsertRowsAfter = {
@@ -19435,9 +19440,7 @@
19435
19440
  const number = getColumnsNumber(env);
19436
19441
  return number === 1 ? _t("Insert column") : _t("Insert %s columns", number.toString());
19437
19442
  },
19438
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19439
- IS_ONLY_ONE_RANGE(env) &&
19440
- env.model.getters.getActiveRows().size === 0,
19443
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19441
19444
  icon: "o-spreadsheet-Icon.INSERT_COL",
19442
19445
  };
19443
19446
  const colInsertColsBefore = {
@@ -19448,9 +19451,7 @@
19448
19451
  : _t("Insert %s columns left", number.toString());
19449
19452
  },
19450
19453
  execute: INSERT_COLUMNS_BEFORE_ACTION,
19451
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19452
- IS_ONLY_ONE_RANGE(env) &&
19453
- env.model.getters.getActiveRows().size === 0,
19454
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19454
19455
  icon: "o-spreadsheet-Icon.INSERT_COL_BEFORE",
19455
19456
  };
19456
19457
  const topBarInsertColsBefore = {
@@ -19483,9 +19484,7 @@
19483
19484
  : _t("Insert %s columns right", number.toString());
19484
19485
  },
19485
19486
  execute: INSERT_COLUMNS_AFTER_ACTION,
19486
- isVisible: (env) => isConsecutive(env.model.getters.getActiveCols()) &&
19487
- IS_ONLY_ONE_RANGE(env) &&
19488
- env.model.getters.getActiveRows().size === 0,
19487
+ isVisible: (env) => CAN_INSERT_HEADER(env, "COL"),
19489
19488
  icon: "o-spreadsheet-Icon.INSERT_COL_AFTER",
19490
19489
  };
19491
19490
  const topBarInsertColsAfter = {
@@ -23826,7 +23825,7 @@
23826
23825
  }
23827
23826
  .o-input-count {
23828
23827
  width: fit-content;
23829
- padding: 4 0 4 4;
23828
+ padding: 4px 0 4px 4px;
23830
23829
  }
23831
23830
  }
23832
23831
  }
@@ -34947,6 +34946,9 @@
34947
34946
  // -----------------------------------------------------------------------------
34948
34947
  function compile(formula) {
34949
34948
  const tokens = rangeTokenize(formula);
34949
+ return compileTokens(tokens);
34950
+ }
34951
+ function compileTokens(tokens) {
34950
34952
  const { dependencies, constantValues } = formulaArguments(tokens);
34951
34953
  const cacheKey = compilationCacheKey(tokens, dependencies, constantValues);
34952
34954
  if (!functionCache[cacheKey]) {
@@ -35313,11 +35315,11 @@
35313
35315
  for (const sheet of Object.keys(this.cells)) {
35314
35316
  for (const cell of Object.values(this.cells[sheet] || {})) {
35315
35317
  if (cell.isFormula) {
35316
- for (const range of cell.dependencies) {
35318
+ for (const range of cell.compiledFormula.dependencies) {
35317
35319
  if (!sheetId || range.sheetId === sheetId) {
35318
35320
  const change = applyChange(range);
35319
35321
  if (change.changeType !== "NONE") {
35320
- this.history.update("cells", sheet, cell.id, "dependencies", cell.dependencies.indexOf(range), change.range);
35322
+ this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
35321
35323
  }
35322
35324
  }
35323
35325
  }
@@ -35513,10 +35515,10 @@
35513
35515
  /*
35514
35516
  * Reconstructs the original formula string based on a normalized form and its dependencies
35515
35517
  */
35516
- getFormulaCellContent(sheetId, cell, dependencies) {
35517
- const ranges = dependencies || cell.dependencies;
35518
+ getFormulaCellContent(sheetId, compiledFormula, dependencies) {
35519
+ const ranges = dependencies || compiledFormula.dependencies;
35518
35520
  let rangeIndex = 0;
35519
- return concat(cell.compiledFormula.tokens.map((token) => {
35521
+ return concat(compiledFormula.tokens.map((token) => {
35520
35522
  if (token.type === "REFERENCE") {
35521
35523
  const range = ranges[rangeIndex++];
35522
35524
  return this.getters.getRangeString(range, sheetId);
@@ -35527,12 +35529,9 @@
35527
35529
  /*
35528
35530
  * Constructs a formula string based on an initial formula and a translation vector
35529
35531
  */
35530
- getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula, dependencies) {
35531
- const adaptedDependencies = this.getters.createAdaptedRanges(dependencies, offsetX, offsetY, sheetId);
35532
- return this.getFormulaCellContent(sheetId, {
35533
- compiledFormula,
35534
- dependencies: adaptedDependencies,
35535
- });
35532
+ getTranslatedCellFormula(sheetId, offsetX, offsetY, compiledFormula) {
35533
+ const adaptedDependencies = this.getters.createAdaptedRanges(compiledFormula.dependencies, offsetX, offsetY, sheetId);
35534
+ return this.getFormulaCellContent(sheetId, compiledFormula, adaptedDependencies);
35536
35535
  }
35537
35536
  getCellStyle(position) {
35538
35537
  return this.getters.getCell(position)?.style || {};
@@ -35712,8 +35711,10 @@
35712
35711
  style,
35713
35712
  format,
35714
35713
  isFormula: true,
35715
- compiledFormula,
35716
- dependencies: [],
35714
+ compiledFormula: {
35715
+ ...compiledFormula,
35716
+ dependencies: [],
35717
+ },
35717
35718
  };
35718
35719
  }
35719
35720
  /**
@@ -35722,7 +35723,7 @@
35722
35723
  */
35723
35724
  createFormulaCellWithDependencies(id, compiledFormula, format, style, sheetId) {
35724
35725
  const dependencies = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
35725
- return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.getFormulaCellContent.bind(this));
35726
+ return new FormulaCellWithDependencies(id, compiledFormula, format, style, dependencies, sheetId, this.getters.getRangeString.bind(this));
35726
35727
  }
35727
35728
  createErrorFormula(id, content, format, style, error) {
35728
35729
  return {
@@ -35732,13 +35733,12 @@
35732
35733
  format,
35733
35734
  isFormula: true,
35734
35735
  compiledFormula: {
35735
- dependencies: [],
35736
35736
  tokens: tokenize(content),
35737
+ dependencies: [],
35737
35738
  execute: function () {
35738
35739
  throw error;
35739
35740
  },
35740
35741
  },
35741
- dependencies: [],
35742
35742
  };
35743
35743
  }
35744
35744
  checkCellOutOfSheet(sheetId, col, row) {
@@ -35751,27 +35751,44 @@
35751
35751
  }
35752
35752
  class FormulaCellWithDependencies {
35753
35753
  id;
35754
- compiledFormula;
35755
35754
  format;
35756
35755
  style;
35757
- dependencies;
35758
35756
  sheetId;
35759
- getFormulaCellContent;
35757
+ getRangeString;
35760
35758
  isFormula = true;
35761
- constructor(id, compiledFormula, format, style, dependencies, sheetId, getFormulaCellContent) {
35759
+ compiledFormula;
35760
+ constructor(id, compiledFormula, format, style, dependencies, sheetId, getRangeString) {
35762
35761
  this.id = id;
35763
- this.compiledFormula = compiledFormula;
35764
35762
  this.format = format;
35765
35763
  this.style = style;
35766
- this.dependencies = dependencies;
35767
35764
  this.sheetId = sheetId;
35768
- this.getFormulaCellContent = getFormulaCellContent;
35765
+ this.getRangeString = getRangeString;
35766
+ let rangeIndex = 0;
35767
+ const tokens = compiledFormula.tokens.map((token) => {
35768
+ if (token.type === "REFERENCE") {
35769
+ const index = rangeIndex++;
35770
+ return new RangeReferenceToken(() => this.getRangeString(dependencies[index], this.sheetId));
35771
+ }
35772
+ return token;
35773
+ });
35774
+ this.compiledFormula = {
35775
+ ...compiledFormula,
35776
+ dependencies,
35777
+ tokens,
35778
+ };
35769
35779
  }
35770
35780
  get content() {
35771
- return this.getFormulaCellContent(this.sheetId, {
35772
- dependencies: this.dependencies,
35773
- compiledFormula: this.compiledFormula,
35774
- });
35781
+ return concat(this.compiledFormula.tokens.map((token) => token.value));
35782
+ }
35783
+ }
35784
+ class RangeReferenceToken {
35785
+ getValue;
35786
+ type = "REFERENCE";
35787
+ constructor(getValue) {
35788
+ this.getValue = getValue;
35789
+ }
35790
+ get value() {
35791
+ return this.getValue();
35775
35792
  }
35776
35793
  }
35777
35794
 
@@ -36916,6 +36933,13 @@
36916
36933
  }
36917
36934
  onDeleteColumnsRows(cmd) {
36918
36935
  for (const table of this.getFilterTables(cmd.sheetId)) {
36936
+ // Remove the filter tables whose data filter headers are in the removed rows.
36937
+ if (cmd.dimension === "ROW" && cmd.elements.includes(table.zone.top)) {
36938
+ const tables = { ...this.tables[cmd.sheetId] };
36939
+ delete tables[table.id];
36940
+ this.history.update("tables", cmd.sheetId, tables);
36941
+ continue;
36942
+ }
36919
36943
  const zone = reduceZoneOnDeletion(table.zone, cmd.dimension === "COL" ? "left" : "top", cmd.elements);
36920
36944
  if (!zone) {
36921
36945
  const tables = { ...this.tables[cmd.sheetId] };
@@ -39964,6 +39988,13 @@
39964
39988
  return (this.evaluatedCells.get(this.encodePosition(position)) ||
39965
39989
  createEvaluatedCell("", { locale: this.getters.getLocale() }));
39966
39990
  }
39991
+ getSpreadPositionsOf(position) {
39992
+ const positionId = this.encodePosition(position);
39993
+ if (!this.spreadingRelations.isArrayFormula(positionId)) {
39994
+ return [];
39995
+ }
39996
+ return Array.from(this.spreadingRelations.getArrayResultPositionIds(positionId)).map(this.decodePosition.bind(this));
39997
+ }
39967
39998
  getArrayFormulaSpreadingOn(position) {
39968
39999
  const positionId = this.encodePosition(position);
39969
40000
  const formulaPosition = this.getArrayFormulaSpreadingOnId(positionId);
@@ -40068,9 +40099,6 @@
40068
40099
  }
40069
40100
  }
40070
40101
  setEvaluatedCell(positionId, evaluatedCell) {
40071
- if (this.nextPositionsToUpdate.has(positionId)) {
40072
- this.nextPositionsToUpdate.delete(positionId);
40073
- }
40074
40102
  this.evaluatedCells.set(positionId, evaluatedCell);
40075
40103
  }
40076
40104
  computeCell(positionId) {
@@ -40125,7 +40153,7 @@
40125
40153
  const position = this.compilationParams[2].getters.getCellPosition(cellId);
40126
40154
  return toXC(position.col, position.row);
40127
40155
  };
40128
- const formulaReturn = cellData.compiledFormula.execute(cellData.dependencies, ...this.compilationParams);
40156
+ const formulaReturn = cellData.compiledFormula.execute(cellData.compiledFormula.dependencies, ...this.compilationParams);
40129
40157
  if (!isMatrix(formulaReturn)) {
40130
40158
  return createEvaluatedCell(formulaReturn.value, {
40131
40159
  format: cellData.format || formulaReturn.format,
@@ -40225,7 +40253,7 @@
40225
40253
  return [];
40226
40254
  }
40227
40255
  const dependencies = [];
40228
- for (const range of cell.dependencies) {
40256
+ for (const range of cell.compiledFormula.dependencies) {
40229
40257
  if (range.invalidSheetName || range.invalidXc) {
40230
40258
  continue;
40231
40259
  }
@@ -40431,6 +40459,7 @@
40431
40459
  "getEvaluatedCell",
40432
40460
  "getEvaluatedCells",
40433
40461
  "getEvaluatedCellsInZone",
40462
+ "getSpreadPositionsOf",
40434
40463
  ];
40435
40464
  shouldRebuildDependenciesGraph = true;
40436
40465
  evaluator;
@@ -40540,6 +40569,9 @@
40540
40569
  getEvaluatedCellsInZone(sheetId, zone) {
40541
40570
  return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
40542
40571
  }
40572
+ getSpreadPositionsOf(position) {
40573
+ return this.evaluator.getSpreadPositionsOf(position);
40574
+ }
40543
40575
  // ---------------------------------------------------------------------------
40544
40576
  // Export
40545
40577
  // ---------------------------------------------------------------------------
@@ -40577,10 +40609,10 @@
40577
40609
  */
40578
40610
  getCorrespondingFormulaCell(position) {
40579
40611
  const cell = this.getters.getCell(position);
40580
- if (cell && cell.content) {
40581
- if (cell.isFormula && !isBadExpression(cell.content)) {
40582
- return cell;
40583
- }
40612
+ if (cell && cell.isFormula) {
40613
+ return isBadExpression(cell.compiledFormula.tokens) ? undefined : cell;
40614
+ }
40615
+ else if (cell && cell.content) {
40584
40616
  return undefined;
40585
40617
  }
40586
40618
  const spreadingFormulaPosition = this.evaluator.getArrayFormulaSpreadingOn(position);
@@ -40597,9 +40629,9 @@
40597
40629
  return buildCompilationParameters(this.config.custom, this.getters, (position) => this.evaluator.getEvaluatedCell(position));
40598
40630
  }
40599
40631
  }
40600
- function isBadExpression(formula) {
40632
+ function isBadExpression(tokens) {
40601
40633
  try {
40602
- compile(formula);
40634
+ compileTokens(tokens);
40603
40635
  return false;
40604
40636
  }
40605
40637
  catch (error) {
@@ -40768,22 +40800,20 @@
40768
40800
  invalidateCFEvaluationCommands.has(cmd.type) ||
40769
40801
  cmd.type === "EVALUATE_CELLS" ||
40770
40802
  cmd.type === "UPDATE_CELL") {
40771
- if (cmd.type !== "UNDO" && cmd.type !== "REDO") {
40772
- for (const chartId in this.charts) {
40773
- this.history.update("charts", chartId, undefined);
40774
- }
40803
+ for (const chartId in this.charts) {
40804
+ this.charts[chartId] = undefined;
40775
40805
  }
40776
40806
  }
40777
40807
  switch (cmd.type) {
40778
40808
  case "UPDATE_CHART":
40779
40809
  case "CREATE_CHART":
40780
40810
  case "DELETE_FIGURE":
40781
- this.history.update("charts", cmd.id, undefined);
40811
+ this.charts[cmd.id] = undefined;
40782
40812
  break;
40783
40813
  case "DELETE_SHEET":
40784
40814
  for (let chartId in this.charts) {
40785
40815
  if (!this.getters.isChartDefined(chartId)) {
40786
- this.history.update("charts", chartId, undefined);
40816
+ this.charts[chartId] = undefined;
40787
40817
  }
40788
40818
  }
40789
40819
  break;
@@ -40795,8 +40825,7 @@
40795
40825
  if (!chart) {
40796
40826
  throw new Error(`No chart for the given id: ${figureId}`);
40797
40827
  }
40798
- const runtime = this.createRuntimeChart(chart);
40799
- this.history.update("charts", figureId, runtime);
40828
+ this.charts[figureId] = this.createRuntimeChart(chart);
40800
40829
  }
40801
40830
  return this.charts[figureId];
40802
40831
  }
@@ -40948,7 +40977,10 @@
40948
40977
  const values = cf.rule.values.map((value, i) => {
40949
40978
  const compiledFormula = formulas[i];
40950
40979
  if (compiledFormula) {
40951
- return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top, compiledFormula, compiledFormula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)));
40980
+ return this.getters.getTranslatedCellFormula(sheetId, col - zone.left, row - zone.top, {
40981
+ ...compiledFormula,
40982
+ dependencies: compiledFormula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
40983
+ });
40952
40984
  }
40953
40985
  return value;
40954
40986
  });
@@ -41320,7 +41352,10 @@
41320
41352
  }
41321
41353
  try {
41322
41354
  const formula = compile(value);
41323
- const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, formula, formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)));
41355
+ const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, {
41356
+ ...formula,
41357
+ dependencies: formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)),
41358
+ });
41324
41359
  const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
41325
41360
  return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
41326
41361
  }
@@ -43572,7 +43607,7 @@
43572
43607
  }
43573
43608
  let content = origin.cell.content;
43574
43609
  if (origin.cell.isFormula && operation === "COPY") {
43575
- content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula, origin.cell.dependencies);
43610
+ content = this.getters.getTranslatedCellFormula(sheetId, col - origin.position.col, row - origin.position.row, origin.cell.compiledFormula);
43576
43611
  }
43577
43612
  this.dispatch("UPDATE_CELL", {
43578
43613
  ...target,
@@ -44104,20 +44139,29 @@
44104
44139
  const sheetId = this.getters.getActiveSheetId();
44105
44140
  const cells = this.getters.getCells(sheetId);
44106
44141
  const matches = [];
44107
- if (this.toSearch) {
44142
+ if (this.toSearch && this.currentSearchRegex) {
44108
44143
  for (const cell of Object.values(cells)) {
44109
44144
  const { col, row } = this.getters.getCellPosition(cell.id);
44145
+ const cellPosition = { sheetId, col, row };
44110
44146
  const isColHidden = this.getters.isColHidden(sheetId, col);
44111
44147
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
44112
44148
  if (isColHidden || isRowHidden) {
44113
44149
  continue;
44114
44150
  }
44115
- if (cell &&
44116
- this.currentSearchRegex &&
44117
- this.currentSearchRegex.test(this.getSearchableString({ sheetId, col, row }))) {
44151
+ if (this.currentSearchRegex.test(this.getSearchableString(cellPosition))) {
44118
44152
  const match = { col, row, selected: false };
44119
44153
  matches.push(match);
44120
44154
  }
44155
+ for (const spreadPosition of this.getters.getSpreadPositionsOf(cellPosition)) {
44156
+ if (this.currentSearchRegex.test(this.getSearchableString(spreadPosition))) {
44157
+ const match = {
44158
+ col: spreadPosition.col,
44159
+ row: spreadPosition.row,
44160
+ selected: false,
44161
+ };
44162
+ matches.push(match);
44163
+ }
44164
+ }
44121
44165
  }
44122
44166
  }
44123
44167
  return matches.sort(this.sortByRowThenColumn);
@@ -44176,16 +44220,19 @@
44176
44220
  return;
44177
44221
  }
44178
44222
  const sheetId = this.getters.getActiveSheetId();
44179
- const cell = this.getters.getCell({ sheetId, ...selectedMatch });
44180
- const { col, row } = selectedMatch;
44223
+ const position = { sheetId, ...selectedMatch };
44224
+ const cell = this.getters.getCell(position);
44225
+ if (!cell?.content) {
44226
+ return;
44227
+ }
44181
44228
  if (cell?.isFormula && !this.searchOptions.searchFormulas) {
44182
44229
  return;
44183
44230
  }
44184
44231
  const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
44185
- const toReplace = this.getSearchableString({ sheetId, col, row });
44232
+ const toReplace = this.getSearchableString(position);
44186
44233
  const content = toReplace.replace(replaceRegex, replaceWith);
44187
44234
  const canonicalContent = canonicalizeNumberContent(content, this.getters.getLocale());
44188
- this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
44235
+ this.dispatch("UPDATE_CELL", { ...position, content: canonicalContent });
44189
44236
  }
44190
44237
  /**
44191
44238
  * Replace the value of the currently selected match
@@ -45760,7 +45807,7 @@
45760
45807
  if (cell.isFormula) {
45761
45808
  const position = this.getters.getCellPosition(cell.id);
45762
45809
  // we only have a vertical offset
45763
- content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula, cell.dependencies);
45810
+ content = this.getters.getTranslatedCellFormula(sheetId, 0, newRow - position.row, cell.compiledFormula);
45764
45811
  }
45765
45812
  newCellValues.style = cell.style;
45766
45813
  newCellValues.content = content;
@@ -47823,6 +47870,8 @@
47823
47870
  case "EVALUATE_CELLS":
47824
47871
  case "ACTIVATE_SHEET":
47825
47872
  case "REMOVE_FILTER_TABLE":
47873
+ case "ADD_COLUMNS_ROWS":
47874
+ case "REMOVE_COLUMNS_ROWS":
47826
47875
  this.isEvaluationDirty = true;
47827
47876
  break;
47828
47877
  case "START":
@@ -55846,6 +55895,7 @@
55846
55895
  exports.addFunction = addFunction;
55847
55896
  exports.astToFormula = astToFormula;
55848
55897
  exports.compile = compile;
55898
+ exports.compileTokens = compileTokens;
55849
55899
  exports.components = components;
55850
55900
  exports.constants = constants;
55851
55901
  exports.convertAstNodes = convertAstNodes;
@@ -55861,6 +55911,7 @@
55861
55911
  exports.links = links;
55862
55912
  exports.load = load;
55863
55913
  exports.parse = parse;
55914
+ exports.parseTokens = parseTokens;
55864
55915
  exports.readonlyAllowedCommands = readonlyAllowedCommands;
55865
55916
  exports.registries = registries;
55866
55917
  exports.setDefaultSheetViewSize = setDefaultSheetViewSize;
@@ -55868,9 +55919,9 @@
55868
55919
  exports.tokenize = tokenize;
55869
55920
 
55870
55921
 
55871
- __info__.version = "17.0.1";
55872
- __info__.date = "2023-11-02T09:35:50.522Z";
55873
- __info__.hash = "0887d5b";
55922
+ __info__.version = "17.0.3";
55923
+ __info__.date = "2023-11-16T11:59:49.524Z";
55924
+ __info__.hash = "8bd0fb2";
55874
55925
 
55875
55926
 
55876
55927
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);