@odoo/o-spreadsheet 17.0.40 → 17.0.42

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.0.40
6
- * @date 2024-11-13T15:03:13.024Z
7
- * @hash a14bf60
5
+ * @version 17.0.42
6
+ * @date 2024-11-28T09:02:39.394Z
7
+ * @hash aa06a38
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2797,7 +2797,9 @@ function linearSearch(data, target, mode, numberOfValues, getValueInData, revers
2797
2797
  }
2798
2798
  }
2799
2799
  }
2800
- return reverseSearch ? numberOfValues - closestMatchIndex - 1 : closestMatchIndex;
2800
+ return reverseSearch && closestMatchIndex !== -1
2801
+ ? numberOfValues - closestMatchIndex - 1
2802
+ : closestMatchIndex;
2801
2803
  }
2802
2804
  /**
2803
2805
  * Normalize a value.
@@ -18732,7 +18734,7 @@ const VLOOKUP = {
18732
18734
  ? dichotomicSearch(range, searchKey?.value, "nextSmaller", "asc", range[0].length, getValueFromRange)
18733
18735
  : linearSearch(range, searchKey?.value, "strict", range[0].length, getValueFromRange);
18734
18736
  const value = range[_index - 1][rowIndex];
18735
- assertAvailable(value, searchKey);
18737
+ assertAvailable(value, searchKey?.value);
18736
18738
  return value;
18737
18739
  },
18738
18740
  isExported: true,
@@ -18780,7 +18782,7 @@ const XLOOKUP = {
18780
18782
  : [returnRange[index]];
18781
18783
  }
18782
18784
  const _defaultValue = defaultValue?.();
18783
- assertAvailable(_defaultValue, searchKey);
18785
+ assertAvailable(_defaultValue, searchKey?.value);
18784
18786
  return [[_defaultValue]];
18785
18787
  },
18786
18788
  isExported: true,
@@ -41683,7 +41685,7 @@ class Evaluator {
41683
41685
  const arrayFormulas = this.spreadingRelations.getFormulaPositionsSpreadingOn(positionId);
41684
41686
  const cells = new JetSet(arrayFormulas);
41685
41687
  const arrayFormulaPositionId = this.getArrayFormulaSpreadingOnId(positionId);
41686
- if (arrayFormulaPositionId) {
41688
+ if (arrayFormulaPositionId !== undefined) {
41687
41689
  // ignore the formula spreading on the position. Keep only the blocked ones
41688
41690
  cells.delete(arrayFormulaPositionId);
41689
41691
  }
@@ -41706,9 +41708,15 @@ class Evaluator {
41706
41708
  }
41707
41709
  for (let i = 0; i < positionIds.length; ++i) {
41708
41710
  const cell = positionIds[i];
41711
+ if (this.nextPositionsToUpdate.has(cell)) {
41712
+ continue;
41713
+ }
41709
41714
  this.setEvaluatedCell(cell, this.computeCell(cell));
41710
41715
  }
41711
41716
  }
41717
+ if (currentIteration >= MAX_ITERATION) {
41718
+ console.warn("Maximum iteration reached while evaluating cells");
41719
+ }
41712
41720
  }
41713
41721
  setEvaluatedCell(positionId, evaluatedCell) {
41714
41722
  this.evaluatedCells.set(positionId, evaluatedCell);
@@ -41740,7 +41748,6 @@ class Evaluator {
41740
41748
  }
41741
41749
  finally {
41742
41750
  this.cellsBeingComputed.delete(cellId);
41743
- this.nextPositionsToUpdate.delete(positionId);
41744
41751
  }
41745
41752
  }
41746
41753
  computeAndSave(position) {
@@ -41810,6 +41817,7 @@ class Evaluator {
41810
41817
  { sheetId, zone: rightPartZone },
41811
41818
  { sheetId, zone: leftColumnZone },
41812
41819
  ]);
41820
+ invalidatedPositions.delete(this.encoder.encode(arrayFormulaPosition));
41813
41821
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
41814
41822
  }
41815
41823
  assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
@@ -41876,6 +41884,7 @@ class Evaluator {
41876
41884
  this.evaluatedCells.delete(child);
41877
41885
  this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([child]));
41878
41886
  this.nextPositionsToUpdate.addMany(this.getArrayFormulasBlockedBy(child));
41887
+ this.spreadingRelations.removeNode(child);
41879
41888
  }
41880
41889
  this.spreadingRelations.removeNode(positionId);
41881
41890
  }
@@ -44503,7 +44512,7 @@ class Session extends EventBus {
44503
44512
  * Notify the server that the user client left the collaborative session
44504
44513
  */
