@odoo/o-spreadsheet 17.2.0 → 17.2.2

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.0
7
- * @date 2024-03-20T08:12:44.398Z
8
- * @hash 1869c24
6
+ * @version 17.2.2
7
+ * @date 2024-04-05T14:01:19.824Z
8
+ * @hash c15836d
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -30,7 +30,6 @@
30
30
  const LINK_COLOR = "#017E84";
31
31
  const FILTERS_COLOR = "#188038";
32
32
  const BACKGROUND_HEADER_FILTER_COLOR = "#E6F4EA";
33
- const BACKGROUND_HEADER_SELECTED_FILTER_COLOR = "#CEEAD6";
34
33
  const SEPARATOR_COLOR = "#E0E2E4";
35
34
  const ICONS_COLOR = "#4A4F59";
36
35
  const HEADER_GROUPING_BACKGROUND_COLOR = "#F5F5F5";
@@ -466,7 +465,7 @@
466
465
  }
467
466
  // Generate new Id if the item didn't exist in the dictionary
468
467
  const ids = Object.keys(itemsDic);
469
- 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)));
470
469
  itemsDic[maxId + 1] = item;
471
470
  return maxId + 1;
472
471
  }
@@ -686,6 +685,34 @@
686
685
  }
687
686
  return RegExp(searchValue, flags);
688
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
+ }
689
716
 
690
717
  const RBA_REGEX = /rgba?\(|\s+|\)/gi;
691
718
  const HEX_MATCH = /^#([A-F\d]{2}){3,4}$/;
@@ -4545,8 +4572,9 @@
4545
4572
  * Get the default height of the cell given its style.
4546
4573
  */
4547
4574
  function getDefaultCellHeight(ctx, cell, colSize) {
4548
- if (!cell || !cell.content)
4575
+ if (!cell || (!cell.isFormula && !cell.content)) {
4549
4576
  return DEFAULT_CELL_HEIGHT;
4577
+ }
4550
4578
  const maxWidth = cell.style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
4551
4579
  const numberOfLines = cell.isFormula
4552
4580
  ? 1
@@ -8004,6 +8032,9 @@
8004
8032
  instantiate(Store, ...args) {
8005
8033
  return this.factory.build(Store, ...args);
8006
8034
  }
8035
+ resetStores() {
8036
+ this.dependencies.clear();
8037
+ }
8007
8038
  }
8008
8039
  class StoreFactory {
8009
8040
  get;
@@ -9937,11 +9968,11 @@ stores.inject(MyMetaStore, storeInstance);
9937
9968
  }
9938
9969
  else {
9939
9970
  const range = this.getters.getRangeFromSheetXC(position.sheetId, rule.criterion.values[0]);
9940
- values = this.getters
9971
+ values = Array.from(new Set(this.getters
9941
9972
  .getRangeValues(range)
9942
9973
  .filter(isNotNull)
9943
9974
  .map((value) => value.toString())
9944
- .filter((val) => val !== "");
9975
+ .filter((val) => val !== "")));
9945
9976
  }
9946
9977
  return values.map((value) => ({ text: value }));
9947
9978
  },
@@ -19388,10 +19419,10 @@ stores.inject(MyMetaStore, storeInstance);
19388
19419
  }
19389
19420
  }
19390
19421
  return {
19391
- labels: Object.keys(labelMap),
19422
+ labels: Array.from(labelSet),
19392
19423
  dataSetsValues: datasets.map((dataset, indexOfDataset) => ({
19393
19424
  ...dataset,
19394
- data: Object.values(labelMap).map((dataOfLabel) => dataOfLabel[indexOfDataset]),
19425
+ data: Array.from(labelSet).map((label) => labelMap[label][indexOfDataset]),
19395
19426
  })),
19396
19427
  };
19397
19428
  }
@@ -20123,7 +20154,7 @@ stores.inject(MyMetaStore, storeInstance);
20123
20154
  return undefined;
