@odoo/o-spreadsheet 16.3.30 → 16.3.31

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.
@@ -1020,7 +1020,7 @@ function getItemId(item, itemsDic) {
1020
1020
  }
1021
1021
  // Generate new Id if the item didn't exist in the dictionary
1022
1022
  const ids = Object.keys(itemsDic);
1023
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
1023
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
1024
1024
  itemsDic[maxId + 1] = item;
1025
1025
  return maxId + 1;
1026
1026
  }
@@ -1212,6 +1212,34 @@ function isConsecutive(iterable) {
1212
1212
  }
1213
1213
  }
1214
1214
  return true;
1215
+ }
1216
+ /**
1217
+ * Alternative to Math.max that works with large arrays.
1218
+ * Typically useful for arrays bigger than 100k elements.
1219
+ */
1220
+ function largeMax(array) {
1221
+ let len = array.length;
1222
+ if (len < 100000)
1223
+ return Math.max(...array);
1224
+ let max = -Infinity;
1225
+ while (len--) {
1226
+ max = array[len] > max ? array[len] : max;
1227
+ }
1228
+ return max;
1229
+ }
1230
+ /**
1231
+ * Alternative to Math.min that works with large arrays.
1232
+ * Typically useful for arrays bigger than 100k elements.
1233
+ */
1234
+ function largeMin(array) {
1235
+ let len = array.length;
1236
+ if (len < 100000)
1237
+ return Math.min(...array);
1238
+ let min = +Infinity;
1239
+ while (len--) {
1240
+ min = array[len] < min ? array[len] : min;
1241
+ }
1242
+ return min;
1215
1243
  }
1216
1244
 
1217
1245
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -6823,10 +6851,10 @@ function aggregateDataForLabels(labels, datasets) {
6823
6851
  }
6824
6852
  }
6825
6853
  return {
6826
- labels: Object.keys(labelMap),
6854
+ labels: Array.from(labelSet),
6827
6855
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
6828
6856
  ...dataset,
6829
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
6857
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
6830
6858
  })),
6831
6859
  };
6832
6860
  }
@@ -7543,7 +7571,7 @@ function getBestTimeUnitForScale(labels, format) {
7543
7571
  return undefined;
7544
7572
  }
7545
7573
  const labelsTimestamps = labelDates.map((date) => date.getTime());
7546
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
7574
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
7547
7575
  const minUnit = getFormatMinDisplayUnit(format);
7548
7576
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
7549
7577
  return "second";
@@ -7983,7 +8011,7 @@ function getPieConfiguration(chart, labels, dataSetFormat) {
7983
8011
  }