44505
44514
  async leave(data) {
44506
- if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44515
+ if (data && Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44507
44516
  await this.snapshot(data());
44508
44517
  }
44509
44518
  delete this.clients[this.clientId];
@@ -57158,7 +57167,8 @@ class Model extends EventBus {
57158
57167
  this.session.join(this.config.client);
57159
57168
  }
57160
57169
  async leaveSession() {
57161
- await this.session.leave(lazy(() => this.exportData()));
57170
+ const snapshot = this.getters.isReadonly() ? undefined : lazy(() => this.exportData());
57171
+ await this.session.leave(snapshot);
57162
57172
  }
57163
57173
  setupUiPlugin(Plugin) {
57164
57174
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57661,6 +57671,6 @@ exports.setTranslationMethod = setTranslationMethod;
57661
57671
  exports.tokenize = tokenize;
57662
57672
 
57663
57673
 
57664
- __info__.version = "17.0.40";
57665
- __info__.date = "2024-11-13T15:03:13.024Z";
57666
- __info__.hash = "a14bf60";
57674
+ __info__.version = "17.0.42";
57675
+ __info__.date = "2024-11-28T09:02:39.394Z";
57676
+ __info__.hash = "aa06a38";
@@ -852,7 +852,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
852
852
  /**
853
853
  * Notify the server that the user client left the collaborative session
854
854
  */
855
- leave(data: Lazy<WorkbookData>): Promise<void>;
855
+ leave(data?: Lazy<WorkbookData>): Promise<void>;
856
856
  /**
857
857
  * Send a snapshot of the spreadsheet to the collaboration server
858
858
  */
@@ -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.0.40
6
- * @date 2024-11-13T15:03:13.024Z
7
- * @hash a14bf60
5
+ * @version 17.0.42
6
+ * @date 2024-11-28T09:02:39.394Z
7
+ * @hash aa06a38
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';
@@ -2795,7 +2795,9 @@ function linearSearch(data, target, mode, numberOfValues, getValueInData, revers
2795
2795
  }
2796
2796
  }
2797
2797
  }
2798
- return reverseSearch ? numberOfValues - closestMatchIndex - 1 : closestMatchIndex;
2798
+ return reverseSearch && closestMatchIndex !== -1
2799
+ ? numberOfValues - closestMatchIndex - 1
2800
+ : closestMatchIndex;
2799
2801
  }
