@odoo/o-spreadsheet 16.4.6 → 16.4.8

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.
@@ -614,13 +614,17 @@ function getAddHeaderStartIndex(position, base) {
614
614
  return position === "after" ? base + 1 : base;
615
615
  }
616
616
  /**
617
- * Compare two objects.
617
+ * Compares two objects.
618
618
  */
619
619
  function deepEquals(o1, o2) {
620
620
  if (o1 === o2)
621
621
  return true;
622
622
  if ((o1 && !o2) || (o2 && !o1))
623
623
  return false;
624
+ if (typeof o1 !== typeof o2)
625
+ return false;
626
+ if (typeof o1 !== "object")
627
+ return o1 === o2;
624
628
  // Objects can have different keys if the values are undefined
625
629
  const keys = new Set();
626
630
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -5265,6 +5269,7 @@ css /* scss */ `
5265
5269
  padding: 10px;
5266
5270
  width: ${ERROR_TOOLTIP_WIDTH}px;
5267
5271
  box-sizing: border-box !important;
5272
+ overflow-wrap: break-word;
5268
5273
  }
5269
5274
  `;
5270
5275
  class ErrorToolTip extends owl.Component {
@@ -5444,6 +5449,9 @@ class FilterMenu extends owl.Component {
5444
5449
  });
5445
5450
  this.state.values = this.getFilterValues(this.props.filterPosition);
5446
5451
  }
5452
+ get isReadonly() {
5453
+ return this.env.model.getters.isReadonly();
5454
+ }
5447
5455
  getFilterValues(position) {
5448
5456
  const sheetId = this.env.model.getters.getActiveSheetId();
5449
5457
  const filter = this.env.model.getters.getFilter({ sheetId, ...position });
@@ -15120,13 +15128,42 @@ function isValidLocale(locale) {
15120
15128
  }
15121
15129
  return true;
15122
15130
  }
15123
- /** Change a content string to its canonical form (en_US locale) */
15131
+ /**
15132
+ * Change a content string from the given locale to its canonical form (en_US locale). Don't convert date string.
15133
+ *
15134
+ * @example
15135
+ * canonicalizeNumberContent("=SUM(1,5; 02/12/2012)", FR_LOCALE) // "=SUM(1.5, 02/12/2012)"
15136
+ * canonicalizeNumberContent("125,9", FR_LOCALE) // "125.9"
15137
+ * canonicalizeNumberContent("02/12/2012", FR_LOCALE) // "02/12/2012"
15138
+ */
15139
+ function canonicalizeNumberContent(content, locale) {
15140
+ return content.startsWith("=")
15141
+ ? canonicalizeFormula$1(content, locale)
15142
+ : canonicalizeNumberLiteral(content, locale);
15143
+ }
15144
+ /**
15145
+ * Change a content string from the given locale to its canonical form (en_US locale). Also convert date string.
15146
+ * This is destructive and won't preserve the original format.
15147
+ *
15148
+ * @example
15149
+ * canonicalizeContent("=SUM(1,5; 5)", FR_LOCALE) // "=SUM(1.5, 5)"
15150
+ * canonicalizeContent("125,9", FR_LOCALE) // "125.9"
15151
+ * canonicalizeContent("02/12/2012", FR_LOCALE) // "12/02/2012"
15152
+ * canonicalizeContent("02-12-2012", FR_LOCALE) // "12/02/2012"
15153
+ */
15124
15154
  function canonicalizeContent(content, locale) {
15125
15155
  return content.startsWith("=")
15126
15156
  ? canonicalizeFormula$1(content, locale)
15127
- : toCanonicalNumberString(content, locale);
15157
+ : canonicalizeLiteral(content, locale);
15128
15158
  }