7984
8012
  function getPieColors(colors, dataSetsValues) {
7985
8013
  const pieColors = [];
7986
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
8014
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
7987
8015
  for (let i = 0; i <= maxLength; i++) {
7988
8016
  pieColors.push(colors.next());
7989
8017
  }
@@ -8946,8 +8974,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
8946
8974
  let last;
8947
8975
  const activesRows = env.model.getters.getActiveRows();
8948
8976
  if (activesRows.size !== 0) {
8949
- first = Math.min(...activesRows);
8950
- last = Math.max(...activesRows);
8977
+ first = largeMin([...activesRows]);
8978
+ last = largeMax([...activesRows]);
8951
8979
  }
8952
8980
  else {
8953
8981
  const zone = env.model.getters.getSelectedZones()[0];
@@ -8975,8 +9003,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
8975
9003
  let last;
8976
9004
  const activeCols = env.model.getters.getActiveCols();
8977
9005
  if (activeCols.size !== 0) {
8978
- first = Math.min(...activeCols);
8979
- last = Math.max(...activeCols);
9006
+ first = largeMin([...activeCols]);
9007
+ last = largeMax([...activeCols]);
8980
9008
  }
8981
9009
  else {
8982
9010
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9004,8 +9032,8 @@ const REMOVE_ROWS_NAME = (env) => {
9004
9032
  let last;
9005
9033
  const activesRows = env.model.getters.getActiveRows();
9006
9034
  if (activesRows.size !== 0) {
9007
- first = Math.min(...activesRows);
9008
- last = Math.max(...activesRows);
9035
+ first = largeMin([...activesRows]);
9036
+ last = largeMax([...activesRows]);
9009
9037
  }
9010
9038
  else {
9011
9039
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9046,8 +9074,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
9046
9074
  let last;
9047
9075
  const activeCols = env.model.getters.getActiveCols();
9048
9076
  if (activeCols.size !== 0) {
9049
- first = Math.min(...activeCols);
9050
- last = Math.max(...activeCols);
9077
+ first = largeMin([...activeCols]);
9078
+ last = largeMax([...activeCols]);
9051
9079
  }
9052
9080
  else {
9053
9081
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9130,7 +9158,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
9130
9158
  let row;
9131
9159
  let quantity;
9132
9160
  if (activeRows.size) {
9133
- row = Math.min(...activeRows);
9161
+ row = largeMin([...activeRows]);
9134
9162
  quantity = activeRows.size;
9135
9163
  }
9136
9164
  else {
@@ -9162,7 +9190,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
9162
9190
  let row;
9163
9191
  let quantity;
9164
9192
  if (activeRows.size) {
9165
- row = Math.max(...activeRows);
9193
+ row = largeMax([...activeRows]);
9166
9194
  quantity = activeRows.size;
9167
9195
  }
9168
9196
  else {
@@ -9207,7 +9235,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
9207
9235
  let column;
9208
9236
  let quantity;
9209
9237
  if (activeCols.size) {
9210
- column = Math.min(...activeCols);
9238
+ column = largeMin([...activeCols]);
9211
9239
  quantity = activeCols.size;
9212
9240
  }
9213
9241
  else {
@@ -9241,7 +9269,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
9241
9269
  let column;
9242
9270
  let quantity;
9243
9271
  if (activeCols.size) {
9244
- column = Math.max(...activeCols);
9272
+ column = largeMax([...activeCols]);
9245
9273
  quantity = activeCols.size;
9246
9274
  }
9247
9275
  else {
@@ -26929,7 +26957,7 @@ function convertHyperlink(link, cellValue, warningManager) {
26929
26957
  function getSheetDims(sheet) {
26930
26958
  const dims = [0, 0];
26931
26959
  for (let row of sheet.rows) {
26932
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
26960
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
26933
26961
  dims[1] = Math.max(dims[1], row.index);
26934
26962
  }
26935
26963
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -31216,7 +31244,7 @@ class HeaderSizePlugin extends CorePlugin {
31216
31244
  for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
31217
31245
  sizes.splice(headerIndex, 1);
31218
31246
  }
31219
- const min = Math.min(...cmd.elements);
31247
+ const min = largeMin(cmd.elements);
31220
31248
  sizes = sizes.map((size, row) => {
31221
31249
  if (cmd.dimension === "ROW" && row >= min) {
31222
31250
  // invalidate sizes
@@ -31443,7 +31471,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
31443
31471
  if (hiddenElements.size >= elements) {
31444
31472
  return 67 /* CommandResult.TooManyHiddenElements */;
31445
31473
  }
31446
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31474
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
31447
31475
  return 87 /* CommandResult.InvalidHeaderIndex */;
31448
31476
  }
31449
31477
  else {
@@ -32216,8 +32244,8 @@ class RangeAdapter {
32216
32244
  let newRange = range;
32217
32245
  let changeType = "NONE";
32218
32246
  for (let group of groups) {
32219
- const min = Math.min(...group);
32220
- const max = Math.max(...group);
32247
+ const min = largeMin(group);
32248
+ const max = largeMax(group);
32221
32249
  if (range.zone[start] <= min && min <= range.zone[end]) {
32222
32250
  const toRemove = Math.min(range.zone[end], max) - min + 1;
32223
32251
  changeType = "RESIZE";
@@ -32648,7 +32676,7 @@ class SheetPlugin extends CorePlugin {
32648
32676
  const elements = cmd.dimension === "COL"
32649
32677
  ? this.getNumberCols(cmd.sheetId)
32650
32678
  : this.getNumberRows(cmd.sheetId);
32651
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
32679
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
32652
32680
  return 87 /* CommandResult.InvalidHeaderIndex */;
32653
32681
  }
32654
32682
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -34150,13 +34178,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
34150
34178
  .map((cell) => cell.value);
34151
34179
  switch (threshold.type) {
34152
34180
  case "value":
34153
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
34181
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
34154
34182
  return result;
34155
34183
  case "number":
34156
34184
  return Number(threshold.value);
34157
34185
  case "percentage":
34158
- const min = Math.min(...rangeValues);
34159
- const max = Math.max(...rangeValues);
34186
+ const min = largeMin(rangeValues);
34187
+ const max = largeMax(rangeValues);
34160
34188
  const delta = max - min;
34161
34189
  return min + (delta * Number(threshold.value)) / 100;
34162
34190
  case "percentile":
@@ -36106,13 +36134,13 @@ class AutomaticSumPlugin extends UIPlugin {
36106
36134
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
36107
36135
  const cellPositions = range(end, -1, -1);
36108
36136
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
36109
- const maxValidPosition = Math.max(...invalidCells);
36137
+ const maxValidPosition = largeMax(invalidCells);
36110
36138
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
36111
36139
  const firstSequence = numberSequences[0] || [];
36112
- if (Math.max(...firstSequence) < maxValidPosition) {
36140
+ if (largeMax(firstSequence) < maxValidPosition) {
36113
36141
  return Infinity;
36114
36142
  }
36115
- return Math.min(...firstSequence);
36143
+ return largeMin(firstSequence);
36116
36144
  }
36117
36145
  shouldFindData(sheetId, zone) {
36118
36146
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -37697,7 +37725,7 @@ class RendererPlugin extends UIPlugin {
37697
37725
  * column of the current viewport
37698
37726
  */
37699
37727
  getColDimensionsInViewport(sheetId, col) {
37700
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
37728
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
37701
37729
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
37702
37730
  const size = this.getters.getColSize(sheetId, col);
37703
37731
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -37712,7 +37740,7 @@ class RendererPlugin extends UIPlugin {
37712
37740
  * of the current viewport
37713
37741
  */
37714
37742
  getRowDimensionsInViewport(sheetId, row) {
37715
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
37743
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
37716
37744
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
37717
37745
  const size = this.getters.getRowSize(sheetId, row);
37718
37746
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -39240,7 +39268,7 @@ class SheetUIPlugin extends UIPlugin {
39240
39268
  getColMaxWidth(sheetId, index) {
39241
39269
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
39242
39270
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
39243
- return Math.max(0, ...sizes);
39271
+ return Math.max(0, largeMax(sizes));
39244
39272
  }
39245
39273
  splitWordToSpecificWidth(ctx, word, width, style) {
39246
39274
  const wordWidth = computeTextWidth(ctx, word, style);
@@ -42503,12 +42531,14 @@ class BottomBarSheet extends owl.Component {
42503
42531
  this.editionState = "initializing";
42504
42532
  }
42505
42533
  stopEdition() {
42506
- if (!this.state.isEditing)
42534
+ const input = this.sheetNameRef.el;
42535
+ if (!this.state.isEditing || !input)
42507
42536
  return;
42508
42537
  this.state.isEditing = false;
42509
42538
  this.editionState = "initializing";
42510
- this.sheetNameRef.el?.blur();
42539
+ input.blur();
42511
42540
  const inputValue = this.getInputContent() || "";
42541
+ input.innerText = inputValue;
42512
42542
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
42513
42543
  }
42514
42544
  cancelEdition() {
@@ -42969,7 +42999,7 @@ class BottomBar extends owl.Component {
42969
42999
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
42970
43000
  }
42971
43001
  onSheetMouseDown(sheetId, event) {
42972
- if (event.button !== 0)
43002
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
42973
43003
  return;
42974
43004
  this.closeMenu();
42975
43005
  const mouseX = event.clientX;
@@ -46143,7 +46173,7 @@ function addLineChart(chart) {
46143
46173
  }
46144
46174
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
46145
46175
  const colors = new ChartColors();
46146
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
46176
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
46147
46177
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
46148
46178
  const dataSetsNodes = [];
46149
46179
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -48064,6 +48094,6 @@ exports.setTranslationMethod = setTranslationMethod;
48064
48094
  exports.tokenize = tokenize;
48065
48095
 
48066
48096
 
48067
- __info__.version = '16.3.30';
48068
- __info__.date = '2024-03-25T09:36:48.685Z';
48069
- __info__.hash = '0d2ee33';
48097
+ __info__.version = '16.3.31';
48098
+ __info__.date = '2024-04-05T13:57:05.657Z';
48099
+ __info__.hash = '052efd4';
@@ -1016,7 +1016,7 @@ function getItemId(item, itemsDic) {
1016
1016
  }
1017
1017
  // Generate new Id if the item didn't exist in the dictionary
1018
1018
  const ids = Object.keys(itemsDic);
1019
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
1019
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
1020
1020
  itemsDic[maxId + 1] = item;
1021
1021
  return maxId + 1;
1022
1022
  }
@@ -1208,6 +1208,34 @@ function isConsecutive(iterable) {
1208
1208
  }
1209
1209
  }
1210
1210
  return true;
1211
+ }
1212
+ /**
1213
+ * Alternative to Math.max that works with large arrays.
1214
+ * Typically useful for arrays bigger than 100k elements.
1215
+ */
1216
+ function largeMax(array) {
1217
+ let len = array.length;
1218
+ if (len < 100000)
1219
+ return Math.max(...array);
1220
+ let max = -Infinity;
1221
+ while (len--) {
1222
+ max = array[len] > max ? array[len] : max;
1223
+ }
1224
+ return max;
1225
+ }
1226
+ /**
1227
+ * Alternative to Math.min that works with large arrays.
1228
+ * Typically useful for arrays bigger than 100k elements.
1229
+ */
1230
+ function largeMin(array) {
1231
+ let len = array.length;
1232
+ if (len < 100000)
1233
+ return Math.min(...array);
1234
+ let min = +Infinity;
1235
+ while (len--) {
1236
+ min = array[len] < min ? array[len] : min;
1237
+ }
1238
+ return min;
1211
1239
  }
1212
1240
 
1213
1241
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -6819,10 +6847,10 @@ function aggregateDataForLabels(labels, datasets) {
6819
6847
  }
6820
6848
  }
6821
6849
  return {
6822
- labels: Object.keys(labelMap),
6850
+ labels: Array.from(labelSet),
6823
6851
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
6824
6852
  ...dataset,
6825
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
6853
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
6826
6854
  })),
6827
6855
  };
6828
6856
  }
@@ -7539,7 +7567,7 @@ function getBestTimeUnitForScale(labels, format) {
7539
7567
  return undefined;
7540
7568
  }
7541
7569
  const labelsTimestamps = labelDates.map((date) => date.getTime());
7542
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
7570
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
7543
7571
  const minUnit = getFormatMinDisplayUnit(format);
7544
7572
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
7545
7573
  return "second";
@@ -7979,7 +8007,7 @@ function getPieConfiguration(chart, labels, dataSetFormat) {
7979
8007
  }
7980
8008
  function getPieColors(colors, dataSetsValues) {
7981
8009
  const pieColors = [];
7982
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
8010
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
7983
8011
  for (let i = 0; i <= maxLength; i++) {
7984
8012
  pieColors.push(colors.next());
7985
8013
  }
@@ -8942,8 +8970,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
8942
8970
  let last;
8943
8971
  const activesRows = env.model.getters.getActiveRows();
8944
8972
  if (activesRows.size !== 0) {
8945
- first = Math.min(...activesRows);
8946
- last = Math.max(...activesRows);
8973
+ first = largeMin([...activesRows]);
8974
+ last = largeMax([...activesRows]);
8947
8975
  }
8948
8976
  else {
8949
8977
  const zone = env.model.getters.getSelectedZones()[0];
@@ -8971,8 +8999,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
8971
8999
  let last;
8972
9000
  const activeCols = env.model.getters.getActiveCols();
8973
9001
  if (activeCols.size !== 0) {
8974
- first = Math.min(...activeCols);
8975
- last = Math.max(...activeCols);
9002
+ first = largeMin([...activeCols]);
9003
+ last = largeMax([...activeCols]);
8976
9004
  }
8977
9005
  else {
8978
9006
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9000,8 +9028,8 @@ const REMOVE_ROWS_NAME = (env) => {
9000
9028
  let last;
9001
9029
  const activesRows = env.model.getters.getActiveRows();
9002
9030
  if (activesRows.size !== 0) {
9003
- first = Math.min(...activesRows);
9004
- last = Math.max(...activesRows);
9031
+ first = largeMin([...activesRows]);
9032
+ last = largeMax([...activesRows]);
9005
9033
  }
9006
9034
  else {
9007
9035
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9042,8 +9070,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
9042
9070
  let last;
9043
9071
  const activeCols = env.model.getters.getActiveCols();
9044
9072
  if (activeCols.size !== 0) {
9045
- first = Math.min(...activeCols);
9046
- last = Math.max(...activeCols);
9073
+ first = largeMin([...activeCols]);
9074
+ last = largeMax([...activeCols]);
9047
9075
  }
9048
9076
  else {
9049
9077
  const zone = env.model.getters.getSelectedZones()[0];
@@ -9126,7 +9154,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
9126
9154
  let row;
9127
9155
  let quantity;
9128
9156
  if (activeRows.size) {
9129
- row = Math.min(...activeRows);
9157
+ row = largeMin([...activeRows]);
9130
9158
  quantity = activeRows.size;
9131
9159
  }
9132
9160
  else {
@@ -9158,7 +9186,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
9158
9186
  let row;
9159
9187
  let quantity;
9160
9188
  if (activeRows.size) {
9161
- row = Math.max(...activeRows);
9189
+ row = largeMax([...activeRows]);
9162
9190
  quantity = activeRows.size;
9163
9191
  }
9164
9192
  else {
@@ -9203,7 +9231,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
9203
9231
  let column;
9204
9232
  let quantity;
9205
9233
  if (activeCols.size) {
9206
- column = Math.min(...activeCols);
9234
+ column = largeMin([...activeCols]);
9207
9235
  quantity = activeCols.size;
9208
9236
  }
9209
9237
  else {
@@ -9237,7 +9265,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
9237
9265
  let column;
9238
9266
  let quantity;
9239
9267
  if (activeCols.size) {
9240
- column = Math.max(...activeCols);
9268
+ column = largeMax([...activeCols]);
9241
9269
  quantity = activeCols.size;
9242
9270
  }
9243
9271
  else {
@@ -26925,7 +26953,7 @@ function convertHyperlink(link, cellValue, warningManager) {
26925
26953
  function getSheetDims(sheet) {
26926
26954
  const dims = [0, 0];
26927
26955
  for (let row of sheet.rows) {
26928
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
26956
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
26929
26957
  dims[1] = Math.max(dims[1], row.index);
26930
26958
  }
26931
26959
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -31212,7 +31240,7 @@ class HeaderSizePlugin extends CorePlugin {
31212
31240
  for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
31213
31241
  sizes.splice(headerIndex, 1);
31214
31242
  }
31215
- const min = Math.min(...cmd.elements);
31243
+ const min = largeMin(cmd.elements);
31216
31244
  sizes = sizes.map((size, row) => {
31217
31245
  if (cmd.dimension === "ROW" && row >= min) {
31218
31246
  // invalidate sizes
@@ -31439,7 +31467,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
31439
31467
  if (hiddenElements.size >= elements) {
31440
31468
  return 67 /* CommandResult.TooManyHiddenElements */;
31441
31469
  }
31442
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
31470
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
31443
31471
  return 87 /* CommandResult.InvalidHeaderIndex */;
31444
31472
  }
31445
31473
  else {
@@ -32212,8 +32240,8 @@ class RangeAdapter {
32212
32240
  let newRange = range;
32213
32241
  let changeType = "NONE";
32214
32242
  for (let group of groups) {
32215
- const min = Math.min(...group);
32216
- const max = Math.max(...group);
32243
+ const min = largeMin(group);
32244
+ const max = largeMax(group);
32217
32245
  if (range.zone[start] <= min && min <= range.zone[end]) {
32218
32246
  const toRemove = Math.min(range.zone[end], max) - min + 1;
32219
32247
  changeType = "RESIZE";
@@ -32644,7 +32672,7 @@ class SheetPlugin extends CorePlugin {
32644
32672
  const elements = cmd.dimension === "COL"
32645
32673
  ? this.getNumberCols(cmd.sheetId)
32646
32674
  : this.getNumberRows(cmd.sheetId);
32647
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
32675
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
32648
32676
  return 87 /* CommandResult.InvalidHeaderIndex */;
32649
32677
  }
32650
32678
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -34146,13 +34174,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
34146
34174
  .map((cell) => cell.value);
34147
34175
  switch (threshold.type) {
34148
34176
  case "value":
34149
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
34177
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
34150
34178
  return result;
34151
34179
  case "number":
34152
34180
  return Number(threshold.value);
34153
34181
  case "percentage":
34154
- const min = Math.min(...rangeValues);
34155
- const max = Math.max(...rangeValues);
34182
+ const min = largeMin(rangeValues);
34183
+ const max = largeMax(rangeValues);
34156
34184
  const delta = max - min;
34157
34185
  return min + (delta * Number(threshold.value)) / 100;
34158
34186
  case "percentile":
@@ -36102,13 +36130,13 @@ class AutomaticSumPlugin extends UIPlugin {
36102
36130
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
36103
36131
  const cellPositions = range(end, -1, -1);
36104
36132
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
36105
- const maxValidPosition = Math.max(...invalidCells);
36133
+ const maxValidPosition = largeMax(invalidCells);
36106
36134
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
36107
36135
  const firstSequence = numberSequences[0] || [];
36108
- if (Math.max(...firstSequence) < maxValidPosition) {
36136
+ if (largeMax(firstSequence) < maxValidPosition) {
36109
36137
  return Infinity;
36110
36138
  }
36111
- return Math.min(...firstSequence);
36139
+ return largeMin(firstSequence);
36112
36140
  }
36113
36141
  shouldFindData(sheetId, zone) {
36114
36142
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -37693,7 +37721,7 @@ class RendererPlugin extends UIPlugin {
37693
37721
  * column of the current viewport
37694
37722
  */
37695
37723
  getColDimensionsInViewport(sheetId, col) {
37696
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
37724
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
37697
37725
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
37698
37726
  const size = this.getters.getColSize(sheetId, col);
37699
37727
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -37708,7 +37736,7 @@ class RendererPlugin extends UIPlugin {
37708
37736
  * of the current viewport
37709
37737
  */
37710
37738
  getRowDimensionsInViewport(sheetId, row) {
37711
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
37739
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
37712
37740
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
37713
37741
  const size = this.getters.getRowSize(sheetId, row);
37714
37742
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -39236,7 +39264,7 @@ class SheetUIPlugin extends UIPlugin {
39236
39264
  getColMaxWidth(sheetId, index) {
39237
39265
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
39238
39266
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
39239
- return Math.max(0, ...sizes);
39267
+ return Math.max(0, largeMax(sizes));
39240
39268
  }
39241
39269
  splitWordToSpecificWidth(ctx, word, width, style) {
39242
39270
  const wordWidth = computeTextWidth(ctx, word, style);
@@ -42499,12 +42527,14 @@ class BottomBarSheet extends Component {
42499
42527
  this.editionState = "initializing";
42500
42528
  }
42501
42529
  stopEdition() {
42502
- if (!this.state.isEditing)
42530
+ const input = this.sheetNameRef.el;
42531
+ if (!this.state.isEditing || !input)
42503
42532
  return;
42504
42533
  this.state.isEditing = false;
42505
42534
  this.editionState = "initializing";
42506
- this.sheetNameRef.el?.blur();
42535
+ input.blur();
42507
42536
  const inputValue = this.getInputContent() || "";
42537
+ input.innerText = inputValue;
42508
42538
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
42509
42539
  }
42510
42540
  cancelEdition() {
@@ -42965,7 +42995,7 @@ class BottomBar extends Component {
42965
42995
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
42966
42996
  }
42967
42997
  onSheetMouseDown(sheetId, event) {
42968
- if (event.button !== 0)
42998
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
42969
42999
  return;
42970
43000
  this.closeMenu();
42971
43001
  const mouseX = event.clientX;
@@ -46139,7 +46169,7 @@ function addLineChart(chart) {
46139
46169
  }
46140
46170
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
46141
46171
  const colors = new ChartColors();
46142
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
46172
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
46143
46173
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
46144
46174
  const dataSetsNodes = [];
46145
46175
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -48032,6 +48062,6 @@ function addFunction(functionName, functionDescription) {
48032
48062
  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 };
48033
48063
 
48034
48064
 
48035
- __info__.version = '16.3.30';
48036
- __info__.date = '2024-03-25T09:36:48.685Z';
48037
- __info__.hash = '0d2ee33';
48065
+ __info__.version = '16.3.31';
48066
+ __info__.date = '2024-04-05T13:57:05.657Z';
48067
+ __info__.hash = '052efd4';