@odoo/o-spreadsheet 17.2.1 → 17.2.3

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.1
7
- * @date 2024-03-25T09:41:58.737Z
8
- * @hash f97284c
6
+ * @version 17.2.3
7
+ * @date 2024-04-10T12:28:36.552Z
8
+ * @hash ab5e22d
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -465,7 +465,7 @@
465
465
  }
466
466
  // Generate new Id if the item didn't exist in the dictionary
467
467
  const ids = Object.keys(itemsDic);
468
- const maxId = ids.length === 0 ? 0 : Math.max(...ids.map((id) => parseInt(id, 10)));
468
+ const maxId = ids.length === 0 ? 0 : largeMax(ids.map((id) => parseInt(id, 10)));
469
469
  itemsDic[maxId + 1] = item;
470
470
  return maxId + 1;
471
471
  }
@@ -561,7 +561,7 @@
561
561
  if (typeof o1 !== typeof o2)
562
562
  return false;
563
563
  if (typeof o1 !== "object")
564
- return o1 === o2;
564
+ return false;
565
565
  // Objects can have different keys if the values are undefined
566
566
  for (const key in o2) {
567
567
  if (!(key in o1) && o2[key] !== undefined) {
@@ -685,6 +685,34 @@
685
685
  }
686
686
  return RegExp(searchValue, flags);
687
687
  }
688
+ /**
689
+ * Alternative to Math.max that works with large arrays.
690
+ * Typically useful for arrays bigger than 100k elements.
691
+ */
692
+ function largeMax(array) {
693
+ let len = array.length;
694
+ if (len < 100000)
695
+ return Math.max(...array);
696
+ let max = -Infinity;
697
+ while (len--) {
698
+ max = array[len] > max ? array[len] : max;
699
+ }
700
+ return max;
701
+ }
702
+ /**
703
+ * Alternative to Math.min that works with large arrays.
704
+ * Typically useful for arrays bigger than 100k elements.
705
+ */
706
+ function largeMin(array) {
707
+ let len = array.length;
708
+ if (len < 100000)
709
+ return Math.min(...array);
710
+ let min = +Infinity;
711
+ while (len--) {
712
+ min = array[len] < min ? array[len] : min;
713
+ }
714
+ return min;
715
+ }
688
716
 
689
717
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
690
718
  const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
@@ -4544,8 +4572,9 @@
4544
4572
  * Get the default height of the cell given its style.
4545
4573
  */
4546
4574
  function getDefaultCellHeight(ctx, cell, colSize) {
4547
- if (!cell || !cell.content)
4575
+ if (!cell || (!cell.isFormula && !cell.content)) {
4548
4576
  return DEFAULT_CELL_HEIGHT;
4577
+ }
4549
4578
  const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
4550
4579
  const numberOfLines = cell.isFormula
4551
4580
  ? 1
@@ -9939,11 +9968,11 @@ stores.inject(MyMetaStore, storeInstance);
9939
9968
  }
9940
9969
  else {
9941
9970
  const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
9942
- values = this.getters
9971
+ values = Array.from(new Set(this.getters
9943
9972
  .getRangeValues(range)
9944
9973
  .filter(isNotNull)
9945
9974
  .map((value) => value.toString())
9946
- .filter((val) => val !== "");
9975
+ .filter((val) => val !== "")));
9947
9976
  }
9948
9977
  return values.map((value) => ({ text: value }));
9949
9978
  },
@@ -19390,10 +19419,10 @@ stores.inject(MyMetaStore, storeInstance);
19390
19419
  }
19391
19420
  }
19392
19421
  return {
19393
- labels: Object.keys(labelMap),
19422
+ labels: Array.from(labelSet),
19394
19423
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
19395
19424
  ...dataset,
19396
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
19425
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
19397
19426
  })),
19398
19427
  };
19399
19428
  }
@@ -20125,7 +20154,7 @@ stores.inject(MyMetaStore, storeInstance);
20125
20154
  return undefined;
20126
20155
  }
20127
20156
  const labelsTimestamps = labelDates.map((date) => date.getTime());
20128
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
20157
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
20129
20158
  const minUnit = getFormatMinDisplayUnit(format);
20130
20159
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
20131
20160
  return "second";
@@ -20613,7 +20642,7 @@ stores.inject(MyMetaStore, storeInstance);
20613
20642
  }
