@odoo/o-spreadsheet 17.1.9 → 17.1.11

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.1.9
6
- * @date 2024-03-25T09:43:27.017Z
7
- * @hash 5fb076e
5
+ * @version 17.1.11
6
+ * @date 2024-04-10T12:27:11.107Z
7
+ * @hash 246caf7
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -458,7 +458,7 @@ function getItemId(item, itemsDic) {
458
458
  }
459
459
  // Generate new Id if the item didn't exist in the dictionary
460
460
  const ids = Object.keys(itemsDic);
461
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
461
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
462
462
  itemsDic[maxId + 1] = item;
463
463
  return maxId + 1;
464
464
  }
@@ -549,7 +549,7 @@ function deepEquals(o1, o2) {
549
549
  if (typeof o1 !== typeof o2)
550
550
  return false;
551
551
  if (typeof o1 !== "object")
552
- return o1 === o2;
552
+ return false;
553
553
  // Objects can have different keys if the values are undefined
554
554
  for (const key in o2) {
555
555
  if (!(key in o1) && o2[key] !== undefined) {
@@ -675,6 +675,34 @@ function isNumberBetween(value, min, max) {
675
675
  }
676
676
  return value >= min && value <= max;
677
677
  }
678
+ /**
679
+ * Alternative to Math.max that works with large arrays.
680
+ * Typically useful for arrays bigger than 100k elements.
681
+ */
682
+ function largeMax(array) {
683
+ let len = array.length;
684
+ if (len < 100000)
685
+ return Math.max(...array);
686
+ let max = -Infinity;
687
+ while (len--) {
688
+ max = array[len] > max ? array[len] : max;
689
+ }
690
+ return max;
691
+ }
692
+ /**
693
+ * Alternative to Math.min that works with large arrays.
694
+ * Typically useful for arrays bigger than 100k elements.
695
+ */
696
+ function largeMin(array) {
697
+ let len = array.length;
698
+ if (len < 100000)
699
+ return Math.min(...array);
700
+ let min = +Infinity;
701
+ while (len--) {
702
+ min = array[len] < min ? array[len] : min;
703
+ }
704
+ return min;
705
+ }
678
706
 
679
707
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
680
708
  const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
@@ -4477,8 +4505,9 @@ function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
4477
4505
  * Get the default height of the cell given its style.
4478
4506
  */
4479
4507
  function getDefaultCellHeight(ctx, cell, colSize) {
4480
- if (!cell || !cell.content)
4508
+ if (!cell || (!cell.isFormula && !cell.content)) {
4481
4509
  return DEFAULT_CELL_HEIGHT;
4510
+ }
4482
4511
  const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
4483
4512
  const numberOfLines = cell.isFormula
4484
4513
  ? 1
@@ -8380,10 +8409,10 @@ function aggregateDataForLabels(labels, datasets) {
8380
8409
  }
8381
8410
  }
8382
8411
  return {
8383
- labels: Object.keys(labelMap),
8412
+ labels: Array.from(labelSet),
8384
8413
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
8385
8414
  ...dataset,
8386
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
8415
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
8387
8416
  })),
8388
8417
  };
8389
8418
  }
@@ -8434,7 +8463,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale })
8434
8463
  const xLabel = tooltipItem.dataset?.label || tooltipItem.label;
8435
8464
  // tooltipItem.parsed.y can be an object or a number for pie charts
8436
8465
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
8437
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
8466
+ const toolTipFormat = !format && Math.abs(yLabel) >= 1000 ? "#,##" : format;
8438
8467
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
8439
8468
  return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
8440
8469
  },
@@ -8721,7 +8750,10 @@ function getBarConfiguration(chart, labels, localeFormat) {
8721
8750
  if (isNaN(value))
8722
8751
  return value;
8723
8752
  const { locale, format } = localeFormat;
8724
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
8753
+ return formatValue(value, {
8754
+ locale,
8755
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
8756
+ });
8725
8757
  },
8726
8758
  },
8727
8759
  },
@@ -9135,7 +9167,7 @@ function getBestTimeUnitForScale(labels, format, locale) {
9135
9167
  return undefined;
9136
9168
  }
