@odoo/o-spreadsheet 16.3.11 → 16.3.13

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.
@@ -314,7 +314,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
314
314
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
315
315
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
316
316
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
317
+ const CACHE = {};
317
318
  function parseDateTime(str) {
319
+ if (str in CACHE) {
320
+ return CACHE[str];
321
+ }
322
+ const date = _parseDateTime(str);
323
+ CACHE[str] = date;
324
+ return date;
325
+ }
326
+ function _parseDateTime(str) {
318
327
  str = str.trim();
319
328
  let time;
320
329
  const timeMatch = str.match(timeRegexp);
@@ -2251,8 +2260,9 @@ class RangeImpl {
2251
2260
  }
2252
2261
  get zone() {
2253
2262
  const { left, top, bottom, right } = this._zone;
2254
- if (right !== undefined && bottom !== undefined)
2255
- return { left, top, right, bottom };
2263
+ if (right !== undefined && bottom !== undefined) {
2264
+ return this._zone;
2265
+ }
2256
2266
  else if (bottom === undefined && right !== undefined) {
2257
2267
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2258
2268
  }
@@ -4990,6 +5000,9 @@ class FilterMenu extends owl.Component {
4990
5000
  });
4991
5001
  this.state.values = this.getFilterValues(this.props.filterPosition);
4992
5002
  }