20614
20643
  function getPieColors(colors, dataSetsValues) {
20615
20644
  const pieColors = [];
20616
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
20645
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
20617
20646
  for (let i = 0; i <= maxLength; i++) {
20618
20647
  pieColors.push(colors.next());
20619
20648
  }
@@ -23418,8 +23447,8 @@ stores.inject(MyMetaStore, storeInstance);
23418
23447
  let last;
23419
23448
  const activesRows = env.model.getters.getActiveRows();
23420
23449
  if (activesRows.size !== 0) {
23421
- first = Math.min(...activesRows);
23422
- last = Math.max(...activesRows);
23450
+ first = largeMin([...activesRows]);
23451
+ last = largeMax([...activesRows]);
23423
23452
  }
23424
23453
  else {
23425
23454
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23447,8 +23476,8 @@ stores.inject(MyMetaStore, storeInstance);
23447
23476
  let last;
23448
23477
  const activeCols = env.model.getters.getActiveCols();
23449
23478
  if (activeCols.size !== 0) {
23450
- first = Math.min(...activeCols);
23451
- last = Math.max(...activeCols);
23479
+ first = largeMin([...activeCols]);
23480
+ last = largeMax([...activeCols]);
23452
23481
  }
23453
23482
  else {
23454
23483
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23476,8 +23505,8 @@ stores.inject(MyMetaStore, storeInstance);
23476
23505
  let last;
23477
23506
  const activesRows = env.model.getters.getActiveRows();
23478
23507
  if (activesRows.size !== 0) {
23479
- first = Math.min(...activesRows);
23480
- last = Math.max(...activesRows);
23508
+ first = largeMin([...activesRows]);
23509
+ last = largeMax([...activesRows]);
23481
23510
  }
23482
23511
  else {
23483
23512
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23518,8 +23547,8 @@ stores.inject(MyMetaStore, storeInstance);
23518
23547
  let last;
23519
23548
  const activeCols = env.model.getters.getActiveCols();
23520
23549
  if (activeCols.size !== 0) {
23521
- first = Math.min(...activeCols);
23522
- last = Math.max(...activeCols);
23550
+ first = largeMin([...activeCols]);
23551
+ last = largeMax([...activeCols]);
23523
23552
  }
23524
23553
  else {
23525
23554
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23560,7 +23589,7 @@ stores.inject(MyMetaStore, storeInstance);
23560
23589
  let row;
23561
23590
  let quantity;
23562
23591
  if (activeRows.size) {
23563
- row = Math.min(...activeRows);
23592
+ row = largeMin([...activeRows]);
23564
23593
  quantity = activeRows.size;
23565
23594
  }
23566
23595
  else {
@@ -23581,7 +23610,7 @@ stores.inject(MyMetaStore, storeInstance);
23581
23610
  let row;
23582
23611
  let quantity;
23583
23612
  if (activeRows.size) {
23584
- row = Math.max(...activeRows);
23613
+ row = largeMax([...activeRows]);
23585
23614
  quantity = activeRows.size;
23586
23615
  }
23587
23616
  else {
@@ -23602,7 +23631,7 @@ stores.inject(MyMetaStore, storeInstance);
23602
23631
  let column;
23603
23632
  let quantity;
23604
23633
  if (activeCols.size) {
23605
- column = Math.min(...activeCols);
23634
+ column = largeMin([...activeCols]);
23606
23635
  quantity = activeCols.size;
23607
23636
  }
23608
23637
  else {
@@ -23623,7 +23652,7 @@ stores.inject(MyMetaStore, storeInstance);
23623
23652
  let column;
23624
23653
  let quantity;
23625
23654
  if (activeCols.size) {
23626
- column = Math.max(...activeCols);
23655
+ column = largeMax([...activeCols]);
23627
23656
  quantity = activeCols.size;
23628
23657
  }
23629
23658
  else {
@@ -30222,7 +30251,11 @@ stores.inject(MyMetaStore, storeInstance);
30222
30251
  const composerStore = useStore(ComposerStore);
30223
30252
  // The feature makes no sense if we are editing a cell, because then the selection isn't active
30224
30253
  // Stop the edition when the panel is mounted, and close the panel if the user start editing a cell
30225
- owl.useEffect(this.props.onCloseSidePanel, () => [composerStore.editionMode]);
30254
+ owl.useEffect((editionMode) => {
30255
+ if (editionMode !== "inactive") {
30256
+ this.props.onCloseSidePanel();
30257
+ }
30258
+ }, () => [composerStore.editionMode]);
30226
30259
  owl.onMounted(() => {
30227
30260
  composerStore.stopEdition();
30228
30261
  });
@@ -31935,6 +31968,7 @@ stores.inject(MyMetaStore, storeInstance);
31935
31968
  onComposerCellFocused: { type: Function, optional: true },
31936
31969
  onComposerContentFocused: Function,
31937
31970
  isDefaultFocus: { type: Boolean, optional: true },
31971
+ onInputContextMenu: { type: Function, optional: true },
31938
31972
  };
31939
31973
  static components = { TextValueProvider, FunctionDescriptionProvider };
31940
31974
  static defaultProps = {
@@ -31985,6 +32019,9 @@ stores.inject(MyMetaStore, storeInstance);
31985
32019
  assistantStyle.right = `0px`;
31986
32020
  }
31987
32021
  }
32022
+ else if (this.props.delimitation) {
32023
+ assistantStyle["max-height"] = `${this.props.delimitation.height}px`;
32024
+ }
31988
32025
  return cssPropertiesToCss(assistantStyle);
31989
32026
  }
31990
32027
  // we can't allow input events to be triggered while we remove and add back the content of the composer in processContent
@@ -32018,6 +32055,12 @@ stores.inject(MyMetaStore, storeInstance);
32018
32055
  owl.useEffect(() => {
32019
32056
  this.processContent();
32020
32057
  });
32058
+ owl.onPatched(() => {
32059
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
32060
+ if (this.composerStore.editionMode === "inactive") {
32061
+ this.processTokenAtCursor();
32062
+ }
32063
+ });
32021
32064
  }
32022
32065
  // ---------------------------------------------------------------------------
32023
32066
  // Handlers
@@ -32265,6 +32308,11 @@ stores.inject(MyMetaStore, storeInstance);
32265
32308
  }
32266
32309
  }
32267
32310
  }
32311
+ onContextMenu(ev) {
32312
+ if (this.composerStore.editionMode === "inactive") {
32313
+ this.props.onInputContextMenu?.(ev);
32314
+ }
32315
+ }
32268
32316
  // ---------------------------------------------------------------------------
32269
32317
  // Private
32270
32318
  // ---------------------------------------------------------------------------
@@ -32486,6 +32534,7 @@ stores.inject(MyMetaStore, storeInstance);
32486
32534
  static template = "o-spreadsheet-GridComposer";
32487
32535
  static props = {
32488
32536
  gridDims: Object,
32537
+ onInputContextMenu: Function,
32489
32538
  };
32490
32539
  static components = { Composer };
32491
32540
  rect = this.defaultRect;
@@ -32533,6 +32582,7 @@ stores.inject(MyMetaStore, storeInstance);
32533
32582
  isDefaultFocus: true,
32534
32583
  onComposerContentFocused: () => this.composerFocusStore.focusGridComposerContent(),
32535
32584
  onComposerCellFocused: (content) => this.composerFocusStore.focusGridComposerCell(content),
32585
+ onInputContextMenu: this.props.onInputContextMenu,
32536
32586
  };
32537
32587
  }
