@odoo/o-spreadsheet 16.4.7 → 16.4.9

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.
@@ -1197,7 +1197,17 @@ const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
1197
1197
  function isDateTime(str, locale) {
1198
1198
  return parseDateTime(str, locale) !== null;
1199
1199
  }
1200
+ const CACHE = new Map();
1200
1201
  function parseDateTime(str, locale) {
1202
+ if (!CACHE.has(locale)) {
1203
+ CACHE.set(locale, new Map());
1204
+ }
1205
+ if (!CACHE.get(locale).has(str)) {
1206
+ CACHE.get(locale).set(str, _parseDateTime(str, locale));
1207
+ }
1208
+ return CACHE.get(locale).get(str);
1209
+ }
1210
+ function _parseDateTime(str, locale) {
1201
1211
  str = str.trim();
1202
1212
  let time = null;
1203
1213
  const timeMatch = str.match(timeRegexp);
@@ -3016,8 +3026,9 @@ class RangeImpl {
3016
3026
  }
3017
3027
  get zone() {
3018
3028
  const { left, top, bottom, right } = this._zone;
3019
- if (right !== undefined && bottom !== undefined)
3020
- return { left, top, right, bottom };
3029
+ if (right !== undefined && bottom !== undefined) {
3030
+ return this._zone;
3031
+ }
3021
3032
  else if (bottom === undefined && right !== undefined) {
3022
3033
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
3023
3034
  }
@@ -4287,7 +4298,7 @@ var LAYERS;
4287
4298
  const SORT_TYPES_ORDER = ["number", "string", "boolean", "undefined"];
4288
4299
  function assert(condition, message) {
4289
4300
  if (!condition()) {
4290
- throw new Error(message);
4301
+ throw new EvaluationError(CellErrorType.GenericError, message);
4291
4302
  }
4292
4303
  }
4293
4304
  // -----------------------------------------------------------------------------
@@ -4932,7 +4943,7 @@ function _createEvaluatedCell(value, localeFormat) {
4932
4943
  return textCell((value || "").toString(), localeFormat);
4933
4944
  }
4934
4945
  catch (error) {
4935
- return errorCell((value || "").toString(), new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
4946
+ return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
4936
4947
  }
4937
4948
  }
4938
4949
  function textCell(value, localeFormat) {
@@ -4999,7 +5010,7 @@ function booleanCell(value, localeFormat) {
4999
5010
  formattedValue,
5000
5011
  };
5001
5012
  }
5002
- function errorCell(content, error) {
5013
+ function errorCell(error) {
5003
5014
  return {
5004
5015
  type: CellValueType.error,
5005
5016
  value: error.errorType,
@@ -5449,6 +5460,9 @@ class FilterMenu extends owl.Component {
5449
5460
  });
5450
5461
  this.state.values = this.getFilterValues(this.props.filterPosition);
5451
5462
  }
5463
+ get isReadonly() {
5464
+ return this.env.model.getters.isReadonly();
5465
+ }
5452
5466
  getFilterValues(position) {
5453
5467
  const sheetId = this.env.model.getters.getActiveSheetId();
5454
5468
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -22798,7 +22812,6 @@ class FindAndReplacePanel extends owl.Component {
22798
22812
  state = owl.useState(this.initialState());
22799
22813
  debounceTimeoutId;
22800
22814
  showFormulaState = false;
22801
- debouncedUpdateSearch;
22802
22815
  findAndReplaceRef = owl.useRef("findAndReplace");
22803
22816
  get hasSearchResult() {
22804
22817
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -22808,9 +22821,9 @@ class FindAndReplacePanel extends owl.Component {
22808
22821
  }
22809
22822
  setup() {
22810
22823
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
22811
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
22812
22824
  owl.onMounted(() => this.focusInput());
22813
22825
  owl.onWillUnmount(() => {
22826
+ clearTimeout(this.debounceTimeoutId);
22814
22827
  this.env.model.dispatch("CLEAR_SEARCH");
22815
22828
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
22816
22829
  });
@@ -22855,6 +22868,13 @@ class FindAndReplacePanel extends owl.Component {
22855
22868
  searchOptions: this.state.searchOptions,
22856
22869
  });
22857
22870
  }
22871
+ debouncedUpdateSearch() {
22872
+ clearTimeout(this.debounceTimeoutId);
22873
+ this.debounceTimeoutId = setTimeout(() => {
22874
+ this.updateSearch();
22875
+ this.debounceTimeoutId = undefined;
22876
+ }, 200);
22877
+ }
22858
22878
  replace() {
22859
22879
  this.env.model.dispatch("REPLACE_SEARCH", {
22860
22880
  replaceWith: this.state.replaceWith,
@@ -31812,10 +31832,11 @@ class CellPlugin extends CorePlugin {
31812
31832
  * Reconstructs the original formula string based on a normalized form and its dependencies
31813
31833
  */
31814
31834
  buildFormulaContent(sheetId, cell, dependencies) {
31815
- const ranges = dependencies || [...cell.dependencies];
31835
+ const ranges = dependencies || cell.dependencies;
31836
+ let rangeIndex = 0;
31816
31837
  return concat(cell.compiledFormula.tokens.map((token) => {
31817
31838
  if (token.type === "REFERENCE") {
31818
- const range = ranges.shift();
31839
+ const range = ranges[rangeIndex++];
31819
31840
  return this.getters.getRangeString(range, sheetId);
31820
31841
  }
31821
31842
  return token.value;
@@ -35423,7 +35444,7 @@ class CompilationParametersBuilder {
35423
35444
  const evaluatedCell = this.getEvaluatedCell(position);
35424
35445
  if (evaluatedCell.type === CellValueType.empty) {
35425
35446
  const cell = this.getters.getCell(position);
35426
- if (!cell || cell.content === "") {
35447
+ if (!cell || (!cell.isFormula && cell.content === "")) {
35427
35448
  return undefined;
35428
35449
  }
35429
35450
  }
@@ -35643,7 +35664,7 @@ class Evaluator {
35643
35664
  constructor(context, getters) {
35644
35665
  this.context = context;
35645
35666
  this.getters = getters;
35646
- this.compilationParams = buildCompilationParameters(context, getters, (position) => this.computeCell(this.encodePosition(position)));
35667
+ this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
35647
35668
  }
35648
35669
  getEvaluatedCell(position) {
35649
35670
  return (this.evaluatedCells.get(this.encodePosition(position)) ||
@@ -35671,7 +35692,7 @@ class Evaluator {
35671
35692
  this.formulaDependencies().addDependencies(positionId, dependencies);
35672
35693
  }
35673
35694
  updateCompilationParameters() {
35674
- this.compilationParams = buildCompilationParameters(this.context, this.getters, (position) => this.computeCell(this.encodePosition(position)));
35695
+ this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
35675
35696
  }
35676
35697
  evaluateCells(positions) {
35677
35698
  const cells = positions.map(this.encodePosition.bind(this));
@@ -35787,15 +35808,21 @@ class Evaluator {
35787
35808
  this.cellsBeingComputed.delete(cellId);
35788
35809
  }
35789
35810
  }
35811
+ computeAndSave(position) {
35812
+ const positionId = this.encodePosition(position);
35813
+ const evaluatedCell = this.computeCell(positionId);
35814
+ if (!this.evaluatedCells.has(positionId)) {
35815
+ this.setEvaluatedCell(positionId, evaluatedCell);
35816
+ }
35817
+ return evaluatedCell;
35818
+ }
35790
35819
  handleError(e, cell) {
35791
- if (!(e instanceof Error)) {
35792
- e = new Error(e);
35820
+ if (!(e instanceof EvaluationError)) {
35821
+ e = new EvaluationError(CellErrorType.GenericError, e.message);
35793
35822
  }
35794
- const msg = e?.errorType || CellErrorType.GenericError;
35795
- // apply function name
35796
35823
  const __lastFnCalled = this.compilationParams[2].__lastFnCalled || "";
35797
- const error = new EvaluationError(msg, e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled), e.logLevel !== undefined ? e.logLevel : CellErrorLevel.error);
35798
- return errorCell(cell.content, error);
35824
+ e.message = e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled);
35825
+ return errorCell(e);
35799
35826
  }
35800
35827
  computeFormulaCell(cellData) {
35801
35828
  const cellId = cellData.id;
@@ -38694,14 +38721,10 @@ class FindAndReplacePlugin extends UIPlugin {
38694
38721
  case "REPLACE_ALL_SEARCH":
38695
38722
  this.replaceAll(cmd.replaceWith);
38696
38723
  break;
38697
- case "EVALUATE_CELLS":
38698
- case "UPDATE_CELL":
38699
- case "REMOVE_FILTER_TABLE":
38700
- case "UPDATE_FILTER":
38701
- this.isSearchDirty = true;
38702
- break;
38703
38724
  case "UNDO":
38704
38725
  case "REDO":
38726
+ case "REMOVE_FILTER_TABLE":
38727
+ case "UPDATE_FILTER":
38705
38728
  case "REMOVE_COLUMNS_ROWS":
38706
38729
  case "HIDE_COLUMNS_ROWS":
38707
38730
  case "UNHIDE_COLUMNS_ROWS":
@@ -41362,7 +41385,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41362
41385
  });
41363
41386
  for (const filterTable of this.copiedTables) {
41364
41387
  this.dispatch("REMOVE_FILTER_TABLE", {
41365
- sheetId: this.getters.getActiveSheetId(),
41388
+ sheetId: this.sheetId,
41366
41389
  target: [filterTable.zone],
41367
41390
  });
41368
41391
  }
@@ -43903,30 +43926,26 @@ class InternalViewport {
43903
43926
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
43904
43927
  const maxCol = this.getters.getNumberCols(sheetId);
43905
43928
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
43906
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
43907
- if (col > maxCol) {
43908
- break;
43909
- }
43910
- if (this.getters.isColHidden(sheetId, col)) {
43911
- continue;
43912
- }
43913
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
43914
- this.offsetScrollbarX = this.offsetX;
43915
- this.adjustViewportZoneX();
43929
+ let finalTarget = targetCol;
43930
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
43931
+ finalTarget++;
43916
43932
  }
43933
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
43934
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
43935
+ this.offsetX =
43936
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
43937
+ this.offsetScrollbarX = this.offsetX;
43938
+ this.adjustViewportZoneX();
43917
43939
  }
43918
43940
  else if (this.left > targetCol) {
43919
- for (let col = this.left; col >= targetCol; col--) {
43920
- if (col < 0) {
43921
- break;
43922
- }
43923
- if (this.getters.isColHidden(sheetId, col)) {
43924
- continue;
43925
- }
43926
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
43927
- this.offsetScrollbarX = this.offsetX;
43928
- this.adjustViewportZoneX();
43941
+ let finalTarget = targetCol;
43942
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
43943
+ finalTarget--;
43929
43944
  }
43945
+ this.offsetX =
43946
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
43947
+ this.offsetScrollbarX = this.offsetX;
43948
+ this.adjustViewportZoneX();
43930
43949
  }
43931
43950
  }
43932
43951
  adjustPositionY(targetRow) {
@@ -43934,30 +43953,26 @@ class InternalViewport {
43934
43953
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
43935
43954
  const maxRow = this.getters.getNumberRows(sheetId);
43936
43955
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
43937
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
43938
- if (row > maxRow) {
43939
- break;
43940
- }
43941
- if (this.getters.isRowHidden(sheetId, row)) {
43942
- continue;
43943
- }
43944
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
43945
- this.offsetScrollbarY = this.offsetY;
43946
- this.adjustViewportZoneY();
43956
+ let finalTarget = targetRow;
43957
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
43958
+ finalTarget++;
43947
43959
  }
43960
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
43961
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
43962
+ this.offsetY =
43963
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
43964
+ this.offsetScrollbarY = this.offsetY;
43965
+ this.adjustViewportZoneY();
43948
43966
  }
43949
43967
  else if (this.top > targetRow) {
43950
- for (let row = this.top; row >= targetRow; row--) {
43951
- if (row < 0) {
43952
- break;
43953
- }
43954
- if (this.getters.isRowHidden(sheetId, row)) {
43955
- continue;
43956
- }
43957
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
43958
- this.offsetScrollbarY = this.offsetY;
43959
- this.adjustViewportZoneY();
43968
+ let finalTarget = targetRow;
43969
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
43970
+ finalTarget--;
43960
43971
  }
43972
+ this.offsetY =
43973
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
43974
+ this.offsetScrollbarY = this.offsetY;
43975
+ this.adjustViewportZoneY();
43961
43976
  }
43962
43977
  }
43963
43978
  setViewportOffset(offsetX, offsetY) {
@@ -50696,6 +50711,6 @@ exports.setTranslationMethod = setTranslationMethod;
50696
50711
  exports.tokenize = tokenize;
50697
50712
 
50698
50713
 
50699
- __info__.version = '16.4.7';
50700
- __info__.date = '2023-09-21T15:58:11.039Z';
50701
- __info__.hash = 'eccdcce';
50714
+ __info__.version = '16.4.9';
50715
+ __info__.date = '2023-10-10T07:28:12.772Z';
50716
+ __info__.hash = '998c612';
@@ -962,7 +962,7 @@ declare class RangeImpl implements Range {
962
962
  constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
963
963
  static fromRange(range: Range, getters: CoreGetters): RangeImpl;
964
964
  get unboundedZone(): UnboundedZone;
965
- get zone(): Zone;
965
+ get zone(): Readonly<Zone>;
966
966
  static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
967
967
  get isFullCol(): boolean;
968
968
  get isFullRow(): boolean;
@@ -1193,7 +1193,17 @@ const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
1193
1193
  function isDateTime(str, locale) {
1194
1194
  return parseDateTime(str, locale) !== null;
1195
1195
  }
1196
+ const CACHE = new Map();
1196
1197
  function parseDateTime(str, locale) {
1198
+ if (!CACHE.has(locale)) {
1199
+ CACHE.set(locale, new Map());
1200
+ }
1201
+ if (!CACHE.get(locale).has(str)) {
1202
+ CACHE.get(locale).set(str, _parseDateTime(str, locale));
1203
+ }
1204
+ return CACHE.get(locale).get(str);
1205
+ }
1206
+ function _parseDateTime(str, locale) {
1197
1207
  str = str.trim();
1198
1208
  let time = null;
1199
1209
  const timeMatch = str.match(timeRegexp);
@@ -3012,8 +3022,9 @@ class RangeImpl {
3012
3022
  }
3013
3023
  get zone() {
3014
3024
  const { left, top, bottom, right } = this._zone;
3015
- if (right !== undefined && bottom !== undefined)
3016
- return { left, top, right, bottom };
3025
+ if (right !== undefined && bottom !== undefined) {
3026
+ return this._zone;
3027
+ }
3017
3028
  else if (bottom === undefined && right !== undefined) {
3018
3029
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
3019
3030
  }
@@ -4283,7 +4294,7 @@ var LAYERS;
4283
4294
  const SORT_TYPES_ORDER = ["number", "string", "boolean", "undefined"];
4284
4295
  function assert(condition, message) {
4285
4296
  if (!condition()) {
4286
- throw new Error(message);
4297
+ throw new EvaluationError(CellErrorType.GenericError, message);
4287
4298
  }
4288
4299
  }
4289
4300
  // -----------------------------------------------------------------------------
@@ -4928,7 +4939,7 @@ function _createEvaluatedCell(value, localeFormat) {
4928
4939
  return textCell((value || "").toString(), localeFormat);
4929
4940
  }
4930
4941
  catch (error) {
4931
- return errorCell((value || "").toString(), new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
4942
+ return errorCell(new EvaluationError(CellErrorType.GenericError, error.message || DEFAULT_ERROR_MESSAGE));
4932
4943
  }
4933
4944
  }
4934
4945
  function textCell(value, localeFormat) {
@@ -4995,7 +5006,7 @@ function booleanCell(value, localeFormat) {
4995
5006
  formattedValue,
4996
5007
  };
4997
5008
  }
4998
- function errorCell(content, error) {
5009
+ function errorCell(error) {
4999
5010
  return {
5000
5011
  type: CellValueType.error,
5001
5012
  value: error.errorType,
@@ -5445,6 +5456,9 @@ class FilterMenu extends Component {
5445
5456
  });
5446
5457
  this.state.values = this.getFilterValues(this.props.filterPosition);
5447
5458
  }
5459
+ get isReadonly() {
5460
+ return this.env.model.getters.isReadonly();
5461
+ }
5448
5462
  getFilterValues(position) {
5449
5463
  const sheetId = this.env.model.getters.getActiveSheetId();
5450
5464
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -22794,7 +22808,6 @@ class FindAndReplacePanel extends Component {
22794
22808
  state = useState(this.initialState());
22795
22809
  debounceTimeoutId;
22796
22810
  showFormulaState = false;
22797
- debouncedUpdateSearch;
22798
22811
  findAndReplaceRef = useRef("findAndReplace");
22799
22812
  get hasSearchResult() {
22800
22813
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -22804,9 +22817,9 @@ class FindAndReplacePanel extends Component {
22804
22817
  }
22805
22818
  setup() {
22806
22819
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
22807
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
22808
22820
  onMounted(() => this.focusInput());
22809
22821
  onWillUnmount(() => {
22822
+ clearTimeout(this.debounceTimeoutId);
22810
22823
  this.env.model.dispatch("CLEAR_SEARCH");
22811
22824
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
22812
22825
  });
@@ -22851,6 +22864,13 @@ class FindAndReplacePanel extends Component {
22851
22864
  searchOptions: this.state.searchOptions,
22852
22865
  });
22853
22866
  }
22867
+ debouncedUpdateSearch() {
22868
+ clearTimeout(this.debounceTimeoutId);
22869
+ this.debounceTimeoutId = setTimeout(() => {
22870
+ this.updateSearch();
22871
+ this.debounceTimeoutId = undefined;
22872
+ }, 200);
22873
+ }
22854
22874
  replace() {
22855
22875
  this.env.model.dispatch("REPLACE_SEARCH", {
22856
22876
  replaceWith: this.state.replaceWith,
@@ -31808,10 +31828,11 @@ class CellPlugin extends CorePlugin {
31808
31828
  * Reconstructs the original formula string based on a normalized form and its dependencies
31809
31829
  */
31810
31830
  buildFormulaContent(sheetId, cell, dependencies) {
31811
- const ranges = dependencies || [...cell.dependencies];
31831
+ const ranges = dependencies || cell.dependencies;
31832
+ let rangeIndex = 0;
31812
31833
  return concat(cell.compiledFormula.tokens.map((token) => {
31813
31834
  if (token.type === "REFERENCE") {
31814
- const range = ranges.shift();
31835
+ const range = ranges[rangeIndex++];
31815
31836
  return this.getters.getRangeString(range, sheetId);
31816
31837
  }
31817
31838
  return token.value;
@@ -35419,7 +35440,7 @@ class CompilationParametersBuilder {
35419
35440
  const evaluatedCell = this.getEvaluatedCell(position);
35420
35441
  if (evaluatedCell.type === CellValueType.empty) {
35421
35442
  const cell = this.getters.getCell(position);
35422
- if (!cell || cell.content === "") {
35443
+ if (!cell || (!cell.isFormula && cell.content === "")) {
35423
35444
  return undefined;
35424
35445
  }
35425
35446
  }
@@ -35639,7 +35660,7 @@ class Evaluator {
35639
35660
  constructor(context, getters) {
35640
35661
  this.context = context;
35641
35662
  this.getters = getters;
35642
- this.compilationParams = buildCompilationParameters(context, getters, (position) => this.computeCell(this.encodePosition(position)));
35663
+ this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
35643
35664
  }
35644
35665
  getEvaluatedCell(position) {
35645
35666
  return (this.evaluatedCells.get(this.encodePosition(position)) ||
@@ -35667,7 +35688,7 @@ class Evaluator {
35667
35688
  this.formulaDependencies().addDependencies(positionId, dependencies);
35668
35689
  }
35669
35690
  updateCompilationParameters() {
35670
- this.compilationParams = buildCompilationParameters(this.context, this.getters, (position) => this.computeCell(this.encodePosition(position)));
35691
+ this.compilationParams = buildCompilationParameters(this.context, this.getters, this.computeAndSave.bind(this));
35671
35692
  }
35672
35693
  evaluateCells(positions) {
35673
35694
  const cells = positions.map(this.encodePosition.bind(this));
@@ -35783,15 +35804,21 @@ class Evaluator {
35783
35804
  this.cellsBeingComputed.delete(cellId);
35784
35805
  }
35785
35806
  }
35807
+ computeAndSave(position) {
35808
+ const positionId = this.encodePosition(position);
35809
+ const evaluatedCell = this.computeCell(positionId);
35810
+ if (!this.evaluatedCells.has(positionId)) {
35811
+ this.setEvaluatedCell(positionId, evaluatedCell);
35812
+ }
35813
+ return evaluatedCell;
35814
+ }
35786
35815
  handleError(e, cell) {
35787
- if (!(e instanceof Error)) {
35788
- e = new Error(e);
35816
+ if (!(e instanceof EvaluationError)) {
35817
+ e = new EvaluationError(CellErrorType.GenericError, e.message);
35789
35818
  }
35790
- const msg = e?.errorType || CellErrorType.GenericError;
35791
- // apply function name
35792
35819
  const __lastFnCalled = this.compilationParams[2].__lastFnCalled || "";
35793
- const error = new EvaluationError(msg, e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled), e.logLevel !== undefined ? e.logLevel : CellErrorLevel.error);
35794
- return errorCell(cell.content, error);
35820
+ e.message = e.message.replace("[[FUNCTION_NAME]]", __lastFnCalled);
35821
+ return errorCell(e);
35795
35822
  }
35796
35823
  computeFormulaCell(cellData) {
35797
35824
  const cellId = cellData.id;
@@ -38690,14 +38717,10 @@ class FindAndReplacePlugin extends UIPlugin {
38690
38717
  case "REPLACE_ALL_SEARCH":
38691
38718
  this.replaceAll(cmd.replaceWith);
38692
38719
  break;
38693
- case "EVALUATE_CELLS":
38694
- case "UPDATE_CELL":
38695
- case "REMOVE_FILTER_TABLE":
38696
- case "UPDATE_FILTER":
38697
- this.isSearchDirty = true;
38698
- break;
38699
38720
  case "UNDO":
38700
38721
  case "REDO":
38722
+ case "REMOVE_FILTER_TABLE":
38723
+ case "UPDATE_FILTER":
38701
38724
  case "REMOVE_COLUMNS_ROWS":
38702
38725
  case "HIDE_COLUMNS_ROWS":
38703
38726
  case "UNHIDE_COLUMNS_ROWS":
@@ -41358,7 +41381,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41358
41381
  });
41359
41382
  for (const filterTable of this.copiedTables) {
41360
41383
  this.dispatch("REMOVE_FILTER_TABLE", {
41361
- sheetId: this.getters.getActiveSheetId(),
41384
+ sheetId: this.sheetId,
41362
41385
  target: [filterTable.zone],
41363
41386
  });
41364
41387
  }
@@ -43899,30 +43922,26 @@ class InternalViewport {
43899
43922
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
43900
43923
  const maxCol = this.getters.getNumberCols(sheetId);
43901
43924
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
43902
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
43903
- if (col > maxCol) {
43904
- break;
43905
- }
43906
- if (this.getters.isColHidden(sheetId, col)) {
43907
- continue;
43908
- }
43909
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
43910
- this.offsetScrollbarX = this.offsetX;
43911
- this.adjustViewportZoneX();
43925
+ let finalTarget = targetCol;
43926
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
43927
+ finalTarget++;
43912
43928
  }
43929
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
43930
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
43931
+ this.offsetX =
43932
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
43933
+ this.offsetScrollbarX = this.offsetX;
43934
+ this.adjustViewportZoneX();
43913
43935
  }
43914
43936
  else if (this.left > targetCol) {
43915
- for (let col = this.left; col >= targetCol; col--) {
43916
- if (col < 0) {
43917
- break;
43918
- }
43919
- if (this.getters.isColHidden(sheetId, col)) {
43920
- continue;
43921
- }
43922
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
43923
- this.offsetScrollbarX = this.offsetX;
43924
- this.adjustViewportZoneX();
43937
+ let finalTarget = targetCol;
43938
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
43939
+ finalTarget--;
43925
43940
  }
43941
+ this.offsetX =
43942
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
43943
+ this.offsetScrollbarX = this.offsetX;
43944
+ this.adjustViewportZoneX();
43926
43945
  }
43927
43946
  }
43928
43947
  adjustPositionY(targetRow) {
@@ -43930,30 +43949,26 @@ class InternalViewport {
43930
43949
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
43931
43950
  const maxRow = this.getters.getNumberRows(sheetId);
43932
43951
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
43933
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
43934
- if (row > maxRow) {
43935
- break;
43936
- }
43937
- if (this.getters.isRowHidden(sheetId, row)) {
43938
- continue;
43939
- }
43940
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
43941
- this.offsetScrollbarY = this.offsetY;
43942
- this.adjustViewportZoneY();
43952
+ let finalTarget = targetRow;
43953
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
43954
+ finalTarget++;
43943
43955
  }
43956
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
43957
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
43958
+ this.offsetY =
43959
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
43960
+ this.offsetScrollbarY = this.offsetY;
43961
+ this.adjustViewportZoneY();
43944
43962
  }
43945
43963
  else if (this.top > targetRow) {
43946
- for (let row = this.top; row >= targetRow; row--) {
43947
- if (row < 0) {
43948
- break;
43949
- }
43950
- if (this.getters.isRowHidden(sheetId, row)) {
43951
- continue;
43952
- }
43953
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
43954
- this.offsetScrollbarY = this.offsetY;
43955
- this.adjustViewportZoneY();
43964
+ let finalTarget = targetRow;
43965
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
43966
+ finalTarget--;
43956
43967
  }
43968
+ this.offsetY =
43969
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
43970
+ this.offsetScrollbarY = this.offsetY;
43971
+ this.adjustViewportZoneY();
43957
43972
  }
43958
43973
  }
43959
43974
  setViewportOffset(offsetX, offsetY) {
@@ -50660,6 +50675,6 @@ const constants = {
50660
50675
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
50661
50676
 
50662
50677
 
50663
- __info__.version = '16.4.7';
50664
- __info__.date = '2023-09-21T15:58:11.039Z';
50665
- __info__.hash = 'eccdcce';
50678
+ __info__.version = '16.4.9';
50679
+ __info__.date = '2023-10-10T07:28:12.772Z';
50680
+ __info__.hash = '998c612';