@odoo/o-spreadsheet 16.0.37 → 16.0.39

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.
@@ -1083,7 +1083,7 @@ function deepEquals(o1, o2) {
1083
1083
  if (typeof o1 !== typeof o2)
1084
1084
  return false;
1085
1085
  if (typeof o1 !== "object")
1086
- return o1 === o2;
1086
+ return false;
1087
1087
  // Objects can have different keys if the values are undefined
1088
1088
  const keys = new Set();
1089
1089
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -4713,6 +4713,7 @@ class LinkEditor extends owl.Component {
4713
4713
  if (this.state.link.url) {
4714
4714
  this.save();
4715
4715
  }
4716
+ ev.preventDefault();
4716
4717
  break;
4717
4718
  case "Escape":
4718
4719
  this.cancel();
@@ -24692,29 +24693,12 @@ function convertWidthFromExcel(width) {
24692
24693
  return width;
24693
24694
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
24694
24695
  }
24695
- function convertBorderDescr(descr) {
24696
- if (!descr) {
24697
- return undefined;
24698
- }
24699
- return {
24700
- style: descr[0],
24701
- color: { rgb: descr[1] },
24702
- };
24703
- }
24704
24696
  function extractStyle(cell, data) {
24705
24697
  let style = {};
24706
24698
  if (cell.style) {
24707
24699
  style = data.styles[cell.style];
24708
24700
  }
24709
24701
  const format = extractFormat(cell, data);
24710
- const exportedBorder = {};
24711
- if (cell.border) {
24712
- const border = data.borders[cell.border];
24713
- exportedBorder.left = convertBorderDescr(border.left);
24714
- exportedBorder.right = convertBorderDescr(border.right);
24715
- exportedBorder.bottom = convertBorderDescr(border.bottom);
24716
- exportedBorder.top = convertBorderDescr(border.top);
24717
- }
24718
24702
  const styles = {
24719
24703
  font: {
24720
24704
  size: (style === null || style === void 0 ? void 0 : style.fontSize) || DEFAULT_FONT_SIZE,
@@ -24728,7 +24712,7 @@ function extractStyle(cell, data) {
24728
24712
  }
24729
24713
  : { reservedAttribute: "none" },
24730
24714
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
24731
- border: exportedBorder || {},
24715
+ border: cell.border || 0,
24732
24716
  alignment: {
24733
24717
  vertical: "center",
24734
24718
  horizontal: style.align,
@@ -24757,23 +24741,19 @@ function extractFormat(cell, data) {
24757
24741
  return undefined;
24758
24742
  }
24759
24743
  function normalizeStyle(construct, styles) {
24760
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
24761
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
24762
- const { id: borderId } = pushElement(styles["border"], construct.borders);
24763
24744
  // Normalize this
24764
24745
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
24765
24746
  const style = {
24766
- fontId,
24767
- fillId,
24768
- borderId,
24747
+ fontId: pushElement(styles.font, construct.fonts),
24748
+ fillId: pushElement(styles.fill, construct.fills),
24749
+ borderId: styles.border,
24769
24750
  numFmtId,
24770
24751
  alignment: {
24771
24752
  vertical: styles.alignment.vertical,
24772
24753
  horizontal: styles.alignment.horizontal,
24773
24754
  },
24774
24755
  };
24775
- const { id } = pushElement(style, construct.styles);
24776
- return id;
24756
+ return pushElement(style, construct.styles);
24777
24757
  }
24778
24758
  function convertFormat(format, numFmtStructure) {
24779
24759
  if (!format) {
@@ -24781,8 +24761,7 @@ function convertFormat(format, numFmtStructure) {
24781
24761
  }
24782
24762
  let formatId = XLSX_FORMAT_MAP[format.format];
24783
24763
  if (!formatId) {
24784
- const { id } = pushElement(format, numFmtStructure);
24785
- formatId = id + FIRST_NUMFMT_ID;
24764
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
24786
24765
  }
24787
24766
  return formatId;
24788
24767
  }
@@ -24807,20 +24786,15 @@ function addRelsToFile(relsFiles, path, rel) {
24807
24786
  return id;
24808
24787
  }
24809
24788
  function pushElement(property, propertyList) {
24810
- for (let [key, value] of Object.entries(propertyList)) {
24811
- if (JSON.stringify(value) === JSON.stringify(property)) {
24812
- return { id: parseInt(key, 10), list: propertyList };
24789
+ let len = propertyList.length;
24790
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
24791
+ for (let i = 0; i < len; i++) {
24792
+ if (operator(property, propertyList[i])) {
24793
+ return i;
24813
24794
  }
24814
24795
  }
24815
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
24816
- if (elemId === -1) {
24817
- propertyList.push(property);
24818
- elemId = propertyList.length - 1;
24819
- }
24820
- return {
24821
- id: elemId,
24822
- list: propertyList,
24823
- };
24796
+ propertyList[propertyList.length] = property;
24797
+ return propertyList.length - 1;
24824
24798
  }
24825
24799
  const chartIds = [];
24826
24800
  /**
@@ -25494,7 +25468,25 @@ function parseXML(xmlString) {
25494
25468
  }
25495
25469
  return document;
25496
25470
  }
25497
- function getDefaultXLSXStructure() {
25471
+ function convertBorderDescr(descr) {
25472
+ if (!descr) {
25473
+ return undefined;
25474
+ }
25475
+ return {
25476
+ style: descr[0],
25477
+ color: { rgb: descr[1] },
25478
+ };
25479
+ }
25480
+ function getDefaultXLSXStructure(data) {
25481
+ const xlsxBorders = Object.values(data.borders).map((border) => {
25482
+ return {
25483
+ left: convertBorderDescr(border.left),
25484
+ right: convertBorderDescr(border.right),
25485
+ bottom: convertBorderDescr(border.bottom),
25486
+ top: convertBorderDescr(border.top),
25487
+ };
25488
+ });
25489
+ const borders = [{}, ...xlsxBorders];
25498
25490
  return {
25499
25491
  relsFiles: [],
25500
25492
  sharedStrings: [],
@@ -25517,7 +25509,7 @@ function getDefaultXLSXStructure() {
25517
25509
  },
25518
25510
  ],
25519
25511
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
25520
- borders: [{}],
25512
+ borders,
25521
25513
  numFmts: [],
25522
25514
  dxfs: [],
25523
25515
  };
@@ -36996,12 +36988,13 @@ class SheetViewPlugin extends UIPlugin {
36996
36988
  case "AlterZoneCorner":
36997
36989
  break;
36998
36990
  case "ZonesSelected":
36991
+ const sheetId = this.getters.getActiveSheetId();
36999
36992
  let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
37000
36993
  if (event.mode === "updateAnchor") {
37001
36994
  const oldZone = event.previousAnchor.zone;
37002
36995
  const newZone = event.anchor.zone;
37003
36996
  // altering a zone should not move the viewport in a dimension that wasn't changed
37004
- const { top, bottom, left, right } = this.getters.getActiveMainViewport();
36997
+ const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
37005
36998
  if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
37006
36999
  col = left > col || col > right ? left : col;
37007
37000
  }
@@ -37009,10 +37002,9 @@ class SheetViewPlugin extends UIPlugin {
37009
37002
  row = top > row || row > bottom ? top : row;
37010
37003
  }
37011
37004
  }
37012
- const sheetId = this.getters.getActiveSheetId();
37013
37005
  col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
37014
37006
  row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
37015
- this.refreshViewport(this.getters.getActiveSheetId(), { col, row });
37007
+ this.refreshViewport(sheetId, { col, row });
37016
37008
  break;
37017
37009
  }
37018
37010
  }
@@ -37037,16 +37029,16 @@ class SheetViewPlugin extends UIPlugin {
37037
37029
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
37038
37030
  break;
37039
37031
  case "SHIFT_VIEWPORT_DOWN":
37040
- const { top } = this.getActiveMainViewport();
37041
37032
  const sheetId = this.getters.getActiveSheetId();
37042
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).start + this.sheetViewHeight);
37043
- this.shiftVertically(shiftedOffsetY);
37033
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37034
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37035
+ this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
37044
37036
  break;
37045
37037
  case "SHIFT_VIEWPORT_UP": {
37046
- const { top } = this.getActiveMainViewport();
37047
37038
  const sheetId = this.getters.getActiveSheetId();
37048
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).end - this.sheetViewHeight);
37049
- this.shiftVertically(shiftedOffsetY);
37039
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37040
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37041
+ this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
37050
37042
  break;
37051
37043
  }
37052
37044
  case "REMOVE_COLUMNS_ROWS":
@@ -37405,17 +37397,6 @@ class SheetViewPlugin extends UIPlugin {
37405
37397
  const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
37406
37398
  Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
37407
37399
  }
37408
- /**
37409
- * Clip the vertical offset within the allowed range.
37410
- * Not above the sheet, nor below the sheet.
37411
- */
37412
- clipOffsetY(offsetY) {
37413
- const { height } = this.getMainViewportRect();
37414
- const maxOffset = height - this.sheetViewHeight;
37415
- offsetY = Math.min(offsetY, maxOffset);
37416
- offsetY = Math.max(offsetY, 0);
37417
- return offsetY;
37418
- }
37419
37400
  getViewportOffset(sheetId) {
37420
37401
  var _a, _b;
37421
37402
  return {
@@ -37469,12 +37450,15 @@ class SheetViewPlugin extends UIPlugin {
37469
37450
  * viewport top.
37470
37451
  */
37471
37452
  shiftVertically(offset) {
37472
- const { top } = this.getActiveMainViewport();
37453
+ const sheetId = this.getters.getActiveSheetId();
37454
+ const { top } = this.getMainInternalViewport(sheetId);
37473
37455
  const { scrollX } = this.getActiveSheetScrollInfo();
37474
37456
  this.setSheetViewOffset(scrollX, offset);
37475
37457
  const { anchor } = this.getters.getSelection();
37476
- const deltaRow = this.getActiveMainViewport().top - top;
37477
- this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37458
+ if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
37459
+ const deltaRow = this.getMainInternalViewport(sheetId).top - top;
37460
+ this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37461
+ }
37478
37462
  }
37479
37463
  getVisibleFigures() {
37480
37464
  const sheetId = this.getters.getActiveSheetId();
@@ -41794,8 +41778,7 @@ function addContent(content, sharedStrings, forceString = false) {
41794
41778
  attrs.push(["t", "b"]);
41795
41779
  }
41796
41780
  else if (forceString || !isNumber(value)) {
41797
- const { id } = pushElement(content, sharedStrings);
41798
- value = id.toString();
41781
+ value = pushElement(content, sharedStrings);
41799
41782
  attrs.push(["t", "s"]);
41800
41783
  }
41801
41784
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -41920,8 +41903,7 @@ function addCellIsRule(cf, rule, dxfs) {
41920
41903
  if (rule.style.fillColor) {
41921
41904
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
41922
41905
  }
41923
- const { id } = pushElement(dxf, dxfs);
41924
- ruleAttributes.push(["dxfId", id]);
41906
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
41925
41907
  return escapeXml /*xml*/ `
41926
41908
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
41927
41909
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -42632,7 +42614,7 @@ function addSheetViews(sheet) {
42632
42614
  */
42633
42615
  function getXLSX(data) {
42634
42616
  const files = [];
42635
- const construct = getDefaultXLSXStructure();
42617
+ const construct = getDefaultXLSXStructure(data);
42636
42618
  files.push(createWorkbook(data, construct));
42637
42619
  files.push(...createWorksheets(data, construct));
42638
42620
  files.push(createStylesSheet(construct));
@@ -43340,6 +43322,6 @@ exports.setTranslationMethod = setTranslationMethod;
43340
43322
  exports.tokenize = tokenize;
43341
43323
 
43342
43324
 
43343
- __info__.version = '16.0.37';
43344
- __info__.date = '2024-04-05T13:58:08.848Z';
43345
- __info__.hash = 'e95827b';
43325
+ __info__.version = '16.0.39';
43326
+ __info__.date = '2024-04-18T16:36:36.901Z';
43327
+ __info__.hash = 'ea5a526';
@@ -4483,11 +4483,6 @@ declare class SheetViewPlugin extends UIPlugin {
4483
4483
  private resizeSheetView;
4484
4484
  private recomputeViewports;
4485
4485
  private setSheetViewOffset;
4486
- /**
4487
- * Clip the vertical offset within the allowed range.
4488
- * Not above the sheet, nor below the sheet.
4489
- */
4490
- private clipOffsetY;
4491
4486
  private getViewportOffset;
4492
4487
  private resetViewports;
4493
4488
  /**
@@ -1079,7 +1079,7 @@ function deepEquals(o1, o2) {
1079
1079
  if (typeof o1 !== typeof o2)
1080
1080
  return false;
1081
1081
  if (typeof o1 !== "object")
1082
- return o1 === o2;
1082
+ return false;
1083
1083
  // Objects can have different keys if the values are undefined
1084
1084
  const keys = new Set();
1085
1085
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -4709,6 +4709,7 @@ class LinkEditor extends Component {
4709
4709
  if (this.state.link.url) {
4710
4710
  this.save();
4711
4711
  }
4712
+ ev.preventDefault();
4712
4713
  break;
4713
4714
  case "Escape":
4714
4715
  this.cancel();
@@ -24688,29 +24689,12 @@ function convertWidthFromExcel(width) {
24688
24689
  return width;
24689
24690
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
24690
24691
  }
24691
- function convertBorderDescr(descr) {
24692
- if (!descr) {
24693
- return undefined;
24694
- }
24695
- return {
24696
- style: descr[0],
24697
- color: { rgb: descr[1] },
24698
- };
24699
- }
24700
24692
  function extractStyle(cell, data) {
24701
24693
  let style = {};
24702
24694
  if (cell.style) {
24703
24695
  style = data.styles[cell.style];
24704
24696
  }
24705
24697
  const format = extractFormat(cell, data);
24706
- const exportedBorder = {};
24707
- if (cell.border) {
24708
- const border = data.borders[cell.border];
24709
- exportedBorder.left = convertBorderDescr(border.left);
24710
- exportedBorder.right = convertBorderDescr(border.right);
24711
- exportedBorder.bottom = convertBorderDescr(border.bottom);
24712
- exportedBorder.top = convertBorderDescr(border.top);
24713
- }
24714
24698
  const styles = {
24715
24699
  font: {
24716
24700
  size: (style === null || style === void 0 ? void 0 : style.fontSize) || DEFAULT_FONT_SIZE,
@@ -24724,7 +24708,7 @@ function extractStyle(cell, data) {
24724
24708
  }
24725
24709
  : { reservedAttribute: "none" },
24726
24710
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
24727
- border: exportedBorder || {},
24711
+ border: cell.border || 0,
24728
24712
  alignment: {
24729
24713
  vertical: "center",
24730
24714
  horizontal: style.align,
@@ -24753,23 +24737,19 @@ function extractFormat(cell, data) {
24753
24737
  return undefined;
24754
24738
  }
24755
24739
  function normalizeStyle(construct, styles) {
24756
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
24757
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
24758
- const { id: borderId } = pushElement(styles["border"], construct.borders);
24759
24740
  // Normalize this
24760
24741
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
24761
24742
  const style = {
24762
- fontId,
24763
- fillId,
24764
- borderId,
24743
+ fontId: pushElement(styles.font, construct.fonts),
24744
+ fillId: pushElement(styles.fill, construct.fills),
24745
+ borderId: styles.border,
24765
24746
  numFmtId,
24766
24747
  alignment: {
24767
24748
  vertical: styles.alignment.vertical,
24768
24749
  horizontal: styles.alignment.horizontal,
24769
24750
  },
24770
24751
  };
24771
- const { id } = pushElement(style, construct.styles);
24772
- return id;
24752
+ return pushElement(style, construct.styles);
24773
24753
  }
24774
24754
  function convertFormat(format, numFmtStructure) {
24775
24755
  if (!format) {
@@ -24777,8 +24757,7 @@ function convertFormat(format, numFmtStructure) {
24777
24757
  }
24778
24758
  let formatId = XLSX_FORMAT_MAP[format.format];
24779
24759
  if (!formatId) {
24780
- const { id } = pushElement(format, numFmtStructure);
24781
- formatId = id + FIRST_NUMFMT_ID;
24760
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
24782
24761
  }
24783
24762
  return formatId;
24784
24763
  }
@@ -24803,20 +24782,15 @@ function addRelsToFile(relsFiles, path, rel) {
24803
24782
  return id;
24804
24783
  }
24805
24784
  function pushElement(property, propertyList) {
24806
- for (let [key, value] of Object.entries(propertyList)) {
24807
- if (JSON.stringify(value) === JSON.stringify(property)) {
24808
- return { id: parseInt(key, 10), list: propertyList };
24785
+ let len = propertyList.length;
24786
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
24787
+ for (let i = 0; i < len; i++) {
24788
+ if (operator(property, propertyList[i])) {
24789
+ return i;
24809
24790
  }
24810
24791
  }
24811
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
24812
- if (elemId === -1) {
24813
- propertyList.push(property);
24814
- elemId = propertyList.length - 1;
24815
- }
24816
- return {
24817
- id: elemId,
24818
- list: propertyList,
24819
- };
24792
+ propertyList[propertyList.length] = property;
24793
+ return propertyList.length - 1;
24820
24794
  }
24821
24795
  const chartIds = [];
24822
24796
  /**
@@ -25490,7 +25464,25 @@ function parseXML(xmlString) {
25490
25464
  }
25491
25465
  return document;
25492
25466
  }
25493
- function getDefaultXLSXStructure() {
25467
+ function convertBorderDescr(descr) {
25468
+ if (!descr) {
25469
+ return undefined;
25470
+ }
25471
+ return {
25472
+ style: descr[0],
25473
+ color: { rgb: descr[1] },
25474
+ };
25475
+ }
25476
+ function getDefaultXLSXStructure(data) {
25477
+ const xlsxBorders = Object.values(data.borders).map((border) => {
25478
+ return {
25479
+ left: convertBorderDescr(border.left),
25480
+ right: convertBorderDescr(border.right),
25481
+ bottom: convertBorderDescr(border.bottom),
25482
+ top: convertBorderDescr(border.top),
25483
+ };
25484
+ });
25485
+ const borders = [{}, ...xlsxBorders];
25494
25486
  return {
25495
25487
  relsFiles: [],
25496
25488
  sharedStrings: [],
@@ -25513,7 +25505,7 @@ function getDefaultXLSXStructure() {
25513
25505
  },
25514
25506
  ],
25515
25507
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
25516
- borders: [{}],
25508
+ borders,
25517
25509
  numFmts: [],
25518
25510
  dxfs: [],
25519
25511
  };
@@ -36992,12 +36984,13 @@ class SheetViewPlugin extends UIPlugin {
36992
36984
  case "AlterZoneCorner":
36993
36985
  break;
36994
36986
  case "ZonesSelected":
36987
+ const sheetId = this.getters.getActiveSheetId();
36995
36988
  let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
36996
36989
  if (event.mode === "updateAnchor") {
36997
36990
  const oldZone = event.previousAnchor.zone;
36998
36991
  const newZone = event.anchor.zone;
36999
36992
  // altering a zone should not move the viewport in a dimension that wasn't changed
37000
- const { top, bottom, left, right } = this.getters.getActiveMainViewport();
36993
+ const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
37001
36994
  if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
37002
36995
  col = left > col || col > right ? left : col;
37003
36996
  }
@@ -37005,10 +36998,9 @@ class SheetViewPlugin extends UIPlugin {
37005
36998
  row = top > row || row > bottom ? top : row;
37006
36999
  }
37007
37000
  }
37008
- const sheetId = this.getters.getActiveSheetId();
37009
37001
  col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
37010
37002
  row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
37011
- this.refreshViewport(this.getters.getActiveSheetId(), { col, row });
37003
+ this.refreshViewport(sheetId, { col, row });
37012
37004
  break;
37013
37005
  }
37014
37006
  }
@@ -37033,16 +37025,16 @@ class SheetViewPlugin extends UIPlugin {
37033
37025
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
37034
37026
  break;
37035
37027
  case "SHIFT_VIEWPORT_DOWN":
37036
- const { top } = this.getActiveMainViewport();
37037
37028
  const sheetId = this.getters.getActiveSheetId();
37038
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).start + this.sheetViewHeight);
37039
- this.shiftVertically(shiftedOffsetY);
37029
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37030
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37031
+ this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
37040
37032
  break;
37041
37033
  case "SHIFT_VIEWPORT_UP": {
37042
- const { top } = this.getActiveMainViewport();
37043
37034
  const sheetId = this.getters.getActiveSheetId();
37044
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).end - this.sheetViewHeight);
37045
- this.shiftVertically(shiftedOffsetY);
37035
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37036
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37037
+ this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
37046
37038
  break;
37047
37039
  }
37048
37040
  case "REMOVE_COLUMNS_ROWS":
@@ -37401,17 +37393,6 @@ class SheetViewPlugin extends UIPlugin {
37401
37393
  const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
37402
37394
  Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
37403
37395
  }
37404
- /**
37405
- * Clip the vertical offset within the allowed range.
37406
- * Not above the sheet, nor below the sheet.
37407
- */
37408
- clipOffsetY(offsetY) {
37409
- const { height } = this.getMainViewportRect();
37410
- const maxOffset = height - this.sheetViewHeight;
37411
- offsetY = Math.min(offsetY, maxOffset);
37412
- offsetY = Math.max(offsetY, 0);
37413
- return offsetY;
37414
- }
37415
37396
  getViewportOffset(sheetId) {
37416
37397
  var _a, _b;
37417
37398
  return {
@@ -37465,12 +37446,15 @@ class SheetViewPlugin extends UIPlugin {
37465
37446
  * viewport top.
37466
37447
  */
37467
37448
  shiftVertically(offset) {
37468
- const { top } = this.getActiveMainViewport();
37449
+ const sheetId = this.getters.getActiveSheetId();
37450
+ const { top } = this.getMainInternalViewport(sheetId);
37469
37451
  const { scrollX } = this.getActiveSheetScrollInfo();
37470
37452
  this.setSheetViewOffset(scrollX, offset);
37471
37453
  const { anchor } = this.getters.getSelection();
37472
- const deltaRow = this.getActiveMainViewport().top - top;
37473
- this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37454
+ if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
37455
+ const deltaRow = this.getMainInternalViewport(sheetId).top - top;
37456
+ this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37457
+ }
37474
37458
  }
37475
37459
  getVisibleFigures() {
37476
37460
  const sheetId = this.getters.getActiveSheetId();
@@ -41790,8 +41774,7 @@ function addContent(content, sharedStrings, forceString = false) {
41790
41774
  attrs.push(["t", "b"]);
41791
41775
  }
41792
41776
  else if (forceString || !isNumber(value)) {
41793
- const { id } = pushElement(content, sharedStrings);
41794
- value = id.toString();
41777
+ value = pushElement(content, sharedStrings);
41795
41778
  attrs.push(["t", "s"]);
41796
41779
  }
41797
41780
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -41916,8 +41899,7 @@ function addCellIsRule(cf, rule, dxfs) {
41916
41899
  if (rule.style.fillColor) {
41917
41900
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
41918
41901
  }
41919
- const { id } = pushElement(dxf, dxfs);
41920
- ruleAttributes.push(["dxfId", id]);
41902
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
41921
41903
  return escapeXml /*xml*/ `
41922
41904
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
41923
41905
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -42628,7 +42610,7 @@ function addSheetViews(sheet) {
42628
42610
  */
42629
42611
  function getXLSX(data) {
42630
42612
  const files = [];
42631
- const construct = getDefaultXLSXStructure();
42613
+ const construct = getDefaultXLSXStructure(data);
42632
42614
  files.push(createWorkbook(data, construct));
42633
42615
  files.push(...createWorksheets(data, construct));
42634
42616
  files.push(createStylesSheet(construct));
@@ -43308,6 +43290,6 @@ function addFunction(functionName, functionDescription) {
43308
43290
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43309
43291
 
43310
43292
 
43311
- __info__.version = '16.0.37';
43312
- __info__.date = '2024-04-05T13:58:08.848Z';
43313
- __info__.hash = 'e95827b';
43293
+ __info__.version = '16.0.39';
43294
+ __info__.date = '2024-04-18T16:36:36.901Z';
43295
+ __info__.hash = 'ea5a526';