@odoo/o-spreadsheet 15.0.19 → 15.0.20

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.
@@ -2993,6 +2993,34 @@ function deepEquals(o1, o2) {
2993
2993
  }
2994
2994
  }
2995
2995
  return true;
2996
+ }
2997
+ /**
2998
+ * Alternative to Math.max that works with large arrays.
2999
+ * Typically useful for arrays bigger than 100k elements.
3000
+ */
3001
+ function largeMax(array) {
3002
+ let len = array.length;
3003
+ if (len < 100000)
3004
+ return Math.max(...array);
3005
+ let max = -Infinity;
3006
+ while (len--) {
3007
+ max = array[len] > max ? array[len] : max;
3008
+ }
3009
+ return max;
3010
+ }
3011
+ /**
3012
+ * Alternative to Math.min that works with large arrays.
3013
+ * Typically useful for arrays bigger than 100k elements.
3014
+ */
3015
+ function largeMin(array) {
3016
+ let len = array.length;
3017
+ if (len < 100000)
3018
+ return Math.min(...array);
3019
+ let min = +Infinity;
3020
+ while (len--) {
3021
+ min = array[len] < min ? array[len] : min;
3022
+ }
3023
+ return min;
2996
3024
  }
2997
3025
 
2998
3026
  /**
@@ -3610,9 +3638,10 @@ function exportRows(rows, exportDefaults = false) {
3610
3638
  * https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
3611
3639
  * */
