@odoo/o-spreadsheet 17.2.25 → 17.2.27

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.25
7
- * @date 2024-11-08T12:13:19.966Z
8
- * @hash 40d42f8
6
+ * @version 17.2.27
7
+ * @date 2024-11-22T14:17:16.936Z
8
+ * @hash 139e5a3
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -2932,7 +2932,9 @@
2932
2932
  return reverseSearch ? numberOfValues - i - 1 : i;
2933
2933
  }
2934
2934
  }
2935
- return reverseSearch ? numberOfValues - closestMatchIndex - 1 : closestMatchIndex;
2935
+ return reverseSearch && closestMatchIndex !== -1
2936
+ ? numberOfValues - closestMatchIndex - 1
2937
+ : closestMatchIndex;
2936
2938
  }
2937
2939
  /**
2938
2940
  * Normalize a value.
@@ -19694,11 +19696,14 @@ stores.inject(MyMetaStore, storeInstance);
19694
19696
  function getChartLabelFormat(getters, range) {
19695
19697
  if (!range)
19696
19698
  return undefined;
19697
- return getters.getEvaluatedCell({
19698
- sheetId: range.sheetId,
19699
- col: range.zone.left,
19700
- row: range.zone.top,
19701
- }).format;
19699
+ const { sheetId, zone: { left, top, bottom }, } = range;
19700
+ for (let row = top; row <= bottom; row++) {
19701
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
19702
+ if (format) {
19703
+ return format;
19704
+ }
19705
+ }
19706
+ return undefined;
19702
19707
  }
19703
19708
  function getChartLabelValues(getters, dataSets, labelRange) {
19704
19709
  let labels = { values: [], formattedValues: [] };
@@ -20414,11 +20419,7 @@ stores.inject(MyMetaStore, storeInstance);
20414
20419
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
20415
20420
  return false;
20416
20421
  }
20417
- const labelFormat = getters.getEvaluatedCell({
20418
- sheetId: labelRange.sheetId,
20419
- col: labelRange.zone.left,
20420
- row: labelRange.zone.top,
20421
- }).format;
20422
+ const labelFormat = getChartLabelFormat(getters, labelRange);
20422
20423
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
20423
20424
  }
20424
20425
  function canBeLinearChart(labelRange, getters) {
@@ -27217,6 +27218,7 @@ stores.inject(MyMetaStore, storeInstance);
27217
27218
  currentColor: { type: String, optional: true },
27218
27219
  maxHeight: { type: Number, optional: true },
27219
27220
  anchorRect: Object,
27221
+ disableNoColor: { type: Boolean, optional: true },
27220
27222
  };
27221
27223
  static defaultProps = { currentColor: "" };
27222
27224
  static components = { Popover };
@@ -27400,6 +27402,7 @@ stores.inject(MyMetaStore, storeInstance);
27400
27402
  disabled: { type: Boolean, optional: true },
27401
27403
  dropdownMaxHeight: { type: Number, optional: true },
27402
27404
  class: { type: String, optional: true },
27405
+ disableNoColor: { type: Boolean, optional: true },
27403
27406
  };
27404
27407
  static components = { ColorPicker };
27405
27408
  colorPickerButtonRef = owl.useRef("colorPickerButton");
@@ -28958,6 +28961,9 @@ stores.inject(MyMetaStore, storeInstance);
28958
28961
  }
28959
28962
  }
28960
28963
  setColorScaleColor(target, color) {
28964
+ if (!isColorValid(color)) {
28965
+ return;
28966
+ }
28961
28967
  const point = this.state.rules.colorScale[target];
28962
28968
  if (point) {
28963
28969
  point.color = Number.parseInt(color.substr(1), 16);
@@ -47826,12 +47832,18 @@ stores.inject(MyMetaStore, storeInstance);
47826
47832
  }
47827
47833
  for (let i = 0; i < positions.length; ++i) {
47828
47834
  const position = positions[i];
47835
+ if (this.nextPositionsToUpdate.has(position)) {
47836
+ continue;
47837
+ }
47829
47838
  const evaluatedCell = this.computeCell(position);
47830
47839
  if (evaluatedCell !== EMPTY_CELL) {
47831
47840
  this.evaluatedCells.set(position, evaluatedCell);
47832
47841
  }
47833
47842
  }
47834
47843
  }
47844
+ if (currentIteration >= MAX_ITERATION) {
47845
+ console.warn("Maximum iteration reached while evaluating cells");
47846
+ }
47835
47847
  }
47836
47848
  computeCell(position) {
47837
47849
  const evaluation = this.evaluatedCells.get(position);
@@ -47863,7 +47875,6 @@ stores.inject(MyMetaStore, storeInstance);
47863
47875
  }
47864
47876
  finally {
47865
47877
  this.cellsBeingComputed.delete(cellId);
47866
- this.nextPositionsToUpdate.delete(position);
47867
47878
  }
47868
47879
  }
47869
47880
  computeAndSave(position) {
@@ -47913,6 +47924,7 @@ stores.inject(MyMetaStore, storeInstance);
47913
47924
  { sheetId, zone: rightPartZone },
47914
47925
  { sheetId, zone: leftColumnZone },
47915
47926
  ]);
47927
+ invalidatedPositions.delete(arrayFormulaPosition);
47916
47928
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
47917
47929
  }
47918
47930
  assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
@@ -48957,25 +48969,11 @@ stores.inject(MyMetaStore, storeInstance);
48957
48969
  }
48958
48970
  switch (cmd.type) {
48959
48971
  case "ADD_DATA_VALIDATION_RULE":
48960
- const ranges = cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range));
48961
- if (cmd.rule.criterion.type === "isBoolean") {
48962
- this.setContentToBooleanCells({ ...cmd.rule, ranges });
48963
- }
48964
- delete this.validationResults[cmd.sheetId];
48965
- break;
48966
48972
  case "REMOVE_DATA_VALIDATION_RULE":
48967
48973
  delete this.validationResults[cmd.sheetId];
48968
48974
  break;
48969
48975
  }
48970
48976
  }
48971
- setContentToBooleanCells(rule) {
48972
- for (const position of getCellPositionsInRanges(rule.ranges)) {
48973
- const evaluatedCell = this.getters.getEvaluatedCell(position);
48974
- if (evaluatedCell.type !== CellValueType.boolean) {
48975
- this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
48976
- }
48977
- }
48978
- }
48979
48977
  isDataValidationInvalid(cellPosition) {
48980
48978
  return !this.getValidationResultForCell(cellPosition).isValid;
48981
48979
  }
@@ -50447,7 +50445,7 @@ stores.inject(MyMetaStore, storeInstance);
50447
50445
  * Notify the server that the user client left the collaborative session
50448
50446
  */
