@odoo/o-spreadsheet 16.0.35 → 16.0.37

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.
@@ -992,7 +992,7 @@ function getItemId(item, itemsDic) {
992
992
  }
993
993
  // Generate new Id if the item didn't exist in the dictionary
994
994
  const ids = Object.keys(itemsDic);
995
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
995
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
996
996
  itemsDic[maxId + 1] = item;
997
997
  return maxId + 1;
998
998
  }
@@ -1138,6 +1138,34 @@ function memoize(func) {
1138
1138
  return cache.get(args[0]);
1139
1139
  },
1140
1140
  }[funcName];
1141
+ }
1142
+ /**
1143
+ * Alternative to Math.max that works with large arrays.
1144
+ * Typically useful for arrays bigger than 100k elements.
1145
+ */
1146
+ function largeMax(array) {
1147
+ let len = array.length;
1148
+ if (len < 100000)
1149
+ return Math.max(...array);
1150
+ let max = -Infinity;
1151
+ while (len--) {
1152
+ max = array[len] > max ? array[len] : max;
1153
+ }
1154
+ return max;
1155
+ }
1156
+ /**
1157
+ * Alternative to Math.min that works with large arrays.
1158
+ * Typically useful for arrays bigger than 100k elements.
1159
+ */
1160
+ function largeMin(array) {
1161
+ let len = array.length;
1162
+ if (len < 100000)
1163
+ return Math.min(...array);
1164
+ let min = +Infinity;
1165
+ while (len--) {
1166
+ min = array[len] < min ? array[len] : min;
1167
+ }
1168
+ return min;
1141
1169
  }
1142
1170
 
1143
1171
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -5100,8 +5128,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
5100
5128
  let last;
5101
5129
  const activesRows = env.model.getters.getActiveRows();
5102
5130
  if (activesRows.size !== 0) {
5103
- first = Math.min(...activesRows);
5104
- last = Math.max(...activesRows);
5131
+ first = largeMin([...activesRows]);
5132
+ last = largeMax([...activesRows]);
5105
5133
  }