32538
32588
  get containerStyle() {
@@ -33998,11 +34048,6 @@ stores.inject(MyMetaStore, storeInstance);
33998
34048
  height: 10000px;
33999
34049
  background-color: ${SELECTION_BORDER_COLOR};
34000
34050
  }
34001
- .o-unhide-buttons {
34002
- width: fit-content;
34003
- gap: 5px;
34004
- transform: translate(-50%, 0);
34005
- }
34006
34051
  .o-unhide:hover {
34007
34052
  z-index: ${ComponentsImportance.Grid + 1};
34008
34053
  background-color: lightgrey;
@@ -34164,10 +34209,6 @@ stores.inject(MyMetaStore, storeInstance);
34164
34209
  height: 1px;
34165
34210
  background-color: ${SELECTION_BORDER_COLOR};
34166
34211
  }
34167
- .o-unhide-buttons {
34168
- height: fit-content;
34169
- transform: translate(0, -50%);
34170
- }
34171
34212
  .o-unhide:hover {
34172
34213
  z-index: ${ComponentsImportance.Grid + 1};
34173
34214
  background-color: lightgrey;
@@ -37264,29 +37305,12 @@ stores.inject(MyMetaStore, storeInstance);
37264
37305
  return width;
37265
37306
  return Math.round((width / WIDTH_FACTOR) * 100) / 100;
37266
37307
  }