15129
- /** Change the content of a cell to its canonical form (en_US locale) */
15159
+ /**
15160
+ * Change a content string from its canonical form (en_US locale) to the given locale. Also convert date string.
15161
+ *
15162
+ * @example
15163
+ * localizeContent("=SUM(1.5, 5)", FR_LOCALE) // "=SUM(1,5; 5)"
15164
+ * localizeContent("125.9", FR_LOCALE) // "125,9"
15165
+ * localizeContent("12/02/2012", FR_LOCALE) // "02/12/2012"
15166
+ */
15130
15167
  function localizeContent(content, locale) {
15131
15168
  return content.startsWith("=")
15132
15169
  ? localizeFormula(content, locale)
@@ -15161,24 +15198,75 @@ function _localizeFormula$1(formula, fromLocale, toLocale) {
15161
15198
  return localizedFormula;
15162
15199
  }
15163
15200
  /**
15164
- * Replace localized number with localized decimal separator by a number with "." as decimal separator
15201
+ * Change a literal string from the given locale to its canonical form (en_US locale). Don't convert date string.
15202
+ *
15203
+ * @example
15204
+ * canonicalizeNumberLiteral("125,9", FR_LOCALE) // "125.9"
15205
+ * canonicalizeNumberLiteral("02/12/2012", FR_LOCALE) // "02/12/2012"
15165
15206
  */
15166
- function toCanonicalNumberString(content, locale) {
15207
+ function canonicalizeNumberLiteral(content, locale) {
15167
15208
  if (locale.decimalSeparator === "." || !isNumber(content, locale)) {
15168
15209
  return content;
15169
15210
  }
15170
15211
  return content.replace(locale.decimalSeparator, ".");
15171
15212
  }
15172
- function localizeLiteral(content, locale) {
15173
- if (locale.decimalSeparator === "." || !isNumber(content, DEFAULT_LOCALE)) {
15174
- return content;
15213
+ /**
15214
+ * Change a content string from the given locale to its canonical form (en_US locale). Also convert date string.
15215
+ * This is destructive and won't preserve the original format.
15216
+ *
15217
+ * @example
15218
+ * canonicalizeLiteral("125,9", FR_LOCALE) // "125.9"
15219
+ * canonicalizeLiteral("02/12/2012", FR_LOCALE) // "12/02/2012"
15220
+ * canonicalizeLiteral("02-12-2012", FR_LOCALE) // "12/02/2012"
15221
+ */
15222
+ function canonicalizeLiteral(content, locale) {
15223
+ if (isDateTime(content, locale)) {
15224
+ const dateNumber = toNumber(content, locale);
15225
+ let format = DEFAULT_LOCALE.dateFormat;
15226
+ if (!Number.isInteger(dateNumber)) {
15227
+ format += " " + DEFAULT_LOCALE.timeFormat;
15228
+ }
15229
+ return formatValue(dateNumber, { locale: DEFAULT_LOCALE, format });
15230
+ }
15231
+ return canonicalizeNumberLiteral(content, locale);
15232
+ }
15233
+ /**
15234
+ * Change a literal string from its canonical form (en_US locale) to the given locale. Don't convert date string.
15235
+ * This is destructive and won't preserve the original format.
15236
+ *
15237
+ * @example
15238
+ * localizeNumberLiteral("125.9", FR_LOCALE) // "125,9"
15239
+ * localizeNumberLiteral("12/02/2012", FR_LOCALE) // "12/02/2012"
15240
+ * localizeNumberLiteral("12-02-2012", FR_LOCALE) // "12/02/2012"
15241
+ */
15242
+ function localizeNumberLiteral(literal, locale) {
15243
+ if (locale.decimalSeparator === "." || !isNumber(literal, DEFAULT_LOCALE)) {
15244
+ return literal;
15175
15245
  }
15176
15246
  const decimalNumberRegex = getDecimalNumberRegex(DEFAULT_LOCALE);
15177
- const localized = content.replace(decimalNumberRegex, (match) => {
15247
+ const localized = literal.replace(decimalNumberRegex, (match) => {
15178
15248
  return match.replace(".", locale.decimalSeparator);
15179
15249
  });
15180
15250
  return localized;
15181
15251
  }
15252
+ /**
15253
+ * Change a literal string from its canonical form (en_US locale) to the given locale. Also convert date string.
15254
+ *
15255
+ * @example
15256
+ * localizeLiteral("125.9", FR_LOCALE) // "125,9"
15257
+ * localizeLiteral("12/02/2012", FR_LOCALE) // "02/12/2012"
15258
+ */
15259
+ function localizeLiteral(literal, locale) {
15260
+ if (isDateTime(literal, DEFAULT_LOCALE)) {
15261
+ const dateNumber = toNumber(literal, DEFAULT_LOCALE);
15262
+ let format = locale.dateFormat;
15263
+ if (!Number.isInteger(dateNumber)) {
15264
+ format += " " + locale.timeFormat;
15265
+ }
15266
+ return formatValue(dateNumber, { locale, format });
15267
+ }
15268
+ return localizeNumberLiteral(literal, locale);
15269
+ }
15182
15270
  function canonicalizeCFRule(cf, locale) {
15183
15271
  return changeCFRuleLocale(cf, (content) => canonicalizeContent(content, locale));
15184
15272
  }
@@ -15535,7 +15623,9 @@ class LinkEditor extends owl.Component {
15535
15623
  save() {
15536
15624
  const { col, row } = this.props.cellPosition;
15537
15625
  const locale = this.env.model.getters.getLocale();
15538
- const label = this.link.label ? canonicalizeContent(this.link.label, locale) : this.link.url;
15626
+ const label = this.link.label
15627
+ ? canonicalizeNumberContent(this.link.label, locale)
15628
+ : this.link.url;
15539
15629
  this.env.model.dispatch("UPDATE_CELL", {
15540
15630
  col: col,
15541
15631
  row: row,
@@ -22711,7 +22801,6 @@ class FindAndReplacePanel extends owl.Component {
22711
22801
  state = owl.useState(this.initialState());
22712
22802
  debounceTimeoutId;
22713
22803
  showFormulaState = false;
22714
- debouncedUpdateSearch;
22715
22804
  findAndReplaceRef = owl.useRef("findAndReplace");
22716
22805
  get hasSearchResult() {
22717
22806
  return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
@@ -22721,9 +22810,9 @@ class FindAndReplacePanel extends owl.Component {
22721
22810
  }
22722
22811
  setup() {
22723
22812
  this.showFormulaState = this.env.model.getters.shouldShowFormulas();
22724
- this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
22725
22813
  owl.onMounted(() => this.focusInput());
22726
22814
  owl.onWillUnmount(() => {
22815
+ clearTimeout(this.debounceTimeoutId);
22727
22816
  this.env.model.dispatch("CLEAR_SEARCH");
22728
22817
  this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
22729
22818
  });
@@ -22768,6 +22857,13 @@ class FindAndReplacePanel extends owl.Component {
22768
22857
  searchOptions: this.state.searchOptions,
22769
22858
  });
22770
22859
  }
22860
+ debouncedUpdateSearch() {
22861
+ clearTimeout(this.debounceTimeoutId);
22862
+ this.debounceTimeoutId = setTimeout(() => {
22863
+ this.updateSearch();
22864
+ this.debounceTimeoutId = undefined;
22865
+ }, 200);
22866
+ }
22771
22867
  replace() {
22772
22868
  this.env.model.dispatch("REPLACE_SEARCH", {
22773
22869
  replaceWith: this.state.replaceWith,
@@ -25305,9 +25401,11 @@ function useCellHovered(env, gridRef, callback) {
25305
25401
  }
25306
25402
  }
25307
25403
  function updateMousePosition(e) {
25308
- x = e.offsetX;
25309
- y = e.offsetY;
25310
- lastMoved = Date.now();
25404
+ if (gridRef.el === e.target) {
25405
+ x = e.offsetX;
25406
+ y = e.offsetY;
25407
+ lastMoved = Date.now();
25408
+ }
25311
25409
  }
25312
25410
  function recompute() {
25313
25411
  const { col, row } = getPosition();
@@ -36680,8 +36778,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
36680
36778
  if (cell.type === CellValueType.error) {
36681
36779
  return false;
36682
36780
  }
36683
- const locale = this.getters.getLocale();
36684
- const values = rule.values.map((val) => parseLiteral(val, locale));
36781
+ const values = rule.values.map((val) => parseLiteral(val, DEFAULT_LOCALE));
36685
36782
  switch (rule.operator) {
36686
36783
  case "IsEmpty":
36687
36784
  return cell.value.toString().trim() === "";
@@ -38606,14 +38703,10 @@ class FindAndReplacePlugin extends UIPlugin {
38606
38703
  case "REPLACE_ALL_SEARCH":
38607
38704
  this.replaceAll(cmd.replaceWith);
38608
38705
  break;
38609
- case "EVALUATE_CELLS":
38610
- case "UPDATE_CELL":
38611
- case "REMOVE_FILTER_TABLE":
38612
- case "UPDATE_FILTER":
38613
- this.isSearchDirty = true;
38614
- break;
38615
38706
  case "UNDO":
38616
38707
  case "REDO":
38708
+ case "REMOVE_FILTER_TABLE":
38709
+ case "UPDATE_FILTER":
38617
38710
  case "REMOVE_COLUMNS_ROWS":
38618
38711
  case "HIDE_COLUMNS_ROWS":
38619
38712
  case "UNHIDE_COLUMNS_ROWS":
@@ -38765,7 +38858,7 @@ class FindAndReplacePlugin extends UIPlugin {
38765
38858
  const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
38766
38859
  const toReplace = this.getSearchableString({ sheetId, col, row });
38767
38860
  const content = toReplace.replace(replaceRegex, replaceWith);
38768
- const canonicalContent = canonicalizeContent(content, this.getters.getLocale());
38861
+ const canonicalContent = canonicalizeNumberContent(content, this.getters.getLocale());
38769
38862
  this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
38770
38863
  }
38771
38864
  /**
@@ -40939,7 +41032,7 @@ class SplitToColumnsPlugin extends UIPlugin {
40939
41032
  sheetId,
40940
41033
  col: col + index,
40941
41034
  row,
40942
- content: canonicalizeContent(content, this.getters.getLocale()),
41035
+ content: canonicalizeNumberContent(content, this.getters.getLocale()),
40943
41036
  format: "",
40944
41037
  style: mainCell?.style || null,
40945
41038
  });
@@ -41125,6 +41218,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41125
41218
  cells;
41126
41219
  copiedTables;
41127
41220
  zones;
41221
+ uuidGenerator = new UuidGenerator();
41128
41222
  constructor(zones, operation, getters, dispatch, selection) {
41129
41223
  super(operation, getters, dispatch, selection);
41130
41224
  if (!zones.length) {
@@ -41273,7 +41367,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41273
41367
  });
41274
41368
  for (const filterTable of this.copiedTables) {
41275
41369
  this.dispatch("REMOVE_FILTER_TABLE", {
41276
- sheetId: this.getters.getActiveSheetId(),
41370
+ sheetId: this.sheetId,
41277
41371
  target: [filterTable.zone],
41278
41372
  });
41279
41373
  }
@@ -41586,8 +41680,9 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41586
41680
  this.adaptCFRules(origin.sheetId, cf, [xc], toRemoveRange);
41587
41681
  }
41588
41682
  else {
41589
- this.adaptCFRules(target.sheetId, cf, [xc], []);
41590
41683
  this.adaptCFRules(origin.sheetId, cf, [], toRemoveRange);
41684
+ const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
41685
+ this.adaptCFRules(target.sheetId, cfToCopyTo, [xc], []);
41591
41686
  }
41592
41687
  }
41593
41688
  }
@@ -41611,6 +41706,12 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
41611
41706
  sheetId,
41612
41707
  });
41613
41708
  }
41709
+ getCFToCopyTo(targetSheetId, originCF) {
41710
+ const cfInTarget = this.getters
41711
+ .getConditionalFormats(targetSheetId)
41712
+ .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
41713
+ return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
41714
+ }
41614
41715
  }
41615
41716
 
41616
41717
  /** State of the clipboard when copying/cutting figures */
@@ -41742,7 +41843,7 @@ class ClipboardFigureImage {
41742
41843
  function canonicalizeNumberValue(content, locale) {
41743
41844
  return content.startsWith("=")
41744
41845
  ? canonicalizeFormula(content, locale)
41745
- : toCanonicalNumberString(content, locale);
41846
+ : canonicalizeNumberLiteral(content, locale);
41746
41847
  }
41747
41848
  /** Change a formula to its canonical form (en_US locale) */
41748
41849
  function canonicalizeFormula(formula, locale) {
@@ -41859,7 +41960,7 @@ class ClipboardPlugin extends UIPlugin {
41859
41960
  allowDispatch(cmd) {
41860
41961
  switch (cmd.type) {
41861
41962
  case "CUT":
41862
- const zones = cmd.cutTarget || this.getters.getSelectedZones();
41963
+ const zones = this.getters.getSelectedZones();
41863
41964
  const state = this.getClipboardState(zones, cmd.type);
41864
41965
  return state.isCutAllowed(zones);
41865
41966
  case "PASTE":
@@ -41894,7 +41995,7 @@ class ClipboardPlugin extends UIPlugin {
41894
41995
  switch (cmd.type) {
41895
41996
  case "COPY":
41896
41997
  case "CUT":
41897
- const zones = ("cutTarget" in cmd && cmd.cutTarget) || this.getters.getSelectedZones();
41998
+ const zones = this.getters.getSelectedZones();
41898
41999
  this.state = this.getClipboardState(zones, cmd.type);
41899
42000
  this.status = "visible";
41900
42001
  this.originSheetId = this.getters.getActiveSheetId();
@@ -42544,7 +42645,7 @@ class EditionPlugin extends UIPlugin {
42544
42645
  if (content) {
42545
42646
  const sheetId = this.getters.getActiveSheetId();
42546
42647
  const cell = this.getters.getEvaluatedCell({ sheetId, col: this.col, row: this.row });
42547
- content = canonicalizeContent(content, this.getters.getLocale());
42648
+ content = canonicalizeNumberContent(content, this.getters.getLocale());
42548
42649
  if (content.startsWith("=")) {
42549
42650
  const left = this.currentTokens.filter((t) => t.type === "LEFT_PAREN").length;
42550
42651
  const right = this.currentTokens.filter((t) => t.type === "RIGHT_PAREN").length;
@@ -43565,26 +43666,24 @@ class GridSelectionPlugin extends UIPlugin {
43565
43666
  const isBasedBefore = cmd.base < start;
43566
43667
  const deltaCol = isBasedBefore && isCol ? thickness : 0;
43567
43668
  const deltaRow = isBasedBefore && !isCol ? thickness : 0;
43568
- this.dispatch("CUT", {
43569
- cutTarget: [
43570
- {
43571
- left: isCol ? start + deltaCol : 0,
43572
- right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
43573
- top: !isCol ? start + deltaRow : 0,
43574
- bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
43575
- },
43576
- ],
43577
- });
43578
- this.dispatch("PASTE", {
43579
- target: [
43580
- {
43581
- left: isCol ? cmd.base : 0,
43582
- right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
43583
- top: !isCol ? cmd.base : 0,
43584
- bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
43585
- },
43586
- ],
43587
- });
43669
+ const target = [
43670
+ {
43671
+ left: isCol ? start + deltaCol : 0,
43672
+ right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
43673
+ top: !isCol ? start + deltaRow : 0,
43674
+ bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
43675
+ },
43676
+ ];
43677
+ const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
43678
+ const pasteTarget = [
43679
+ {
43680
+ left: isCol ? cmd.base : 0,
43681
+ right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
43682
+ top: !isCol ? cmd.base : 0,
43683
+ bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
43684
+ },
43685
+ ];
43686
+ state.paste(pasteTarget, { selectTarget: true });
43588
43687
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
43589
43688
  let currentIndex = cmd.base;
43590
43689
  for (const element of toRemove) {
@@ -43809,30 +43908,26 @@ class InternalViewport {
43809
43908
  const { end } = this.getters.getColDimensions(sheetId, targetCol);
43810
43909
  const maxCol = this.getters.getNumberCols(sheetId);
43811
43910
  if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
43812
- for (let col = this.left; this.offsetX + this.offsetCorrectionX + this.viewportWidth < end; col++) {
43813
- if (col > maxCol) {
43814
- break;
43815
- }
43816
- if (this.getters.isColHidden(sheetId, col)) {
43817
- continue;
43818
- }
43819
- this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
43820
- this.offsetScrollbarX = this.offsetX;
43821
- this.adjustViewportZoneX();
43911
+ let finalTarget = targetCol;
43912
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
43913
+ finalTarget++;
43822
43914
  }
43915
+ const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
43916
+ const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
43917
+ this.offsetX =
43918
+ this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
43919
+ this.offsetScrollbarX = this.offsetX;
43920
+ this.adjustViewportZoneX();
43823
43921
  }
43824
43922
  else if (this.left > targetCol) {
43825
- for (let col = this.left; col >= targetCol; col--) {
43826
- if (col < 0) {
43827
- break;
43828
- }
43829
- if (this.getters.isColHidden(sheetId, col)) {
43830
- continue;
43831
- }
43832
- this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
43833
- this.offsetScrollbarX = this.offsetX;
43834
- this.adjustViewportZoneX();
43923
+ let finalTarget = targetCol;
43924
+ while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
43925
+ finalTarget--;
43835
43926
  }
43927
+ this.offsetX =
43928
+ this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
43929
+ this.offsetScrollbarX = this.offsetX;
43930
+ this.adjustViewportZoneX();
43836
43931
  }
43837
43932
  }
43838
43933
  adjustPositionY(targetRow) {
@@ -43840,30 +43935,26 @@ class InternalViewport {
43840
43935
  const { end } = this.getters.getRowDimensions(sheetId, targetRow);
43841
43936
  const maxRow = this.getters.getNumberRows(sheetId);
43842
43937
  if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
43843
- for (let row = this.top; this.offsetY + this.viewportHeight + this.offsetCorrectionY < end; row++) {
43844
- if (row > maxRow) {
43845
- break;
43846
- }
43847
- if (this.getters.isRowHidden(sheetId, row)) {
43848
- continue;
43849
- }
43850
- this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
43851
- this.offsetScrollbarY = this.offsetY;
43852
- this.adjustViewportZoneY();
43938
+ let finalTarget = targetRow;
43939
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
43940
+ finalTarget++;
43853
43941
  }
43942
+ const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
43943
+ const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
43944
+ this.offsetY =
43945
+ this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
43946
+ this.offsetScrollbarY = this.offsetY;
43947
+ this.adjustViewportZoneY();
43854
43948
  }
43855
43949
  else if (this.top > targetRow) {
43856
- for (let row = this.top; row >= targetRow; row--) {
43857
- if (row < 0) {
43858
- break;
43859
- }
43860
- if (this.getters.isRowHidden(sheetId, row)) {
43861
- continue;
43862
- }
43863
- this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
43864
- this.offsetScrollbarY = this.offsetY;
43865
- this.adjustViewportZoneY();
43950
+ let finalTarget = targetRow;
43951
+ while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
43952
+ finalTarget--;
43866
43953
  }
43954
+ this.offsetY =
43955
+ this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
43956
+ this.offsetScrollbarY = this.offsetY;
43957
+ this.adjustViewportZoneY();
43867
43958
  }
43868
43959
  }
43869
43960
  setViewportOffset(offsetX, offsetY) {
@@ -50602,6 +50693,6 @@ exports.setTranslationMethod = setTranslationMethod;
50602
50693
  exports.tokenize = tokenize;
50603
50694
 
50604
50695
 
50605
- __info__.version = '16.4.6';
50606
- __info__.date = '2023-09-12T11:43:54.243Z';
50607
- __info__.hash = '5746355';
50696
+ __info__.version = '16.4.8';
50697
+ __info__.date = '2023-10-03T12:45:33.807Z';
50698
+ __info__.hash = 'c614d64';
@@ -1897,8 +1897,6 @@ interface CopyCommand {
1897
1897
  }
1898
1898
  interface CutCommand {
1899
1899
  type: "CUT";
1900
- /** Zones to cut. If none were given, will copy the zones in the selection*/
1901
- cutTarget?: Zone[];
1902
1900
  }
1903
1901
  interface PasteCommand {
1904
1902
  type: "PASTE";