@odoo/o-spreadsheet 17.4.11 → 17.4.13

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.4.11
6
- * @date 2024-11-08T12:15:26.239Z
7
- * @hash 2eb3f1c
5
+ * @version 17.4.13
6
+ * @date 2024-11-22T14:17:01.675Z
7
+ * @hash a5e4e16
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3135,7 +3135,9 @@
3135
3135
  return reverseSearch ? numberOfValues - i - 1 : i;
3136
3136
  }
3137
3137
  }
3138
- return reverseSearch ? numberOfValues - closestMatchIndex - 1 : closestMatchIndex;
3138
+ return reverseSearch && closestMatchIndex !== -1
3139
+ ? numberOfValues - closestMatchIndex - 1
3140
+ : closestMatchIndex;
3139
3141
  }
3140
3142
  /**
3141
3143
  * Normalize a value.
@@ -23488,11 +23490,14 @@ stores.inject(MyMetaStore, storeInstance);
23488
23490
  function getChartLabelFormat(getters, range) {
23489
23491
  if (!range)
23490
23492
  return undefined;
23491
- return getters.getEvaluatedCell({
23492
- sheetId: range.sheetId,
23493
- col: range.zone.left,
23494
- row: range.zone.top,
23495
- }).format;
23493
+ const { sheetId, zone: { left, top, bottom }, } = range;
23494
+ for (let row = top; row <= bottom; row++) {
23495
+ const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
23496
+ if (format) {
23497
+ return format;
23498
+ }
23499
+ }
23500
+ return undefined;
23496
23501
  }
23497
23502
  function getChartLabelValues(getters, dataSets, labelRange) {
23498
23503
  let labels = { values: [], formattedValues: [] };
@@ -24031,11 +24036,7 @@ stores.inject(MyMetaStore, storeInstance);
24031
24036
  if (!labelRange || !canBeLinearChart(labelRange, getters)) {
24032
24037
  return false;
24033
24038
  }
24034
- const labelFormat = getters.getEvaluatedCell({
24035
- sheetId: labelRange.sheetId,
24036
- col: labelRange.zone.left,
24037
- row: labelRange.zone.top,
24038
- }).format;
24039
+ const labelFormat = getChartLabelFormat(getters, labelRange);
24039
24040
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
24040
24041
  }
24041
24042
  function canBeLinearChart(labelRange, getters) {
@@ -32068,6 +32069,7 @@ stores.inject(MyMetaStore, storeInstance);
32068
32069
  currentColor: { type: String, optional: true },
32069
32070
  maxHeight: { type: Number, optional: true },
32070
32071
  anchorRect: Object,
32072
+ disableNoColor: { type: Boolean, optional: true },
32071
32073
  };
32072
32074
  static defaultProps = { currentColor: "" };
32073
32075
  static components = { Popover };
@@ -32293,6 +32295,7 @@ stores.inject(MyMetaStore, storeInstance);
32293
32295
  currentColor: { type: String, optional: true },
32294
32296
  title: { type: String, optional: true },
32295
32297
  onColorPicked: Function,
32298
+ disableNoColor: { type: Boolean, optional: true },
32296
32299
  };
32297
32300
  colorPickerButtonRef = owl.useRef("colorPickerButton");
32298
32301
  state;
@@ -34354,6 +34357,9 @@ stores.inject(MyMetaStore, storeInstance);
34354
34357
  }
34355
34358
  }
34356
34359
  setColorScaleColor(target, color) {
34360
+ if (!isColorValid(color)) {
34361
+ return;
34362
+ }
34357
34363
  const point = this.state.rules.colorScale[target];
34358
34364
  if (point) {
34359
34365
  point.color = Number.parseInt(color.substr(1), 16);
@@ -54276,6 +54282,9 @@ stores.inject(MyMetaStore, storeInstance);
54276
54282
  }
54277
54283
  for (let i = 0; i < positions.length; ++i) {
54278
54284
  const position = positions[i];
54285
+ if (this.nextPositionsToUpdate.has(position)) {
54286
+ continue;
54287
+ }
54279
54288
  const evaluatedCell = this.computeCell(position);
54280
54289
  if (evaluatedCell !== EMPTY_CELL) {
54281
54290
  this.evaluatedCells.set(position, evaluatedCell);
@@ -54283,6 +54292,9 @@ stores.inject(MyMetaStore, storeInstance);
54283
54292
  }
54284
54293
  onIterationEndEvaluationRegistry.getAll().forEach((callback) => callback(this.getters));
54285
54294
  }
54295
+ if (currentIteration >= MAX_ITERATION) {
54296
+ console.warn("Maximum iteration reached while evaluating cells");
54297
+ }
54286
54298
  }
54287
54299
  computeCell(position) {
54288
54300
  const evaluation = this.evaluatedCells.get(position);
@@ -54317,7 +54329,6 @@ stores.inject(MyMetaStore, storeInstance);
54317
54329
  }
54318
54330
  finally {
54319
54331
  this.cellsBeingComputed.delete(cellId);
54320
- this.nextPositionsToUpdate.delete(position);
54321
54332
  }
54322
54333
  }
54323
54334
  computeAndSave(position) {
@@ -54368,6 +54379,7 @@ stores.inject(MyMetaStore, storeInstance);
54368
54379
  { sheetId, zone: rightPartZone },
54369
54380
  { sheetId, zone: leftColumnZone },
54370
54381
  ]);
54382
+ invalidatedPositions.delete(arrayFormulaPosition);
54371
54383
  this.nextPositionsToUpdate.addMany(invalidatedPositions);
54372
54384
  }
54373
54385
  assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
@@ -55426,25 +55438,11 @@ stores.inject(MyMetaStore, storeInstance);
55426
55438
  }
55427
55439
  switch (cmd.type) {
55428
55440
  case "ADD_DATA_VALIDATION_RULE":
55429
- const ranges = cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range));
55430
- if (cmd.rule.criterion.type === "isBoolean") {
55431
- this.setContentToBooleanCells({ ...cmd.rule, ranges });
55432
- }
55433
- delete this.validationResults[cmd.sheetId];
55434
- break;
55435
55441
  case "REMOVE_DATA_VALIDATION_RULE":
55436
55442
  delete this.validationResults[cmd.sheetId];
55437
55443
  break;
55438
55444
  }
55439
55445
  }
55440
- setContentToBooleanCells(rule) {
55441
- for (const position of getCellPositionsInRanges(rule.ranges)) {
55442
- const evaluatedCell = this.getters.getEvaluatedCell(position);
55443
- if (evaluatedCell.type !== CellValueType.boolean) {
55444
- this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
55445
- }
55446
- }
55447
- }
55448
55446
  isDataValidationInvalid(cellPosition) {
55449
55447
  return !this.getValidationResultForCell(cellPosition).isValid;
55450
55448
  }
@@ -57376,7 +57374,7 @@ stores.inject(MyMetaStore, storeInstance);
57376
57374
  * Notify the server that the user client left the collaborative session
57377
57375
  */