50449
50447
  async leave(data) {
50450
- if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
50448
+ if (data && Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
50451
50449
  await this.snapshot(data());
50452
50450
  }
50453
50451
  delete this.clients[this.clientId];
@@ -51553,6 +51551,42 @@ stores.inject(MyMetaStore, storeInstance);
51553
51551
  }
51554
51552
  }
51555
51553
 
51554
+ class DataValidationInsertionPlugin extends UIPlugin {
51555
+ handle(cmd) {
51556
+ switch (cmd.type) {
51557
+ case "ADD_DATA_VALIDATION_RULE":
51558
+ if (cmd.rule.criterion.type === "isBoolean") {
51559
+ const ranges = cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range));
51560
+ for (const position of getCellPositionsInRanges(ranges)) {
51561
+ const cell = this.getters.getCell(position);
51562
+ const evaluatedCell = this.getters.getEvaluatedCell(position);
51563
+ if (!cell?.content) {
51564
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
51565
+ // In this case, a cell has been updated in the core plugin but
51566
+ // not yet evaluated. This can occur after a paste operation.
51567
+ }
51568
+ else if (cell?.content && evaluatedCell.type === CellValueType.empty) {
51569
+ let value;
51570
+ if (cell.content.startsWith("=")) {
51571
+ const result = this.getters.evaluateFormula(position.sheetId, cell.content);
51572
+ value = (isMatrix(result) ? result[0][0] : result)?.toString();
51573
+ }
51574
+ else {
51575
+ value = cell.content;
51576
+ }
51577
+ if (!value || !isBoolean(value)) {
51578
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
51579
+ }
51580
+ }
51581
+ else if (evaluatedCell.type !== CellValueType.boolean) {
51582
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
51583
+ }
51584
+ }
51585
+ }
51586
+ }
51587
+ }
51588
+ }
51589
+
51556
51590
  const genericRepeatsTransforms = [
51557
51591
  repeatSheetDependantCommand,
51558
51592
  repeatTargetDependantCommand,
@@ -54786,7 +54820,8 @@ stores.inject(MyMetaStore, storeInstance);
54786
54820
  .add("collaborative", CollaborativePlugin)
54787
54821
  .add("history", HistoryPlugin)
54788
54822
  .add("data_cleanup", DataCleanupPlugin)
54789
- .add("table_autofill", TableAutofillPlugin);
54823
+ .add("table_autofill", TableAutofillPlugin)
54824
+ .add("datavalidation_insert", DataValidationInsertionPlugin);
54790
54825
  // Plugins which have a state, but which should not be shared in collaborative
54791
54826
  const statefulUIPluginRegistry = new Registry()
54792
54827
  .add("selection", GridSelectionPlugin)
@@ -60414,7 +60449,8 @@ stores.inject(MyMetaStore, storeInstance);
60414
60449
  this.session.join(this.config.client);
60415
60450
  }
60416
60451
  async leaveSession() {
60417
- await this.session.leave(lazy(() => this.exportData()));
60452
+ const snapshot = this.getters.isReadonly() ? undefined : lazy(() => this.exportData());
60453
+ await this.session.leave(snapshot);
60418
60454
  }
60419
60455
  setupUiPlugin(Plugin) {
60420
60456
  const plugin = new Plugin(this.uiPluginConfig);
@@ -60968,9 +61004,9 @@ stores.inject(MyMetaStore, storeInstance);
60968
61004
  exports.tokenize = tokenize;
60969
61005
 
60970
61006
 
60971
- __info__.version = "17.2.25";
60972
- __info__.date = "2024-11-08T12:13:19.966Z";
60973
- __info__.hash = "40d42f8";
61007
+ __info__.version = "17.2.27";
61008
+ __info__.date = "2024-11-22T14:17:16.936Z";
61009
+ __info__.hash = "139e5a3";
60974
61010
 
60975
61011
 
60976
61012
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);