@odoo/o-spreadsheet 16.4.27 → 16.4.28

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.
@@ -526,7 +526,7 @@ function getItemId(item, itemsDic) {
526
526
  }
527
527
  // Generate new Id if the item didn't exist in the dictionary
528
528
  const ids = Object.keys(itemsDic);
529
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
529
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
530
530
  itemsDic[maxId + 1] = item;
531
531
  return maxId + 1;
532
532
  }
@@ -742,6 +742,34 @@ function insertItemsAtIndex(array, items, index) {
742
742
  const newArray = [...array];
743
743
  newArray.splice(index, 0, ...items);
744
744
  return newArray;
745
+ }
746
+ /**
747
+ * Alternative to Math.max that works with large arrays.
748
+ * Typically useful for arrays bigger than 100k elements.
749
+ */
750
+ function largeMax(array) {
751
+ let len = array.length;
752
+ if (len < 100000)
753
+ return Math.max(...array);
754
+ let max = -Infinity;
755
+ while (len--) {
756
+ max = array[len] > max ? array[len] : max;
757
+ }
758
+ return max;
759
+ }
760
+ /**
761
+ * Alternative to Math.min that works with large arrays.
762
+ * Typically useful for arrays bigger than 100k elements.
763
+ */
764
+ function largeMin(array) {
765
+ let len = array.length;
766
+ if (len < 100000)
767
+ return Math.min(...array);
768
+ let min = +Infinity;
769
+ while (len--) {
770
+ min = array[len] < min ? array[len] : min;
771
+ }
772
+ return min;
745
773
  }
746
774
 
747
775
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -16338,10 +16366,10 @@ function aggregateDataForLabels(labels, datasets) {
16338
16366
  }
16339
16367
  }
16340
16368
  return {
16341
- labels: Object.keys(labelMap),
16369
+ labels: Array.from(labelSet),
16342
16370
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
16343
16371
  ...dataset,
16344
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
16372
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
16345
16373
  })),
16346
16374
  };
16347
16375
  }
@@ -17062,7 +17090,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
17062
17090
  return undefined;
17063
17091
  }
17064
17092
  const labelsTimestamps = labelDates.map((date) => date.getTime());
17065
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
17093
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
17066
17094
  const minUnit = getFormatMinDisplayUnit(format);
17067
17095
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
17068
17096
  return "second";
@@ -17504,7 +17532,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
17504
17532
  }