2800
2802
  /**
2801
2803
  * Normalize a value.
@@ -18730,7 +18732,7 @@ const VLOOKUP = {
18730
18732
  ? dichotomicSearch(range, searchKey?.value, "nextSmaller", "asc", range[0].length, getValueFromRange)
18731
18733
  : linearSearch(range, searchKey?.value, "strict", range[0].length, getValueFromRange);
18732
18734
  const value = range[_index - 1][rowIndex];
18733
- assertAvailable(value, searchKey);
18735
+ assertAvailable(value, searchKey?.value);
18734
18736
  return value;
18735
18737
  },
18736
18738
  isExported: true,
@@ -18778,7 +18780,7 @@ const XLOOKUP = {
18778
18780
  : [returnRange[index]];
18779
18781
  }
18780
18782
  const _defaultValue = defaultValue?.();
18781
- assertAvailable(_defaultValue, searchKey);
18783
+ assertAvailable(_defaultValue, searchKey?.value);
18782
18784
  return [[_defaultValue]];
18783
18785
  },
18784
18786
  isExported: true,
@@ -41681,7 +41683,7 @@ class Evaluator {
41681
41683
  const arrayFormulas = this.spreadingRelations.getFormulaPositionsSpreadingOn(positionId);
41682
41684
  const cells = new JetSet(arrayFormulas);
41683
41685
  const arrayFormulaPositionId = this.getArrayFormulaSpreadingOnId(positionId);
41684
- if (arrayFormulaPositionId) {
41686
+ if (arrayFormulaPositionId !== undefined) {
41685
41687
  // ignore the formula spreading on the position. Keep only the blocked ones
41686
41688
  cells.delete(arrayFormulaPositionId);
41687
41689
  }
@@ -41704,9 +41706,15 @@ class Evaluator {
41704
41706
  }
41705
41707
  for (let i = 0; i < positionIds.length; ++i) {
41706
41708
  const cell = positionIds[i];
41709
+ if (this.nextPositionsToUpdate.has(cell)) {
41710
+ continue;
41711
+ }
41707
41712
  this.setEvaluatedCell(cell, this.computeCell(cell));
41708
41713
  }
41709
41714
  }
41715
+ if (currentIteration >= MAX_ITERATION) {
41716
+ console.warn("Maximum iteration reached while evaluating cells");
41717
+ }
41710
41718
  }
41711
41719
  setEvaluatedCell(positionId, evaluatedCell) {
41712
41720
  this.evaluatedCells.set(positionId, evaluatedCell);
@@ -41738,7 +41746,6 @@ class Evaluator {
41738
41746
  }
41739
41747
  finally {
41740
41748
  this.cellsBeingComputed.delete(cellId);
41741
- this.nextPositionsToUpdate.delete(positionId);
41742
41749
  }
41743
41750
  }
41744
41751
  computeAndSave(position) {
@@ -41808,6 +41815,7 @@ class Evaluator {
41808
41815
  { sheetId, zone: rightPartZone },
41809
41816
  { sheetId, zone: leftColumnZone },
41810
41817
  ]);
41818
+ invalidatedPositions.delete(this.encoder.encode(arrayFormulaPosition));
41811
41819
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
41812
41820
  }
41813
41821
  assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
@@ -41874,6 +41882,7 @@ class Evaluator {
41874
41882
  this.evaluatedCells.delete(child);
41875
41883
  this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([child]));
41876
41884
  this.nextPositionsToUpdate.addMany(this.getArrayFormulasBlockedBy(child));
41885
+ this.spreadingRelations.removeNode(child);
41877
41886
  }
41878
41887
  this.spreadingRelations.removeNode(positionId);
41879
41888
  }
@@ -44501,7 +44510,7 @@ class Session extends EventBus {
44501
44510
  * Notify the server that the user client left the collaborative session
44502
44511
  */
44503
44512
  async leave(data) {
44504
- if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44513
+ if (data && Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44505
44514
  await this.snapshot(data());
44506
44515
  }
44507
44516
  delete this.clients[this.clientId];
@@ -57156,7 +57165,8 @@ class Model extends EventBus {
57156
57165
  this.session.join(this.config.client);
57157
57166
  }
57158
57167
  async leaveSession() {
57159
- await this.session.leave(lazy(() => this.exportData()));
57168
+ const snapshot = this.getters.isReadonly() ? undefined : lazy(() => this.exportData());
57169
+ await this.session.leave(snapshot);
57160
57170
  }
57161
57171
  setupUiPlugin(Plugin) {
57162
57172
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57624,6 +57634,6 @@ const constants = {
57624
57634
  export { AbstractChart, 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 };
57625
57635
 
57626
57636
 
57627
- __info__.version = "17.0.40";
57628
- __info__.date = "2024-11-13T15:03:13.024Z";
57629
- __info__.hash = "a14bf60";
57637
+ __info__.version = "17.0.42";
57638
+ __info__.date = "2024-11-28T09:02:39.394Z";
57639
+ __info__.hash = "aa06a38";
@@ -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.0.40
6
- * @date 2024-11-13T15:03:13.024Z
7
- * @hash a14bf60
5
+ * @version 17.0.42
6
+ * @date 2024-11-28T09:02:39.394Z
7
+ * @hash aa06a38
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -2796,7 +2796,9 @@
2796
2796
  }
2797
2797
  }
2798
2798
  }
2799
- return reverseSearch ? numberOfValues - closestMatchIndex - 1 : closestMatchIndex;
2799
+ return reverseSearch && closestMatchIndex !== -1
2800
+ ? numberOfValues - closestMatchIndex - 1
2801
+ : closestMatchIndex;
2800
2802
  }
