@odoo/o-spreadsheet 16.2.16 → 16.2.18

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.
@@ -302,7 +302,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
302
302
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
303
303
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
304
304
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
305
+ const CACHE = {};
305
306
  function parseDateTime(str) {
307
+ if (str in CACHE) {
308
+ return CACHE[str];
309
+ }
310
+ const date = _parseDateTime(str);
311
+ CACHE[str] = date;
312
+ return date;
313
+ }
314
+ function _parseDateTime(str) {
306
315
  str = str.trim();
307
316
  let time;
308
317
  const timeMatch = str.match(timeRegexp);
@@ -2144,8 +2153,9 @@ class RangeImpl {
2144
2153
  }
2145
2154
  get zone() {
2146
2155
  const { left, top, bottom, right } = this._zone;
2147
- if (right !== undefined && bottom !== undefined)
2148
- return { left, top, right, bottom };
2156
+ if (right !== undefined && bottom !== undefined) {
2157
+ return this._zone;
2158
+ }
2149
2159
  else if (bottom === undefined && right !== undefined) {
2150
2160
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2151
2161
  }
@@ -4869,6 +4879,9 @@ class FilterMenu extends owl.Component {
4869
4879
  });
4870
4880
  this.state.values = this.getFilterValues(this.props.filterPosition);
4871
4881
  }
4882
+ get isReadonly() {
4883
+ return this.env.model.getters.isReadonly();
4884
+ }
4872
4885
  getFilterValues(position) {
4873
4886
  const sheetId = this.env.model.getters.getActiveSheetId();
4874
4887
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -18709,9 +18722,9 @@ class FindAndReplacePanel extends owl.Component {
18709
18722
  }
18710
18723
  setup() {
18711
18724
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
18712
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
18713
18725
  owl.onMounted(() => this.focusInput());
18714
18726
  owl.onWillUnmount(() => {
18727
+ clearTimeout(this.debounceTimeoutId);
18715
18728
  this.env.model.dispatch("CLEAR_SEARCH");
18716
18729
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
18717
18730
  });
@@ -18756,6 +18769,13 @@ class FindAndReplacePanel extends owl.Component {
18756
18769
  searchOptions: this.state.searchOptions,
18757
18770
  });
18758
18771
  }