9137
9169
  const labelsTimestamps = labelDates.map((date) => date.getTime());
9138
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
9170
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
9139
9171
  const minUnit = getFormatMinDisplayUnit(format);
9140
9172
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
9141
9173
  return "second";
@@ -9372,7 +9404,10 @@ function getLineConfiguration(chart, labels, localeFormat) {
9372
9404
  if (isNaN(value))
9373
9405
  return value;
9374
9406
  const { locale, format } = localeFormat;
9375
- return formatValue(value, { locale, format: !format && value > 1000 ? "#,##" : format });
9407
+ return formatValue(value, {
9408
+ locale,
9409
+ format: !format && Math.abs(value) >= 1000 ? "#,##" : format,
9410
+ });
9376
9411
  },
9377
9412
  },
9378
9413
  },
@@ -9599,7 +9634,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
9599
9634
  const percentage = calculatePercentage(data, dataIndex);
9600
9635
  const xLabel = tooltipItem.label || tooltipItem.dataset.label;
9601
9636
  const yLabel = tooltipItem.parsed.y ?? tooltipItem.parsed;
9602
- const toolTipFormat = !format && yLabel > 1000 ? "#,##" : format;
9637
+ const toolTipFormat = !format && yLabel >= 1000 ? "#,##" : format;
9603
9638
  const yLabelStr = formatValue(yLabel, { format: toolTipFormat, locale });
9604
9639
  return xLabel ? `${xLabel}: ${yLabelStr} (${percentage}%)` : `${yLabelStr} (${percentage}%)`;
9605
9640
  };
@@ -9607,7 +9642,7 @@ function getPieConfiguration(chart, labels, localeFormat) {
9607
9642
  }