37267
- function convertBorderDescr(descr) {
37268
- if (!descr) {
37269
- return undefined;
37270
- }
37271
- return {
37272
- style: descr.style,
37273
- color: { rgb: descr.color },
37274
- };
37275
- }
37276
37308
  function extractStyle(cell, data) {
37277
37309
  let style = {};
37278
37310
  if (cell.style) {
37279
37311
  style = data.styles[cell.style];
37280
37312
  }
37281
37313
  const format = extractFormat(cell, data);
37282
- const exportedBorder = {};
37283
- if (cell.border) {
37284
- const border = data.borders[cell.border];
37285
- exportedBorder.left = convertBorderDescr(border.left);
37286
- exportedBorder.right = convertBorderDescr(border.right);
37287
- exportedBorder.bottom = convertBorderDescr(border.bottom);
37288
- exportedBorder.top = convertBorderDescr(border.top);
37289
- }
37290
37314
  const styles = {
37291
37315
  font: {
37292
37316
  size: style?.fontSize || DEFAULT_FONT_SIZE,
@@ -37300,7 +37324,7 @@ stores.inject(MyMetaStore, storeInstance);
37300
37324
  }
37301
37325
  : { reservedAttribute: "none" },
37302
37326
  numFmt: format ? { format: format, id: 0 /* id not used for export */ } : undefined,
37303
- border: exportedBorder || {},
37327
+ border: cell.border || 0,
37304
37328
  alignment: {
37305
37329
  horizontal: style.align,
37306
37330
  vertical: style.verticalAlign
@@ -37322,15 +37346,12 @@ stores.inject(MyMetaStore, storeInstance);
37322
37346
  return undefined;
37323
37347
  }
37324
37348
  function normalizeStyle(construct, styles) {
37325
- const { id: fontId } = pushElement(styles["font"], construct.fonts);
37326
- const { id: fillId } = pushElement(styles["fill"], construct.fills);
37327
- const { id: borderId } = pushElement(styles["border"], construct.borders);
37328
37349
  // Normalize this
37329
37350
  const numFmtId = convertFormat(styles["numFmt"], construct.numFmts);
37330
37351
  const style = {
37331
- fontId,
37332
- fillId,
37333
- borderId,
37352
+ fontId: pushElement(styles.font, construct.fonts),
37353
+ fillId: pushElement(styles.fill, construct.fills),
37354
+ borderId: styles.border,
37334
37355
  numFmtId,
37335
37356
  alignment: {
37336
37357
  vertical: styles.alignment.vertical,
@@ -37338,8 +37359,7 @@ stores.inject(MyMetaStore, storeInstance);
37338
37359
  wrapText: styles.alignment.wrapText,
37339
37360
  },
37340
37361
  };
37341
- const { id } = pushElement(style, construct.styles);
37342
- return id;
37362
+ return pushElement(style, construct.styles);
37343
37363
  }
37344
37364
  function convertFormat(format, numFmtStructure) {
37345
37365
  if (!format) {
@@ -37347,8 +37367,7 @@ stores.inject(MyMetaStore, storeInstance);
37347
37367
  }
37348
37368
  let formatId = XLSX_FORMAT_MAP[format.format];
37349
37369
  if (!formatId) {
37350
- const { id } = pushElement(format, numFmtStructure);
37351
- formatId = id + FIRST_NUMFMT_ID;
37370
+ formatId = pushElement(format, numFmtStructure) + FIRST_NUMFMT_ID;
37352
37371
  }
37353
37372
  return formatId;
37354
37373
  }
@@ -37373,20 +37392,15 @@ stores.inject(MyMetaStore, storeInstance);
37373
37392
  return id;
37374
37393
  }
37375
37394
  function pushElement(property, propertyList) {
37376
- for (let [key, value] of Object.entries(propertyList)) {
37377
- if (JSON.stringify(value) === JSON.stringify(property)) {
37378
- return { id: parseInt(key, 10), list: propertyList };
37395
+ let len = propertyList.length;
37396
+ const operator = typeof property === "object" ? deepEquals : (a, b) => a === b;
37397
+ for (let i = 0; i < len; i++) {
37398
+ if (operator(property, propertyList[i])) {
37399
+ return i;
37379
37400
  }
37380
37401
  }
37381
- let elemId = propertyList.findIndex((elem) => JSON.stringify(elem) === JSON.stringify(property));
37382
- if (elemId === -1) {
37383
- propertyList.push(property);
37384
- elemId = propertyList.length - 1;
37385
- }
37386
- return {
37387
- id: elemId,
37388
- list: propertyList,
37389
- };
37402
+ propertyList[propertyList.length] = property;
37403
+ return propertyList.length - 1;
37390
37404
  }
37391
37405
  const chartIds = [];
37392
37406
  /**
@@ -37861,7 +37875,7 @@ stores.inject(MyMetaStore, storeInstance);
37861
37875
  function getSheetDims(sheet) {
37862
37876
  const dims = [0, 0];
37863
37877
  for (let row of sheet.rows) {
37864
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
37878
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
37865
37879
  dims[1] = Math.max(dims[1], row.index);
37866
37880
  }
37867
37881
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -38181,7 +38195,25 @@ stores.inject(MyMetaStore, storeInstance);
38181
38195
  }
38182
38196
  return document;
38183
38197
  }
38184
- function getDefaultXLSXStructure() {
38198
+ function convertBorderDescr(descr) {
38199
+ if (!descr) {
38200
+ return undefined;
38201
+ }
38202
+ return {
38203
+ style: descr.style,
38204
+ color: { rgb: descr.color },
38205
+ };
38206
+ }
38207
+ function getDefaultXLSXStructure(data) {
38208
+ const xlsxBorders = Object.values(data.borders).map((border) => {
38209
+ return {
38210
+ left: convertBorderDescr(border.left),
38211
+ right: convertBorderDescr(border.right),
38212
+ bottom: convertBorderDescr(border.bottom),
38213
+ top: convertBorderDescr(border.top),
38214
+ };
38215
+ });
38216
+ const borders = [{}, ...xlsxBorders];
38185
38217
  return {
38186
38218
  relsFiles: [],
38187
38219
  sharedStrings: [],
@@ -38204,7 +38236,7 @@ stores.inject(MyMetaStore, storeInstance);
38204
38236
  },
38205
38237
  ],
38206
38238
  fills: [{ reservedAttribute: "none" }, { reservedAttribute: "gray125" }],
38207
- borders: [{}],
38239
+ borders,
38208
38240
  numFmts: [],
38209
38241
  dxfs: [],
38210
38242
  };
@@ -42368,6 +42400,9 @@ stores.inject(MyMetaStore, storeInstance);
42368
42400
  if (newRule.criterion.type === "isBoolean") {
42369
42401
  this.setCenterStyleToBooleanCells(newRule);
42370
42402
  }
42403
+ else if (newRule.criterion.type === "isValueInList") {
42404
+ newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
42405
+ }
42371
42406
  const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
42372
42407
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
42373
42408
  if (ruleIndex !== -1) {
@@ -42764,7 +42799,7 @@ stores.inject(MyMetaStore, storeInstance);
42764
42799
  if (hiddenElements.size >= elements) {
42765
42800
  return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
42766
42801
  }
42767
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
42802
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
42768
42803
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
42769
42804
  }
42770
42805
  else {
@@ -43582,8 +43617,8 @@ stores.inject(MyMetaStore, storeInstance);
43582
43617
  let newRange = range;
43583
43618
  let changeType = "NONE";
43584
43619
  for (let group of groups) {
43585
- const min = Math.min(...group);
43586
- const max = Math.max(...group);
43620
+ const min = largeMin(group);
43621
+ const max = largeMax(group);
43587
43622
  if (range.zone[start] <= min && min <= range.zone[end]) {
43588
43623
  const toRemove = Math.min(range.zone[end], max) - min + 1;
43589
43624
  changeType = "RESIZE";
@@ -44032,8 +44067,8 @@ stores.inject(MyMetaStore, storeInstance);
44032
44067
  }
44033
44068
  return "Success" /* CommandResult.Success */;
44034
44069
  case "REMOVE_COLUMNS_ROWS": {
44035
- const min = Math.min(...cmd.elements);
44036
- const max = Math.max(...cmd.elements);
44070
+ const min = largeMin(cmd.elements);
44071
+ const max = largeMax(cmd.elements);
44037
44072
  if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
44038
44073
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
44039
44074
  }
@@ -45238,7 +45273,15 @@ stores.inject(MyMetaStore, storeInstance);
45238
45273
  }
45239
45274
  }
45240
45275
  exportForExcel(data) {
45241
- this.export(data);
45276
+ for (const sheet of data.sheets) {
45277
+ for (const table of this.getTables(sheet.id)) {
45278
+ if (zoneToDimension(table.range.zone).numberOfRows === 1) {
45279
+ continue;
45280
+ }
45281
+ const tableData = { range: zoneToXc(table.range.zone), filters: [] };
45282
+ sheet.tables.push(tableData);
45283
+ }
45284
+ }
45242
45285
  }
45243
45286
  }