57378
57376
  async leave(data) {
57379
- if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
57377
+ if (data && Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
57380
57378
  await this.snapshot(data());
57381
57379
  }
57382
57380
  delete this.clients[this.clientId];
@@ -58847,6 +58845,42 @@ stores.inject(MyMetaStore, storeInstance);
58847
58845
  }
58848
58846
  }
58849
58847
 
58848
+ class DataValidationInsertionPlugin extends UIPlugin {
58849
+ handle(cmd) {
58850
+ switch (cmd.type) {
58851
+ case "ADD_DATA_VALIDATION_RULE":
58852
+ if (cmd.rule.criterion.type === "isBoolean") {
58853
+ const ranges = cmd.ranges.map((range) => this.getters.getRangeFromRangeData(range));
58854
+ for (const position of getCellPositionsInRanges(ranges)) {
58855
+ const cell = this.getters.getCell(position);
58856
+ const evaluatedCell = this.getters.getEvaluatedCell(position);
58857
+ if (!cell?.content) {
58858
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
58859
+ // In this case, a cell has been updated in the core plugin but
58860
+ // not yet evaluated. This can occur after a paste operation.
58861
+ }
58862
+ else if (cell?.content && evaluatedCell.type === CellValueType.empty) {
58863
+ let value;
58864
+ if (cell.content.startsWith("=")) {
58865
+ const result = this.getters.evaluateFormula(position.sheetId, cell.content);
58866
+ value = (isMatrix(result) ? result[0][0] : result)?.toString();
58867
+ }
58868
+ else {
58869
+ value = cell.content;
58870
+ }
58871
+ if (!value || !isBoolean(value)) {
58872
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
58873
+ }
58874
+ }
58875
+ else if (evaluatedCell.type !== CellValueType.boolean) {
58876
+ this.dispatch("UPDATE_CELL", { ...position, content: "FALSE" });
58877
+ }
58878
+ }
58879
+ }
58880
+ }
58881
+ }
58882
+ }
58883
+
58850
58884
  const genericRepeatsTransforms = [
58851
58885
  repeatSheetDependantCommand,
58852
58886
  repeatTargetDependantCommand,
@@ -61912,7 +61946,8 @@ stores.inject(MyMetaStore, storeInstance);
61912
61946
  .add("history", HistoryPlugin)
61913
61947
  .add("data_cleanup", DataCleanupPlugin)
61914
61948
  .add("table_autofill", TableAutofillPlugin)
61915
- .add("table_ui_resize", TableResizeUI);
61949
+ .add("table_ui_resize", TableResizeUI)
61950
+ .add("datavalidation_insert", DataValidationInsertionPlugin);
61916
61951
  // Plugins which have a state, but which should not be shared in collaborative
61917
61952
  const statefulUIPluginRegistry = new Registry()
61918
61953
  .add("selection", GridSelectionPlugin)
@@ -68074,7 +68109,8 @@ stores.inject(MyMetaStore, storeInstance);
68074
68109
  this.session.join(this.config.client);
68075
68110
  }
68076
68111
  async leaveSession() {
68077
- await this.session.leave(lazy(() => this.exportData()));
68112
+ const snapshot = this.getters.isReadonly() ? undefined : lazy(() => this.exportData());
68113
+ await this.session.leave(snapshot);
68078
68114
  }
68079
68115
  setupUiPlugin(Plugin) {
68080
68116
  const plugin = new Plugin(this.uiPluginConfig);
@@ -68677,9 +68713,9 @@ stores.inject(MyMetaStore, storeInstance);
68677
68713
  exports.tokenize = tokenize;
68678
68714
 
68679
68715
 
68680
- __info__.version = "17.4.11";
68681
- __info__.date = "2024-11-08T12:15:26.239Z";
68682
- __info__.hash = "2eb3f1c";
68716
+ __info__.version = "17.4.13";
68717
+ __info__.date = "2024-11-22T14:17:01.675Z";
68718
+ __info__.hash = "a5e4e16";
68683
68719
 
68684
68720
 
68685
68721
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);