9608
9643
  function getPieColors(colors, dataSetsValues) {
9609
9644
  const pieColors = [];
9610
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
9645
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
9611
9646
  for (let i = 0; i <= maxLength; i++) {
9612
9647
  pieColors.push(colors.next());
9613
9648
  }
@@ -10531,8 +10566,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
10531
10566
  let last;
10532
10567
  const activesRows = env.model.getters.getActiveRows();
10533
10568
  if (activesRows.size !== 0) {
10534
- first = Math.min(...activesRows);
10535
- last = Math.max(...activesRows);
10569
+ first = largeMin([...activesRows]);
10570
+ last = largeMax([...activesRows]);
10536
10571
  }
10537
10572
  else {
10538
10573
  const zone = env.model.getters.getSelectedZones()[0];
@@ -10560,8 +10595,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
10560
10595
  let last;
10561
10596
  const activeCols = env.model.getters.getActiveCols();
10562
10597
  if (activeCols.size !== 0) {
10563
- first = Math.min(...activeCols);
10564
- last = Math.max(...activeCols);
10598
+ first = largeMin([...activeCols]);
10599
+ last = largeMax([...activeCols]);
10565
10600
  }
10566
10601
  else {
10567
10602
  const zone = env.model.getters.getSelectedZones()[0];
@@ -10589,8 +10624,8 @@ const REMOVE_ROWS_NAME = (env) => {
10589
10624
  let last;
10590
10625
  const activesRows = env.model.getters.getActiveRows();
10591
10626
  if (activesRows.size !== 0) {
10592
- first = Math.min(...activesRows);
10593
- last = Math.max(...activesRows);
10627
+ first = largeMin([...activesRows]);
10628
+ last = largeMax([...activesRows]);
10594
10629
  }
10595
10630
  else {
10596
10631
  const zone = env.model.getters.getSelectedZones()[0];
@@ -10631,8 +10666,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
10631
10666
  let last;
10632
10667
  const activeCols = env.model.getters.getActiveCols();
10633
10668
  if (activeCols.size !== 0) {
10634
- first = Math.min(...activeCols);
10635
- last = Math.max(...activeCols);
10669
+ first = largeMin([...activeCols]);
10670
+ last = largeMax([...activeCols]);
10636
10671
  }
10637
10672
  else {
10638
10673
  const zone = env.model.getters.getSelectedZones()[0];
@@ -10673,7 +10708,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
10673
10708
  let row;
10674
10709
  let quantity;
10675
10710
  if (activeRows.size) {
10676
- row = Math.min(...activeRows);
10711
+ row = largeMin([...activeRows]);
10677
10712
  quantity = activeRows.size;
10678
10713
  }
10679
10714
  else {
@@ -10694,7 +10729,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
10694
10729
  let row;
10695
10730
  let quantity;
10696
10731
  if (activeRows.size) {
10697
- row = Math.max(...activeRows);
10732
+ row = largeMax([...activeRows]);
10698
10733
  quantity = activeRows.size;
10699
10734
  }
10700
10735
  else {
@@ -10715,7 +10750,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
10715
10750
  let column;
10716
10751
  let quantity;
10717
10752
  if (activeCols.size) {
10718
- column = Math.min(...activeCols);
10753
+ column = largeMin([...activeCols]);
10719
10754
  quantity = activeCols.size;
10720
10755
  }
10721
10756
  else {
@@ -10736,7 +10771,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
10736
10771
  let column;
10737
10772
  let quantity;
10738
10773
  if (activeCols.size) {
10739
- column = Math.max(...activeCols);
10774
+ column = largeMax([...activeCols]);
10740
10775
  quantity = activeCols.size;
10741
10776
  }
10742
10777
  else {
@@ -27072,6 +27107,7 @@ class Composer extends Component {
27072
27107
  onComposerCellFocused: { type: Function, optional: true },
27073
27108
  onComposerContentFocused: Function,
27074
27109
  isDefaultFocus: { type: Boolean, optional: true },
27110
+ onInputContextMenu: { type: Function, optional: true },
27075
27111
  };
27076
27112
  static components = { TextValueProvider, FunctionDescriptionProvider };
27077
27113
  static defaultProps = {
@@ -27430,6 +27466,11 @@ class Composer extends Component {
27430
27466
  }
27431
27467
  }
27432
27468
  }
27469
+ onContextMenu(ev) {
27470
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27471
+ this.props.onInputContextMenu?.(ev);
27472
+ }
27473
+ }
27433
27474
  // ---------------------------------------------------------------------------
27434
27475
  // Private
27435
27476
  // ---------------------------------------------------------------------------
@@ -27697,6 +27738,7 @@ class GridComposer extends Component {
27697
27738
  onComposerCellFocused: Function,
27698
27739
  onComposerContentFocused: Function,
27699
27740
  gridDims: Object,
27741
+ onInputContextMenu: Function,
27700
27742
  };
27701
27743
  static components = { Composer };
27702
27744
  rect = this.defaultRect;
@@ -27741,6 +27783,7 @@ class GridComposer extends Component {
27741
27783
  isDefaultFocus: true,
27742
27784
  onComposerContentFocused: this.props.onComposerContentFocused,
27743
27785
  onComposerCellFocused: this.props.onComposerCellFocused,
27786
+ onInputContextMenu: this.props.onInputContextMenu,
27744
27787
  };
27745
27788
  }
27746
27789
  get containerStyle() {
@@ -29217,11 +29260,6 @@ css /* scss */ `
29217
29260
  height: 10000px;
29218
29261
  background-color: ${SELECTION_BORDER_COLOR};
29219
29262
  }
29220
- .o-unhide-buttons {
29221
- width: fit-content;
29222
- gap: 5px;
29223
- transform: translate(-50%, 0);
29224
- }
29225
29263
  .o-unhide:hover {
29226
29264
  z-index: ${ComponentsImportance.Grid + 1};
29227
29265
  background-color: lightgrey;
@@ -29383,10 +29421,6 @@ css /* scss */ `
29383
29421
  height: 1px;
29384
29422
  background-color: ${SELECTION_BORDER_COLOR};
29385
29423
  }
29386
- .o-unhide-buttons {
29387
- height: fit-content;
29388
- transform: translate(0, -50%);
29389
- }
29390
29424
  .o-unhide:hover {
29391
29425
  z-index: ${ComponentsImportance.Grid + 1};
29392
29426
  background-color: lightgrey;
@@ -31747,29 +31781,12 @@ function convertWidthFromExcel(width) {
31747
31781
  return width;
31748
31782
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
31749
31783
  }
31750
- function convertBorderDescr(descr) {
31751
- if (!descr) {
31752
- return undefined;
31753
- }
31754
- return {
31755
- style: descr.style,
31756
- color: { rgb: descr.color },
31757
- };
31758
- }
31759
31784
  function extractStyle(cell, data) {
31760
31785
  let style = {};
31761
31786
  if (cell.style) {
31762
31787
  style = data.styles[cell.style];
31763
31788
  }
31764
31789
  const format = extractFormat(cell, data);
31765
- const exportedBorder = {};
31766
- if (cell.border) {
31767
- const border = data.borders[cell.border];
31768
- exportedBorder.left = convertBorderDescr(border.left);
31769
- exportedBorder.right = convertBorderDescr(border.right);
31770
- exportedBorder.bottom = convertBorderDescr(border.bottom);
31771
- exportedBorder.top = convertBorderDescr(border.top);
31772
- }
31773
31790
  const styles = {
31774
31791
  font: {
31775
31792
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -31783,7 +31800,7 @@ function extractStyle(cell, data) {
31783
31800
  }
31784
31801
  : { reservedAttribute: "none" },
31785
31802
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
31786
- border: exportedBorder || {},
31803
+ border: cell.border || 0,
31787
31804
  alignment: {
31788
31805
  horizontal: style.align,
31789
31806
  vertical: style.verticalAlign
@@ -31805,15 +31822,12 @@ function extractFormat(cell, data) {
31805
31822
  return undefined;
31806
31823
  }
31807
31824
  function normalizeStyle(construct, styles) {
31808
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
31809
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
31810
- const { id: borderId } = pushElement(styles["border"], construct.borders);
31811
31825
  // Normalize this
31812
31826
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
31813
31827
  const style = {
31814
- fontId,
31815
- fillId,
31816
- borderId,
31828
+ fontId: pushElement(styles.font, construct.fonts),
31829
+ fillId: pushElement(styles.fill, construct.fills),
31830
+ borderId: styles.border,
31817
31831
  numFmtId,
31818
31832
  alignment: {
31819
31833
  vertical: styles.alignment.vertical,
@@ -31821,8 +31835,7 @@ function normalizeStyle(construct, styles) {
31821
31835
  wrapText: styles.alignment.wrapText,
31822
31836
  },
31823
31837
  };
31824
- const { id } = pushElement(style, construct.styles);
31825
- return id;
31838
+ return pushElement(style, construct.styles);
31826
31839
  }
31827
31840
  function convertFormat(format, numFmtStructure) {
31828
31841
  if (!format) {
@@ -31830,8 +31843,7 @@ function convertFormat(format, numFmtStructure) {
31830
31843
  }
31831
31844
  let formatId = XLSX_FORMAT_MAP[format.format];
31832
31845
  if (!formatId) {
31833
- const { id } = pushElement(format, numFmtStructure);
31834
- formatId = id + FIRST_NUMFMT_ID;
31846
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
31835
31847
  }
31836
31848
  return formatId;
31837
31849
  }
@@ -31856,20 +31868,15 @@ function addRelsToFile(relsFiles, path, rel) {
31856
31868
  return id;
31857
31869
  }
31858
31870
  function pushElement(property, propertyList) {
31859
- for (let [key, value] of Object.entries(propertyList)) {
31860
- if (JSON.stringify(value) === JSON.stringify(property)) {
31861
- return { id: parseInt(key, 10), list: propertyList };
31871
+ let len = propertyList.length;
31872
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
31873
+ for (let i = 0; i < len; i++) {
31874
+ if (operator(property, propertyList[i])) {
31875
+ return i;
31862
31876
  }
31863
31877
  }
31864
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
31865
- if (elemId === -1) {
31866
- propertyList.push(property);
31867
- elemId = propertyList.length - 1;
31868
- }
31869
- return {
31870
- id: elemId,
31871
- list: propertyList,
31872
- };
31878
+ propertyList[propertyList.length] = property;
31879
+ return propertyList.length - 1;
31873
31880
  }
31874
31881
  const chartIds = [];
31875
31882
  /**
@@ -32327,7 +32334,7 @@ function convertHyperlink(link, cellValue, warningManager) {
32327
32334
  function getSheetDims(sheet) {
32328
32335
  const dims = [0, 0];
32329
32336
  for (let row of sheet.rows) {
32330
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
32337
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
32331
32338
  dims[1] = Math.max(dims[1], row.index);
32332
32339
  }
32333
32340
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -32596,7 +32603,25 @@ function parseXML(xmlString, mimeType = "text/xml") {
32596
32603
  }
32597
32604
  return document;
32598
32605
  }
32599
- function getDefaultXLSXStructure() {
32606
+ function convertBorderDescr(descr) {
32607
+ if (!descr) {
32608
+ return undefined;
32609
+ }
32610
+ return {
32611
+ style: descr.style,
32612
+ color: { rgb: descr.color },
32613
+ };
32614
+ }
32615
+ function getDefaultXLSXStructure(data) {
32616
+ const xlsxBorders = Object.values(data.borders).map((border) => {
32617
+ return {
32618
+ left: convertBorderDescr(border.left),
32619
+ right: convertBorderDescr(border.right),
32620
+ bottom: convertBorderDescr(border.bottom),
32621
+ top: convertBorderDescr(border.top),
32622
+ };
32623
+ });
32624
+ const borders = [{}, ...xlsxBorders];
32600
32625
  return {
32601
32626
  relsFiles: [],
32602
32627
  sharedStrings: [],
@@ -32619,7 +32644,7 @@ function getDefaultXLSXStructure() {
32619
32644
  },
32620
32645
  ],
32621
32646
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
32622
- borders: [{}],
32647
+ borders,
32623
32648
  numFmts: [],
32624
32649
  dxfs: [],
32625
32650
  };
@@ -37227,6 +37252,9 @@ class DataValidationPlugin extends CorePlugin {
37227
37252
  if (newRule.criterion.type === "isBoolean") {
37228
37253
  this.setCenterStyleToBooleanCells(newRule);
37229
37254
  }
37255
+ else if (newRule.criterion.type === "isValueInList") {
37256
+ newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
37257
+ }
37230
37258
  const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
37231
37259
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
37232
37260
  if (ruleIndex !== -1) {
@@ -37812,7 +37840,17 @@ class FiltersPlugin extends CorePlugin {
37812
37840
  }
37813
37841
  }
37814
37842
  exportForExcel(data) {
37815
- this.export(data);
37843
+ for (const sheet of data.sheets) {
37844
+ for (const filterTable of this.getFilterTables(sheet.id)) {
37845
+ if (zoneToDimension(filterTable.zone).numberOfRows === 1) {
37846
+ continue;
37847
+ }
37848
+ sheet.filterTables.push({
37849
+ range: zoneToXc(filterTable.zone),
37850
+ filters: [],
37851
+ });
37852
+ }
37853
+ }
37816
37854
  }
37817
37855
  }
37818
37856
 
@@ -37953,7 +37991,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
37953
37991
  if (hiddenElements.size >= elements) {
37954
37992
  return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
37955
37993
  }
37956
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
37994
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
37957
37995
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
37958
37996
  }
37959
37997
  else {
@@ -38768,8 +38806,8 @@ class RangeAdapter {
38768
38806
  let newRange = range;
38769
38807
  let changeType = "NONE";
38770
38808
  for (let group of groups) {
38771
- const min = Math.min(...group);
38772
- const max = Math.max(...group);
38809
+ const min = largeMin(group);
38810
+ const max = largeMax(group);
38773
38811
  if (range.zone[start] <= min && min <= range.zone[end]) {
38774
38812
  const toRemove = Math.min(range.zone[end], max) - min + 1;
38775
38813
  changeType = "RESIZE";
@@ -39192,8 +39230,8 @@ class SheetPlugin extends CorePlugin {
39192
39230
  }
39193
39231
  return "Success" /* CommandResult.Success */;
39194
39232
  case "REMOVE_COLUMNS_ROWS": {
39195
- const min = Math.min(...cmd.elements);
39196
- const max = Math.max(...cmd.elements);
39233
+ const min = largeMin(cmd.elements);
39234
+ const max = largeMax(cmd.elements);
39197
39235
  if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
39198
39236
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
39199
39237
  }
@@ -41532,7 +41570,9 @@ class Evaluator {
41532
41570
  this.blockedArrayFormulas = new Set();
41533
41571
  this.spreadingRelations = new SpreadingRelation();
41534
41572
  this.formulaDependencies = lazy(() => {
41535
- const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId).map((range) => ({
41573
+ const dependencies = [...this.getAllCells()].flatMap((positionId) => this.getDirectDependencies(positionId)
41574
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
41575
+ .map((range) => ({
41536
41576
  data: positionId,
41537
41577
  boundingBox: {
41538
41578
  zone: range.zone,
@@ -42101,7 +42141,7 @@ class EvaluationPlugin extends UIPlugin {
42101
42141
  ? getItemId(newFormat, data.formats)
42102
42142
  : exportedCellData.format;
42103
42143
  let content;
42104
- if (formulaCell instanceof FormulaCellWithDependencies) {
42144
+ if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
42105
42145
  content = formulaCell.contentWithFixedReferences;
42106
42146
  }
42107
42147
  else {
@@ -42522,13 +42562,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
42522
42562
  .map((cell) => cell.value);
42523
42563
  switch (threshold.type) {
42524
42564
  case "value":
42525
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
42565
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
42526
42566
  return result;
42527
42567
  case "number":
42528
42568
  return Number(threshold.value);
42529
42569
  case "percentage":
42530
- const min = Math.min(...rangeValues);
42531
- const max = Math.max(...rangeValues);
42570
+ const min = largeMin(rangeValues);
42571
+ const max = largeMax(rangeValues);
42532
42572
  const delta = max - min;
42533
42573
  return min + (delta * Number(threshold.value)) / 100;
42534
42574
  case "percentile":
@@ -43570,13 +43610,13 @@ class AutomaticSumPlugin extends UIPlugin {
43570
43610
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
43571
43611
  const cellPositions = range(end, -1, -1);
43572
43612
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
43573
- const maxValidPosition = Math.max(...invalidCells);
43613
+ const maxValidPosition = largeMax(invalidCells);
43574
43614
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
43575
43615
  const firstSequence = numberSequences[0] || [];
43576
- if (Math.max(...firstSequence) < maxValidPosition) {
43616
+ if (largeMax(firstSequence) < maxValidPosition) {
43577
43617
  return Infinity;
43578
43618
  }
43579
- return Math.min(...firstSequence);
43619
+ return largeMin(firstSequence);
43580
43620
  }
43581
43621
  shouldFindData(sheetId, zone) {
43582
43622
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -46069,7 +46109,7 @@ class RendererPlugin extends UIPlugin {
46069
46109
  * column of the current viewport
46070
46110
  */
46071
46111
  getColDimensionsInViewport(sheetId, col) {
46072
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
46112
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
46073
46113
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
46074
46114
  const size = this.getters.getColSize(sheetId, col);
46075
46115
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -46084,7 +46124,7 @@ class RendererPlugin extends UIPlugin {
46084
46124
  * of the current viewport
46085
46125
  */
46086
46126
  getRowDimensionsInViewport(sheetId, row) {
46087
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
46127
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
46088
46128
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
46089
46129
  const size = this.getters.getRowSize(sheetId, row);
46090
46130
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -47467,7 +47507,7 @@ class SheetUIPlugin extends UIPlugin {
47467
47507
  getColMaxWidth(sheetId, index) {
47468
47508
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
47469
47509
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
47470
- return Math.max(0, ...sizes);
47510
+ return Math.max(0, largeMax(sizes));
47471
47511
  }
47472
47512
  /**
47473
47513
  * Check that any "sheetId" in the command matches an existing
@@ -48234,7 +48274,7 @@ class ClipboardOsState extends ClipboardCellsAbstractState {
48234
48274
  }
48235
48275
  getPasteZone(target) {
48236
48276
  const height = this.values.length;
48237
- const width = Math.max(...this.values.map((a) => a.length));
48277
+ const width = largeMax(this.values.map((a) => a.length));
48238
48278
  const { left: activeCol, top: activeRow } = target[0];
48239
48279
  return {
48240
48280
  top: activeRow,
@@ -49180,11 +49220,11 @@ class EditionPlugin extends UIPlugin {
49180
49220
  }
49181
49221
  else {
49182
49222
  const range = this.getters.getRangeFromSheetXC(this.sheetId, rule.criterion.values[0]);
49183
- values = this.getters
49223
+ values = Array.from(new Set(this.getters
49184
49224
  .getRangeValues(range)
49185
49225
  .filter(isNotNull)
49186
49226
  .map((value) => value.toString())
49187
- .filter((val) => val !== "");
49227
+ .filter((val) => val !== "")));
49188
49228
  }
49189
49229
  const composerContent = this.getCurrentContent();
49190
49230
  if (composerContent && composerContent !== this.getInitialComposerContent()) {
@@ -51616,12 +51656,14 @@ class BottomBarSheet extends Component {
51616
51656
  this.editionState = "initializing";
51617
51657
  }
51618
51658
  stopEdition() {
51619
- if (!this.state.isEditing)
51659
+ const input = this.sheetNameRef.el;
51660
+ if (!this.state.isEditing || !input)
51620
51661
  return;
51621
51662
  this.state.isEditing = false;
51622
51663
  this.editionState = "initializing";
51623
- this.sheetNameRef.el?.blur();
51664
+ input.blur();
51624
51665
  const inputValue = this.getInputContent() || "";
51666
+ input.innerText = inputValue;
51625
51667
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
51626
51668
  }
51627
51669
  cancelEdition() {
@@ -51912,7 +51954,7 @@ class BottomBar extends Component {
51912
51954
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
51913
51955
  }
51914
51956
  onSheetMouseDown(sheetId, event) {
51915
- if (event.button !== 0)
51957
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
51916
51958
  return;
51917
51959
  this.closeMenu();
51918
51960
  const visibleSheets = this.getVisibleSheets();
@@ -55366,7 +55408,7 @@ function addLineChart(chart) {
55366
55408
  }
55367
55409
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
55368
55410
  const colors = new ChartColors();
55369
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
55411
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
55370
55412
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
55371
55413
  const dataSetsNodes = [];
55372
55414
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -55504,8 +55546,7 @@ function addContent(content, sharedStrings, forceString = false) {
55504
55546
  attrs.push(["t", "b"]);
55505
55547
  }
55506
55548
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
55507
- const { id } = pushElement(content, sharedStrings);
55508
- value = id.toString();
55549
+ value = pushElement(content, sharedStrings);
55509
55550
  attrs.push(["t", "s"]);
55510
55551
  }
55511
55552
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -55630,8 +55671,7 @@ function addCellIsRule(cf, rule, dxfs) {
55630
55671
  if (rule.style.fillColor) {
55631
55672
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
55632
55673
  }
55633
- const { id } = pushElement(dxf, dxfs);
55634
- ruleAttributes.push(["dxfId", id]);
55674
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
55635
55675
  return escapeXml /*xml*/ `
55636
55676
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
55637
55677
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -56441,7 +56481,7 @@ function addSheetViews(sheet) {
56441
56481
  */
56442
56482
  function getXLSX(data) {
56443
56483
  const files = [];
56444
- const construct = getDefaultXLSXStructure();
56484
+ const construct = getDefaultXLSXStructure(data);
56445
56485
  files.push(createWorkbook(data, construct));
56446
56486
  files.push(...createWorksheets(data, construct));
56447
56487
  files.push(createStylesSheet(construct));
@@ -57294,6 +57334,6 @@ const constants = {
57294
57334
  export { AbstractChart, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
57295
57335
 
57296
57336
 
57297
- __info__.version = "17.1.9";
57298
- __info__.date = "2024-03-25T09:43:27.017Z";
57299
- __info__.hash = "5fb076e";
57337
+ __info__.version = "17.1.11";
57338
+ __info__.date = "2024-04-10T12:27:11.107Z";
57339
+ __info__.hash = "246caf7";