45244
45287
 
@@ -47010,7 +47053,9 @@ stores.inject(MyMetaStore, storeInstance);
47010
47053
  this.blockedArrayFormulas = this.createEmptyPositionSet();
47011
47054
  this.spreadingRelations = new SpreadingRelation(this.createEmptyPositionSet.bind(this));
47012
47055
  this.formulaDependencies = lazy(() => {
47013
- const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position).map((range) => ({
47056
+ const dependencies = [...this.getAllCells()].flatMap((position) => this.getDirectDependencies(position)
47057
+ .filter((range) => !range.invalidSheetName && !range.invalidXc)
47058
+ .map((range) => ({
47014
47059
  data: position,
47015
47060
  boundingBox: {
47016
47061
  zone: range.zone,
@@ -47497,7 +47542,7 @@ stores.inject(MyMetaStore, storeInstance);
47497
47542
  ? getItemId(newFormat, data.formats)
47498
47543
  : exportedCellData.format;
47499
47544
  let content;
47500
- if (formulaCell instanceof FormulaCellWithDependencies) {
47545
+ if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
47501
47546
  content = formulaCell.contentWithFixedReferences;
47502
47547
  }
47503
47548
  else {
@@ -47946,13 +47991,13 @@ stores.inject(MyMetaStore, storeInstance);
47946
47991
  .map((cell) => cell.value);
47947
47992
  switch (threshold.type) {
47948
47993
  case "value":
47949
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
47994
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
47950
47995
  return result;
47951
47996
  case "number":
47952
47997
  return Number(threshold.value);
47953
47998
  case "percentage":
47954
- const min = Math.min(...rangeValues);
47955
- const max = Math.max(...rangeValues);
47999
+ const min = largeMin(rangeValues);
48000
+ const max = largeMax(rangeValues);
47956
48001
  const delta = max - min;
47957
48002
  return min + (delta * Number(threshold.value)) / 100;
47958
48003
  case "percentile":
@@ -49025,13 +49070,13 @@ stores.inject(MyMetaStore, storeInstance);
49025
49070
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
49026
49071
  const cellPositions = range(end, -1, -1);
49027
49072
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
49028
- const maxValidPosition = Math.max(...invalidCells);
49073
+ const maxValidPosition = largeMax(invalidCells);
49029
49074
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
49030
49075
  const firstSequence = numberSequences[0] || [];
49031
- if (Math.max(...firstSequence) < maxValidPosition) {
49076
+ if (largeMax(firstSequence) < maxValidPosition) {
49032
49077
  return Infinity;
49033
49078
  }
49034
- return Math.min(...firstSequence);
49079
+ return largeMin(firstSequence);
49035
49080
  }
49036
49081
  shouldFindData(sheetId, zone) {
49037
49082
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -50772,7 +50817,7 @@ stores.inject(MyMetaStore, storeInstance);
50772
50817
  getColMaxWidth(sheetId, index) {
50773
50818
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
50774
50819
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
50775
- return Math.max(0, ...sizes);
50820
+ return Math.max(0, largeMax(sizes));
50776
50821
  }
50777
50822
  /**
50778
50823
  * Check that any "sheetId" in the command matches an existing
@@ -53668,7 +53713,7 @@ stores.inject(MyMetaStore, storeInstance);
53668
53713
  * column of the current viewport
53669
53714
  */
53670
53715
  getColDimensionsInViewport(sheetId, col) {
53671
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
53716
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
53672
53717
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
53673
53718
  const size = this.getters.getColSize(sheetId, col);
53674
53719
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -53683,7 +53728,7 @@ stores.inject(MyMetaStore, storeInstance);
53683
53728
  * of the current viewport
53684
53729
  */
53685
53730
  getRowDimensionsInViewport(sheetId, row) {
53686
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
53731
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
53687
53732
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
53688
53733
  const size = this.getters.getRowSize(sheetId, row);
53689
53734
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -54396,12 +54441,14 @@ stores.inject(MyMetaStore, storeInstance);
54396
54441
  this.editionState = "initializing";
54397
54442
  }
54398
54443
  stopEdition() {
54399
- if (!this.state.isEditing)
54444
+ const input = this.sheetNameRef.el;
54445
+ if (!this.state.isEditing || !input)
54400
54446
  return;
54401
54447
  this.state.isEditing = false;
54402
54448
  this.editionState = "initializing";
54403
- this.sheetNameRef.el?.blur();
54449
+ input.blur();
54404
54450
  const inputValue = this.getInputContent() || "";
54451
+ input.innerText = inputValue;
54405
54452
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
54406
54453
  }
54407
54454
  cancelEdition() {
@@ -54692,7 +54739,7 @@ stores.inject(MyMetaStore, storeInstance);
54692
54739
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
54693
54740
  }
54694
54741
  onSheetMouseDown(sheetId, event) {
54695
- if (event.button !== 0)
54742
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
54696
54743
  return;
54697
54744
  this.closeMenu();
54698
54745
  const visibleSheets = this.getVisibleSheets();
@@ -55653,6 +55700,13 @@ stores.inject(MyMetaStore, storeInstance);
55653
55700
  "border-color": SELECTION_BORDER_COLOR,
55654
55701
  });
55655
55702
  }
55703
+ get delimitation() {
55704
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
55705
+ return {
55706
+ width,
55707
+ height,
55708
+ };
55709
+ }
55656
55710
  onFocus(selection) {
55657
55711
  this.composerFocusStore.focusTopBarComposer(selection);
55658
55712
  }
@@ -58146,7 +58200,7 @@ stores.inject(MyMetaStore, storeInstance);
58146
58200
  }
58147
58201
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
58148
58202
  const colors = new ChartColors();
58149
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
58203
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
58150
58204
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
58151
58205
  const dataSetsNodes = [];
58152
58206
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -58284,8 +58338,7 @@ stores.inject(MyMetaStore, storeInstance);
58284
58338
  attrs.push(["t", "b"]);
58285
58339
  }
58286
58340
  else if (forceString || !isNumber(value, DEFAULT_LOCALE)) {
58287
- const { id } = pushElement(content, sharedStrings);
58288
- value = id.toString();
58341
+ value = pushElement(content, sharedStrings);
58289
58342
  attrs.push(["t", "s"]);
58290
58343
  }
58291
58344
  return { attrs, node: escapeXml /*xml*/ `<v>${value}</v>` };
@@ -58410,8 +58463,7 @@ stores.inject(MyMetaStore, storeInstance);
58410
58463
  if (rule.style.fillColor) {
58411
58464
  dxf.fill = { fgColor: { rgb: rule.style.fillColor } };
58412
58465
  }
58413
- const { id } = pushElement(dxf, dxfs);
58414
- ruleAttributes.push(["dxfId", id]);
58466
+ ruleAttributes.push(["dxfId", pushElement(dxf, dxfs)]);
58415
58467
  return escapeXml /*xml*/ `
58416
58468
  <conditionalFormatting sqref="${cf.ranges.join(" ")}">
58417
58469
  <cfRule ${formatAttributes(ruleAttributes)}>
@@ -59241,7 +59293,7 @@ stores.inject(MyMetaStore, storeInstance);
59241
59293
  */
59242
59294
  function getXLSX(data) {
59243
59295
  const files = [];
59244
- const construct = getDefaultXLSXStructure();
59296
+ const construct = getDefaultXLSXStructure(data);
59245
59297
  files.push(createWorkbook(data, construct));
59246
59298
  files.push(...createWorksheets(data, construct));
59247
59299
  files.push(createStylesSheet(construct));
@@ -60176,9 +60228,9 @@ stores.inject(MyMetaStore, storeInstance);
60176
60228
  exports.tokenize = tokenize;
60177
60229
 
60178
60230
 
60179
- __info__.version = "17.2.1";
60180
- __info__.date = "2024-03-25T09:41:58.737Z";
60181
- __info__.hash = "f97284c";
60231
+ __info__.version = "17.2.3";
60232
+ __info__.date = "2024-04-10T12:28:36.552Z";
60233
+ __info__.hash = "ab5e22d";
60182
60234
 
60183
60235
 
60184
60236
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);