5106
5134
  else {
5107
5135
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5129,8 +5157,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
5129
5157
  let last;
5130
5158
  const activeCols = env.model.getters.getActiveCols();
5131
5159
  if (activeCols.size !== 0) {
5132
- first = Math.min(...activeCols);
5133
- last = Math.max(...activeCols);
5160
+ first = largeMin([...activeCols]);
5161
+ last = largeMax([...activeCols]);
5134
5162
  }
5135
5163
  else {
5136
5164
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5158,8 +5186,8 @@ const REMOVE_ROWS_NAME = (env) => {
5158
5186
  let last;
5159
5187
  const activesRows = env.model.getters.getActiveRows();
5160
5188
  if (activesRows.size !== 0) {
5161
- first = Math.min(...activesRows);
5162
- last = Math.max(...activesRows);
5189
+ first = largeMin([...activesRows]);
5190
+ last = largeMax([...activesRows]);
5163
5191
  }
5164
5192
  else {
5165
5193
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5200,8 +5228,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
5200
5228
  let last;
5201
5229
  const activeCols = env.model.getters.getActiveCols();
5202
5230
  if (activeCols.size !== 0) {
5203
- first = Math.min(...activeCols);
5204
- last = Math.max(...activeCols);
5231
+ first = largeMin([...activeCols]);
5232
+ last = largeMax([...activeCols]);
5205
5233
  }
5206
5234
  else {
5207
5235
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5270,7 +5298,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
5270
5298
  let row;
5271
5299
  let quantity;
5272
5300
  if (activeRows.size) {
5273
- row = Math.min(...activeRows);
5301
+ row = largeMin([...activeRows]);
5274
5302
  quantity = activeRows.size;
5275
5303
  }
5276
5304
  else {
@@ -5302,7 +5330,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
5302
5330
  let row;
5303
5331
  let quantity;
5304
5332
  if (activeRows.size) {
5305
- row = Math.max(...activeRows);
5333
+ row = largeMax([...activeRows]);
5306
5334
  quantity = activeRows.size;
5307
5335
  }
5308
5336
  else {
@@ -5343,7 +5371,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
5343
5371
  let column;
5344
5372
  let quantity;
5345
5373
  if (activeCols.size) {
5346
- column = Math.min(...activeCols);
5374
+ column = largeMin([...activeCols]);
5347
5375
  quantity = activeCols.size;
5348
5376
  }
5349
5377
  else {
@@ -5377,7 +5405,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
5377
5405
  let column;
5378
5406
  let quantity;
5379
5407
  if (activeCols.size) {
5380
- column = Math.max(...activeCols);
5408
+ column = largeMax([...activeCols]);
5381
5409
  quantity = activeCols.size;
5382
5410
  }
5383
5411
  else {
@@ -7933,7 +7961,7 @@ function getBestTimeUnitForScale(labels, format) {
7933
7961
  return undefined;
7934
7962
  }
7935
7963
  const labelsTimestamps = labelDates.map((date) => date.getTime());
7936
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
7964
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
7937
7965
  const minUnit = getFormatMinDisplayUnit(format);
7938
7966
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
7939
7967
  return "second";
@@ -8349,7 +8377,7 @@ function getPieConfiguration(chart, labels) {
8349
8377
  }
8350
8378
  function getPieColors(colors, dataSetsValues) {
8351
8379
  const pieColors = [];
8352
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
8380
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
8353
8381
  for (let i = 0; i <= maxLength; i++) {
8354
8382
  pieColors.push(colors.next());
8355
8383
  }
@@ -20437,6 +20465,10 @@ class Composer extends owl.Component {
20437
20465
  if (!this.isKeyStillDown) {
20438
20466
  this.processContent();
20439
20467
  }
20468
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider and ShowDescription true
20469
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20470
+ this.processTokenAtCursor();
20471
+ }
20440
20472
  });
20441
20473
  }
20442
20474
  // ---------------------------------------------------------------------------
@@ -20635,6 +20667,12 @@ class Composer extends owl.Component {
20635
20667
  onCompleted(text) {
20636
20668
  text && this.autoComplete(text);
20637
20669
  }
20670
+ onContextMenu(ev) {
20671
+ var _a, _b;
20672
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20673
+ (_b = (_a = this.props).onInputContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, ev);
20674
+ }
20675
+ }
20638
20676
  // ---------------------------------------------------------------------------
20639
20677
  // Private
20640
20678
  // ---------------------------------------------------------------------------
@@ -20868,6 +20906,7 @@ class GridComposer extends owl.Component {
20868
20906
  isDefaultFocus: true,
20869
20907
  onComposerContentFocused: this.props.onComposerContentFocused,
20870
20908
  onComposerCellFocused: this.props.onComposerCellFocused,
20909
+ onInputContextMenu: this.props.onInputContextMenu,
20871
20910
  };
20872
20911
  }
20873
20912
  get containerStyle() {
@@ -23018,8 +23057,8 @@ class Grid extends owl.Component {
23018
23057
  else if (this.env.model.getters.getActiveRows().has(row)) {
23019
23058
  type = "ROW";
23020
23059
  }
23021
- const { x, y, width, height } = this.env.model.getters.getVisibleRect(lastZone);
23022
- this.toggleContextMenu(type, x + width, y + height);
23060
+ const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
23061
+ this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
23023
23062
  }
23024
23063
  onCellRightClicked(col, row, { x, y }) {
23025
23064
  const zones = this.env.model.getters.getSelectedZones();
@@ -25185,7 +25224,7 @@ function convertHyperlink(link, cellValue, warningManager) {
25185
25224
  function getSheetDims(sheet) {
25186
25225
  const dims = [0, 0];
25187
25226
  for (let row of sheet.rows) {
25188
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
25227
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
25189
25228
  dims[1] = Math.max(dims[1], row.index);
25190
25229
  }
25191
25230
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -29222,7 +29261,17 @@ class FiltersPlugin extends CorePlugin {
29222
29261
  }
29223
29262
  }
29224
29263
  exportForExcel(data) {
29225
- this.export(data);
29264
+ for (const sheet of data.sheets) {
29265
+ for (const filterTable of this.getFilterTables(sheet.id)) {
29266
+ if (zoneToDimension(filterTable.zone).height === 1) {
29267
+ continue;
29268
+ }
29269
+ sheet.filterTables.push({
29270
+ range: zoneToXc(filterTable.zone),
29271
+ filters: [],
29272
+ });
29273
+ }
29274
+ }
29226
29275
  }
29227
29276
  }
29228
29277
  FiltersPlugin.getters = [
@@ -29278,7 +29327,7 @@ class HeaderSizePlugin extends CorePlugin {
29278
29327
  for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
29279
29328
  sizes.splice(headerIndex, 1);
29280
29329
  }
29281
- const min = Math.min(...cmd.elements);
29330
+ const min = largeMin(cmd.elements);
29282
29331
  sizes = sizes.map((size, row) => {
29283
29332
  if (cmd.dimension === "ROW" && row >= min) {
29284
29333
  // invalidate sizes
@@ -29506,7 +29555,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
29506
29555
  if (hiddenElements.size >= elements) {
29507
29556
  return 66 /* CommandResult.TooManyHiddenElements */;
29508
29557
  }
29509
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29558
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
29510
29559
  return 86 /* CommandResult.InvalidHeaderIndex */;
29511
29560
  }
29512
29561
  else {
@@ -30181,7 +30230,7 @@ class SheetPlugin extends CorePlugin {
30181
30230
  const elements = cmd.dimension === "COL"
30182
30231
  ? this.getNumberCols(cmd.sheetId)
30183
30232
  : this.getNumberRows(cmd.sheetId);
30184
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30233
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
30185
30234
  return 86 /* CommandResult.InvalidHeaderIndex */;
30186
30235
  }
30187
30236
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -31554,13 +31603,13 @@ class AutomaticSumPlugin extends UIPlugin {
31554
31603
  const cells = this.getters.getCellsInZone(sheet.id, zone);
31555
31604
  const cellPositions = range(end, -1, -1);
31556
31605
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
31557
- const maxValidPosition = Math.max(...invalidCells);
31606
+ const maxValidPosition = largeMax(invalidCells);
31558
31607
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
31559
31608
  const firstSequence = numberSequences[0] || [];
31560
- if (Math.max(...firstSequence) < maxValidPosition) {
31609
+ if (largeMax(firstSequence) < maxValidPosition) {
31561
31610
  return Infinity;
31562
31611
  }
31563
- return Math.min(...firstSequence);
31612
+ return largeMin(firstSequence);
31564
31613
  }
31565
31614
  shouldFindData(sheetId, zone) {
31566
31615
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -33243,13 +33292,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
33243
33292
  .filter(this.isCellValueNumber);
33244
33293
  switch (threshold.type) {
33245
33294
  case "value":
33246
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
33295
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
33247
33296
  return result;
33248
33297
  case "number":
33249
33298
  return Number(threshold.value);
33250
33299
  case "percentage":
33251
- const min = Math.min(...rangeValues);
33252
- const max = Math.max(...rangeValues);
33300
+ const min = largeMin(rangeValues);
33301
+ const max = largeMax(rangeValues);
33253
33302
  const delta = max - min;
33254
33303
  return min + (delta * Number(threshold.value)) / 100;
33255
33304
  case "percentile":
@@ -37986,7 +38035,7 @@ class SheetUIPlugin extends UIPlugin {
37986
38035
  getColMaxWidth(sheetId, index) {
37987
38036
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
37988
38037
  const sizes = cellsPositions.map((position) => this.getCellWidth(sheetId, position));
37989
- return Math.max(0, ...sizes);
38038
+ return Math.max(0, largeMax(sizes));
37990
38039
  }
37991
38040
  splitWordToSpecificWidth(ctx, word, width, style) {
37992
38041
  const wordWidth = computeTextWidth(ctx, word, style);
@@ -40337,8 +40386,8 @@ class RangeAdapter {
40337
40386
  let newRange = range;
40338
40387
  let changeType = "NONE";
40339
40388
  for (let group of groups) {
40340
- const min = Math.min(...group);
40341
- const max = Math.max(...group);
40389
+ const min = largeMin(group);
40390
+ const max = largeMax(group);
40342
40391
  if (range.zone[start] <= min && min <= range.zone[end]) {
40343
40392
  const toRemove = Math.min(range.zone[end], max) - min + 1;
40344
40393
  changeType = "RESIZE";
@@ -41596,7 +41645,7 @@ function addLineChart(chart) {
41596
41645
  }
41597
41646
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
41598
41647
  const colors = new ChartColors();
41599
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41648
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41600
41649
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
41601
41650
  const dataSetsNodes = [];
41602
41651
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -43291,6 +43340,6 @@ exports.setTranslationMethod = setTranslationMethod;
43291
43340
  exports.tokenize = tokenize;
43292
43341
 
43293
43342
 
43294
- __info__.version = '16.0.35';
43295
- __info__.date = '2024-03-15T10:57:14.362Z';
43296
- __info__.hash = '5cba28b';
43343
+ __info__.version = '16.0.37';
43344
+ __info__.date = '2024-04-05T13:58:08.848Z';
43345
+ __info__.hash = 'e95827b';
@@ -5538,6 +5538,7 @@ interface ComposerProps {
5538
5538
  focus: "inactive" | "cellFocus" | "contentFocus";
5539
5539
  onComposerContentFocused: () => void;
5540
5540
  onComposerCellFocused?: (content: String) => void;
5541
+ onInputContextMenu?: (event: MouseEvent) => void;
5541
5542
  isDefaultFocus?: boolean;
5542
5543
  }
5543
5544
  interface ComposerState$1 {
@@ -5600,6 +5601,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
5600
5601
  onClick(): void;
5601
5602
  onBlur(): void;
5602
5603
  onCompleted(text: string | undefined): void;
5604
+ onContextMenu(ev: MouseEvent): void;
5603
5605
  private processContent;
5604
5606
  private getContent;
5605
5607
  private getColoredTokens;
@@ -5618,6 +5620,7 @@ interface Props$i {
5618
5620
  content: string;
5619
5621
  onComposerContentFocused: () => void;
5620
5622
  onComposerCellFocused: () => void;
5623
+ onInputContextMenu: (event: MouseEvent) => void;
5621
5624
  }
5622
5625
  /**
5623
5626
  * This component is a composer which positions itself on the grid at the anchor cell.
@@ -988,7 +988,7 @@ function getItemId(item, itemsDic) {
988
988
  }
989
989
  // Generate new Id if the item didn't exist in the dictionary
990
990
  const ids = Object.keys(itemsDic);
991
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
991
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
992
992
  itemsDic[maxId + 1] = item;
993
993
  return maxId + 1;
994
994
  }
@@ -1134,6 +1134,34 @@ function memoize(func) {
1134
1134
  return cache.get(args[0]);
1135
1135
  },
1136
1136
  }[funcName];
1137
+ }
1138
+ /**
1139
+ * Alternative to Math.max that works with large arrays.
1140
+ * Typically useful for arrays bigger than 100k elements.
1141
+ */
1142
+ function largeMax(array) {
1143
+ let len = array.length;
1144
+ if (len < 100000)
1145
+ return Math.max(...array);
1146
+ let max = -Infinity;
1147
+ while (len--) {
1148
+ max = array[len] > max ? array[len] : max;
1149
+ }
1150
+ return max;
1151
+ }
1152
+ /**
1153
+ * Alternative to Math.min that works with large arrays.
1154
+ * Typically useful for arrays bigger than 100k elements.
1155
+ */
1156
+ function largeMin(array) {
1157
+ let len = array.length;
1158
+ if (len < 100000)
1159
+ return Math.min(...array);
1160
+ let min = +Infinity;
1161
+ while (len--) {
1162
+ min = array[len] < min ? array[len] : min;
1163
+ }
1164
+ return min;
1137
1165
  }
1138
1166
 
1139
1167
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
@@ -5096,8 +5124,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
5096
5124
  let last;
5097
5125
  const activesRows = env.model.getters.getActiveRows();
5098
5126
  if (activesRows.size !== 0) {
5099
- first = Math.min(...activesRows);
5100
- last = Math.max(...activesRows);
5127
+ first = largeMin([...activesRows]);
5128
+ last = largeMax([...activesRows]);
5101
5129
  }
5102
5130
  else {
5103
5131
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5125,8 +5153,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
5125
5153
  let last;
5126
5154
  const activeCols = env.model.getters.getActiveCols();
5127
5155
  if (activeCols.size !== 0) {
5128
- first = Math.min(...activeCols);
5129
- last = Math.max(...activeCols);
5156
+ first = largeMin([...activeCols]);
5157
+ last = largeMax([...activeCols]);
5130
5158
  }
5131
5159
  else {
5132
5160
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5154,8 +5182,8 @@ const REMOVE_ROWS_NAME = (env) => {
5154
5182
  let last;
5155
5183
  const activesRows = env.model.getters.getActiveRows();
5156
5184
  if (activesRows.size !== 0) {
5157
- first = Math.min(...activesRows);
5158
- last = Math.max(...activesRows);
5185
+ first = largeMin([...activesRows]);
5186
+ last = largeMax([...activesRows]);
5159
5187
  }
5160
5188
  else {
5161
5189
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5196,8 +5224,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
5196
5224
  let last;
5197
5225
  const activeCols = env.model.getters.getActiveCols();
5198
5226
  if (activeCols.size !== 0) {
5199
- first = Math.min(...activeCols);
5200
- last = Math.max(...activeCols);
5227
+ first = largeMin([...activeCols]);
5228
+ last = largeMax([...activeCols]);
5201
5229
  }
5202
5230
  else {
5203
5231
  const zone = env.model.getters.getSelectedZones()[0];
@@ -5266,7 +5294,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
5266
5294
  let row;
5267
5295
  let quantity;
5268
5296
  if (activeRows.size) {
5269
- row = Math.min(...activeRows);
5297
+ row = largeMin([...activeRows]);
5270
5298
  quantity = activeRows.size;
5271
5299
  }
5272
5300
  else {
@@ -5298,7 +5326,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
5298
5326
  let row;
5299
5327
  let quantity;
5300
5328
  if (activeRows.size) {
5301
- row = Math.max(...activeRows);
5329
+ row = largeMax([...activeRows]);
5302
5330
  quantity = activeRows.size;
5303
5331
  }
5304
5332
  else {
@@ -5339,7 +5367,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
5339
5367
  let column;
5340
5368
  let quantity;
5341
5369
  if (activeCols.size) {
5342
- column = Math.min(...activeCols);
5370
+ column = largeMin([...activeCols]);
5343
5371
  quantity = activeCols.size;
5344
5372
  }
5345
5373
  else {
@@ -5373,7 +5401,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
5373
5401
  let column;
5374
5402
  let quantity;
5375
5403
  if (activeCols.size) {
5376
- column = Math.max(...activeCols);
5404
+ column = largeMax([...activeCols]);
5377
5405
  quantity = activeCols.size;
5378
5406
  }
5379
5407
  else {
@@ -7929,7 +7957,7 @@ function getBestTimeUnitForScale(labels, format) {
7929
7957
  return undefined;
7930
7958
  }
7931
7959
  const labelsTimestamps = labelDates.map((date) => date.getTime());
7932
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
7960
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
7933
7961
  const minUnit = getFormatMinDisplayUnit(format);
7934
7962
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
7935
7963
  return "second";
@@ -8345,7 +8373,7 @@ function getPieConfiguration(chart, labels) {
8345
8373
  }
8346
8374
  function getPieColors(colors, dataSetsValues) {
8347
8375
  const pieColors = [];
8348
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
8376
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
8349
8377
  for (let i = 0; i <= maxLength; i++) {
8350
8378
  pieColors.push(colors.next());
8351
8379
  }
@@ -20433,6 +20461,10 @@ class Composer extends Component {
20433
20461
  if (!this.isKeyStillDown) {
20434
20462
  this.processContent();
20435
20463
  }
20464
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider and ShowDescription true
20465
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20466
+ this.processTokenAtCursor();
20467
+ }
20436
20468
  });
20437
20469
  }
20438
20470
  // ---------------------------------------------------------------------------
@@ -20631,6 +20663,12 @@ class Composer extends Component {
20631
20663
  onCompleted(text) {
20632
20664
  text && this.autoComplete(text);
20633
20665
  }
20666
+ onContextMenu(ev) {
20667
+ var _a, _b;
20668
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20669
+ (_b = (_a = this.props).onInputContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, ev);
20670
+ }
20671
+ }
20634
20672
  // ---------------------------------------------------------------------------
20635
20673
  // Private
20636
20674
  // ---------------------------------------------------------------------------
@@ -20864,6 +20902,7 @@ class GridComposer extends Component {
20864
20902
  isDefaultFocus: true,
20865
20903
  onComposerContentFocused: this.props.onComposerContentFocused,
20866
20904
  onComposerCellFocused: this.props.onComposerCellFocused,
20905
+ onInputContextMenu: this.props.onInputContextMenu,
20867
20906
  };
20868
20907
  }
20869
20908
  get containerStyle() {
@@ -23014,8 +23053,8 @@ class Grid extends Component {
23014
23053
  else if (this.env.model.getters.getActiveRows().has(row)) {
23015
23054
  type = "ROW";
23016
23055
  }
23017
- const { x, y, width, height } = this.env.model.getters.getVisibleRect(lastZone);
23018
- this.toggleContextMenu(type, x + width, y + height);
23056
+ const { x, y, width } = this.env.model.getters.getVisibleRect(lastZone);
23057
+ this.toggleContextMenu(type, this.canvasPosition.x + x + width, this.canvasPosition.y + y);
23019
23058
  }
23020
23059
  onCellRightClicked(col, row, { x, y }) {
23021
23060
  const zones = this.env.model.getters.getSelectedZones();
@@ -25181,7 +25220,7 @@ function convertHyperlink(link, cellValue, warningManager) {
25181
25220
  function getSheetDims(sheet) {
25182
25221
  const dims = [0, 0];
25183
25222
  for (let row of sheet.rows) {
25184
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
25223
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
25185
25224
  dims[1] = Math.max(dims[1], row.index);
25186
25225
  }
25187
25226
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -29218,7 +29257,17 @@ class FiltersPlugin extends CorePlugin {
29218
29257
  }
29219
29258
  }
29220
29259
  exportForExcel(data) {
29221
- this.export(data);
29260
+ for (const sheet of data.sheets) {
29261
+ for (const filterTable of this.getFilterTables(sheet.id)) {
29262
+ if (zoneToDimension(filterTable.zone).height === 1) {
29263
+ continue;
29264
+ }
29265
+ sheet.filterTables.push({
29266
+ range: zoneToXc(filterTable.zone),
29267
+ filters: [],
29268
+ });
29269
+ }
29270
+ }
29222
29271
  }
29223
29272
  }
29224
29273
  FiltersPlugin.getters = [
@@ -29274,7 +29323,7 @@ class HeaderSizePlugin extends CorePlugin {
29274
29323
  for (let headerIndex of [...cmd.elements].sort((a, b) => b - a)) {
29275
29324
  sizes.splice(headerIndex, 1);
29276
29325
  }
29277
- const min = Math.min(...cmd.elements);
29326
+ const min = largeMin(cmd.elements);
29278
29327
  sizes = sizes.map((size, row) => {
29279
29328
  if (cmd.dimension === "ROW" && row >= min) {
29280
29329
  // invalidate sizes
@@ -29502,7 +29551,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
29502
29551
  if (hiddenElements.size >= elements) {
29503
29552
  return 66 /* CommandResult.TooManyHiddenElements */;
29504
29553
  }
29505
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
29554
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
29506
29555
  return 86 /* CommandResult.InvalidHeaderIndex */;
29507
29556
  }
29508
29557
  else {
@@ -30177,7 +30226,7 @@ class SheetPlugin extends CorePlugin {
30177
30226
  const elements = cmd.dimension === "COL"
30178
30227
  ? this.getNumberCols(cmd.sheetId)
30179
30228
  : this.getNumberRows(cmd.sheetId);
30180
- if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
30229
+ if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
30181
30230
  return 86 /* CommandResult.InvalidHeaderIndex */;
30182
30231
  }
30183
30232
  else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
@@ -31550,13 +31599,13 @@ class AutomaticSumPlugin extends UIPlugin {
31550
31599
  const cells = this.getters.getCellsInZone(sheet.id, zone);
31551
31600
  const cellPositions = range(end, -1, -1);
31552
31601
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
31553
- const maxValidPosition = Math.max(...invalidCells);
31602
+ const maxValidPosition = largeMax(invalidCells);
31554
31603
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
31555
31604
  const firstSequence = numberSequences[0] || [];
31556
- if (Math.max(...firstSequence) < maxValidPosition) {
31605
+ if (largeMax(firstSequence) < maxValidPosition) {
31557
31606
  return Infinity;
31558
31607
  }
31559
- return Math.min(...firstSequence);
31608
+ return largeMin(firstSequence);
31560
31609
  }
31561
31610
  shouldFindData(sheetId, zone) {
31562
31611
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -33239,13 +33288,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
33239
33288
  .filter(this.isCellValueNumber);
33240
33289
  switch (threshold.type) {
33241
33290
  case "value":
33242
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
33291
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
33243
33292
  return result;
33244
33293
  case "number":
33245
33294
  return Number(threshold.value);
33246
33295
  case "percentage":
33247
- const min = Math.min(...rangeValues);
33248
- const max = Math.max(...rangeValues);
33296
+ const min = largeMin(rangeValues);
33297
+ const max = largeMax(rangeValues);
33249
33298
  const delta = max - min;
33250
33299
  return min + (delta * Number(threshold.value)) / 100;
33251
33300
  case "percentile":
@@ -37982,7 +38031,7 @@ class SheetUIPlugin extends UIPlugin {
37982
38031
  getColMaxWidth(sheetId, index) {
37983
38032
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
37984
38033
  const sizes = cellsPositions.map((position) => this.getCellWidth(sheetId, position));
37985
- return Math.max(0, ...sizes);
38034
+ return Math.max(0, largeMax(sizes));
37986
38035
  }
37987
38036
  splitWordToSpecificWidth(ctx, word, width, style) {
37988
38037
  const wordWidth = computeTextWidth(ctx, word, style);
@@ -40333,8 +40382,8 @@ class RangeAdapter {
40333
40382
  let newRange = range;
40334
40383
  let changeType = "NONE";
40335
40384
  for (let group of groups) {
40336
- const min = Math.min(...group);
40337
- const max = Math.max(...group);
40385
+ const min = largeMin(group);
40386
+ const max = largeMax(group);
40338
40387
  if (range.zone[start] <= min && min <= range.zone[end]) {
40339
40388
  const toRemove = Math.min(range.zone[end], max) - min + 1;
40340
40389
  changeType = "RESIZE";
@@ -41592,7 +41641,7 @@ function addLineChart(chart) {
41592
41641
  }
41593
41642
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
41594
41643
  const colors = new ChartColors();
41595
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41644
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
41596
41645
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
41597
41646
  const dataSetsNodes = [];
41598
41647
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -43259,6 +43308,6 @@ function addFunction(functionName, functionDescription) {
43259
43308
  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 };
43260
43309
 
43261
43310
 
43262
- __info__.version = '16.0.35';
43263
- __info__.date = '2024-03-15T10:57:14.362Z';
43264
- __info__.hash = '5cba28b';
43311
+ __info__.version = '16.0.37';
43312
+ __info__.date = '2024-04-05T13:58:08.848Z';
43313
+ __info__.hash = 'e95827b';