@odoo/o-spreadsheet 18.0.5 → 18.0.6

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 18.0.5
6
- * @date 2024-11-22T14:19:19.721Z
7
- * @hash 9eb34d9
5
+ * @version 18.0.6
6
+ * @date 2024-11-28T09:05:39.780Z
7
+ * @hash 6e043e4
8
8
  */
9
9
 
10
10
  'use strict';
@@ -3542,7 +3542,6 @@ exports.CommandResult = void 0;
3542
3542
  CommandResult["ValueCellIsInvalidFormula"] = "ValueCellIsInvalidFormula";
3543
3543
  CommandResult["InvalidDefinition"] = "InvalidDefinition";
3544
3544
  CommandResult["InvalidColor"] = "InvalidColor";
3545
- CommandResult["DataBarRangeValuesMismatch"] = "DataBarRangeValuesMismatch";
3546
3545
  })(exports.CommandResult || (exports.CommandResult = {}));
3547
3546
 
3548
3547
  const DEFAULT_LOCALES = [
@@ -27922,7 +27921,6 @@ const CfTerms = {
27922
27921
  ["ValueLowerInvalidFormula" /* CommandResult.ValueLowerInvalidFormula */]: _t("Invalid lower inflection point formula"),
27923
27922
  ["EmptyRange" /* CommandResult.EmptyRange */]: _t("A range needs to be defined"),
27924
27923
  ["ValueCellIsInvalidFormula" /* CommandResult.ValueCellIsInvalidFormula */]: _t("At least one of the provided values is an invalid formula"),
27925
- ["DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */]: _t("All the ranges and the range values must have the same size"),
27926
27924
  Unexpected: _t("The rule is invalid for an unknown reason"),
27927
27925
  },
27928
27926
  ColorScale: _t("Color scale"),
@@ -30107,9 +30105,12 @@ function createPyramidChartRuntime(chart, getters) {
30107
30105
  if (datasets && datasets[1]) {
30108
30106
  datasets[1].data = datasets[1].data.map((value) => (value > 0 ? -value : 0));
30109
30107
  }
30108
+ const maxValue = Math.max(...config.data?.datasets.map((dataSet) => Math.max(...dataSet.data.map(Math.abs))));
30110
30109
  const scales = config.options.scales;
30111
30110
  const scalesXCallback = scales.x.ticks.callback;
30112
30111
  scales.x.ticks.callback = (value) => scalesXCallback(Math.abs(value));
30112
+ scales.x.suggestedMin = -maxValue;
30113
+ scales.x.suggestedMax = maxValue;
30113
30114
  const tooltipLabelCallback = config.options.plugins.tooltip.callbacks.label;
30114
30115
  config.options.plugins.tooltip.callbacks.label = (item) => {
30115
30116
  const tooltipItem = { ...item, parsed: { y: item.parsed.y, x: Math.abs(item.parsed.x) } };
@@ -51863,8 +51864,6 @@ class ConditionalFormatPlugin extends CorePlugin {
51863
51864
  case "IconSetRule": {
51864
51865
  return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
51865
51866
  }
51866
- case "DataBarRule":
51867
- return this.checkDataBarRangeValues(rule, cmd.ranges, cmd.sheetId);
51868
51867
  }
51869
51868
  return "Success" /* CommandResult.Success */;
51870
51869
  }
@@ -51984,18 +51983,6 @@ class ConditionalFormatPlugin extends CorePlugin {
51984
51983
  }
51985
51984
  return "Success" /* CommandResult.Success */;
51986
51985
  }
51987
- checkDataBarRangeValues(rule, ranges, sheetId) {
51988
- if (rule.rangeValues) {
51989
- const { numberOfCols, numberOfRows } = zoneToDimension(this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues).zone);
51990
- for (const range of ranges) {
51991
- const dimensions = zoneToDimension(this.getters.getRangeFromRangeData(range).zone);
51992
- if (numberOfCols !== dimensions.numberOfCols || numberOfRows !== dimensions.numberOfRows) {
51993
- return "DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */;
51994
- }
51995
- }
51996
- }
51997
- return "Success" /* CommandResult.Success */;
51998
- }
51999
51986
  removeConditionalFormatting(id, sheet) {
52000
51987
  const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
52001
51988
  if (cfIndex !== -1) {
@@ -58376,8 +58363,12 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
58376
58363
  const zoneOfValues = rangeValues.zone;
58377
58364
  for (let row = zone.top; row <= zone.bottom; row++) {
58378
58365
  for (let col = zone.left; col <= zone.right; col++) {
58379
- const cell = this.getEvaluatedCellInZone(sheetId, zone, col, row, zoneOfValues);
58380
- if (cell.type !== CellValueType.number || cell.value <= 0) {
58366
+ const targetCol = col - zone.left + zoneOfValues.left;
58367
+ const targetRow = row - zone.top + zoneOfValues.top;
58368
+ const cell = this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58369
+ if (!isInside(targetCol, targetRow, zoneOfValues) ||
58370
+ cell.type !== CellValueType.number ||
58371
+ cell.value <= 0) {
58381
58372
  // values negatives or 0 are ignored
58382
58373
  continue;
58383
58374
  }
@@ -58390,11 +58381,6 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
58390
58381
  }
58391
58382
  }
58392
58383
  }
58393
- getEvaluatedCellInZone(sheetId, zone, col, row, targetZone) {
58394
- const targetCol = col - zone.left + targetZone.left;
58395
- const targetRow = row - zone.top + targetZone.top;
58396
- return this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58397
- }
58398
58384
  /** Compute the color scale for the given range and CF rule, and apply in in the given computedStyle object */
58399
58385
  applyColorScale(sheetId, range, rule, computedStyle) {
58400
58386
  const minValue = this.parsePoint(sheetId, range, rule.minimum, "min");
@@ -72570,6 +72556,6 @@ exports.tokenColors = tokenColors;
72570
72556
  exports.tokenize = tokenize;
72571
72557
 
72572
72558
 
72573
- __info__.version = "18.0.5";
72574
- __info__.date = "2024-11-22T14:19:19.721Z";
72575
- __info__.hash = "9eb34d9";
72559
+ __info__.version = "18.0.6";
72560
+ __info__.date = "2024-11-28T09:05:39.780Z";
72561
+ __info__.hash = "6e043e4";
@@ -2670,8 +2670,7 @@ declare const enum CommandResult {
2670
2670
  EmptyName = "EmptyName",
2671
2671
  ValueCellIsInvalidFormula = "ValueCellIsInvalidFormula",
2672
2672
  InvalidDefinition = "InvalidDefinition",
2673
- InvalidColor = "InvalidColor",
2674
- DataBarRangeValuesMismatch = "DataBarRangeValuesMismatch"
2673
+ InvalidColor = "InvalidColor"
2675
2674
  }
2676
2675
  interface CommandHandler<T> {
2677
2676
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -3921,7 +3920,6 @@ declare class ConditionalFormatPlugin extends CorePlugin<ConditionalFormatState>
3921
3920
  private checkMidBiggerThanMax;
3922
3921
  private checkMinBiggerThanMid;
3923
3922
  private checkCFValues;
3924
- private checkDataBarRangeValues;
3925
3923
  private removeConditionalFormatting;
3926
3924
  private changeCFPriority;
3927
3925
  }
@@ -4628,7 +4626,6 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
4628
4626
  private applyIcon;
4629
4627
  private computeIcon;
4630
4628
  private applyDataBar;
4631
- private getEvaluatedCellInZone;
4632
4629
  /** Compute the color scale for the given range and CF rule, and apply in in the given computedStyle object */
4633
4630
  private applyColorScale;
4634
4631
  private computeColorDiffUnits;
@@ -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 18.0.5
6
- * @date 2024-11-22T14:19:19.721Z
7
- * @hash 9eb34d9
5
+ * @version 18.0.6
6
+ * @date 2024-11-28T09:05:39.780Z
7
+ * @hash 6e043e4
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -3540,7 +3540,6 @@ var CommandResult;
3540
3540
  CommandResult["ValueCellIsInvalidFormula"] = "ValueCellIsInvalidFormula";
3541
3541
  CommandResult["InvalidDefinition"] = "InvalidDefinition";
3542
3542
  CommandResult["InvalidColor"] = "InvalidColor";
3543
- CommandResult["DataBarRangeValuesMismatch"] = "DataBarRangeValuesMismatch";
3544
3543
  })(CommandResult || (CommandResult = {}));
3545
3544
 
3546
3545
  const DEFAULT_LOCALES = [
@@ -27920,7 +27919,6 @@ const CfTerms = {
27920
27919
  ["ValueLowerInvalidFormula" /* CommandResult.ValueLowerInvalidFormula */]: _t("Invalid lower inflection point formula"),
27921
27920
  ["EmptyRange" /* CommandResult.EmptyRange */]: _t("A range needs to be defined"),
27922
27921
  ["ValueCellIsInvalidFormula" /* CommandResult.ValueCellIsInvalidFormula */]: _t("At least one of the provided values is an invalid formula"),
27923
- ["DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */]: _t("All the ranges and the range values must have the same size"),
27924
27922
  Unexpected: _t("The rule is invalid for an unknown reason"),
27925
27923
  },
27926
27924
  ColorScale: _t("Color scale"),
@@ -30105,9 +30103,12 @@ function createPyramidChartRuntime(chart, getters) {
30105
30103
  if (datasets && datasets[1]) {
30106
30104
  datasets[1].data = datasets[1].data.map((value) => (value > 0 ? -value : 0));
30107
30105
  }
30106
+ const maxValue = Math.max(...config.data?.datasets.map((dataSet) => Math.max(...dataSet.data.map(Math.abs))));
30108
30107
  const scales = config.options.scales;
30109
30108
  const scalesXCallback = scales.x.ticks.callback;
30110
30109
  scales.x.ticks.callback = (value) => scalesXCallback(Math.abs(value));
30110
+ scales.x.suggestedMin = -maxValue;
30111
+ scales.x.suggestedMax = maxValue;
30111
30112
  const tooltipLabelCallback = config.options.plugins.tooltip.callbacks.label;
30112
30113
  config.options.plugins.tooltip.callbacks.label = (item) => {
30113
30114
  const tooltipItem = { ...item, parsed: { y: item.parsed.y, x: Math.abs(item.parsed.x) } };
@@ -51861,8 +51862,6 @@ class ConditionalFormatPlugin extends CorePlugin {
51861
51862
  case "IconSetRule": {
51862
51863
  return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
51863
51864
  }
51864
- case "DataBarRule":
51865
- return this.checkDataBarRangeValues(rule, cmd.ranges, cmd.sheetId);
51866
51865
  }
51867
51866
  return "Success" /* CommandResult.Success */;
51868
51867
  }
@@ -51982,18 +51981,6 @@ class ConditionalFormatPlugin extends CorePlugin {
51982
51981
  }
51983
51982
  return "Success" /* CommandResult.Success */;
51984
51983
  }
51985
- checkDataBarRangeValues(rule, ranges, sheetId) {
51986
- if (rule.rangeValues) {
51987
- const { numberOfCols, numberOfRows } = zoneToDimension(this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues).zone);
51988
- for (const range of ranges) {
51989
- const dimensions = zoneToDimension(this.getters.getRangeFromRangeData(range).zone);
51990
- if (numberOfCols !== dimensions.numberOfCols || numberOfRows !== dimensions.numberOfRows) {
51991
- return "DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */;
51992
- }
51993
- }
51994
- }
51995
- return "Success" /* CommandResult.Success */;
51996
- }
51997
51984
  removeConditionalFormatting(id, sheet) {
51998
51985
  const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
51999
51986
  if (cfIndex !== -1) {
@@ -58374,8 +58361,12 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
58374
58361
  const zoneOfValues = rangeValues.zone;
58375
58362
  for (let row = zone.top; row <= zone.bottom; row++) {
58376
58363
  for (let col = zone.left; col <= zone.right; col++) {
58377
- const cell = this.getEvaluatedCellInZone(sheetId, zone, col, row, zoneOfValues);
58378
- if (cell.type !== CellValueType.number || cell.value <= 0) {
58364
+ const targetCol = col - zone.left + zoneOfValues.left;
58365
+ const targetRow = row - zone.top + zoneOfValues.top;
58366
+ const cell = this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58367
+ if (!isInside(targetCol, targetRow, zoneOfValues) ||
58368
+ cell.type !== CellValueType.number ||
58369
+ cell.value <= 0) {
58379
58370
  // values negatives or 0 are ignored
58380
58371
  continue;
58381
58372
  }
@@ -58388,11 +58379,6 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
58388
58379
  }
58389
58380
  }
58390
58381
  }
58391
- getEvaluatedCellInZone(sheetId, zone, col, row, targetZone) {
58392
- const targetCol = col - zone.left + targetZone.left;
58393
- const targetRow = row - zone.top + targetZone.top;
58394
- return this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58395
- }
58396
58382
  /** Compute the color scale for the given range and CF rule, and apply in in the given computedStyle object */
58397
58383
  applyColorScale(sheetId, range, rule, computedStyle) {
58398
58384
  const minValue = this.parsePoint(sheetId, range, rule.minimum, "min");
@@ -72525,6 +72511,6 @@ const constants = {
72525
72511
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
72526
72512
 
72527
72513
 
72528
- __info__.version = "18.0.5";
72529
- __info__.date = "2024-11-22T14:19:19.721Z";
72530
- __info__.hash = "9eb34d9";
72514
+ __info__.version = "18.0.6";
72515
+ __info__.date = "2024-11-28T09:05:39.780Z";
72516
+ __info__.hash = "6e043e4";
@@ -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 18.0.5
6
- * @date 2024-11-22T14:19:19.721Z
7
- * @hash 9eb34d9
5
+ * @version 18.0.6
6
+ * @date 2024-11-28T09:05:39.780Z
7
+ * @hash 6e043e4
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3541,7 +3541,6 @@
3541
3541
  CommandResult["ValueCellIsInvalidFormula"] = "ValueCellIsInvalidFormula";
3542
3542
  CommandResult["InvalidDefinition"] = "InvalidDefinition";
3543
3543
  CommandResult["InvalidColor"] = "InvalidColor";
3544
- CommandResult["DataBarRangeValuesMismatch"] = "DataBarRangeValuesMismatch";
3545
3544
  })(exports.CommandResult || (exports.CommandResult = {}));
3546
3545
 
3547
3546
  const DEFAULT_LOCALES = [
@@ -27921,7 +27920,6 @@ stores.inject(MyMetaStore, storeInstance);
27921
27920
  ["ValueLowerInvalidFormula" /* CommandResult.ValueLowerInvalidFormula */]: _t("Invalid lower inflection point formula"),
27922
27921
  ["EmptyRange" /* CommandResult.EmptyRange */]: _t("A range needs to be defined"),
27923
27922
  ["ValueCellIsInvalidFormula" /* CommandResult.ValueCellIsInvalidFormula */]: _t("At least one of the provided values is an invalid formula"),
27924
- ["DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */]: _t("All the ranges and the range values must have the same size"),
27925
27923
  Unexpected: _t("The rule is invalid for an unknown reason"),
27926
27924
  },
27927
27925
  ColorScale: _t("Color scale"),
@@ -30106,9 +30104,12 @@ stores.inject(MyMetaStore, storeInstance);
30106
30104
  if (datasets && datasets[1]) {
30107
30105
  datasets[1].data = datasets[1].data.map((value) => (value > 0 ? -value : 0));
30108
30106
  }
30107
+ const maxValue = Math.max(...config.data?.datasets.map((dataSet) => Math.max(...dataSet.data.map(Math.abs))));
30109
30108
  const scales = config.options.scales;
30110
30109
  const scalesXCallback = scales.x.ticks.callback;
30111
30110
  scales.x.ticks.callback = (value) => scalesXCallback(Math.abs(value));
30111
+ scales.x.suggestedMin = -maxValue;
30112
+ scales.x.suggestedMax = maxValue;
30112
30113
  const tooltipLabelCallback = config.options.plugins.tooltip.callbacks.label;
30113
30114
  config.options.plugins.tooltip.callbacks.label = (item) => {
30114
30115
  const tooltipItem = { ...item, parsed: { y: item.parsed.y, x: Math.abs(item.parsed.x) } };
@@ -51862,8 +51863,6 @@ stores.inject(MyMetaStore, storeInstance);
51862
51863
  case "IconSetRule": {
51863
51864
  return this.checkValidations(rule, this.chainValidations(this.checkInflectionPoints(this.checkNaN), this.checkLowerBiggerThanUpper), this.chainValidations(this.checkInflectionPoints(this.checkFormulaCompilation)));
51864
51865
  }
51865
- case "DataBarRule":
51866
- return this.checkDataBarRangeValues(rule, cmd.ranges, cmd.sheetId);
51867
51866
  }
51868
51867
  return "Success" /* CommandResult.Success */;
51869
51868
  }
@@ -51983,18 +51982,6 @@ stores.inject(MyMetaStore, storeInstance);
51983
51982
  }
51984
51983
  return "Success" /* CommandResult.Success */;
51985
51984
  }
51986
- checkDataBarRangeValues(rule, ranges, sheetId) {
51987
- if (rule.rangeValues) {
51988
- const { numberOfCols, numberOfRows } = zoneToDimension(this.getters.getRangeFromSheetXC(sheetId, rule.rangeValues).zone);
51989
- for (const range of ranges) {
51990
- const dimensions = zoneToDimension(this.getters.getRangeFromRangeData(range).zone);
51991
- if (numberOfCols !== dimensions.numberOfCols || numberOfRows !== dimensions.numberOfRows) {
51992
- return "DataBarRangeValuesMismatch" /* CommandResult.DataBarRangeValuesMismatch */;
51993
- }
51994
- }
51995
- }
51996
- return "Success" /* CommandResult.Success */;
51997
- }
51998
51985
  removeConditionalFormatting(id, sheet) {
51999
51986
  const cfIndex = this.cfRules[sheet].findIndex((s) => s.id === id);
52000
51987
  if (cfIndex !== -1) {
@@ -58375,8 +58362,12 @@ stores.inject(MyMetaStore, storeInstance);
58375
58362
  const zoneOfValues = rangeValues.zone;
58376
58363
  for (let row = zone.top; row <= zone.bottom; row++) {
58377
58364
  for (let col = zone.left; col <= zone.right; col++) {
58378
- const cell = this.getEvaluatedCellInZone(sheetId, zone, col, row, zoneOfValues);
58379
- if (cell.type !== CellValueType.number || cell.value <= 0) {
58365
+ const targetCol = col - zone.left + zoneOfValues.left;
58366
+ const targetRow = row - zone.top + zoneOfValues.top;
58367
+ const cell = this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58368
+ if (!isInside(targetCol, targetRow, zoneOfValues) ||
58369
+ cell.type !== CellValueType.number ||
58370
+ cell.value <= 0) {
58380
58371
  // values negatives or 0 are ignored
58381
58372
  continue;
58382
58373
  }
@@ -58389,11 +58380,6 @@ stores.inject(MyMetaStore, storeInstance);
58389
58380
  }
58390
58381
  }
58391
58382
  }
58392
- getEvaluatedCellInZone(sheetId, zone, col, row, targetZone) {
58393
- const targetCol = col - zone.left + targetZone.left;
58394
- const targetRow = row - zone.top + targetZone.top;
58395
- return this.getters.getEvaluatedCell({ sheetId, col: targetCol, row: targetRow });
58396
- }
58397
58383
  /** Compute the color scale for the given range and CF rule, and apply in in the given computedStyle object */
58398
58384
  applyColorScale(sheetId, range, rule, computedStyle) {
58399
58385
  const minValue = this.parsePoint(sheetId, range, rule.minimum, "min");
@@ -72569,9 +72555,9 @@ stores.inject(MyMetaStore, storeInstance);
72569
72555
  exports.tokenize = tokenize;
72570
72556
 
72571
72557
 
72572
- __info__.version = "18.0.5";
72573
- __info__.date = "2024-11-22T14:19:19.721Z";
72574
- __info__.hash = "9eb34d9";
72558
+ __info__.version = "18.0.6";
72559
+ __info__.date = "2024-11-28T09:05:39.780Z";
72560
+ __info__.hash = "6e043e4";
72575
72561
 
72576
72562
 
72577
72563
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);