@odoo/o-spreadsheet 16.0.36 → 16.0.38

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.
@@ -989,7 +989,7 @@
989
989
  }
990
990
  // Generate new Id if the item didn't exist in the dictionary
991
991
  const ids = Object.keys(itemsDic);
992
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
992
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
993
993
  itemsDic[maxId + 1] = item;
994
994
  return maxId + 1;
995
995
  }
@@ -1080,7 +1080,7 @@
1080
1080
  if (typeof o1 !== typeof o2)
1081
1081
  return false;
1082
1082
  if (typeof o1 !== "object")
1083
- return o1 === o2;
1083
+ return false;
1084
1084
  // Objects can have different keys if the values are undefined
1085
1085
  const keys = new Set();
1086
1086
  Object.keys(o1).forEach((key) => keys.add(key));
@@ -1135,6 +1135,34 @@
1135
1135
  return cache.get(args[0]);
1136
1136
  },
1137
1137
  }[funcName];
1138
+ }
1139
+ /**
1140
+ * Alternative to Math.max that works with large arrays.
1141
+ * Typically useful for arrays bigger than 100k elements.
1142
+ */
1143
+ function largeMax(array) {
1144
+ let len = array.length;
1145
+ if (len < 100000)
1146
+ return Math.max(...array);
1147
+ let max = -Infinity;
1148
+ while (len--) {
1149
+ max = array[len] > max ? array[len] : max;
1150
+ }
1151
+ return max;
1152
+ }
1153
+ /**
1154
+ * Alternative to Math.min that works with large arrays.
1155
+ * Typically useful for arrays bigger than 100k elements.
1156
+ */
1157
+ function largeMin(array) {
1158
+ let len = array.length;
1159
+ if (len < 100000)
1160
+ return Math.min(...array);
1161
+ let min = +Infinity;
1162
+ while (len--) {
1163
+ min = array[len] < min ? array[len] : min;
1164
+ }
1165
+ return min;
1138
1166
  }
1139
1167
 
1140
1168
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -4682,6 +4710,7 @@
4682
4710
  if (this.state.link.url) {
4683
4711
  this.save();
4684
4712
  }
4713
+ ev.preventDefault();
4685
4714
  break;
4686
4715
  case "Escape":
4687
4716
  this.cancel();
@@ -5097,8 +5126,8 @@
5097
5126
  let last;
5098
5127
  const activesRows = env.model.getters.getActiveRows();
5099
5128
  if (activesRows.size !== 0) {
5100
- first = Math.min(...activesRows);
5101
- last = Math.max(...activesRows);
5129
+ first = largeMin([...activesRows]);
5130
+ last = largeMax([...activesRows]);
5102
5131
  }