20124
20155
  }
20125
20156
  const labelsTimestamps = labelDates.map((date) => date.getTime());
20126
- const period = Math.max(...labelsTimestamps) - Math.min(...labelsTimestamps);
20157
+ const period = largeMax(labelsTimestamps) - largeMin(labelsTimestamps);
20127
20158
  const minUnit = getFormatMinDisplayUnit(format);
20128
20159
  if (UNIT_LENGTH.second >= UNIT_LENGTH[minUnit] && Milliseconds.inSeconds(period) < 180) {
20129
20160
  return "second";
@@ -20611,7 +20642,7 @@ stores.inject(MyMetaStore, storeInstance);
20611
20642
  }
20612
20643
  function getPieColors(colors, dataSetsValues) {
20613
20644
  const pieColors = [];
20614
- const maxLength = Math.max(...dataSetsValues.map((ds) => ds.data.length));
20645
+ const maxLength = largeMax(dataSetsValues.map((ds) => ds.data.length));
20615
20646
  for (let i = 0; i <= maxLength; i++) {
20616
20647
  pieColors.push(colors.next());
20617
20648
  }
@@ -23416,8 +23447,8 @@ stores.inject(MyMetaStore, storeInstance);
23416
23447
  let last;
23417
23448
  const activesRows = env.model.getters.getActiveRows();
23418
23449
  if (activesRows.size !== 0) {
23419
- first = Math.min(...activesRows);
23420
- last = Math.max(...activesRows);
23450
+ first = largeMin([...activesRows]);
23451
+ last = largeMax([...activesRows]);
23421
23452
  }
23422
23453
  else {
23423
23454
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23445,8 +23476,8 @@ stores.inject(MyMetaStore, storeInstance);
23445
23476
  let last;
23446
23477
  const activeCols = env.model.getters.getActiveCols();
23447
23478
  if (activeCols.size !== 0) {
23448
- first = Math.min(...activeCols);
23449
- last = Math.max(...activeCols);
23479
+ first = largeMin([...activeCols]);
23480
+ last = largeMax([...activeCols]);
23450
23481
  }
23451
23482
  else {
23452
23483
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23474,8 +23505,8 @@ stores.inject(MyMetaStore, storeInstance);
23474
23505
  let last;
23475
23506
  const activesRows = env.model.getters.getActiveRows();
23476
23507
  if (activesRows.size !== 0) {
23477
- first = Math.min(...activesRows);
23478
- last = Math.max(...activesRows);
23508
+ first = largeMin([...activesRows]);
23509
+ last = largeMax([...activesRows]);
23479
23510
  }
23480
23511
  else {
23481
23512
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23516,8 +23547,8 @@ stores.inject(MyMetaStore, storeInstance);
23516
23547
  let last;
23517
23548
  const activeCols = env.model.getters.getActiveCols();
23518
23549
  if (activeCols.size !== 0) {
23519
- first = Math.min(...activeCols);
23520
- last = Math.max(...activeCols);
23550
+ first = largeMin([...activeCols]);
23551
+ last = largeMax([...activeCols]);
23521
23552
  }
23522
23553
  else {
23523
23554
  const zone = env.model.getters.getSelectedZones()[0];
@@ -23558,7 +23589,7 @@ stores.inject(MyMetaStore, storeInstance);
23558
23589
  let row;
23559
23590
  let quantity;
23560
23591
  if (activeRows.size) {
23561
- row = Math.min(...activeRows);
23592
+ row = largeMin([...activeRows]);
23562
23593
  quantity = activeRows.size;
23563
23594
  }
23564
23595
  else {
@@ -23579,7 +23610,7 @@ stores.inject(MyMetaStore, storeInstance);
23579
23610
  let row;
23580
23611
  let quantity;
23581
23612
  if (activeRows.size) {
23582
- row = Math.max(...activeRows);
23613
+ row = largeMax([...activeRows]);
23583
23614
  quantity = activeRows.size;
23584
23615
  }
23585
23616
  else {
@@ -23600,7 +23631,7 @@ stores.inject(MyMetaStore, storeInstance);
23600
23631
  let column;
23601
23632
  let quantity;
23602
23633
  if (activeCols.size) {
23603
- column = Math.min(...activeCols);
23634
+ column = largeMin([...activeCols]);
23604
23635
  quantity = activeCols.size;
23605
23636
  }
23606
23637
  else {
@@ -23621,7 +23652,7 @@ stores.inject(MyMetaStore, storeInstance);
23621
23652
  let column;
23622
23653
  let quantity;
23623
23654
  if (activeCols.size) {
23624
- column = Math.max(...activeCols);
23655
+ column = largeMax([...activeCols]);
23625
23656
  quantity = activeCols.size;
23626
23657
  }
23627
23658
  else {
@@ -24214,14 +24245,19 @@ stores.inject(MyMetaStore, storeInstance);
24214
24245
  children: [allFunctionListMenuBuilder],
24215
24246
  };
24216
24247
  function allFunctionListMenuBuilder() {
24217
- const fnNames = functionRegistry.getKeys();
24248
+ const fnNames = functionRegistry.getKeys().filter((key) => !functionRegistry.get(key).hidden);
24218
24249
  return createFormulaFunctions(fnNames);
24219
24250
  }
24220
24251
  const categoriesFunctionListMenuBuilder = () => {
24221
24252
  const functions = functionRegistry.content;
24222
- const categories = [...new Set(functionRegistry.getAll().map((fn) => fn.category))].filter(isDefined$1);
24253
+ const categories = [
24254
+ ...new Set(functionRegistry
24255
+ .getAll()
24256
+ .filter((fn) => !fn.hidden)
24257
+ .map((fn) => fn.category)),
24258
+ ].filter(isDefined$1);
24223
24259
  return categories.sort().map((category, i) => {
24224
- const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category);
24260
+ const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category && !functions[key].hidden);
24225
24261
  return {
24226
24262
  name: category,
24227
24263
  children: createFormulaFunctions(functionsInCategory),
@@ -28379,11 +28415,9 @@ stores.inject(MyMetaStore, storeInstance);
28379
28415
  }
28380
28416
  .o-cell-is-operator {
28381
28417
  margin-bottom: 5px;
28382
- width: 96%;
28383
28418
  }
28384
28419
  .o-cell-is-value {
28385
28420
  margin-bottom: 5px;
28386
- width: 96%;
28387
28421
  }
28388
28422
  .o-color-picker-widget .o-color-picker-button {
28389
28423
  pointer-events: all;
@@ -30217,7 +30251,11 @@ stores.inject(MyMetaStore, storeInstance);
30217
30251
  const composerStore = useStore(ComposerStore);
30218
30252
  // The feature makes no sense if we are editing a cell, because then the selection isn't active
30219
30253
  // Stop the edition when the panel is mounted, and close the panel if the user start editing a cell
30220
- owl.useEffect(this.props.onCloseSidePanel, () => [composerStore.editionMode]);
30254
+ owl.useEffect((editionMode) => {
30255
+ if (editionMode !== "inactive") {
30256
+ this.props.onCloseSidePanel();
30257
+ }
30258
+ }, () => [composerStore.editionMode]);
30221
30259
  owl.onMounted(() => {
30222
30260
  composerStore.stopEdition();
30223
30261
  });
@@ -31085,6 +31123,9 @@ stores.inject(MyMetaStore, storeInstance);
31085
31123
  el?.focus({ preventScroll: true });
31086
31124
  }
31087
31125
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
31126
+ owl.onWillUnmount(() => {
31127
+ this.props.onFigureDeleted();
31128
+ });
31088
31129
  }
31089
31130
  clickAnchor(dirX, dirY, ev) {
31090
31131
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -31103,6 +31144,7 @@ stores.inject(MyMetaStore, storeInstance);
31103
31144
  this.props.onFigureDeleted();
31104
31145
  ev.stopPropagation();
31105
31146
  ev.preventDefault();
31147
+ ev.stopPropagation();
31106
31148
  break;
31107
31149
  case "ArrowDown":
31108
31150
  case "ArrowLeft":
@@ -31123,6 +31165,7 @@ stores.inject(MyMetaStore, storeInstance);
31123
31165
  });
31124
31166
  ev.stopPropagation();
31125
31167
  ev.preventDefault();
31168
+ ev.stopPropagation();
31126
31169
  break;
31127
31170
  }
31128
31171
  }
@@ -31790,6 +31833,7 @@ stores.inject(MyMetaStore, storeInstance);
31790
31833
  // -----------------------------------------------------------------------------
31791
31834
  css /* scss */ `
31792
31835
  .o-formula-assistant {
31836
+ background: #ffffff;
31793
31837
  .o-formula-assistant-head {
31794
31838
  background-color: #f2f2f2;
31795
31839
  padding: 10px;
@@ -31845,6 +31889,9 @@ stores.inject(MyMetaStore, storeInstance);
31845
31889
  this.assistantState.allowCellSelectionBehind = false;
31846
31890
  }, 2000);
31847
31891
  }
31892
+ get formulaArgSeparator() {
31893
+ return this.env.model.getters.getLocale().formulaArgSeparator + " ";
31894
+ }
31848
31895
  }
31849
31896
 
31850
31897
  const functions$2 = functionRegistry.content;
@@ -32004,6 +32051,12 @@ stores.inject(MyMetaStore, storeInstance);
32004
32051
  owl.useEffect(() => {
32005
32052
  this.processContent();
32006
32053
  });
32054
+ owl.onPatched(() => {
32055
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
32056
+ if (this.composerStore.editionMode === "inactive") {
32057
+ this.processTokenAtCursor();
32058
+ }
32059
+ });
32007
32060
  }
32008
32061
  // ---------------------------------------------------------------------------
32009
32062
  // Handlers
@@ -33984,11 +34037,6 @@ stores.inject(MyMetaStore, storeInstance);
33984
34037
  height: 10000px;
33985
34038
  background-color: ${SELECTION_BORDER_COLOR};
33986
34039
  }
33987
- .o-unhide-buttons {
33988
- width: fit-content;
33989
- gap: 5px;
33990
- transform: translate(-50%, 0);
33991
- }
33992
34040
  .o-unhide:hover {
33993
34041
  z-index: ${ComponentsImportance.Grid + 1};
33994
34042
  background-color: lightgrey;
@@ -34150,10 +34198,6 @@ stores.inject(MyMetaStore, storeInstance);
34150
34198
  height: 1px;
34151
34199
  background-color: ${SELECTION_BORDER_COLOR};
34152
34200
  }
34153
- .o-unhide-buttons {
34154
- height: fit-content;
34155
- transform: translate(0, -50%);
34156
- }
34157
34201
  .o-unhide:hover {
34158
34202
  z-index: ${ComponentsImportance.Grid + 1};
34159
34203
  background-color: lightgrey;
@@ -34614,19 +34658,16 @@ stores.inject(MyMetaStore, storeInstance);
34614
34658
  for (let col = left; col <= right; col++) {
34615
34659
  const colZone = { left: col, right: col, top: 0, bottom: numberOfRows - 1 };
34616
34660
  const { x, width } = this.getters.getVisibleRect(colZone);
34617
- const colHasFilter = this.getters.doesZonesContainFilter(sheetId, [colZone]);
34618
34661
  const isColActive = activeCols.has(col);
34619
34662
  const isColSelected = selectedCols.has(col);
34620
34663
  if (isColActive) {
34621
- ctx.fillStyle = colHasFilter ? FILTERS_COLOR : BACKGROUND_HEADER_ACTIVE_COLOR;
34664
+ ctx.fillStyle = BACKGROUND_HEADER_ACTIVE_COLOR;
34622
34665
  }
34623
34666
  else if (isColSelected) {
34624
- ctx.fillStyle = colHasFilter
34625
- ? BACKGROUND_HEADER_SELECTED_FILTER_COLOR
34626
- : BACKGROUND_HEADER_SELECTED_COLOR;
34667
+ ctx.fillStyle = BACKGROUND_HEADER_SELECTED_COLOR;
34627
34668
  }
34628
34669
  else {
34629
- ctx.fillStyle = colHasFilter ? BACKGROUND_HEADER_FILTER_COLOR : BACKGROUND_HEADER_COLOR;
34670
+ ctx.fillStyle = BACKGROUND_HEADER_COLOR;
34630
34671
  }
34631
34672
  ctx.fillRect(x, 0, width, HEADER_HEIGHT);
34632
34673
  }
@@ -34634,19 +34675,16 @@ stores.inject(MyMetaStore, storeInstance);
34634
34675
  for (let row = top; row <= bottom; row++) {
34635
34676
  const rowZone = { top: row, bottom: row, left: 0, right: numberOfCols - 1 };
34636
34677
  const { y, height } = this.getters.getVisibleRect(rowZone);
34637
- const rowHasFilter = this.getters.doesZonesContainFilter(sheetId, [rowZone]);
34638
34678
  const isRowActive = activeRows.has(row);
34639
34679
  const isRowSelected = selectedRows.has(row);
34640
34680
  if (isRowActive) {
34641
- ctx.fillStyle = rowHasFilter ? FILTERS_COLOR : BACKGROUND_HEADER_ACTIVE_COLOR;
34681
+ ctx.fillStyle = BACKGROUND_HEADER_ACTIVE_COLOR;
34642
34682
  }
34643
34683
  else if (isRowSelected) {
34644
- ctx.fillStyle = rowHasFilter
34645
- ? BACKGROUND_HEADER_SELECTED_FILTER_COLOR
34646
- : BACKGROUND_HEADER_SELECTED_COLOR;
34684
+ ctx.fillStyle = BACKGROUND_HEADER_SELECTED_COLOR;
34647
34685
  }
34648
34686
  else {
34649
- ctx.fillStyle = rowHasFilter ? BACKGROUND_HEADER_FILTER_COLOR : BACKGROUND_HEADER_COLOR;
34687
+ ctx.fillStyle = BACKGROUND_HEADER_COLOR;
34650
34688
  }
34651
34689
  ctx.fillRect(0, y, HEADER_WIDTH, height);
34652
34690
  }
@@ -37853,7 +37891,7 @@ stores.inject(MyMetaStore, storeInstance);
37853
37891
  function getSheetDims(sheet) {
37854
37892
  const dims = [0, 0];
37855
37893
  for (let row of sheet.rows) {
37856
- dims[0] = Math.max(dims[0], ...row.cells.map((cell) => toCartesian(cell.xc).col));
37894
+ dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
37857
37895
  dims[1] = Math.max(dims[1], row.index);
37858
37896
  }
37859
37897
  dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
@@ -42360,6 +42398,9 @@ stores.inject(MyMetaStore, storeInstance);
42360
42398
  if (newRule.criterion.type === "isBoolean") {
42361
42399
  this.setCenterStyleToBooleanCells(newRule);
42362
42400
  }
42401
+ else if (newRule.criterion.type === "isValueInList") {
42402
+ newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
42403
+ }
42363
42404
  const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
42364
42405
  const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
42365
42406
  if (ruleIndex !== -1) {
@@ -42756,7 +42797,7 @@ stores.inject(MyMetaStore, storeInstance);
42756
42797
  if (hiddenElements.size >= elements) {
42757
42798
  return "TooManyHiddenElements" /* CommandResult.TooManyHiddenElements */;
42758
42799
  }
42759
- else if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
42800
+ else if (largeMin(cmd.elements) < 0 || largeMax(cmd.elements) > elements) {
42760
42801
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
42761
42802
  }
42762
42803
  else {
@@ -43574,8 +43615,8 @@ stores.inject(MyMetaStore, storeInstance);
43574
43615
  let newRange = range;
43575
43616
  let changeType = "NONE";
43576
43617
  for (let group of groups) {
43577
- const min = Math.min(...group);
43578
- const max = Math.max(...group);
43618
+ const min = largeMin(group);
43619
+ const max = largeMax(group);
43579
43620
  if (range.zone[start] <= min && min <= range.zone[end]) {
43580
43621
  const toRemove = Math.min(range.zone[end], max) - min + 1;
43581
43622
  changeType = "RESIZE";
@@ -44024,8 +44065,8 @@ stores.inject(MyMetaStore, storeInstance);
44024
44065
  }
44025
44066
  return "Success" /* CommandResult.Success */;
44026
44067
  case "REMOVE_COLUMNS_ROWS": {
44027
- const min = Math.min(...cmd.elements);
44028
- const max = Math.max(...cmd.elements);
44068
+ const min = largeMin(cmd.elements);
44069
+ const max = largeMax(cmd.elements);
44029
44070
  if (min < 0 || !this.doesHeaderExist(cmd.sheetId, cmd.dimension, max)) {
44030
44071
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
44031
44072
  }
@@ -44819,7 +44860,6 @@ stores.inject(MyMetaStore, storeInstance);
44819
44860
 
44820
44861
  class TablePlugin extends CorePlugin {
44821
44862
  static getters = [
44822
- "doesZonesContainFilter",
44823
44863
  "getFilter",
44824
44864
  "getFilters",
44825
44865
  "getTable",
@@ -44976,10 +45016,6 @@ stores.inject(MyMetaStore, storeInstance);
44976
45016
  getTablesOverlappingZones(sheetId, zones) {
44977
45017
  return this.getTables(sheetId).filter((table) => zones.some((zone) => overlap(table.range.zone, zone)));
44978
45018
  }
44979
- doesZonesContainFilter(sheetId, zones) {
44980
- return (this.getTablesOverlappingZones(sheetId, zones).filter((table) => table.config.hasFilters)
44981
- .length > 0);
44982
- }
44983
45019
  getFilterHeaders(sheetId) {
44984
45020
  const headers = [];
44985
45021
  for (const table of this.getTables(sheetId)) {
@@ -47494,7 +47530,7 @@ stores.inject(MyMetaStore, storeInstance);
47494
47530
  ? getItemId(newFormat, data.formats)
47495
47531
  : exportedCellData.format;
47496
47532
  let content;
47497
- if (formulaCell instanceof FormulaCellWithDependencies) {
47533
+ if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
47498
47534
  content = formulaCell.contentWithFixedReferences;
47499
47535
  }
47500
47536
  else {
@@ -47943,13 +47979,13 @@ stores.inject(MyMetaStore, storeInstance);
47943
47979
  .map((cell) => cell.value);
47944
47980
  switch (threshold.type) {
47945
47981
  case "value":
47946
- const result = functionName === "max" ? Math.max(...rangeValues) : Math.min(...rangeValues);
47982
+ const result = functionName === "max" ? largeMax(rangeValues) : largeMin(rangeValues);
47947
47983
  return result;
47948
47984
  case "number":
47949
47985
  return Number(threshold.value);
47950
47986
  case "percentage":
47951
- const min = Math.min(...rangeValues);
47952
- const max = Math.max(...rangeValues);
47987
+ const min = largeMin(rangeValues);
47988
+ const max = largeMax(rangeValues);
47953
47989
  const delta = max - min;
47954
47990
  return min + (delta * Number(threshold.value)) / 100;
47955
47991
  case "percentile":
@@ -49022,13 +49058,13 @@ stores.inject(MyMetaStore, storeInstance);
49022
49058
  const cells = this.getters.getEvaluatedCellsInZone(sheet.id, zone);
49023
49059
  const cellPositions = range(end, -1, -1);
49024
49060
  const invalidCells = cellPositions.filter((position) => cells[position] && !cells[position].isAutoSummable);
49025
- const maxValidPosition = Math.max(...invalidCells);
49061
+ const maxValidPosition = largeMax(invalidCells);
49026
49062
  const numberSequences = groupConsecutive(cellPositions.filter((position) => this.isNumber(cells[position])));
49027
49063
  const firstSequence = numberSequences[0] || [];
49028
- if (Math.max(...firstSequence) < maxValidPosition) {
49064
+ if (largeMax(firstSequence) < maxValidPosition) {
49029
49065
  return Infinity;
49030
49066
  }
49031
- return Math.min(...firstSequence);
49067
+ return largeMin(firstSequence);
49032
49068
  }
49033
49069
  shouldFindData(sheetId, zone) {
49034
49070
  return this.getters.isEmpty(sheetId, zone) || this.getters.isSingleCellOrMerge(sheetId, zone);
@@ -50769,7 +50805,7 @@ stores.inject(MyMetaStore, storeInstance);
50769
50805
  getColMaxWidth(sheetId, index) {
50770
50806
  const cellsPositions = positions(this.getters.getColsZone(sheetId, index, index));
50771
50807
  const sizes = cellsPositions.map((position) => this.getCellWidth({ sheetId, ...position }));
50772
- return Math.max(0, ...sizes);
50808
+ return Math.max(0, largeMax(sizes));
50773
50809
  }
50774
50810
  /**
50775
50811
  * Check that any "sheetId" in the command matches an existing
@@ -52474,6 +52510,7 @@ stores.inject(MyMetaStore, storeInstance);
52474
52510
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
52475
52511
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
52476
52512
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
52513
+ this.selectedFigureId = null;
52477
52514
  break;
52478
52515
  }
52479
52516
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -53664,7 +53701,7 @@ stores.inject(MyMetaStore, storeInstance);
53664
53701
  * column of the current viewport
53665
53702
  */
53666
53703
  getColDimensionsInViewport(sheetId, col) {
53667
- const left = Math.min(...this.getters.getSheetViewVisibleCols());
53704
+ const left = largeMin(this.getters.getSheetViewVisibleCols());
53668
53705
  const start = this.getters.getColRowOffsetInViewport("COL", left, col);
53669
53706
  const size = this.getters.getColSize(sheetId, col);
53670
53707
  const isColHidden = this.getters.isColHidden(sheetId, col);
@@ -53679,7 +53716,7 @@ stores.inject(MyMetaStore, storeInstance);
53679
53716
  * of the current viewport
53680
53717
  */
53681
53718
  getRowDimensionsInViewport(sheetId, row) {
53682
- const top = Math.min(...this.getters.getSheetViewVisibleRows());
53719
+ const top = largeMin(this.getters.getSheetViewVisibleRows());
53683
53720
  const start = this.getters.getColRowOffsetInViewport("ROW", top, row);
53684
53721
  const size = this.getters.getRowSize(sheetId, row);
53685
53722
  const isRowHidden = this.getters.isRowHidden(sheetId, row);
@@ -54392,12 +54429,14 @@ stores.inject(MyMetaStore, storeInstance);
54392
54429
  this.editionState = "initializing";
54393
54430
  }
54394
54431
  stopEdition() {
54395
- if (!this.state.isEditing)
54432
+ const input = this.sheetNameRef.el;
54433
+ if (!this.state.isEditing || !input)
54396
54434
  return;
54397
54435
  this.state.isEditing = false;
54398
54436
  this.editionState = "initializing";
54399
- this.sheetNameRef.el?.blur();
54437
+ input.blur();
54400
54438
  const inputValue = this.getInputContent() || "";
54439
+ input.innerText = inputValue;
54401
54440
  interactiveRenameSheet(this.env, this.props.sheetId, inputValue, () => this.startEdition());
54402
54441
  }
54403
54442
  cancelEdition() {
@@ -54688,7 +54727,7 @@ stores.inject(MyMetaStore, storeInstance);
54688
54727
  this.sheetListRef.el.scrollTo({ top: 0, left: scroll, behavior: "smooth" });
54689
54728
  }
54690
54729
  onSheetMouseDown(sheetId, event) {
54691
- if (event.button !== 0)
54730
+ if (event.button !== 0 || this.env.model.getters.isReadonly())
54692
54731
  return;
54693
54732
  this.closeMenu();
54694
54733
  const visibleSheets = this.getVisibleSheets();
@@ -56092,9 +56131,6 @@ stores.inject(MyMetaStore, storeInstance);
56092
56131
  .text-muted {
56093
56132
  color: grey !important;
56094
56133
  }
56095
- button {
56096
- color: #333;
56097
- }
56098
56134
  .o-disabled {
56099
56135
  opacity: 0.4;
56100
56136
  pointer: default;
@@ -56215,17 +56251,17 @@ stores.inject(MyMetaStore, storeInstance);
56215
56251
  }
56216
56252
 
56217
56253
  .o-button {
56218
- border: 1px solid lightgrey;
56254
+ border: 1px solid;
56219
56255
  padding: 0px 20px 0px 20px;
56220
56256
  border-radius: 4px;
56221
56257
  font-weight: 500;
56222
56258
  font-size: 14px;
56223
56259
  height: 30px;
56224
56260
  line-height: 16px;
56225
- background: white;
56226
56261
  margin-right: 8px;
56227
- &:hover:enabled {
56228
- background-color: rgba(0, 0, 0, 0.08);
56262
+
56263
+ &:not(:hover) {
56264
+ background-color: transparent;
56229
56265
  }
56230
56266
 
56231
56267
  &:enabled {
@@ -56239,6 +56275,15 @@ stores.inject(MyMetaStore, storeInstance);
56239
56275
  &:last-child {
56240
56276
  margin-right: 0px;
56241
56277
  }
56278
+
56279
+ &.o-button-grey {
56280
+ border-color: lightgrey;
56281
+ background: #ffffff;
56282
+ color: #333;
56283
+ &:hover:enabled {
56284
+ background-color: rgba(0, 0, 0, 0.08);
56285
+ }
56286
+ }
56242
56287
  }
56243
56288
 
56244
56289
  .o-input {
@@ -58136,7 +58181,7 @@ stores.inject(MyMetaStore, storeInstance);
58136
58181
  }
58137
58182
  function addDoughnutChart(chart, chartSheetIndex, data, { holeSize } = { holeSize: 50 }) {
58138
58183
  const colors = new ChartColors();
58139
- const maxLength = Math.max(...chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
58184
+ const maxLength = largeMax(chart.dataSets.map((ds) => getRangeSize(ds.range, chartSheetIndex, data)));
58140
58185
  const doughnutColors = range(0, maxLength).map(() => toXlsxHexColor(colors.next()));
58141
58186
  const dataSetsNodes = [];
58142
58187
  for (const [dsIndex, dataset] of Object.entries(chart.dataSets).reverse()) {
@@ -60166,9 +60211,9 @@ stores.inject(MyMetaStore, storeInstance);
60166
60211
  exports.tokenize = tokenize;
60167
60212
 
60168
60213
 
60169
- __info__.version = "17.2.0";
60170
- __info__.date = "2024-03-20T08:12:44.398Z";
60171
- __info__.hash = "1869c24";
60214
+ __info__.version = "17.2.2";
60215
+ __info__.date = "2024-04-05T14:01:19.824Z";
60216
+ __info__.hash = "c15836d";
60172
60217
 
60173
60218
 
60174
60219
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);