17505
17533
  function getPieColors(colors, dataSetsValues) {
17506
17534
  const pieColors = [];
17507
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
17535
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
17508
17536
  for (let i = 0; i <= maxLength; i++) {
17509
17537
  pieColors.push(colors.next());
17510
17538
  }
@@ -18321,8 +18349,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
18321
18349
  let last;
18322
18350
  const activesRows = env.model.getters.getActiveRows();
18323
18351
  if (activesRows.size !== 0) {
18324
- first = Math.min(...activesRows);
18325
- last = Math.max(...activesRows);
18352
+ first = largeMin([...activesRows]);
18353
+ last = largeMax([...activesRows]);
18326
18354
  }
18327
18355
  else {
18328
18356
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18350,8 +18378,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
18350
18378
  let last;
18351
18379
  const activeCols = env.model.getters.getActiveCols();
18352
18380
  if (activeCols.size !== 0) {
18353
- first = Math.min(...activeCols);
18354
- last = Math.max(...activeCols);
18381
+ first = largeMin([...activeCols]);
18382
+ last = largeMax([...activeCols]);
18355
18383
  }
18356
18384
  else {
18357
18385
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18379,8 +18407,8 @@ const REMOVE_ROWS_NAME = (env) => {
18379
18407
  let last;
18380
18408
  const activesRows = env.model.getters.getActiveRows();
18381
18409
  if (activesRows.size !== 0) {
18382
- first = Math.min(...activesRows);
18383
- last = Math.max(...activesRows);
18410
+ first = largeMin([...activesRows]);
18411
+ last = largeMax([...activesRows]);
18384
18412
  }
18385
18413
  else {
18386
18414
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18421,8 +18449,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
18421
18449
  let last;
18422
18450
  const activeCols = env.model.getters.getActiveCols();
18423
18451
  if (activeCols.size !== 0) {
18424
- first = Math.min(...activeCols);
18425
- last = Math.max(...activeCols);
18452
+ first = largeMin([...activeCols]);
18453
+ last = largeMax([...activeCols]);
18426
18454
  }
18427
18455
  else {
18428
18456
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18463,7 +18491,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
18463
18491
  let row;
18464
18492
  let quantity;
18465
18493
  if (activeRows.size) {
18466
- row = Math.min(...activeRows);
18494
+ row = largeMin([...activeRows]);
18467
18495
  quantity = activeRows.size;
18468
18496
  }
18469
18497
  else {
@@ -18484,7 +18512,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
18484
18512
  let row;
18485
18513
  let quantity;
18486
18514
  if (activeRows.size) {
18487
- row = Math.max(...activeRows);
18515
+ row = largeMax([...activeRows]);
18488
18516
  quantity = activeRows.size;
18489
18517
  }
18490
18518
  else {
@@ -18505,7 +18533,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
18505
18533
  let column;
18506
18534
  let quantity;
18507
18535
  if (activeCols.size) {
18508
- column = Math.min(...activeCols);
18536
+ column = largeMin([...activeCols]);
18509
18537
  quantity = activeCols.size;
18510
18538
  }
18511
18539
  else {
@@ -18526,7 +18554,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
18526
18554
  let column;
18527
18555
  let quantity;
18528
18556
  if (activeCols.size) {
18529
- column = Math.max(...activeCols);
18557
+ column = largeMax([...activeCols]);
18530
18558
  quantity = activeCols.size;
18531
18559
  }
18532
18560
  else {
@@ -29040,7 +29068,7 @@ function convertHyperlink(link, cellValue, warningManager) {
29040
29068
  function getSheetDims(sheet) {
29041
29069
  const dims = [0, 0];
29042
29070
  for (let row of sheet.rows) {
29043
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
29071
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
29044
29072
  dims[1] = Math.max(dims[1], row.index);
29045
29073
  }
29046
29074
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -33537,7 +33565,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
33537
33565
  if (hiddenElements.size >= elements) {
33538
33566
  return 69 /* CommandResult.TooManyHiddenElements */;
33539
33567
  }
33540
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
33568
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
33541
33569
  return 89 /* CommandResult.InvalidHeaderIndex */;
33542
33570
  }
33543
33571
  else {
@@ -34331,8 +34359,8 @@ class RangeAdapter {
34331
34359
  let newRange = range;
34332
34360
  let changeType = "NONE";
34333
34361
  for (let group of groups) {
34334
- const min = Math.min(...group);
34335
- const max = Math.max(...group);
34362
+ const min = largeMin(group);
34363
+ const max = largeMax(group);
34336
34364
  if (range.zone[start] <= min && min <= range.zone[end]) {
34337
34365
  const toRemove = Math.min(range.zone[end], max) - min + 1;
34338
34366
  changeType = "RESIZE";
@@ -34759,7 +34787,7 @@ class SheetPlugin extends CorePlugin {
34759
34787
  const elements = cmd.dimension === "COL"
34760
34788
  ? this.getNumberCols(cmd.sheetId)
34761
34789
  : this.getNumberRows(cmd.sheetId);
34762
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
34790
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
34763
34791
  return 89 /* CommandResult.InvalidHeaderIndex */;
34764
34792
  }
34765
34793
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -37635,13 +37663,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
37635
37663
  .map((cell) => cell.value);
37636
37664
  switch (threshold.type) {
37637
37665
  case "value":
37638
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
37666
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
37639
37667
  return result;
37640
37668
  case "number":
37641
37669
  return Number(threshold.value);
37642
37670
  case "percentage":
37643
- const min = Math.min(...rangeValues);
37644
- const max = Math.max(...rangeValues);
37671
+ const min = largeMin(rangeValues);
37672
+ const max = largeMax(rangeValues);
37645
37673
  const delta = max - min;
37646
37674
  return min + (delta * Number(threshold.value)) / 100;
37647
37675
  case "percentile":
@@ -38524,13 +38552,13 @@ class AutomaticSumPlugin extends UIPlugin {
38524
38552
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
38525
38553
  const cellPositions = range(end, -1, -1);
38526
38554
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
38527
- const maxValidPosition = Math.max(...invalidCells);
38555
+ const maxValidPosition = largeMax(invalidCells);
38528
38556
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
38529
38557
  const firstSequence = numberSequences[0] || [];
38530
- if (Math.max(...firstSequence) < maxValidPosition) {
38558
+ if (largeMax(firstSequence) < maxValidPosition) {
38531
38559
  return Infinity;
38532
38560
  }
38533
- return Math.min(...firstSequence);
38561
+ return largeMin(firstSequence);
38534
38562
  }
38535
38563
  shouldFindData(sheetId, zone) {
38536
38564
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -40119,7 +40147,7 @@ class RendererPlugin extends UIPlugin {
40119
40147
  * column of the current viewport
40120
40148
  */
40121
40149
  getColDimensionsInViewport(sheetId, col) {
40122
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
40150
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
40123
40151
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
40124
40152
  const size = this.getters.getColSize(sheetId, col);
40125
40153
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -40134,7 +40162,7 @@ class RendererPlugin extends UIPlugin {
40134
40162
  * of the current viewport
40135
40163
  */
40136
40164
  getRowDimensionsInViewport(sheetId, row) {
40137
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
40165
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
40138
40166
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
40139
40167
  const size = this.getters.getRowSize(sheetId, row);
40140
40168
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -41631,7 +41659,7 @@ class SheetUIPlugin extends UIPlugin {
41631
41659
  getColMaxWidth(sheetId, index) {
41632
41660
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
41633
41661
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
41634
- return Math.max(0, ...sizes);
41662
+ return Math.max(0, largeMax(sizes));
41635
41663
  }
41636
41664
  /**
41637
41665
  * Check that any "sheetId" in the command matches an existing
@@ -42933,7 +42961,7 @@ class ClipboardOsState extends ClipboardCellsAbstractState {
42933
42961
  }
42934
42962
  getPasteZone(target) {
42935
42963
  const height = this.values.length;
42936
- const width = Math.max(...this.values.map((a) => a.length));
42964
+ const width = largeMax(this.values.map((a) => a.length));
42937
42965
  const { left: activeCol, top: activeRow } = target[0];
42938
42966
  return {
42939
42967
  top: activeRow,
@@ -46154,12 +46182,14 @@ class BottomBarSheet extends owl.Component {
46154
46182
  this.editionState = "initializing";
46155
46183
  }
46156
46184
  stopEdition() {
46157
- if (!this.state.isEditing)
46185
+ const input = this.sheetNameRef.el;
46186
+ if (!this.state.isEditing || !input)
46158
46187
  return;
46159
46188
  this.state.isEditing = false;
46160
46189
  this.editionState = "initializing";
46161
- this.sheetNameRef.el?.blur();
46190
+ input.blur();
46162
46191
  const inputValue = this.getInputContent() || "";
46192
+ input.innerText = inputValue;
46163
46193
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
46164
46194
  }
46165
46195
  cancelEdition() {
@@ -46621,7 +46651,7 @@ class BottomBar extends owl.Component {
46621
46651
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
46622
46652
  }
46623
46653
  onSheetMouseDown(sheetId, event) {
46624
- if (event.button !== 0)
46654
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
46625
46655
  return;
46626
46656
  this.closeMenu();
46627
46657
  const mouseX = event.clientX;
@@ -49825,7 +49855,7 @@ function addLineChart(chart) {
49825
49855
  }
49826
49856
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
49827
49857
  const colors = new ChartColors();
49828
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
49858
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
49829
49859
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
49830
49860
  const dataSetsNodes = [];
49831
49861
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -51754,6 +51784,6 @@ exports.setTranslationMethod = setTranslationMethod;
51754
51784
  exports.tokenize = tokenize;
51755
51785
 
51756
51786
 
51757
- __info__.version = '16.4.27';
51758
- __info__.date = '2024-03-25T09:41:12.743Z';
51759
- __info__.hash = '42e4252';
51787
+ __info__.version = '16.4.28';
51788
+ __info__.date = '2024-04-05T13:59:39.997Z';
51789
+ __info__.hash = '7127826';
@@ -522,7 +522,7 @@ function getItemId(item, itemsDic) {
522
522
  }
523
523
  // Generate new Id if the item didn't exist in the dictionary
524
524
  const ids = Object.keys(itemsDic);
525
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
525
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
526
526
  itemsDic[maxId + 1] = item;
527
527
  return maxId + 1;
528
528
  }
@@ -738,6 +738,34 @@ function insertItemsAtIndex(array, items, index) {
738
738
  const newArray = [...array];
739
739
  newArray.splice(index, 0, ...items);
740
740
  return newArray;
741
+ }
742
+ /**
743
+ * Alternative to Math.max that works with large arrays.
744
+ * Typically useful for arrays bigger than 100k elements.
745
+ */
746
+ function largeMax(array) {
747
+ let len = array.length;
748
+ if (len < 100000)
749
+ return Math.max(...array);
750
+ let max = -Infinity;
751
+ while (len--) {
752
+ max = array[len] > max ? array[len] : max;
753
+ }
754
+ return max;
755
+ }
756
+ /**
757
+ * Alternative to Math.min that works with large arrays.
758
+ * Typically useful for arrays bigger than 100k elements.
759
+ */
760
+ function largeMin(array) {
761
+ let len = array.length;
762
+ if (len < 100000)
763
+ return Math.min(...array);
764
+ let min = +Infinity;
765
+ while (len--) {
766
+ min = array[len] < min ? array[len] : min;
767
+ }
768
+ return min;
741
769
  }
742
770
 
743
771
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -16334,10 +16362,10 @@ function aggregateDataForLabels(labels, datasets) {
16334
16362
  }
16335
16363
  }
16336
16364
  return {
16337
- labels: Object.keys(labelMap),
16365
+ labels: Array.from(labelSet),
16338
16366
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
16339
16367
  ...dataset,
16340
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
16368
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
16341
16369
  })),
16342
16370
  };
16343
16371
  }
@@ -17058,7 +17086,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
17058
17086
  return undefined;
17059
17087
  }
17060
17088
  const labelsTimestamps = labelDates.map((date) => date.getTime());
17061
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
17089
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
17062
17090
  const minUnit = getFormatMinDisplayUnit(format);
17063
17091
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
17064
17092
  return "second";
@@ -17500,7 +17528,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
17500
17528
  }
17501
17529
  function getPieColors(colors, dataSetsValues) {
17502
17530
  const pieColors = [];
17503
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
17531
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
17504
17532
  for (let i = 0; i <= maxLength; i++) {
17505
17533
  pieColors.push(colors.next());
17506
17534
  }
@@ -18317,8 +18345,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
18317
18345
  let last;
18318
18346
  const activesRows = env.model.getters.getActiveRows();
18319
18347
  if (activesRows.size !== 0) {
18320
- first = Math.min(...activesRows);
18321
- last = Math.max(...activesRows);
18348
+ first = largeMin([...activesRows]);
18349
+ last = largeMax([...activesRows]);
18322
18350
  }
18323
18351
  else {
18324
18352
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18346,8 +18374,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
18346
18374
  let last;
18347
18375
  const activeCols = env.model.getters.getActiveCols();
18348
18376
  if (activeCols.size !== 0) {
18349
- first = Math.min(...activeCols);
18350
- last = Math.max(...activeCols);
18377
+ first = largeMin([...activeCols]);
18378
+ last = largeMax([...activeCols]);
18351
18379
  }
18352
18380
  else {
18353
18381
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18375,8 +18403,8 @@ const REMOVE_ROWS_NAME = (env) => {
18375
18403
  let last;
18376
18404
  const activesRows = env.model.getters.getActiveRows();
18377
18405
  if (activesRows.size !== 0) {
18378
- first = Math.min(...activesRows);
18379
- last = Math.max(...activesRows);
18406
+ first = largeMin([...activesRows]);
18407
+ last = largeMax([...activesRows]);
18380
18408
  }
18381
18409
  else {
18382
18410
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18417,8 +18445,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
18417
18445
  let last;
18418
18446
  const activeCols = env.model.getters.getActiveCols();
18419
18447
  if (activeCols.size !== 0) {
18420
- first = Math.min(...activeCols);
18421
- last = Math.max(...activeCols);
18448
+ first = largeMin([...activeCols]);
18449
+ last = largeMax([...activeCols]);
18422
18450
  }
18423
18451
  else {
18424
18452
  const zone = env.model.getters.getSelectedZones()[0];
@@ -18459,7 +18487,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
18459
18487
  let row;
18460
18488
  let quantity;
18461
18489
  if (activeRows.size) {
18462
- row = Math.min(...activeRows);
18490
+ row = largeMin([...activeRows]);
18463
18491
  quantity = activeRows.size;
18464
18492
  }
18465
18493
  else {
@@ -18480,7 +18508,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
18480
18508
  let row;
18481
18509
  let quantity;
18482
18510
  if (activeRows.size) {
18483
- row = Math.max(...activeRows);
18511
+ row = largeMax([...activeRows]);
18484
18512
  quantity = activeRows.size;
18485
18513
  }
18486
18514
  else {
@@ -18501,7 +18529,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
18501
18529
  let column;
18502
18530
  let quantity;
18503
18531
  if (activeCols.size) {
18504
- column = Math.min(...activeCols);
18532
+ column = largeMin([...activeCols]);
18505
18533
  quantity = activeCols.size;
18506
18534
  }
18507
18535
  else {
@@ -18522,7 +18550,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
18522
18550
  let column;
18523
18551
  let quantity;
18524
18552
  if (activeCols.size) {
18525
- column = Math.max(...activeCols);
18553
+ column = largeMax([...activeCols]);
18526
18554
  quantity = activeCols.size;
18527
18555
  }
18528
18556
  else {
@@ -29036,7 +29064,7 @@ function convertHyperlink(link, cellValue, warningManager) {
29036
29064
  function getSheetDims(sheet) {
29037
29065
  const dims = [0, 0];
29038
29066
  for (let row of sheet.rows) {
29039
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
29067
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
29040
29068
  dims[1] = Math.max(dims[1], row.index);
29041
29069
  }
29042
29070
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -33533,7 +33561,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
33533
33561
  if (hiddenElements.size >= elements) {
33534
33562
  return 69 /* CommandResult.TooManyHiddenElements */;
33535
33563
  }
33536
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
33564
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
33537
33565
  return 89 /* CommandResult.InvalidHeaderIndex */;
33538
33566
  }
33539
33567
  else {
@@ -34327,8 +34355,8 @@ class RangeAdapter {
34327
34355
  let newRange = range;
34328
34356
  let changeType = "NONE";
34329
34357
  for (let group of groups) {
34330
- const min = Math.min(...group);
34331
- const max = Math.max(...group);
34358
+ const min = largeMin(group);
34359
+ const max = largeMax(group);
34332
34360
  if (range.zone[start] <= min && min <= range.zone[end]) {
34333
34361
  const toRemove = Math.min(range.zone[end], max) - min + 1;
34334
34362
  changeType = "RESIZE";
@@ -34755,7 +34783,7 @@ class SheetPlugin extends CorePlugin {
34755
34783
  const elements = cmd.dimension === "COL"
34756
34784
  ? this.getNumberCols(cmd.sheetId)
34757
34785
  : this.getNumberRows(cmd.sheetId);
34758
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
34786
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
34759
34787
  return 89 /* CommandResult.InvalidHeaderIndex */;
34760
34788
  }
34761
34789
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -37631,13 +37659,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
37631
37659
  .map((cell) => cell.value);
37632
37660
  switch (threshold.type) {
37633
37661
  case "value":
37634
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
37662
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
37635
37663
  return result;
37636
37664
  case "number":
37637
37665
  return Number(threshold.value);
37638
37666
  case "percentage":
37639
- const min = Math.min(...rangeValues);
37640
- const max = Math.max(...rangeValues);
37667
+ const min = largeMin(rangeValues);
37668
+ const max = largeMax(rangeValues);
37641
37669
  const delta = max - min;
37642
37670
  return min + (delta * Number(threshold.value)) / 100;
37643
37671
  case "percentile":
@@ -38520,13 +38548,13 @@ class AutomaticSumPlugin extends UIPlugin {
38520
38548
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
38521
38549
  const cellPositions = range(end, -1, -1);
38522
38550
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
38523
- const maxValidPosition = Math.max(...invalidCells);
38551
+ const maxValidPosition = largeMax(invalidCells);
38524
38552
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
38525
38553
  const firstSequence = numberSequences[0] || [];
38526
- if (Math.max(...firstSequence) < maxValidPosition) {
38554
+ if (largeMax(firstSequence) < maxValidPosition) {
38527
38555
  return Infinity;
38528
38556
  }
38529
- return Math.min(...firstSequence);
38557
+ return largeMin(firstSequence);
38530
38558
  }
38531
38559
  shouldFindData(sheetId, zone) {
38532
38560
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -40115,7 +40143,7 @@ class RendererPlugin extends UIPlugin {
40115
40143
  * column of the current viewport
40116
40144
  */
40117
40145
  getColDimensionsInViewport(sheetId, col) {
40118
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
40146
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
40119
40147
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
40120
40148
  const size = this.getters.getColSize(sheetId, col);
40121
40149
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -40130,7 +40158,7 @@ class RendererPlugin extends UIPlugin {
40130
40158
  * of the current viewport
40131
40159
  */
40132
40160
  getRowDimensionsInViewport(sheetId, row) {
40133
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
40161
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
40134
40162
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
40135
40163
  const size = this.getters.getRowSize(sheetId, row);
40136
40164
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -41627,7 +41655,7 @@ class SheetUIPlugin extends UIPlugin {
41627
41655
  getColMaxWidth(sheetId, index) {
41628
41656
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
41629
41657
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
41630
- return Math.max(0, ...sizes);
41658
+ return Math.max(0, largeMax(sizes));
41631
41659
  }
41632
41660
  /**
41633
41661
  * Check that any "sheetId" in the command matches an existing
@@ -42929,7 +42957,7 @@ class ClipboardOsState extends ClipboardCellsAbstractState {
42929
42957
  }
42930
42958
  getPasteZone(target) {
42931
42959
  const height = this.values.length;
42932
- const width = Math.max(...this.values.map((a) => a.length));
42960
+ const width = largeMax(this.values.map((a) => a.length));
42933
42961
  const { left: activeCol, top: activeRow } = target[0];
42934
42962
  return {
42935
42963
  top: activeRow,
@@ -46150,12 +46178,14 @@ class BottomBarSheet extends Component {
46150
46178
  this.editionState = "initializing";
46151
46179
  }
46152
46180
  stopEdition() {
46153
- if (!this.state.isEditing)
46181
+ const input = this.sheetNameRef.el;
46182
+ if (!this.state.isEditing || !input)
46154
46183
  return;
46155
46184
  this.state.isEditing = false;
46156
46185
  this.editionState = "initializing";
46157
- this.sheetNameRef.el?.blur();
46186
+ input.blur();
46158
46187
  const inputValue = this.getInputContent() || "";
46188
+ input.innerText = inputValue;
46159
46189
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
46160
46190
  }
46161
46191
  cancelEdition() {
@@ -46617,7 +46647,7 @@ class BottomBar extends Component {
46617
46647
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
46618
46648
  }
46619
46649
  onSheetMouseDown(sheetId, event) {
46620
- if (event.button !== 0)
46650
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
46621
46651
  return;
46622
46652
  this.closeMenu();
46623
46653
  const mouseX = event.clientX;
@@ -49821,7 +49851,7 @@ function addLineChart(chart) {
49821
49851
  }
49822
49852
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
49823
49853
  const colors = new ChartColors();
49824
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
49854
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
49825
49855
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
49826
49856
  const dataSetsNodes = [];
49827
49857
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -51718,6 +51748,6 @@ const constants = {
51718
51748
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
51719
51749
 
51720
51750
 
51721
- __info__.version = '16.4.27';
51722
- __info__.date = '2024-03-25T09:41:12.743Z';
51723
- __info__.hash = '42e4252';
51751
+ __info__.version = '16.4.28';
51752
+ __info__.date = '2024-04-05T13:59:39.997Z';
51753
+ __info__.hash = '7127826';