5103
5132
  else {
5104
5133
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5126,8 +5155,8 @@
5126
5155
  let last;
5127
5156
  const activeCols = env.model.getters.getActiveCols();
5128
5157
  if (activeCols.size !== 0) {
5129
- first = Math.min(...activeCols);
5130
- last = Math.max(...activeCols);
5158
+ first = largeMin([...activeCols]);
5159
+ last = largeMax([...activeCols]);
5131
5160
  }
5132
5161
  else {
5133
5162
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5155,8 +5184,8 @@
5155
5184
  let last;
5156
5185
  const activesRows = env.model.getters.getActiveRows();
5157
5186
  if (activesRows.size !== 0) {
5158
- first = Math.min(...activesRows);
5159
- last = Math.max(...activesRows);
5187
+ first = largeMin([...activesRows]);
5188
+ last = largeMax([...activesRows]);
5160
5189
  }
5161
5190
  else {
5162
5191
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5197,8 +5226,8 @@
5197
5226
  let last;
5198
5227
  const activeCols = env.model.getters.getActiveCols();
5199
5228
  if (activeCols.size !== 0) {
5200
- first = Math.min(...activeCols);
5201
- last = Math.max(...activeCols);
5229
+ first = largeMin([...activeCols]);
5230
+ last = largeMax([...activeCols]);
5202
5231
  }
5203
5232
  else {
5204
5233
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5267,7 +5296,7 @@
5267
5296
  let row;
5268
5297
  let quantity;
5269
5298
  if (activeRows.size) {
5270
- row = Math.min(...activeRows);
5299
+ row = largeMin([...activeRows]);
5271
5300
  quantity = activeRows.size;
5272
5301
  }
5273
5302
  else {
@@ -5299,7 +5328,7 @@
5299
5328
  let row;
5300
5329
  let quantity;
5301
5330
  if (activeRows.size) {
5302
- row = Math.max(...activeRows);
5331
+ row = largeMax([...activeRows]);
5303
5332
  quantity = activeRows.size;
5304
5333
  }
5305
5334
  else {
@@ -5340,7 +5369,7 @@
5340
5369
  let column;
5341
5370
  let quantity;
5342
5371
  if (activeCols.size) {
5343
- column = Math.min(...activeCols);
5372
+ column = largeMin([...activeCols]);
5344
5373
  quantity = activeCols.size;
5345
5374
  }
5346
5375
  else {
@@ -5374,7 +5403,7 @@
5374
5403
  let column;
5375
5404
  let quantity;
5376
5405
  if (activeCols.size) {
5377
- column = Math.max(...activeCols);
5406
+ column = largeMax([...activeCols]);
5378
5407
  quantity = activeCols.size;
5379
5408
  }
5380
5409
  else {
@@ -7930,7 +7959,7 @@
7930
7959
  return undefined;
7931
7960
  }
7932
7961
  const labelsTimestamps = labelDates.map((date) => date.getTime());
7933
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
7962
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
7934
7963
  const minUnit = getFormatMinDisplayUnit(format);
7935
7964
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
7936
7965
  return "second";
@@ -8346,7 +8375,7 @@
8346
8375
  }
8347
8376
  function getPieColors(colors, dataSetsValues) {
8348
8377
  const pieColors = [];
8349
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
8378
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
8350
8379
  for (let i = 0; i <= maxLength; i++) {
8351
8380
  pieColors.push(colors.next());
8352
8381
  }
@@ -20636,6 +20665,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20636
20665
  onCompleted(text) {
20637
20666
  text && this.autoComplete(text);
20638
20667
  }
20668
+ onContextMenu(ev) {
20669
+ var _a, _b;
20670
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20671
+ (_b = (_a = this.props).onInputContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, ev);
20672
+ }
20673
+ }
20639
20674
  // ---------------------------------------------------------------------------
20640
20675
  // Private
20641
20676
  // ---------------------------------------------------------------------------
@@ -20869,6 +20904,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20869
20904
  isDefaultFocus: true,
20870
20905
  onComposerContentFocused: this.props.onComposerContentFocused,
20871
20906
  onComposerCellFocused: this.props.onComposerCellFocused,
20907
+ onInputContextMenu: this.props.onInputContextMenu,
20872
20908
  };
20873
20909
  }
20874
20910
  get containerStyle() {
@@ -23019,8 +23055,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23019
23055
  else if (this.env.model.getters.getActiveRows().has(row)) {
23020
23056
  type = "ROW";
23021
23057
  }
23022
- const { x, y, width, height } = this.env.model.getters.getVisibleRect(lastZone);
23023
- this.toggleContextMenu(type, x + width, y + height);
23058
+ const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
23059
+ this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
23024
23060
  }
23025
23061
  onCellRightClicked(col, row, { x, y }) {
23026
23062
  const zones = this.env.model.getters.getSelectedZones();
@@ -24654,29 +24690,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24654
24690
  return width;
24655
24691
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
24656
24692
  }
24657
- function convertBorderDescr(descr) {
24658
- if (!descr) {
24659
- return undefined;
24660
- }
24661
- return {
24662
- style: descr[0],
24663
- color: { rgb: descr[1] },
24664
- };
24665
- }
24666
24693
  function extractStyle(cell, data) {
24667
24694
  let style = {};
24668
24695
  if (cell.style) {
24669
24696
  style = data.styles[cell.style];
24670
24697
  }
24671
24698
  const format = extractFormat(cell, data);
24672
- const exportedBorder = {};
24673
- if (cell.border) {
24674
- const border = data.borders[cell.border];
24675
- exportedBorder.left = convertBorderDescr(border.left);
24676
- exportedBorder.right = convertBorderDescr(border.right);
24677
- exportedBorder.bottom = convertBorderDescr(border.bottom);
24678
- exportedBorder.top = convertBorderDescr(border.top);
24679
- }
24680
24699
  const styles = {
24681
24700
  font: {
24682
24701
  size: (style === null || style === void 0 ? void 0 : style.fontSize) || DEFAULT_FONT_SIZE,
@@ -24690,7 +24709,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24690
24709
  }
24691
24710
  : { reservedAttribute: "none" },
24692
24711
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
24693
- border: exportedBorder || {},
24712
+ border: cell.border || 0,
24694
24713
  alignment: {
24695
24714
  vertical: "center",
24696
24715
  horizontal: style.align,
@@ -24719,23 +24738,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24719
24738
  return undefined;
24720
24739
  }
24721
24740
  function normalizeStyle(construct, styles) {
24722
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
24723
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
24724
- const { id: borderId } = pushElement(styles["border"], construct.borders);
24725
24741
  // Normalize this
24726
24742
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
24727
24743
  const style = {
24728
- fontId,
24729
- fillId,
24730
- borderId,
24744
+ fontId: pushElement(styles.font, construct.fonts),
24745
+ fillId: pushElement(styles.fill, construct.fills),
24746
+ borderId: styles.border,
24731
24747
  numFmtId,
24732
24748
  alignment: {
24733
24749
  vertical: styles.alignment.vertical,
24734
24750
  horizontal: styles.alignment.horizontal,
24735
24751
  },
24736
24752
  };
24737
- const { id } = pushElement(style, construct.styles);
24738
- return id;
24753
+ return pushElement(style, construct.styles);
24739
24754
  }
24740
24755
  function convertFormat(format, numFmtStructure) {
24741
24756
  if (!format) {
@@ -24743,8 +24758,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24743
24758
  }
24744
24759
  let formatId = XLSX_FORMAT_MAP[format.format];
24745
24760
  if (!formatId) {
24746
- const { id } = pushElement(format, numFmtStructure);
24747
- formatId = id + FIRST_NUMFMT_ID;
24761
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
24748
24762
  }
24749
24763
  return formatId;
24750
24764
  }
@@ -24769,20 +24783,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24769
24783
  return id;
24770
24784
  }
24771
24785
  function pushElement(property, propertyList) {
24772
- for (let [key, value] of Object.entries(propertyList)) {
24773
- if (JSON.stringify(value) === JSON.stringify(property)) {
24774
- return { id: parseInt(key, 10), list: propertyList };
24786
+ let len = propertyList.length;
24787
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
24788
+ for (let i = 0; i < len; i++) {
24789
+ if (operator(property, propertyList[i])) {
24790
+ return i;
24775
24791
  }
24776
24792
  }
24777
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
24778
- if (elemId === -1) {
24779
- propertyList.push(property);
24780
- elemId = propertyList.length - 1;
24781
- }
24782
- return {
24783
- id: elemId,
24784
- list: propertyList,
24785
- };
24793
+ propertyList[propertyList.length] = property;
24794
+ return propertyList.length - 1;
24786
24795
  }
24787
24796
  const chartIds = [];
24788
24797
  /**
@@ -25186,7 +25195,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
25186
25195
  function getSheetDims(sheet) {
25187
25196
  const dims = [0, 0];
25188
25197
  for (let row of sheet.rows) {
25189
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
25198
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
25190
25199
  dims[1] = Math.max(dims[1], row.index);
25191
25200
  }
25192
25201
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -25456,7 +25465,25 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
25456
25465
  }
25457
25466
  return document;
25458
25467
  }
25459
- function getDefaultXLSXStructure() {
25468
+ function convertBorderDescr(descr) {
25469
+ if (!descr) {
25470
+ return undefined;
25471
+ }
25472
+ return {
25473
+ style: descr[0],
25474
+ color: { rgb: descr[1] },
25475
+ };
25476
+ }
25477
+ function getDefaultXLSXStructure(data) {
25478
+ const xlsxBorders = Object.values(data.borders).map((border) => {
25479
+ return {
25480
+ left: convertBorderDescr(border.left),
25481
+ right: convertBorderDescr(border.right),
25482
+ bottom: convertBorderDescr(border.bottom),
25483
+ top: convertBorderDescr(border.top),
25484
+ };
25485
+ });
25486
+ const borders = [{}, ...xlsxBorders];
25460
25487
  return {
25461
25488
  relsFiles: [],
25462
25489
  sharedStrings: [],
@@ -25479,7 +25506,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
25479
25506
  },
25480
25507
  ],
25481
25508
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
25482
- borders: [{}],
25509
+ borders,
25483
25510
  numFmts: [],
25484
25511
  dxfs: [],
25485
25512
  };
@@ -29223,7 +29250,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29223
29250
  }
29224
29251
  }
29225
29252
  exportForExcel(data) {
29226
- this.export(data);
29253
+ for (const sheet of data.sheets) {
29254
+ for (const filterTable of this.getFilterTables(sheet.id)) {
29255
+ if (zoneToDimension(filterTable.zone).height === 1) {
29256
+ continue;
29257
+ }
29258
+ sheet.filterTables.push({
29259
+ range: zoneToXc(filterTable.zone),
29260
+ filters: [],
29261
+ });
29262
+ }
29263
+ }
29227
29264
  }
29228
29265
  }
29229
29266
  FiltersPlugin.getters = [
@@ -29279,7 +29316,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29279
29316
  for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
29280
29317
  sizes.splice(headerIndex, 1);
29281
29318
  }
29282
- const min = Math.min(...cmd.elements);
29319
+ const min = largeMin(cmd.elements);
29283
29320
  sizes = sizes.map((size, row) => {
29284
29321
  if (cmd.dimension === "ROW" && row >= min) {
29285
29322
  // invalidate sizes
@@ -29507,7 +29544,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29507
29544
  if (hiddenElements.size >= elements) {
29508
29545
  return 66 /* CommandResult.TooManyHiddenElements */;
29509
29546
  }
29510
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29547
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
29511
29548
  return 86 /* CommandResult.InvalidHeaderIndex */;
29512
29549
  }
29513
29550
  else {
@@ -30182,7 +30219,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
30182
30219
  const elements = cmd.dimension === "COL"
30183
30220
  ? this.getNumberCols(cmd.sheetId)
30184
30221
  : this.getNumberRows(cmd.sheetId);
30185
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30222
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
30186
30223
  return 86 /* CommandResult.InvalidHeaderIndex */;
30187
30224
  }
30188
30225
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -31555,13 +31592,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31555
31592
  const cells = this.getters.getCellsInZone(sheet.id, zone);
31556
31593
  const cellPositions = range(end, -1, -1);
31557
31594
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
31558
- const maxValidPosition = Math.max(...invalidCells);
31595
+ const maxValidPosition = largeMax(invalidCells);
31559
31596
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
31560
31597
  const firstSequence = numberSequences[0] || [];
31561
- if (Math.max(...firstSequence) < maxValidPosition) {
31598
+ if (largeMax(firstSequence) < maxValidPosition) {
31562
31599
  return Infinity;
31563
31600
  }
31564
- return Math.min(...firstSequence);
31601
+ return largeMin(firstSequence);
31565
31602
  }
31566
31603
  shouldFindData(sheetId, zone) {
31567
31604
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -33244,13 +33281,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
33244
33281
  .filter(this.isCellValueNumber);
33245
33282
  switch (threshold.type) {
33246
33283
  case "value":
33247
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
33284
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
33248
33285
  return result;
33249
33286
  case "number":
33250
33287
  return Number(threshold.value);
33251
33288
  case "percentage":
33252
- const min = Math.min(...rangeValues);
33253
- const max = Math.max(...rangeValues);
33289
+ const min = largeMin(rangeValues);
33290
+ const max = largeMax(rangeValues);
33254
33291
  const delta = max - min;
33255
33292
  return min + (delta * Number(threshold.value)) / 100;
33256
33293
  case "percentile":
@@ -36948,12 +36985,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36948
36985
  case "AlterZoneCorner":
36949
36986
  break;
36950
36987
  case "ZonesSelected":
36988
+ const sheetId = this.getters.getActiveSheetId();
36951
36989
  let { col, row } = findCellInNewZone(event.previousAnchor.zone, event.anchor.zone);
36952
36990
  if (event.mode === "updateAnchor") {
36953
36991
  const oldZone = event.previousAnchor.zone;
36954
36992
  const newZone = event.anchor.zone;
36955
36993
  // altering a zone should not move the viewport in a dimension that wasn't changed
36956
- const { top, bottom, left, right } = this.getters.getActiveMainViewport();
36994
+ const { top, bottom, left, right } = this.getMainInternalViewport(sheetId);
36957
36995
  if (oldZone.left === newZone.left && oldZone.right === newZone.right) {
36958
36996
  col = left > col || col > right ? left : col;
36959
36997
  }
@@ -36961,10 +36999,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36961
36999
  row = top > row || row > bottom ? top : row;
36962
37000
  }
36963
37001
  }
36964
- const sheetId = this.getters.getActiveSheetId();
36965
37002
  col = Math.min(col, this.getters.getNumberCols(sheetId) - 1);
36966
37003
  row = Math.min(row, this.getters.getNumberRows(sheetId) - 1);
36967
- this.refreshViewport(this.getters.getActiveSheetId(), { col, row });
37004
+ this.refreshViewport(sheetId, { col, row });
36968
37005
  break;
36969
37006
  }
36970
37007
  }
@@ -36989,16 +37026,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36989
37026
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
36990
37027
  break;
36991
37028
  case "SHIFT_VIEWPORT_DOWN":
36992
- const { top } = this.getActiveMainViewport();
36993
37029
  const sheetId = this.getters.getActiveSheetId();
36994
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).start + this.sheetViewHeight);
36995
- this.shiftVertically(shiftedOffsetY);
37030
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37031
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37032
+ this.shiftVertically(topRowDims.start + viewportHeight - offsetCorrectionY);
36996
37033
  break;
36997
37034
  case "SHIFT_VIEWPORT_UP": {
36998
- const { top } = this.getActiveMainViewport();
36999
37035
  const sheetId = this.getters.getActiveSheetId();
37000
- const shiftedOffsetY = this.clipOffsetY(this.getters.getRowDimensions(sheetId, top).end - this.sheetViewHeight);
37001
- this.shiftVertically(shiftedOffsetY);
37036
+ const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
37037
+ const topRowDims = this.getters.getRowDimensions(sheetId, top);
37038
+ this.shiftVertically(topRowDims.end - offsetCorrectionY - viewportHeight);
37002
37039
  break;
37003
37040
  }
37004
37041
  case "REMOVE_COLUMNS_ROWS":
@@ -37357,17 +37394,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37357
37394
  const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
37358
37395
  Object.values(this.getSubViewports(sheetId)).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
37359
37396
  }
37360
- /**
37361
- * Clip the vertical offset within the allowed range.
37362
- * Not above the sheet, nor below the sheet.
37363
- */
37364
- clipOffsetY(offsetY) {
37365
- const { height } = this.getMainViewportRect();
37366
- const maxOffset = height - this.sheetViewHeight;
37367
- offsetY = Math.min(offsetY, maxOffset);
37368
- offsetY = Math.max(offsetY, 0);
37369
- return offsetY;
37370
- }
37371
37397
  getViewportOffset(sheetId) {
37372
37398
  var _a, _b;
37373
37399
  return {
@@ -37421,12 +37447,15 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37421
37447
  * viewport top.
37422
37448
  */
37423
37449
  shiftVertically(offset) {
37424
- const { top } = this.getActiveMainViewport();
37450
+ const sheetId = this.getters.getActiveSheetId();
37451
+ const { top } = this.getMainInternalViewport(sheetId);
37425
37452
  const { scrollX } = this.getActiveSheetScrollInfo();
37426
37453
  this.setSheetViewOffset(scrollX, offset);
37427
37454
  const { anchor } = this.getters.getSelection();
37428
- const deltaRow = this.getActiveMainViewport().top - top;
37429
- this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37455
+ if (anchor.cell.row >= this.getters.getPaneDivisions(sheetId).ySplit) {
37456
+ const deltaRow = this.getMainInternalViewport(sheetId).top - top;
37457
+ this.selection.selectCell(anchor.cell.col, anchor.cell.row + deltaRow);
37458
+ }
37430
37459
  }
37431
37460
  getVisibleFigures() {
37432
37461
  const sheetId = this.getters.getActiveSheetId();
@@ -37987,7 +38016,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
37987
38016
  getColMaxWidth(sheetId, index) {
37988
38017
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
37989
38018
  const sizes = cellsPositions.map((position) => this.getCellWidth(sheetId, position));
37990
- return Math.max(0, ...sizes);
38019
+ return Math.max(0, largeMax(sizes));
37991
38020
  }
37992
38021
  splitWordToSpecificWidth(ctx, word, width, style) {
37993
38022
  const wordWidth = computeTextWidth(ctx, word, style);
@@ -40338,8 +40367,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40338
40367
  let newRange = range;
40339
40368
  let changeType = "NONE";
40340
40369
  for (let group of groups) {
40341
- const min = Math.min(...group);
40342
- const max = Math.max(...group);
40370
+ const min = largeMin(group);
40371
+ const max = largeMax(group);
40343
40372
  if (range.zone[start] <= min && min <= range.zone[end]) {
40344
40373
  const toRemove = Math.min(range.zone[end], max) - min + 1;
40345
40374
  changeType = "RESIZE";
@@ -41597,7 +41626,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41597
41626
  }
41598
41627
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
41599
41628
  const colors = new ChartColors();
41600
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41629
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41601
41630
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
41602
41631
  const dataSetsNodes = [];
41603
41632
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -41746,8 +41775,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41746
41775
  attrs.push(["t", "b"]);
41747
41776
  }
41748
41777
  else if (forceString || !isNumber(value)) {
41749
- const { id } = pushElement(content, sharedStrings);
41750
- value = id.toString();
41778
+ value = pushElement(content, sharedStrings);
41751
41779
  attrs.push(["t", "s"]);
41752
41780
  }
41753
41781
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -41872,8 +41900,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41872
41900
  if (rule.style.fillColor) {
41873
41901
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
41874
41902
  }
41875
- const { id } = pushElement(dxf, dxfs);
41876
- ruleAttributes.push(["dxfId", id]);
41903
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
41877
41904
  return escapeXml /*xml*/ `
41878
41905
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
41879
41906
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -42584,7 +42611,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42584
42611
  */
42585
42612
  function getXLSX(data) {
42586
42613
  const files = [];
42587
- const construct = getDefaultXLSXStructure();
42614
+ const construct = getDefaultXLSXStructure(data);
42588
42615
  files.push(createWorkbook(data, construct));
42589
42616
  files.push(...createWorksheets(data, construct));
42590
42617
  files.push(createStylesSheet(construct));
@@ -43294,9 +43321,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43294
43321
  Object.defineProperty(exports, '__esModule', { value: true });
43295
43322
 
43296
43323
 
43297
- __info__.version = '16.0.36';
43298
- __info__.date = '2024-03-25T09:36:40.811Z';
43299
- __info__.hash = '2c2117b';
43324
+ __info__.version = '16.0.38';
43325
+ __info__.date = '2024-04-10T12:16:41.911Z';
43326
+ __info__.hash = '6c7d510';
43300
43327
 
43301
43328
 
43302
43329
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);