2801
2803
  /**
2802
2804
  * Normalize a value.
@@ -18731,7 +18733,7 @@
18731
18733
  ? dichotomicSearch(range, searchKey?.value, "nextSmaller", "asc", range[0].length, getValueFromRange)
18732
18734
  : linearSearch(range, searchKey?.value, "strict", range[0].length, getValueFromRange);
18733
18735
  const value = range[_index - 1][rowIndex];
18734
- assertAvailable(value, searchKey);
18736
+ assertAvailable(value, searchKey?.value);
18735
18737
  return value;
18736
18738
  },
18737
18739
  isExported: true,
@@ -18779,7 +18781,7 @@
18779
18781
  : [returnRange[index]];
18780
18782
  }
18781
18783
  const _defaultValue = defaultValue?.();
18782
- assertAvailable(_defaultValue, searchKey);
18784
+ assertAvailable(_defaultValue, searchKey?.value);
18783
18785
  return [[_defaultValue]];
18784
18786
  },
18785
18787
  isExported: true,
@@ -41682,7 +41684,7 @@
41682
41684
  const arrayFormulas = this.spreadingRelations.getFormulaPositionsSpreadingOn(positionId);
41683
41685
  const cells = new JetSet(arrayFormulas);
41684
41686
  const arrayFormulaPositionId = this.getArrayFormulaSpreadingOnId(positionId);
41685
- if (arrayFormulaPositionId) {
41687
+ if (arrayFormulaPositionId !== undefined) {
41686
41688
  // ignore the formula spreading on the position. Keep only the blocked ones
41687
41689
  cells.delete(arrayFormulaPositionId);
41688
41690
  }
@@ -41705,9 +41707,15 @@
41705
41707
  }
41706
41708
  for (let i = 0; i < positionIds.length; ++i) {
41707
41709
  const cell = positionIds[i];
41710
+ if (this.nextPositionsToUpdate.has(cell)) {
41711
+ continue;
41712
+ }
41708
41713
  this.setEvaluatedCell(cell, this.computeCell(cell));
41709
41714
  }
41710
41715
  }
41716
+ if (currentIteration >= MAX_ITERATION) {
41717
+ console.warn("Maximum iteration reached while evaluating cells");
41718
+ }
41711
41719
  }
41712
41720
  setEvaluatedCell(positionId, evaluatedCell) {
41713
41721
  this.evaluatedCells.set(positionId, evaluatedCell);
@@ -41739,7 +41747,6 @@
41739
41747
  }
41740
41748
  finally {
41741
41749
  this.cellsBeingComputed.delete(cellId);
41742
- this.nextPositionsToUpdate.delete(positionId);
41743
41750
  }
41744
41751
  }
41745
41752
  computeAndSave(position) {
@@ -41809,6 +41816,7 @@
41809
41816
  { sheetId, zone: rightPartZone },
41810
41817
  { sheetId, zone: leftColumnZone },
41811
41818
  ]);
41819
+ invalidatedPositions.delete(this.encoder.encode(arrayFormulaPosition));
41812
41820
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
41813
41821
  }
41814
41822
  assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
@@ -41875,6 +41883,7 @@
41875
41883
  this.evaluatedCells.delete(child);
41876
41884
  this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([child]));
41877
41885
  this.nextPositionsToUpdate.addMany(this.getArrayFormulasBlockedBy(child));
41886
+ this.spreadingRelations.removeNode(child);
41878
41887
  }
41879
41888
  this.spreadingRelations.removeNode(positionId);
41880
41889
  }
@@ -44502,7 +44511,7 @@
44502
44511
  * Notify the server that the user client left the collaborative session
44503
44512
  */
44504
44513
  async leave(data) {
44505
- if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44514
+ if (data && Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
44506
44515
  await this.snapshot(data());
44507
44516
  }
44508
44517
  delete this.clients[this.clientId];
@@ -57157,7 +57166,8 @@
57157
57166
  this.session.join(this.config.client);
57158
57167
  }
57159
57168
  async leaveSession() {
57160
- await this.session.leave(lazy(() => this.exportData()));
57169
+ const snapshot = this.getters.isReadonly() ? undefined : lazy(() => this.exportData());
57170
+ await this.session.leave(snapshot);
57161
57171
  }
57162
57172
  setupUiPlugin(Plugin) {
57163
57173
  const plugin = new Plugin(this.uiPluginConfig);
@@ -57660,9 +57670,9 @@
57660
57670
  exports.tokenize = tokenize;
57661
57671
 
57662
57672
 
57663
- __info__.version = "17.0.40";
57664
- __info__.date = "2024-11-13T15:03:13.024Z";
57665
- __info__.hash = "a14bf60";
57673
+ __info__.version = "17.0.42";
57674
+ __info__.date = "2024-11-28T09:02:39.394Z";
57675
+ __info__.hash = "aa06a38";
57666
57676
 
57667
57677
 
57668
57678
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);