3612
3640
  class UuidGenerator {
3613
- constructor() {
3641
+ constructor(isFast = false) {
3614
3642
  this.isFastIdStrategy = false;
3615
3643
  this.fastIdStart = 0;
3644
+ this.setIsFastStrategy(isFast);
3616
3645
  }
3617
3646
  setIsFastStrategy(isFast) {
3618
3647
  this.isFastIdStrategy = isFast;
@@ -9523,6 +9552,7 @@ class CellPlugin extends CorePlugin {
9523
9552
  constructor() {
9524
9553
  super(...arguments);
9525
9554
  this.cells = {};
9555
+ this.cellUuidGenerator = new UuidGenerator(true);
9526
9556
  this.createCell = cellFactory(this.getters);
9527
9557
  }
9528
9558
  adaptRanges(applyChange, sheetId) {
@@ -9702,7 +9732,7 @@ class CellPlugin extends CorePlugin {
9702
9732
  }
9703
9733
  importCell(sheet, cellData, normalizedStyles) {
9704
9734
  const style = (cellData.style && normalizedStyles[cellData.style]) || undefined;
9705
- const cellId = this.uuidGenerator.uuidv4();
9735
+ const cellId = this.cellUuidGenerator.uuidv4();
9706
9736
  const properties = { format: cellData === null || cellData === void 0 ? void 0 : cellData.format, style };
9707
9737
  return this.createCell(cellId, (cellData === null || cellData === void 0 ? void 0 : cellData.content) || "", properties, sheet.id);
9708
9738
  }
@@ -9885,7 +9915,7 @@ class CellPlugin extends CorePlugin {
9885
9915
  }
9886
9916
  return;
9887
9917
  }
9888
- const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.uuidGenerator.uuidv4();
9918
+ const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.cellUuidGenerator.uuidv4();
9889
9919
  const didContentChange = hasContent;
9890
9920
  const properties = { format, style };
9891
9921
  const cell = this.createCell(cellId, afterContent, properties, sheet.id);
@@ -12032,8 +12062,8 @@ class SheetPlugin extends CorePlugin {
12032
12062
  getImportedSheetSize(data) {
12033
12063
  const positions = Object.keys(data.cells).map(toCartesian);
12034
12064
  return {
12035
- rowNumber: Math.max(data.rowNumber, ...new Set(positions.map(([col, row]) => row + 1))),
12036
- colNumber: Math.max(data.colNumber, ...new Set(positions.map(([col, row]) => col + 1))),
12065
+ rowNumber: Math.max(data.rowNumber, largeMax(positions.map(([col, row]) => row + 1))),
12066
+ colNumber: Math.max(data.colNumber, largeMax(positions.map(([col, row]) => col + 1))),
12037
12067
  };
12038
12068
  }
12039
12069
  // ----------------------------------------------------
@@ -12570,8 +12600,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
12570
12600
  let last;
12571
12601
  const activesRows = env.getters.getActiveRows();
12572
12602
  if (activesRows.size !== 0) {
12573
- first = Math.min(...activesRows);
12574
- last = Math.max(...activesRows);
12603
+ first = largeMin([...activesRows]);
12604
+ last = largeMax([...activesRows]);
12575
12605
  }
12576
12606
  else {
12577
12607
  const zone = env.getters.getSelectedZones()[0];
@@ -12596,8 +12626,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
12596
12626
  let last;
12597
12627
  const activeCols = env.getters.getActiveCols();
12598
12628
  if (activeCols.size !== 0) {
12599
- first = Math.min(...activeCols);
12600
- last = Math.max(...activeCols);
12629
+ first = largeMin([...activeCols]);
12630
+ last = largeMax([...activeCols]);
12601
12631
  }
12602
12632
  else {
12603
12633
  const zone = env.getters.getSelectedZones()[0];
@@ -12622,8 +12652,8 @@ const REMOVE_ROWS_NAME = (env) => {
12622
12652
  let last;
12623
12653
  const activesRows = env.getters.getActiveRows();
12624
12654
  if (activesRows.size !== 0) {
12625
- first = Math.min(...activesRows);
12626
- last = Math.max(...activesRows);
12655
+ first = largeMin([...activesRows]);
12656
+ last = largeMax([...activesRows]);
12627
12657
  }
12628
12658
  else {
12629
12659
  const zone = env.getters.getSelectedZones()[0];
@@ -12654,8 +12684,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
12654
12684
  let last;
12655
12685
  const activeCols = env.getters.getActiveCols();
12656
12686
  if (activeCols.size !== 0) {
12657
- first = Math.min(...activeCols);
12658
- last = Math.max(...activeCols);
12687
+ first = largeMin([...activeCols]);
12688
+ last = largeMax([...activeCols]);
12659
12689
  }
12660
12690
  else {
12661
12691
  const zone = env.getters.getSelectedZones()[0];
@@ -12720,7 +12750,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
12720
12750
  let row;
12721
12751
  let quantity;
12722
12752
  if (activeRows.size) {
12723
- row = Math.min(...activeRows);
12753
+ row = largeMin([...activeRows]);
12724
12754
  quantity = activeRows.size;
12725
12755
  }
12726
12756
  else {
@@ -12752,7 +12782,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
12752
12782
  let row;
12753
12783
  let quantity;
12754
12784
  if (activeRows.size) {
12755
- row = Math.max(...activeRows);
12785
+ row = largeMax([...activeRows]);
12756
12786
  quantity = activeRows.size;
12757
12787
  }
12758
12788
  else {
@@ -12793,7 +12823,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
12793
12823
  let column;
12794
12824
  let quantity;
12795
12825
  if (activeCols.size) {
12796
- column = Math.min(...activeCols);
12826
+ column = largeMin([...activeCols]);
12797
12827
  quantity = activeCols.size;
12798
12828
  }
12799
12829
  else {
@@ -12827,7 +12857,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
12827
12857
  let column;
12828
12858
  let quantity;
12829
12859
  if (activeCols.size) {
12830
- column = Math.max(...activeCols);
12860
+ column = largeMax([...activeCols]);
12831
12861
  quantity = activeCols.size;
12832
12862
  }
12833
12863
  else {
@@ -16569,13 +16599,13 @@ class AutomaticSumPlugin extends UIPlugin {
16569
16599
  const cells = mapCellsInZone(zone, sheet, (cell) => cell, undefined).flat();
16570
16600
  const cellPositions = range(end, -1, -1);
16571
16601
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
16572
- const maxValidPosition = Math.max(...invalidCells);
16602
+ const maxValidPosition = largeMax(invalidCells);
16573
16603
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
16574
16604
  const firstSequence = numberSequences[0] || [];
16575
- if (Math.max(...firstSequence) < maxValidPosition) {
16605
+ if (largeMax(firstSequence) < maxValidPosition) {
16576
16606
  return Infinity;
16577
16607
  }
16578
- return Math.min(...firstSequence);
16608
+ return largeMin(firstSequence);
16579
16609
  }
16580
16610
  shouldFindData(sheetId, zone) {
16581
16611
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -22266,13 +22296,13 @@ class SheetUIPlugin extends UIPlugin {
22266
22296
  getColMaxWidth(sheetId, index) {
22267
22297
  const cells = this.getters.getColCells(sheetId, index);
22268
22298
  const sizes = cells.map((cell) => this.getCellWidth(cell));
22269
- return Math.max(0, ...sizes);
22299
+ return Math.max(0, largeMax(sizes));
22270
22300
  }
22271
22301
  getRowMaxHeight(sheetId, index) {
22272
22302
  const sheet = this.getters.getSheet(sheetId);
22273
22303
  const cells = Object.values(sheet.rows[index].cells);
22274
22304
  const sizes = cells.map((cell) => this.getCellHeight(cell));
22275
- return Math.max(0, ...sizes);
22305
+ return Math.max(0, largeMax(sizes));
22276
22306
  }
22277
22307
  interactiveRenameSheet(sheetId, title) {
22278
22308
  const placeholder = this.getters.getSheetName(sheetId);
@@ -23691,8 +23721,8 @@ class RangeAdapter {
23691
23721
  let newRange = range;
23692
23722
  let changeType = "NONE";
23693
23723
  for (let group of groups) {
23694
- const min = Math.min(...group);
23695
- const max = Math.max(...group);
23724
+ const min = largeMin(group);
23725
+ const max = largeMax(group);
23696
23726
  if (range.zone[start] <= min && min <= range.zone[end]) {
23697
23727
  const toRemove = Math.min(range.zone[end], max) - min + 1;
23698
23728
  changeType = "RESIZE";
@@ -31508,6 +31538,6 @@ exports.registries = registries;
31508
31538
  exports.setTranslationMethod = setTranslationMethod;
31509
31539
 
31510
31540
 
31511
- __info__.version = '15.0.19';
31512
- __info__.date = '2024-03-15T10:55:52.497Z';
31513
- __info__.hash = '277ed99';
31541
+ __info__.version = '15.0.20';
31542
+ __info__.date = '2024-04-05T13:56:04.792Z';
31543
+ __info__.hash = '09e95ef';
@@ -92,6 +92,7 @@ declare function formatDecimal(n: number, decimals: number, sep?: string): strin
92
92
  declare class UuidGenerator {
93
93
  private isFastIdStrategy;
94
94
  private fastIdStart;
95
+ constructor(isFast?: boolean);
95
96
  setIsFastStrategy(isFast: boolean): void;
96
97
  uuidv4(): string;
97
98
  }
@@ -2344,6 +2345,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
2344
2345
  [id: string]: Cell;
2345
2346
  };
2346
2347
  };
2348
+ private cellUuidGenerator;
2347
2349
  private createCell;
2348
2350
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
2349
2351
  allowDispatch(cmd: CoreCommand): CommandResult;
@@ -2970,6 +2970,34 @@ function deepEquals(o1, o2) {
2970
2970
  }
2971
2971
  }
2972
2972
  return true;
2973
+ }
2974
+ /**
2975
+ * Alternative to Math.max that works with large arrays.
2976
+ * Typically useful for arrays bigger than 100k elements.
2977
+ */
2978
+ function largeMax(array) {
2979
+ let len = array.length;
2980
+ if (len < 100000)
2981
+ return Math.max(...array);
2982
+ let max = -Infinity;
2983
+ while (len--) {
2984
+ max = array[len] > max ? array[len] : max;
2985
+ }
2986
+ return max;
2987
+ }
2988
+ /**
2989
+ * Alternative to Math.min that works with large arrays.
2990
+ * Typically useful for arrays bigger than 100k elements.
2991
+ */
2992
+ function largeMin(array) {
2993
+ let len = array.length;
2994
+ if (len < 100000)
2995
+ return Math.min(...array);
2996
+ let min = +Infinity;
2997
+ while (len--) {
2998
+ min = array[len] < min ? array[len] : min;
2999
+ }
3000
+ return min;
2973
3001
  }
2974
3002
 
2975
3003
  /**
@@ -3587,9 +3615,10 @@ function exportRows(rows, exportDefaults = false) {
3587
3615
  * https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
3588
3616
  * */
3589
3617
  class UuidGenerator {
3590
- constructor() {
3618
+ constructor(isFast = false) {
3591
3619
  this.isFastIdStrategy = false;
3592
3620
  this.fastIdStart = 0;
3621
+ this.setIsFastStrategy(isFast);
3593
3622
  }
3594
3623
  setIsFastStrategy(isFast) {
3595
3624
  this.isFastIdStrategy = isFast;
@@ -9500,6 +9529,7 @@ class CellPlugin extends CorePlugin {
9500
9529
  constructor() {
9501
9530
  super(...arguments);
9502
9531
  this.cells = {};
9532
+ this.cellUuidGenerator = new UuidGenerator(true);
9503
9533
  this.createCell = cellFactory(this.getters);
9504
9534
  }
9505
9535
  adaptRanges(applyChange, sheetId) {
@@ -9679,7 +9709,7 @@ class CellPlugin extends CorePlugin {
9679
9709
  }
9680
9710
  importCell(sheet, cellData, normalizedStyles) {
9681
9711
  const style = (cellData.style && normalizedStyles[cellData.style]) || undefined;
9682
- const cellId = this.uuidGenerator.uuidv4();
9712
+ const cellId = this.cellUuidGenerator.uuidv4();
9683
9713
  const properties = { format: cellData === null || cellData === void 0 ? void 0 : cellData.format, style };
9684
9714
  return this.createCell(cellId, (cellData === null || cellData === void 0 ? void 0 : cellData.content) || "", properties, sheet.id);
9685
9715
  }
@@ -9862,7 +9892,7 @@ class CellPlugin extends CorePlugin {
9862
9892
  }
9863
9893
  return;
9864
9894
  }
9865
- const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.uuidGenerator.uuidv4();
9895
+ const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.cellUuidGenerator.uuidv4();
9866
9896
  const didContentChange = hasContent;
9867
9897
  const properties = { format, style };
9868
9898
  const cell = this.createCell(cellId, afterContent, properties, sheet.id);
@@ -12009,8 +12039,8 @@ class SheetPlugin extends CorePlugin {
12009
12039
  getImportedSheetSize(data) {
12010
12040
  const positions = Object.keys(data.cells).map(toCartesian);
12011
12041
  return {
12012
- rowNumber: Math.max(data.rowNumber, ...new Set(positions.map(([col, row]) => row + 1))),
12013
- colNumber: Math.max(data.colNumber, ...new Set(positions.map(([col, row]) => col + 1))),
12042
+ rowNumber: Math.max(data.rowNumber, largeMax(positions.map(([col, row]) => row + 1))),
12043
+ colNumber: Math.max(data.colNumber, largeMax(positions.map(([col, row]) => col + 1))),
12014
12044
  };
12015
12045
  }
12016
12046
  // ----------------------------------------------------
@@ -12547,8 +12577,8 @@ const DELETE_CONTENT_ROWS_NAME = (env) => {
12547
12577
  let last;
12548
12578
  const activesRows = env.getters.getActiveRows();
12549
12579
  if (activesRows.size !== 0) {
12550
- first = Math.min(...activesRows);
12551
- last = Math.max(...activesRows);
12580
+ first = largeMin([...activesRows]);
12581
+ last = largeMax([...activesRows]);
12552
12582
  }
12553
12583
  else {
12554
12584
  const zone = env.getters.getSelectedZones()[0];
@@ -12573,8 +12603,8 @@ const DELETE_CONTENT_COLUMNS_NAME = (env) => {
12573
12603
  let last;
12574
12604
  const activeCols = env.getters.getActiveCols();
12575
12605
  if (activeCols.size !== 0) {
12576
- first = Math.min(...activeCols);
12577
- last = Math.max(...activeCols);
12606
+ first = largeMin([...activeCols]);
12607
+ last = largeMax([...activeCols]);
12578
12608
  }
12579
12609
  else {
12580
12610
  const zone = env.getters.getSelectedZones()[0];
@@ -12599,8 +12629,8 @@ const REMOVE_ROWS_NAME = (env) => {
12599
12629
  let last;
12600
12630
  const activesRows = env.getters.getActiveRows();
12601
12631
  if (activesRows.size !== 0) {
12602
- first = Math.min(...activesRows);
12603
- last = Math.max(...activesRows);
12632
+ first = largeMin([...activesRows]);
12633
+ last = largeMax([...activesRows]);
12604
12634
  }
12605
12635
  else {
12606
12636
  const zone = env.getters.getSelectedZones()[0];
@@ -12631,8 +12661,8 @@ const REMOVE_COLUMNS_NAME = (env) => {
12631
12661
  let last;
12632
12662
  const activeCols = env.getters.getActiveCols();
12633
12663
  if (activeCols.size !== 0) {
12634
- first = Math.min(...activeCols);
12635
- last = Math.max(...activeCols);
12664
+ first = largeMin([...activeCols]);
12665
+ last = largeMax([...activeCols]);
12636
12666
  }
12637
12667
  else {
12638
12668
  const zone = env.getters.getSelectedZones()[0];
@@ -12697,7 +12727,7 @@ const INSERT_ROWS_BEFORE_ACTION = (env) => {
12697
12727
  let row;
12698
12728
  let quantity;
12699
12729
  if (activeRows.size) {
12700
- row = Math.min(...activeRows);
12730
+ row = largeMin([...activeRows]);
12701
12731
  quantity = activeRows.size;
12702
12732
  }
12703
12733
  else {
@@ -12729,7 +12759,7 @@ const INSERT_ROWS_AFTER_ACTION = (env) => {
12729
12759
  let row;
12730
12760
  let quantity;
12731
12761
  if (activeRows.size) {
12732
- row = Math.max(...activeRows);
12762
+ row = largeMax([...activeRows]);
12733
12763
  quantity = activeRows.size;
12734
12764
  }
12735
12765
  else {
@@ -12770,7 +12800,7 @@ const INSERT_COLUMNS_BEFORE_ACTION = (env) => {
12770
12800
  let column;
12771
12801
  let quantity;
12772
12802
  if (activeCols.size) {
12773
- column = Math.min(...activeCols);
12803
+ column = largeMin([...activeCols]);
12774
12804
  quantity = activeCols.size;
12775
12805
  }
12776
12806
  else {
@@ -12804,7 +12834,7 @@ const INSERT_COLUMNS_AFTER_ACTION = (env) => {
12804
12834
  let column;
12805
12835
  let quantity;
12806
12836
  if (activeCols.size) {
12807
- column = Math.max(...activeCols);
12837
+ column = largeMax([...activeCols]);
12808
12838
  quantity = activeCols.size;
12809
12839
  }
12810
12840
  else {
@@ -16546,13 +16576,13 @@ class AutomaticSumPlugin extends UIPlugin {
16546
16576
  const cells = mapCellsInZone(zone, sheet, (cell) => cell, undefined).flat();
16547
16577
  const cellPositions = range(end, -1, -1);
16548
16578
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
16549
- const maxValidPosition = Math.max(...invalidCells);
16579
+ const maxValidPosition = largeMax(invalidCells);
16550
16580
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
16551
16581
  const firstSequence = numberSequences[0] || [];
16552
- if (Math.max(...firstSequence) < maxValidPosition) {
16582
+ if (largeMax(firstSequence) < maxValidPosition) {
16553
16583
  return Infinity;
16554
16584
  }
16555
- return Math.min(...firstSequence);
16585
+ return largeMin(firstSequence);
16556
16586
  }
16557
16587
  shouldFindData(sheetId, zone) {
16558
16588
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -22243,13 +22273,13 @@ class SheetUIPlugin extends UIPlugin {
22243
22273
  getColMaxWidth(sheetId, index) {
22244
22274
  const cells = this.getters.getColCells(sheetId, index);
22245
22275
  const sizes = cells.map((cell) => this.getCellWidth(cell));
22246
- return Math.max(0, ...sizes);
22276
+ return Math.max(0, largeMax(sizes));
22247
22277
  }
22248
22278
  getRowMaxHeight(sheetId, index) {
22249
22279
  const sheet = this.getters.getSheet(sheetId);
22250
22280
  const cells = Object.values(sheet.rows[index].cells);
22251
22281
  const sizes = cells.map((cell) => this.getCellHeight(cell));
22252
- return Math.max(0, ...sizes);
22282
+ return Math.max(0, largeMax(sizes));
22253
22283
  }
22254
22284
  interactiveRenameSheet(sheetId, title) {
22255
22285
  const placeholder = this.getters.getSheetName(sheetId);
@@ -23668,8 +23698,8 @@ class RangeAdapter {
23668
23698
  let newRange = range;
23669
23699
  let changeType = "NONE";
23670
23700
  for (let group of groups) {
23671
- const min = Math.min(...group);
23672
- const max = Math.max(...group);
23701
+ const min = largeMin(group);
23702
+ const max = largeMax(group);
23673
23703
  if (range.zone[start] <= min && min <= range.zone[end]) {
23674
23704
  const toRemove = Math.min(range.zone[end], max) - min + 1;
23675
23705
  changeType = "RESIZE";
@@ -31463,6 +31493,6 @@ const helpers = {
31463
31493
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31464
31494
 
31465
31495
 
31466
- __info__.version = '15.0.19';
31467
- __info__.date = '2024-03-15T10:55:52.497Z';
31468
- __info__.hash = '277ed99';
31496
+ __info__.version = '15.0.20';
31497
+ __info__.date = '2024-04-05T13:56:04.792Z';
31498
+ __info__.hash = '09e95ef';
@@ -2990,6 +2990,34 @@
2990
2990
  }
2991
2991
  }
2992
2992
  return true;
2993
+ }
2994
+ /**
2995
+ * Alternative to Math.max that works with large arrays.
2996
+ * Typically useful for arrays bigger than 100k elements.
2997
+ */
2998
+ function largeMax(array) {
2999
+ let len = array.length;
3000
+ if (len < 100000)
3001
+ return Math.max(...array);
3002
+ let max = -Infinity;
3003
+ while (len--) {
3004
+ max = array[len] > max ? array[len] : max;
3005
+ }
3006
+ return max;
3007
+ }
3008
+ /**
3009
+ * Alternative to Math.min that works with large arrays.
3010
+ * Typically useful for arrays bigger than 100k elements.
3011
+ */
3012
+ function largeMin(array) {
3013
+ let len = array.length;
3014
+ if (len < 100000)
3015
+ return Math.min(...array);
3016
+ let min = +Infinity;
3017
+ while (len--) {
3018
+ min = array[len] < min ? array[len] : min;
3019
+ }
3020
+ return min;
2993
3021
  }
2994
3022
 
2995
3023
  /**
@@ -3607,9 +3635,10 @@
3607
3635
  * https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
3608
3636
  * */
3609
3637
  class UuidGenerator {
3610
- constructor() {
3638
+ constructor(isFast = false) {
3611
3639
  this.isFastIdStrategy = false;
3612
3640
  this.fastIdStart = 0;
3641
+ this.setIsFastStrategy(isFast);
3613
3642
  }
3614
3643
  setIsFastStrategy(isFast) {
3615
3644
  this.isFastIdStrategy = isFast;
@@ -9520,6 +9549,7 @@
9520
9549
  constructor() {
9521
9550
  super(...arguments);
9522
9551
  this.cells = {};
9552
+ this.cellUuidGenerator = new UuidGenerator(true);
9523
9553
  this.createCell = cellFactory(this.getters);
9524
9554
  }
9525
9555
  adaptRanges(applyChange, sheetId) {
@@ -9699,7 +9729,7 @@
9699
9729
  }
9700
9730
  importCell(sheet, cellData, normalizedStyles) {
9701
9731
  const style = (cellData.style && normalizedStyles[cellData.style]) || undefined;
9702
- const cellId = this.uuidGenerator.uuidv4();
9732
+ const cellId = this.cellUuidGenerator.uuidv4();
9703
9733
  const properties = { format: cellData === null || cellData === void 0 ? void 0 : cellData.format, style };
9704
9734
  return this.createCell(cellId, (cellData === null || cellData === void 0 ? void 0 : cellData.content) || "", properties, sheet.id);
9705
9735
  }
@@ -9882,7 +9912,7 @@
9882
9912
  }
9883
9913
  return;
9884
9914
  }
9885
- const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.uuidGenerator.uuidv4();
9915
+ const cellId = (before === null || before === void 0 ? void 0 : before.id) || this.cellUuidGenerator.uuidv4();
9886
9916
  const didContentChange = hasContent;
9887
9917
  const properties = { format, style };
9888
9918
  const cell = this.createCell(cellId, afterContent, properties, sheet.id);
@@ -12029,8 +12059,8 @@
12029
12059
  getImportedSheetSize(data) {
12030
12060
  const positions = Object.keys(data.cells).map(toCartesian);
12031
12061
  return {
12032
- rowNumber: Math.max(data.rowNumber, ...new Set(positions.map(([col, row]) => row + 1))),
12033
- colNumber: Math.max(data.colNumber, ...new Set(positions.map(([col, row]) => col + 1))),
12062
+ rowNumber: Math.max(data.rowNumber, largeMax(positions.map(([col, row]) => row + 1))),
12063
+ colNumber: Math.max(data.colNumber, largeMax(positions.map(([col, row]) => col + 1))),
12034
12064
  };
12035
12065
  }
12036
12066
  // ----------------------------------------------------
@@ -12567,8 +12597,8 @@
12567
12597
  let last;
12568
12598
  const activesRows = env.getters.getActiveRows();
12569
12599
  if (activesRows.size !== 0) {
12570
- first = Math.min(...activesRows);
12571
- last = Math.max(...activesRows);
12600
+ first = largeMin([...activesRows]);
12601
+ last = largeMax([...activesRows]);
12572
12602
  }
12573
12603
  else {
12574
12604
  const zone = env.getters.getSelectedZones()[0];
@@ -12593,8 +12623,8 @@
12593
12623
  let last;
12594
12624
  const activeCols = env.getters.getActiveCols();
12595
12625
  if (activeCols.size !== 0) {
12596
- first = Math.min(...activeCols);
12597
- last = Math.max(...activeCols);
12626
+ first = largeMin([...activeCols]);
12627
+ last = largeMax([...activeCols]);
12598
12628
  }
12599
12629
  else {
12600
12630
  const zone = env.getters.getSelectedZones()[0];
@@ -12619,8 +12649,8 @@
12619
12649
  let last;
12620
12650
  const activesRows = env.getters.getActiveRows();
12621
12651
  if (activesRows.size !== 0) {
12622
- first = Math.min(...activesRows);
12623
- last = Math.max(...activesRows);
12652
+ first = largeMin([...activesRows]);
12653
+ last = largeMax([...activesRows]);
12624
12654
  }
12625
12655
  else {
12626
12656
  const zone = env.getters.getSelectedZones()[0];
@@ -12651,8 +12681,8 @@
12651
12681
  let last;
12652
12682
  const activeCols = env.getters.getActiveCols();
12653
12683
  if (activeCols.size !== 0) {
12654
- first = Math.min(...activeCols);
12655
- last = Math.max(...activeCols);
12684
+ first = largeMin([...activeCols]);
12685
+ last = largeMax([...activeCols]);
12656
12686
  }
12657
12687
  else {
12658
12688
  const zone = env.getters.getSelectedZones()[0];
@@ -12717,7 +12747,7 @@
12717
12747
  let row;
12718
12748
  let quantity;
12719
12749
  if (activeRows.size) {
12720
- row = Math.min(...activeRows);
12750
+ row = largeMin([...activeRows]);
12721
12751
  quantity = activeRows.size;
12722
12752
  }
12723
12753
  else {
@@ -12749,7 +12779,7 @@
12749
12779
  let row;
12750
12780
  let quantity;
12751
12781
  if (activeRows.size) {
12752
- row = Math.max(...activeRows);
12782
+ row = largeMax([...activeRows]);
12753
12783
  quantity = activeRows.size;
12754
12784
  }
12755
12785
  else {
@@ -12790,7 +12820,7 @@
12790
12820
  let column;
12791
12821
  let quantity;
12792
12822
  if (activeCols.size) {
12793
- column = Math.min(...activeCols);
12823
+ column = largeMin([...activeCols]);
12794
12824
  quantity = activeCols.size;
12795
12825
  }
12796
12826
  else {
@@ -12824,7 +12854,7 @@
12824
12854
  let column;
12825
12855
  let quantity;
12826
12856
  if (activeCols.size) {
12827
- column = Math.max(...activeCols);
12857
+ column = largeMax([...activeCols]);
12828
12858
  quantity = activeCols.size;
12829
12859
  }
12830
12860
  else {
@@ -16566,13 +16596,13 @@
16566
16596
  const cells = mapCellsInZone(zone, sheet, (cell) => cell, undefined).flat();
16567
16597
  const cellPositions = range(end, -1, -1);
16568
16598
  const invalidCells = cellPositions.filter((position) => { var _a; return cells[position] && !((_a = cells[position]) === null || _a === void 0 ? void 0 : _a.isAutoSummable); });
16569
- const maxValidPosition = Math.max(...invalidCells);
16599
+ const maxValidPosition = largeMax(invalidCells);
16570
16600
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
16571
16601
  const firstSequence = numberSequences[0] || [];
16572
- if (Math.max(...firstSequence) < maxValidPosition) {
16602
+ if (largeMax(firstSequence) < maxValidPosition) {
16573
16603
  return Infinity;
16574
16604
  }
16575
- return Math.min(...firstSequence);
16605
+ return largeMin(firstSequence);
16576
16606
  }
16577
16607
  shouldFindData(sheetId, zone) {
16578
16608
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -22263,13 +22293,13 @@
22263
22293
  getColMaxWidth(sheetId, index) {
22264
22294
  const cells = this.getters.getColCells(sheetId, index);
22265
22295
  const sizes = cells.map((cell) => this.getCellWidth(cell));
22266
- return Math.max(0, ...sizes);
22296
+ return Math.max(0, largeMax(sizes));
22267
22297
  }
22268
22298
  getRowMaxHeight(sheetId, index) {
22269
22299
  const sheet = this.getters.getSheet(sheetId);
22270
22300
  const cells = Object.values(sheet.rows[index].cells);
22271
22301
  const sizes = cells.map((cell) => this.getCellHeight(cell));
22272
- return Math.max(0, ...sizes);
22302
+ return Math.max(0, largeMax(sizes));
22273
22303
  }
22274
22304
  interactiveRenameSheet(sheetId, title) {
22275
22305
  const placeholder = this.getters.getSheetName(sheetId);
@@ -23688,8 +23718,8 @@
23688
23718
  let newRange = range;
23689
23719
  let changeType = "NONE";
23690
23720
  for (let group of groups) {
23691
- const min = Math.min(...group);
23692
- const max = Math.max(...group);
23721
+ const min = largeMin(group);
23722
+ const max = largeMax(group);
23693
23723
  if (range.zone[start] <= min && min <= range.zone[end]) {
23694
23724
  const toRemove = Math.min(range.zone[end], max) - min + 1;
23695
23725
  changeType = "RESIZE";
@@ -31507,9 +31537,9 @@
31507
31537
  Object.defineProperty(exports, '__esModule', { value: true });
31508
31538
 
31509
31539
 
31510
- __info__.version = '15.0.19';
31511
- __info__.date = '2024-03-15T10:55:52.497Z';
31512
- __info__.hash = '277ed99';
31540
+ __info__.version = '15.0.20';
31541
+ __info__.date = '2024-04-05T13:56:04.792Z';
31542
+ __info__.hash = '09e95ef';
31513
31543
 
31514
31544
 
31515
31545
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);