5003
+ get isReadonly() {
5004
+ return this.env.model.getters.isReadonly();
5005
+ }
4993
5006
  getFilterValues(position) {
4994
5007
  const sheetId = this.env.model.getters.getActiveSheetId();
4995
5008
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -19678,7 +19691,6 @@ class FindAndReplacePanel extends owl.Component {
19678
19691
  state = owl.useState(this.initialState());
19679
19692
  debounceTimeoutId;
19680
19693
  showFormulaState = false;
19681
- debouncedUpdateSearch;
19682
19694
  findAndReplaceRef = owl.useRef("findAndReplace");
19683
19695
  get hasSearchResult() {
19684
19696
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -19688,9 +19700,9 @@ class FindAndReplacePanel extends owl.Component {
19688
19700
  }
19689
19701
  setup() {
19690
19702
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
19691
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
19692
19703
  owl.onMounted(() => this.focusInput());
19693
19704
  owl.onWillUnmount(() => {
19705
+ clearTimeout(this.debounceTimeoutId);
19694
19706
  this.env.model.dispatch("CLEAR_SEARCH");
19695
19707
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
19696
19708
  });
@@ -19735,6 +19747,13 @@ class FindAndReplacePanel extends owl.Component {
19735
19747
  searchOptions: this.state.searchOptions,
19736
19748
  });
19737
19749
  }
19750
+ debouncedUpdateSearch() {
19751
+ clearTimeout(this.debounceTimeoutId);
19752
+ this.debounceTimeoutId = setTimeout(() => {
19753
+ this.updateSearch();
19754
+ this.debounceTimeoutId = undefined;
19755
+ }, 200);
19756
+ }
19738
19757
  replace() {
19739
19758
  this.env.model.dispatch("REPLACE_SEARCH", {
19740
19759
  replaceWith: this.state.replaceWith,
@@ -22508,7 +22527,14 @@ class AbstractResizer extends owl.Component {
22508
22527
  return;
22509
22528
  }
22510
22529
  if (this.state.waitingForMove === true) {
22511
- this.startMovement(ev);
22530
+ if (!this.env.model.getters.isGridSelectionActive()) {
22531
+ this._selectElement(index, false);
22532
+ }
22533
+ else {
22534
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
22535
+ // a way to have the grid selection follow the other selections evolution
22536
+ this.startMovement(ev);
22537
+ }
22512
22538
  return;
22513
22539
  }
22514
22540
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -29633,10 +29659,11 @@ class CellPlugin extends CorePlugin {
29633
29659
  * Reconstructs the original formula string based on a normalized form and its dependencies
29634
29660
  */
29635
29661
  buildFormulaContent(sheetId, cell, dependencies) {
29636
- const ranges = dependencies || [...cell.dependencies];
29662
+ const ranges = dependencies || cell.dependencies;
29663
+ let rangeIndex = 0;
29637
29664
  return concat(cell.compiledFormula.tokens.map((token) => {
29638
29665
  if (token.type === "REFERENCE") {
29639
- const range = ranges.shift();
29666
+ const range = ranges[rangeIndex++];
29640
29667
  return this.getters.getRangeString(range, sheetId);
29641
29668
  }
29642
29669
  return token.value;
@@ -30941,7 +30968,11 @@ class HeaderSizePlugin extends CorePlugin {
30941
30968
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
30942
30969
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
30943
30970
  const baseSize = sizes[cmd.base];
30944
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
30971
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
30972
+ manualSize: baseSize.manualSize,
30973
+ computedSize: lazy(baseSize.computedSize()),
30974
+ }));
30975
+ sizes.splice(addIndex, 0, ...sizesToInsert);
30945
30976
  sizes = sizes.map((size, row) => {
30946
30977
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
30947
30978
  // invalidate sizes
@@ -34450,30 +34481,26 @@ class InternalViewport {
34450
34481
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
34451
34482
  const maxCol = this.getters.getNumberCols(sheetId);
34452
34483
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
34453
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
34454
- if (col > maxCol) {
34455
- break;
34456
- }
34457
- if (this.getters.isColHidden(sheetId, col)) {
34458
- continue;
34459
- }
34460
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
34461
- this.offsetScrollbarX = this.offsetX;
34462
- this.adjustViewportZoneX();
34484
+ let finalTarget = targetCol;
34485
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
34486
+ finalTarget++;
34463
34487
  }
34488
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
34489
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
34490
+ this.offsetX =
34491
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
34492
+ this.offsetScrollbarX = this.offsetX;
34493
+ this.adjustViewportZoneX();
34464
34494
  }
34465
34495
  else if (this.left > targetCol) {
34466
- for (let col = this.left; col >= targetCol; col--) {
34467
- if (col < 0) {
34468
- break;
34469
- }
34470
- if (this.getters.isColHidden(sheetId, col)) {
34471
- continue;
34472
- }
34473
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
34474
- this.offsetScrollbarX = this.offsetX;
34475
- this.adjustViewportZoneX();
34496
+ let finalTarget = targetCol;
34497
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
34498
+ finalTarget--;
34476
34499
  }
34500
+ this.offsetX =
34501
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
34502
+ this.offsetScrollbarX = this.offsetX;
34503
+ this.adjustViewportZoneX();
34477
34504
  }
34478
34505
  }
34479
34506
  adjustPositionY(targetRow) {
@@ -34481,30 +34508,26 @@ class InternalViewport {
34481
34508
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
34482
34509
  const maxRow = this.getters.getNumberRows(sheetId);
34483
34510
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
34484
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
34485
- if (row > maxRow) {
34486
- break;
34487
- }
34488
- if (this.getters.isRowHidden(sheetId, row)) {
34489
- continue;
34490
- }
34491
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
34492
- this.offsetScrollbarY = this.offsetY;
34493
- this.adjustViewportZoneY();
34511
+ let finalTarget = targetRow;
34512
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
34513
+ finalTarget++;
34494
34514
  }
34515
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
34516
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
34517
+ this.offsetY =
34518
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
34519
+ this.offsetScrollbarY = this.offsetY;
34520
+ this.adjustViewportZoneY();
34495
34521
  }
34496
34522
  else if (this.top > targetRow) {
34497
- for (let row = this.top; row >= targetRow; row--) {
34498
- if (row < 0) {
34499
- break;
34500
- }
34501
- if (this.getters.isRowHidden(sheetId, row)) {
34502
- continue;
34503
- }
34504
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
34505
- this.offsetScrollbarY = this.offsetY;
34506
- this.adjustViewportZoneY();
34523
+ let finalTarget = targetRow;
34524
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
34525
+ finalTarget--;
34507
34526
  }
34527
+ this.offsetY =
34528
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
34529
+ this.offsetScrollbarY = this.offsetY;
34530
+ this.adjustViewportZoneY();
34508
34531
  }
34509
34532
  }
34510
34533
  setViewportOffset(offsetX, offsetY) {
@@ -36980,14 +37003,10 @@ class FindAndReplacePlugin extends UIPlugin {
36980
37003
  case "REPLACE_ALL_SEARCH":
36981
37004
  this.replaceAll(cmd.replaceWith);
36982
37005
  break;
36983
- case "EVALUATE_CELLS":
36984
- case "UPDATE_CELL":
36985
- case "REMOVE_FILTER_TABLE":
36986
- case "UPDATE_FILTER":
36987
- this.isSearchDirty = true;
36988
- break;
36989
37006
  case "UNDO":
36990
37007
  case "REDO":
37008
+ case "REMOVE_FILTER_TABLE":
37009
+ case "UPDATE_FILTER":
36991
37010
  case "REMOVE_COLUMNS_ROWS":
36992
37011
  case "HIDE_COLUMNS_ROWS":
36993
37012
  case "UNHIDE_COLUMNS_ROWS":
@@ -39706,7 +39725,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
39706
39725
  });
39707
39726
  for (const filterTable of this.copiedTables) {
39708
39727
  this.dispatch("REMOVE_FILTER_TABLE", {
39709
- sheetId: this.getters.getActiveSheetId(),
39728
+ sheetId: this.sheetId,
39710
39729
  target: [filterTable.zone],
39711
39730
  });
39712
39731
  }
@@ -41196,6 +41215,7 @@ class GridSelectionPlugin extends UIPlugin {
41196
41215
  "isSingleColSelected",
41197
41216
  "getElementsFromSelection",
41198
41217
  "tryGetActiveSheetId",
41218
+ "isGridSelectionActive",
41199
41219
  ];
41200
41220
  gridSelection = {
41201
41221
  anchor: {
@@ -41405,6 +41425,9 @@ class GridSelectionPlugin extends UIPlugin {
41405
41425
  // ---------------------------------------------------------------------------
41406
41426
  // Getters
41407
41427
  // ---------------------------------------------------------------------------
41428
+ isGridSelectionActive() {
41429
+ return this.selection.isListening(this);
41430
+ }
41408
41431
  getActiveSheet() {
41409
41432
  return this.activeSheet;
41410
41433
  }
@@ -45260,6 +45283,9 @@ class SelectionStreamProcessorImpl {
45260
45283
  anchor: { zone, cell: this.anchor.cell },
45261
45284
  });
45262
45285
  }
45286
+ isListening(owner) {
45287
+ return this.stream.isListening(owner);
45288
+ }
45263
45289
  /**
45264
45290
  * Process a new anchor selection event. If the new anchor is inside
45265
45291
  * the sheet boundaries, the event is pushed to the event stream to
@@ -47720,6 +47746,6 @@ exports.setTranslationMethod = setTranslationMethod;
47720
47746
  exports.tokenize = tokenize;
47721
47747
 
47722
47748
 
47723
- __info__.version = '16.3.11';
47724
- __info__.date = '2023-09-21T15:56:40.754Z';
47725
- __info__.hash = '245df8c';
47749
+ __info__.version = '16.3.13';
47750
+ __info__.date = '2023-10-10T07:28:39.702Z';
47751
+ __info__.hash = '67b6363';
@@ -958,7 +958,7 @@ declare class RangeImpl implements Range {
958
958
  constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
959
959
  static fromRange(range: Range, getters: CoreGetters): RangeImpl;
960
960
  get unboundedZone(): UnboundedZone;
961
- get zone(): Zone;
961
+ get zone(): Readonly<Zone>;
962
962
  static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
963
963
  get isFullCol(): boolean;
964
964
  get isFullRow(): boolean;
@@ -1056,6 +1056,7 @@ interface SelectionProcessor {
1056
1056
  selectAll(): DispatchResult;
1057
1057
  loopSelection(): DispatchResult;
1058
1058
  selectTableAroundSelection(): DispatchResult;
1059
+ isListening(owner: unknown): boolean;
1059
1060
  }
1060
1061
  type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
1061
1062
 
@@ -4664,7 +4665,7 @@ declare class ClipboardPlugin extends UIPlugin {
4664
4665
  */
4665
4666
  declare class GridSelectionPlugin extends UIPlugin {
4666
4667
  static layers: LAYERS[];
4667
- static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getSelectedCells", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "isSingleColSelected", "getElementsFromSelection", "tryGetActiveSheetId"];
4668
+ static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getSelectedCells", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "isSingleColSelected", "getElementsFromSelection", "tryGetActiveSheetId", "isGridSelectionActive"];
4668
4669
  private gridSelection;
4669
4670
  private selectedFigureId;
4670
4671
  private sheetsData;
@@ -4674,6 +4675,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4674
4675
  allowDispatch(cmd: LocalCommand): CommandResult;
4675
4676
  private handleEvent;
4676
4677
  handle(cmd: Command): void;
4678
+ isGridSelectionActive(): boolean;
4677
4679
  getActiveSheet(): Readonly<Sheet>;
4678
4680
  getActiveSheetId(): UID;
4679
4681
  tryGetActiveSheetId(): UID | undefined;
@@ -310,7 +310,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
310
310
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
311
311
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
312
312
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
313
+ const CACHE = {};
313
314
  function parseDateTime(str) {
315
+ if (str in CACHE) {
316
+ return CACHE[str];
317
+ }
318
+ const date = _parseDateTime(str);
319
+ CACHE[str] = date;
320
+ return date;
321
+ }
322
+ function _parseDateTime(str) {
314
323
  str = str.trim();
315
324
  let time;
316
325
  const timeMatch = str.match(timeRegexp);
@@ -2247,8 +2256,9 @@ class RangeImpl {
2247
2256
  }
2248
2257
  get zone() {
2249
2258
  const { left, top, bottom, right } = this._zone;
2250
- if (right !== undefined && bottom !== undefined)
2251
- return { left, top, right, bottom };
2259
+ if (right !== undefined && bottom !== undefined) {
2260
+ return this._zone;
2261
+ }
2252
2262
  else if (bottom === undefined && right !== undefined) {
2253
2263
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2254
2264
  }
@@ -4986,6 +4996,9 @@ class FilterMenu extends Component {
4986
4996
  });
4987
4997
  this.state.values = this.getFilterValues(this.props.filterPosition);
4988
4998
  }
4999
+ get isReadonly() {
5000
+ return this.env.model.getters.isReadonly();
5001
+ }
4989
5002
  getFilterValues(position) {
4990
5003
  const sheetId = this.env.model.getters.getActiveSheetId();
4991
5004
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -19674,7 +19687,6 @@ class FindAndReplacePanel extends Component {
19674
19687
  state = useState(this.initialState());
19675
19688
  debounceTimeoutId;
19676
19689
  showFormulaState = false;
19677
- debouncedUpdateSearch;
19678
19690
  findAndReplaceRef = useRef("findAndReplace");
19679
19691
  get hasSearchResult() {
19680
19692
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -19684,9 +19696,9 @@ class FindAndReplacePanel extends Component {
19684
19696
  }
19685
19697
  setup() {
19686
19698
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
19687
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
19688
19699
  onMounted(() => this.focusInput());
19689
19700
  onWillUnmount(() => {
19701
+ clearTimeout(this.debounceTimeoutId);
19690
19702
  this.env.model.dispatch("CLEAR_SEARCH");
19691
19703
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
19692
19704
  });
@@ -19731,6 +19743,13 @@ class FindAndReplacePanel extends Component {
19731
19743
  searchOptions: this.state.searchOptions,
19732
19744
  });
19733
19745
  }
19746
+ debouncedUpdateSearch() {
19747
+ clearTimeout(this.debounceTimeoutId);
19748
+ this.debounceTimeoutId = setTimeout(() => {
19749
+ this.updateSearch();
19750
+ this.debounceTimeoutId = undefined;
19751
+ }, 200);
19752
+ }
19734
19753
  replace() {
19735
19754
  this.env.model.dispatch("REPLACE_SEARCH", {
19736
19755
  replaceWith: this.state.replaceWith,
@@ -22504,7 +22523,14 @@ class AbstractResizer extends Component {
22504
22523
  return;
22505
22524
  }
22506
22525
  if (this.state.waitingForMove === true) {
22507
- this.startMovement(ev);
22526
+ if (!this.env.model.getters.isGridSelectionActive()) {
22527
+ this._selectElement(index, false);
22528
+ }
22529
+ else {
22530
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
22531
+ // a way to have the grid selection follow the other selections evolution
22532
+ this.startMovement(ev);
22533
+ }
22508
22534
  return;
22509
22535
  }
22510
22536
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -29629,10 +29655,11 @@ class CellPlugin extends CorePlugin {
29629
29655
  * Reconstructs the original formula string based on a normalized form and its dependencies
29630
29656
  */
29631
29657
  buildFormulaContent(sheetId, cell, dependencies) {
29632
- const ranges = dependencies || [...cell.dependencies];
29658
+ const ranges = dependencies || cell.dependencies;
29659
+ let rangeIndex = 0;
29633
29660
  return concat(cell.compiledFormula.tokens.map((token) => {
29634
29661
  if (token.type === "REFERENCE") {
29635
- const range = ranges.shift();
29662
+ const range = ranges[rangeIndex++];
29636
29663
  return this.getters.getRangeString(range, sheetId);
29637
29664
  }
29638
29665
  return token.value;
@@ -30937,7 +30964,11 @@ class HeaderSizePlugin extends CorePlugin {
30937
30964
  let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
30938
30965
  const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
30939
30966
  const baseSize = sizes[cmd.base];
30940
- sizes.splice(addIndex, 0, ...Array(cmd.quantity).fill(baseSize));
30967
+ const sizesToInsert = range(0, cmd.quantity).map(() => ({
30968
+ manualSize: baseSize.manualSize,
30969
+ computedSize: lazy(baseSize.computedSize()),
30970
+ }));
30971
+ sizes.splice(addIndex, 0, ...sizesToInsert);
30941
30972
  sizes = sizes.map((size, row) => {
30942
30973
  if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
30943
30974
  // invalidate sizes
@@ -34446,30 +34477,26 @@ class InternalViewport {
34446
34477
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
34447
34478
  const maxCol = this.getters.getNumberCols(sheetId);
34448
34479
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
34449
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
34450
- if (col > maxCol) {
34451
- break;
34452
- }
34453
- if (this.getters.isColHidden(sheetId, col)) {
34454
- continue;
34455
- }
34456
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
34457
- this.offsetScrollbarX = this.offsetX;
34458
- this.adjustViewportZoneX();
34480
+ let finalTarget = targetCol;
34481
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
34482
+ finalTarget++;
34459
34483
  }
34484
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
34485
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
34486
+ this.offsetX =
34487
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
34488
+ this.offsetScrollbarX = this.offsetX;
34489
+ this.adjustViewportZoneX();
34460
34490
  }
34461
34491
  else if (this.left > targetCol) {
34462
- for (let col = this.left; col >= targetCol; col--) {
34463
- if (col < 0) {
34464
- break;
34465
- }
34466
- if (this.getters.isColHidden(sheetId, col)) {
34467
- continue;
34468
- }
34469
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
34470
- this.offsetScrollbarX = this.offsetX;
34471
- this.adjustViewportZoneX();
34492
+ let finalTarget = targetCol;
34493
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
34494
+ finalTarget--;
34472
34495
  }
34496
+ this.offsetX =
34497
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
34498
+ this.offsetScrollbarX = this.offsetX;
34499
+ this.adjustViewportZoneX();
34473
34500
  }
34474
34501
  }
34475
34502
  adjustPositionY(targetRow) {
@@ -34477,30 +34504,26 @@ class InternalViewport {
34477
34504
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
34478
34505
  const maxRow = this.getters.getNumberRows(sheetId);
34479
34506
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
34480
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
34481
- if (row > maxRow) {
34482
- break;
34483
- }
34484
- if (this.getters.isRowHidden(sheetId, row)) {
34485
- continue;
34486
- }
34487
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
34488
- this.offsetScrollbarY = this.offsetY;
34489
- this.adjustViewportZoneY();
34507
+ let finalTarget = targetRow;
34508
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
34509
+ finalTarget++;
34490
34510
  }
34511
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
34512
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
34513
+ this.offsetY =
34514
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
34515
+ this.offsetScrollbarY = this.offsetY;
34516
+ this.adjustViewportZoneY();
34491
34517
  }
34492
34518
  else if (this.top > targetRow) {
34493
- for (let row = this.top; row >= targetRow; row--) {
34494
- if (row < 0) {
34495
- break;
34496
- }
34497
- if (this.getters.isRowHidden(sheetId, row)) {
34498
- continue;
34499
- }
34500
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
34501
- this.offsetScrollbarY = this.offsetY;
34502
- this.adjustViewportZoneY();
34519
+ let finalTarget = targetRow;
34520
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
34521
+ finalTarget--;
34503
34522
  }
34523
+ this.offsetY =
34524
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
34525
+ this.offsetScrollbarY = this.offsetY;
34526
+ this.adjustViewportZoneY();
34504
34527
  }
34505
34528
  }
34506
34529
  setViewportOffset(offsetX, offsetY) {
@@ -36976,14 +36999,10 @@ class FindAndReplacePlugin extends UIPlugin {
36976
36999
  case "REPLACE_ALL_SEARCH":
36977
37000
  this.replaceAll(cmd.replaceWith);
36978
37001
  break;
36979
- case "EVALUATE_CELLS":
36980
- case "UPDATE_CELL":
36981
- case "REMOVE_FILTER_TABLE":
36982
- case "UPDATE_FILTER":
36983
- this.isSearchDirty = true;
36984
- break;
36985
37002
  case "UNDO":
36986
37003
  case "REDO":
37004
+ case "REMOVE_FILTER_TABLE":
37005
+ case "UPDATE_FILTER":
36987
37006
  case "REMOVE_COLUMNS_ROWS":
36988
37007
  case "HIDE_COLUMNS_ROWS":
36989
37008
  case "UNHIDE_COLUMNS_ROWS":
@@ -39702,7 +39721,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
39702
39721
  });
39703
39722
  for (const filterTable of this.copiedTables) {
39704
39723
  this.dispatch("REMOVE_FILTER_TABLE", {
39705
- sheetId: this.getters.getActiveSheetId(),
39724
+ sheetId: this.sheetId,
39706
39725
  target: [filterTable.zone],
39707
39726
  });
39708
39727
  }
@@ -41192,6 +41211,7 @@ class GridSelectionPlugin extends UIPlugin {
41192
41211
  "isSingleColSelected",
41193
41212
  "getElementsFromSelection",
41194
41213
  "tryGetActiveSheetId",
41214
+ "isGridSelectionActive",
41195
41215
  ];
41196
41216
  gridSelection = {
41197
41217
  anchor: {
@@ -41401,6 +41421,9 @@ class GridSelectionPlugin extends UIPlugin {
41401
41421
  // ---------------------------------------------------------------------------
41402
41422
  // Getters
41403
41423
  // ---------------------------------------------------------------------------
41424
+ isGridSelectionActive() {
41425
+ return this.selection.isListening(this);
41426
+ }
41404
41427
  getActiveSheet() {
41405
41428
  return this.activeSheet;
41406
41429
  }
@@ -45256,6 +45279,9 @@ class SelectionStreamProcessorImpl {
45256
45279
  anchor: { zone, cell: this.anchor.cell },
45257
45280
  });
45258
45281
  }
45282
+ isListening(owner) {
45283
+ return this.stream.isListening(owner);
45284
+ }
45259
45285
  /**
45260
45286
  * Process a new anchor selection event. If the new anchor is inside
45261
45287
  * the sheet boundaries, the event is pushed to the event stream to
@@ -47688,6 +47714,6 @@ function addFunction(functionName, functionDescription) {
47688
47714
  export { AbstractChart, CommandResult, CorePlugin, 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, setDefaultSheetViewSize, setTranslationMethod, tokenize };
47689
47715
 
47690
47716
 
47691
- __info__.version = '16.3.11';
47692
- __info__.date = '2023-09-21T15:56:40.754Z';
47693
- __info__.hash = '245df8c';
47717
+ __info__.version = '16.3.13';
47718
+ __info__.date = '2023-10-10T07:28:39.702Z';
47719
+ __info__.hash = '67b6363';