18772
+ debouncedUpdateSearch() {
18773
+ clearTimeout(this.debounceTimeoutId);
18774
+ this.debounceTimeoutId = setTimeout(() => {
18775
+ this.updateSearch();
18776
+ this.debounceTimeoutId = undefined;
18777
+ }, 200);
18778
+ }
18759
18779
  replace() {
18760
18780
  this.env.model.dispatch("REPLACE_SEARCH", {
18761
18781
  replaceWith: this.state.replaceWith,
@@ -21166,7 +21186,14 @@ class AbstractResizer extends owl.Component {
21166
21186
  return;
21167
21187
  }
21168
21188
  if (this.state.waitingForMove === true) {
21169
- this.startMovement(ev);
21189
+ if (!this.env.model.getters.isGridSelectionActive()) {
21190
+ this._selectElement(index, false);
21191
+ }
21192
+ else {
21193
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
21194
+ // a way to have the grid selection follow the other selections evolution
21195
+ this.startMovement(ev);
21196
+ }
21170
21197
  return;
21171
21198
  }
21172
21199
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -28126,10 +28153,11 @@ class CellPlugin extends CorePlugin {
28126
28153
  * Reconstructs the original formula string based on a normalized form and its dependencies
28127
28154
  */
28128
28155
  buildFormulaContent(sheetId, cell, dependencies) {
28129
- const ranges = dependencies || [...cell.dependencies];
28156
+ const ranges = dependencies || cell.dependencies;
28157
+ let rangeIndex = 0;
28130
28158
  return concat(cell.compiledFormula.tokens.map((token) => {
28131
28159
  if (token.type === "REFERENCE") {
28132
- const range = ranges.shift();
28160
+ const range = ranges[rangeIndex++];
28133
28161
  return this.getters.getRangeString(range, sheetId);
28134
28162
  }
28135
28163
  return token.value;
@@ -29435,7 +29463,11 @@ class HeaderSizePlugin extends CorePlugin {
29435
29463
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
29436
29464
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
29437
29465
  const baseSize = sizes[cmd.base];
29438
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
29466
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
29467
+ manualSize: baseSize.manualSize,
29468
+ computedSize: lazy(baseSize.computedSize()),
29469
+ }));
29470
+ sizes.splice(addIndex, 0, ...sizesToInsert);
29439
29471
  sizes = sizes.map((size, row) => {
29440
29472
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
29441
29473
  // invalidate sizes
@@ -32948,30 +32980,26 @@ class InternalViewport {
32948
32980
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
32949
32981
  const maxCol = this.getters.getNumberCols(sheetId);
32950
32982
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
32951
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
32952
- if (col > maxCol) {
32953
- break;
32954
- }
32955
- if (this.getters.isColHidden(sheetId, col)) {
32956
- continue;
32957
- }
32958
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
32959
- this.offsetScrollbarX = this.offsetX;
32960
- this.adjustViewportZoneX();
32983
+ let finalTarget = targetCol;
32984
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
32985
+ finalTarget++;
32961
32986
  }
32987
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
32988
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
32989
+ this.offsetX =
32990
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
32991
+ this.offsetScrollbarX = this.offsetX;
32992
+ this.adjustViewportZoneX();
32962
32993
  }
32963
32994
  else if (this.left > targetCol) {
32964
- for (let col = this.left; col >= targetCol; col--) {
32965
- if (col < 0) {
32966
- break;
32967
- }
32968
- if (this.getters.isColHidden(sheetId, col)) {
32969
- continue;
32970
- }
32971
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
32972
- this.offsetScrollbarX = this.offsetX;
32973
- this.adjustViewportZoneX();
32995
+ let finalTarget = targetCol;
32996
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
32997
+ finalTarget--;
32974
32998
  }
32999
+ this.offsetX =
33000
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
33001
+ this.offsetScrollbarX = this.offsetX;
33002
+ this.adjustViewportZoneX();
32975
33003
  }
32976
33004
  }
32977
33005
  adjustPositionY(targetRow) {
@@ -32979,30 +33007,26 @@ class InternalViewport {
32979
33007
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
32980
33008
  const maxRow = this.getters.getNumberRows(sheetId);
32981
33009
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
32982
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
32983
- if (row > maxRow) {
32984
- break;
32985
- }
32986
- if (this.getters.isRowHidden(sheetId, row)) {
32987
- continue;
32988
- }
32989
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
32990
- this.offsetScrollbarY = this.offsetY;
32991
- this.adjustViewportZoneY();
33010
+ let finalTarget = targetRow;
33011
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
33012
+ finalTarget++;
32992
33013
  }
33014
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
33015
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
33016
+ this.offsetY =
33017
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
33018
+ this.offsetScrollbarY = this.offsetY;
33019
+ this.adjustViewportZoneY();
32993
33020
  }
32994
33021
  else if (this.top > targetRow) {
32995
- for (let row = this.top; row >= targetRow; row--) {
32996
- if (row < 0) {
32997
- break;
32998
- }
32999
- if (this.getters.isRowHidden(sheetId, row)) {
33000
- continue;
33001
- }
33002
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
33003
- this.offsetScrollbarY = this.offsetY;
33004
- this.adjustViewportZoneY();
33022
+ let finalTarget = targetRow;
33023
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
33024
+ finalTarget--;
33005
33025
  }
33026
+ this.offsetY =
33027
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
33028
+ this.offsetScrollbarY = this.offsetY;
33029
+ this.adjustViewportZoneY();
33006
33030
  }
33007
33031
  }
33008
33032
  setViewportOffset(offsetX, offsetY) {
@@ -34577,14 +34601,10 @@ class FindAndReplacePlugin extends UIPlugin {
34577
34601
  case "REPLACE_ALL_SEARCH":
34578
34602
  this.replaceAll(cmd.replaceWith);
34579
34603
  break;
34580
- case "EVALUATE_CELLS":
34581
- case "UPDATE_CELL":
34582
- case "REMOVE_FILTER_TABLE":
34583
- case "UPDATE_FILTER":
34584
- this.isSearchDirty = true;
34585
- break;
34586
34604
  case "UNDO":
34587
34605
  case "REDO":
34606
+ case "REMOVE_FILTER_TABLE":
34607
+ case "UPDATE_FILTER":
34588
34608
  case "REMOVE_COLUMNS_ROWS":
34589
34609
  case "HIDE_COLUMNS_ROWS":
34590
34610
  case "UNHIDE_COLUMNS_ROWS":
@@ -37584,7 +37604,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
37584
37604
  });
37585
37605
  for (const filterTable of this.copiedTables) {
37586
37606
  this.dispatch("REMOVE_FILTER_TABLE", {
37587
- sheetId: this.getters.getActiveSheetId(),
37607
+ sheetId: this.sheetId,
37588
37608
  target: [filterTable.zone],
37589
37609
  });
37590
37610
  }
@@ -39243,6 +39263,9 @@ class GridSelectionPlugin extends UIPlugin {
39243
39263
  // ---------------------------------------------------------------------------
39244
39264
  // Getters
39245
39265
  // ---------------------------------------------------------------------------
39266
+ isGridSelectionActive() {
39267
+ return this.selection.isListening(this);
39268
+ }
39246
39269
  getActiveSheet() {
39247
39270
  return this.activeSheet;
39248
39271
  }
@@ -39617,6 +39640,7 @@ GridSelectionPlugin.getters = [
39617
39640
  "getSheetPosition",
39618
39641
  "isSelected",
39619
39642
  "getElementsFromSelection",
39643
+ "isGridSelectionActive",
39620
39644
  ];
39621
39645
 
39622
39646
  const corePluginRegistry = new Registry()
@@ -43095,6 +43119,9 @@ class SelectionStreamProcessorImpl {
43095
43119
  anchor: { zone, cell: this.anchor.cell },
43096
43120
  });
43097
43121
  }
43122
+ isListening(owner) {
43123
+ return this.stream.isListening(owner);
43124
+ }
43098
43125
  /**
43099
43126
  * Process a new anchor selection event. If the new anchor is inside
43100
43127
  * the sheet boundaries, the event is pushed to the event stream to
@@ -45458,6 +45485,6 @@ exports.setTranslationMethod = setTranslationMethod;
45458
45485
  exports.tokenize = tokenize;
45459
45486
 
45460
45487
 
45461
- __info__.version = '16.2.16';
45462
- __info__.date = '2023-09-21T15:56:53.639Z';
45463
- __info__.hash = '1a70819';
45488
+ __info__.version = '16.2.18';
45489
+ __info__.date = '2023-10-10T07:29:40.321Z';
45490
+ __info__.hash = '451fa09';
@@ -249,7 +249,7 @@ declare class RangeImpl implements Range {
249
249
  constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
250
250
  static fromRange(range: Range, getters: CoreGetters): RangeImpl;
251
251
  get unboundedZone(): UnboundedZone;
252
- get zone(): Zone;
252
+ get zone(): Readonly<Zone>;
253
253
  static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
254
254
  get isFullCol(): boolean;
255
255
  get isFullRow(): boolean;
@@ -347,6 +347,7 @@ interface SelectionProcessor {
347
347
  selectAll(): DispatchResult;
348
348
  loopSelection(): DispatchResult;
349
349
  selectTableAroundSelection(): DispatchResult;
350
+ isListening(owner: unknown): boolean;
350
351
  }
351
352
  type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
352
353
 
@@ -4554,7 +4555,7 @@ declare class ClipboardPlugin extends UIPlugin {
4554
4555
  */
4555
4556
  declare class GridSelectionPlugin extends UIPlugin {
4556
4557
  static layers: LAYERS[];
4557
- static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection"];
4558
+ static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection", "isGridSelectionActive"];
4558
4559
  private gridSelection;
4559
4560
  private selectedFigureId;
4560
4561
  private sheetsData;
@@ -4564,6 +4565,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4564
4565
  allowDispatch(cmd: Command): CommandResult;
4565
4566
  private handleEvent;
4566
4567
  handle(cmd: Command): void;
4568
+ isGridSelectionActive(): boolean;
4567
4569
  getActiveSheet(): Readonly<Sheet>;
4568
4570
  getActiveSheetId(): UID;
4569
4571
  getActiveCell(): EvaluatedCell;
@@ -298,7 +298,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
298
298
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
299
299
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
300
300
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
301
+ const CACHE = {};
301
302
  function parseDateTime(str) {
303
+ if (str in CACHE) {
304
+ return CACHE[str];
305
+ }
306
+ const date = _parseDateTime(str);
307
+ CACHE[str] = date;
308
+ return date;
309
+ }
310
+ function _parseDateTime(str) {
302
311
  str = str.trim();
303
312
  let time;
304
313
  const timeMatch = str.match(timeRegexp);
@@ -2140,8 +2149,9 @@ class RangeImpl {
2140
2149
  }
2141
2150
  get zone() {
2142
2151
  const { left, top, bottom, right } = this._zone;
2143
- if (right !== undefined && bottom !== undefined)
2144
- return { left, top, right, bottom };
2152
+ if (right !== undefined && bottom !== undefined) {
2153
+ return this._zone;
2154
+ }
2145
2155
  else if (bottom === undefined && right !== undefined) {
2146
2156
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2147
2157
  }
@@ -4865,6 +4875,9 @@ class FilterMenu extends Component {
4865
4875
  });
4866
4876
  this.state.values = this.getFilterValues(this.props.filterPosition);
4867
4877
  }
4878
+ get isReadonly() {
4879
+ return this.env.model.getters.isReadonly();
4880
+ }
4868
4881
  getFilterValues(position) {
4869
4882
  const sheetId = this.env.model.getters.getActiveSheetId();
4870
4883
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -18705,9 +18718,9 @@ class FindAndReplacePanel extends Component {
18705
18718
  }
18706
18719
  setup() {
18707
18720
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
18708
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
18709
18721
  onMounted(() => this.focusInput());
18710
18722
  onWillUnmount(() => {
18723
+ clearTimeout(this.debounceTimeoutId);
18711
18724
  this.env.model.dispatch("CLEAR_SEARCH");
18712
18725
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
18713
18726
  });
@@ -18752,6 +18765,13 @@ class FindAndReplacePanel extends Component {
18752
18765
  searchOptions: this.state.searchOptions,
18753
18766
  });
18754
18767
  }
18768
+ debouncedUpdateSearch() {
18769
+ clearTimeout(this.debounceTimeoutId);
18770
+ this.debounceTimeoutId = setTimeout(() => {
18771
+ this.updateSearch();
18772
+ this.debounceTimeoutId = undefined;
18773
+ }, 200);
18774
+ }
18755
18775
  replace() {
18756
18776
  this.env.model.dispatch("REPLACE_SEARCH", {
18757
18777
  replaceWith: this.state.replaceWith,
@@ -21162,7 +21182,14 @@ class AbstractResizer extends Component {
21162
21182
  return;
21163
21183
  }
21164
21184
  if (this.state.waitingForMove === true) {
21165
- this.startMovement(ev);
21185
+ if (!this.env.model.getters.isGridSelectionActive()) {
21186
+ this._selectElement(index, false);
21187
+ }
21188
+ else {
21189
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
21190
+ // a way to have the grid selection follow the other selections evolution
21191
+ this.startMovement(ev);
21192
+ }
21166
21193
  return;
21167
21194
  }
21168
21195
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -28122,10 +28149,11 @@ class CellPlugin extends CorePlugin {
28122
28149
  * Reconstructs the original formula string based on a normalized form and its dependencies
28123
28150
  */
28124
28151
  buildFormulaContent(sheetId, cell, dependencies) {
28125
- const ranges = dependencies || [...cell.dependencies];
28152
+ const ranges = dependencies || cell.dependencies;
28153
+ let rangeIndex = 0;
28126
28154
  return concat(cell.compiledFormula.tokens.map((token) => {
28127
28155
  if (token.type === "REFERENCE") {
28128
- const range = ranges.shift();
28156
+ const range = ranges[rangeIndex++];
28129
28157
  return this.getters.getRangeString(range, sheetId);
28130
28158
  }
28131
28159
  return token.value;
@@ -29431,7 +29459,11 @@ class HeaderSizePlugin extends CorePlugin {
29431
29459
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
29432
29460
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
29433
29461
  const baseSize = sizes[cmd.base];
29434
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
29462
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
29463
+ manualSize: baseSize.manualSize,
29464
+ computedSize: lazy(baseSize.computedSize()),
29465
+ }));
29466
+ sizes.splice(addIndex, 0, ...sizesToInsert);
29435
29467
  sizes = sizes.map((size, row) => {
29436
29468
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
29437
29469
  // invalidate sizes
@@ -32944,30 +32976,26 @@ class InternalViewport {
32944
32976
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
32945
32977
  const maxCol = this.getters.getNumberCols(sheetId);
32946
32978
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
32947
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
32948
- if (col > maxCol) {
32949
- break;
32950
- }
32951
- if (this.getters.isColHidden(sheetId, col)) {
32952
- continue;
32953
- }
32954
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
32955
- this.offsetScrollbarX = this.offsetX;
32956
- this.adjustViewportZoneX();
32979
+ let finalTarget = targetCol;
32980
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
32981
+ finalTarget++;
32957
32982
  }
32983
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
32984
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
32985
+ this.offsetX =
32986
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
32987
+ this.offsetScrollbarX = this.offsetX;
32988
+ this.adjustViewportZoneX();
32958
32989
  }
32959
32990
  else if (this.left > targetCol) {
32960
- for (let col = this.left; col >= targetCol; col--) {
32961
- if (col < 0) {
32962
- break;
32963
- }
32964
- if (this.getters.isColHidden(sheetId, col)) {
32965
- continue;
32966
- }
32967
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
32968
- this.offsetScrollbarX = this.offsetX;
32969
- this.adjustViewportZoneX();
32991
+ let finalTarget = targetCol;
32992
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
32993
+ finalTarget--;
32970
32994
  }
32995
+ this.offsetX =
32996
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
32997
+ this.offsetScrollbarX = this.offsetX;
32998
+ this.adjustViewportZoneX();
32971
32999
  }
32972
33000
  }
32973
33001
  adjustPositionY(targetRow) {
@@ -32975,30 +33003,26 @@ class InternalViewport {
32975
33003
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
32976
33004
  const maxRow = this.getters.getNumberRows(sheetId);
32977
33005
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
32978
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
32979
- if (row > maxRow) {
32980
- break;
32981
- }
32982
- if (this.getters.isRowHidden(sheetId, row)) {
32983
- continue;
32984
- }
32985
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
32986
- this.offsetScrollbarY = this.offsetY;
32987
- this.adjustViewportZoneY();
33006
+ let finalTarget = targetRow;
33007
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
33008
+ finalTarget++;
32988
33009
  }
33010
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
33011
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
33012
+ this.offsetY =
33013
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
33014
+ this.offsetScrollbarY = this.offsetY;
33015
+ this.adjustViewportZoneY();
32989
33016
  }
32990
33017
  else if (this.top > targetRow) {
32991
- for (let row = this.top; row >= targetRow; row--) {
32992
- if (row < 0) {
32993
- break;
32994
- }
32995
- if (this.getters.isRowHidden(sheetId, row)) {
32996
- continue;
32997
- }
32998
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
32999
- this.offsetScrollbarY = this.offsetY;
33000
- this.adjustViewportZoneY();
33018
+ let finalTarget = targetRow;
33019
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
33020
+ finalTarget--;
33001
33021
  }
33022
+ this.offsetY =
33023
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
33024
+ this.offsetScrollbarY = this.offsetY;
33025
+ this.adjustViewportZoneY();
33002
33026
  }
33003
33027
  }
33004
33028
  setViewportOffset(offsetX, offsetY) {
@@ -34573,14 +34597,10 @@ class FindAndReplacePlugin extends UIPlugin {
34573
34597
  case "REPLACE_ALL_SEARCH":
34574
34598
  this.replaceAll(cmd.replaceWith);
34575
34599
  break;
34576
- case "EVALUATE_CELLS":
34577
- case "UPDATE_CELL":
34578
- case "REMOVE_FILTER_TABLE":
34579
- case "UPDATE_FILTER":
34580
- this.isSearchDirty = true;
34581
- break;
34582
34600
  case "UNDO":
34583
34601
  case "REDO":
34602
+ case "REMOVE_FILTER_TABLE":
34603
+ case "UPDATE_FILTER":
34584
34604
  case "REMOVE_COLUMNS_ROWS":
34585
34605
  case "HIDE_COLUMNS_ROWS":
34586
34606
  case "UNHIDE_COLUMNS_ROWS":
@@ -37580,7 +37600,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
37580
37600
  });
37581
37601
  for (const filterTable of this.copiedTables) {
37582
37602
  this.dispatch("REMOVE_FILTER_TABLE", {
37583
- sheetId: this.getters.getActiveSheetId(),
37603
+ sheetId: this.sheetId,
37584
37604
  target: [filterTable.zone],
37585
37605
  });
37586
37606
  }
@@ -39239,6 +39259,9 @@ class GridSelectionPlugin extends UIPlugin {
39239
39259
  // ---------------------------------------------------------------------------
39240
39260
  // Getters
39241
39261
  // ---------------------------------------------------------------------------
39262
+ isGridSelectionActive() {
39263
+ return this.selection.isListening(this);
39264
+ }
39242
39265
  getActiveSheet() {
39243
39266
  return this.activeSheet;
39244
39267
  }
@@ -39613,6 +39636,7 @@ GridSelectionPlugin.getters = [
39613
39636
  "getSheetPosition",
39614
39637
  "isSelected",
39615
39638
  "getElementsFromSelection",
39639
+ "isGridSelectionActive",
39616
39640
  ];
39617
39641
 
39618
39642
  const corePluginRegistry = new Registry()
@@ -43091,6 +43115,9 @@ class SelectionStreamProcessorImpl {
43091
43115
  anchor: { zone, cell: this.anchor.cell },
43092
43116
  });
43093
43117
  }
43118
+ isListening(owner) {
43119
+ return this.stream.isListening(owner);
43120
+ }
43094
43121
  /**
43095
43122
  * Process a new anchor selection event. If the new anchor is inside
43096
43123
  * the sheet boundaries, the event is pushed to the event stream to
@@ -45426,6 +45453,6 @@ function addFunction(functionName, functionDescription) {
45426
45453
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
45427
45454
 
45428
45455
 
45429
- __info__.version = '16.2.16';
45430
- __info__.date = '2023-09-21T15:56:53.639Z';
45431
- __info__.hash = '1a70819';
45456
+ __info__.version = '16.2.18';
45457
+ __info__.date = '2023-10-10T07:29:40.321Z';
45458
+ __info__.hash = '451fa09';