@odoo/o-spreadsheet 18.1.17 → 18.1.18

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.1.17
6
- * @date 2025-04-25T08:08:46.599Z
7
- * @hash a63687f
5
+ * @version 18.1.18
6
+ * @date 2025-05-02T12:30:47.822Z
7
+ * @hash 29c21c6
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3761,6 +3761,7 @@
3761
3761
  CommandResult["ValueCellIsInvalidFormula"] = "ValueCellIsInvalidFormula";
3762
3762
  CommandResult["InvalidDefinition"] = "InvalidDefinition";
3763
3763
  CommandResult["InvalidColor"] = "InvalidColor";
3764
+ CommandResult["InvalidPivotDataSet"] = "InvalidPivotDataSet";
3764
3765
  })(exports.CommandResult || (exports.CommandResult = {}));
3765
3766
 
3766
3767
  const DEFAULT_LOCALES = [
@@ -10008,7 +10009,7 @@ stores.inject(MyMetaStore, storeInstance);
10008
10009
  const yMin = chart.chartArea.top;
10009
10010
  const textsPositions = {};
10010
10011
  for (const dataset of chart._metasets) {
10011
- if (isTrendLineAxis(dataset.axisID) || dataset.hidden) {
10012
+ if (isTrendLineAxis(dataset.xAxisID) || dataset.hidden) {
10012
10013
  continue;
10013
10014
  }
10014
10015
  for (let i = 0; i < dataset._parsed.length; i++) {
@@ -10051,7 +10052,7 @@ stores.inject(MyMetaStore, storeInstance);
10051
10052
  const xMin = chart.chartArea.left;
10052
10053
  const textsPositions = {};
10053
10054
  for (const dataset of chart._metasets) {
10054
- if (isTrendLineAxis(dataset.axisID)) {
10055
+ if (isTrendLineAxis(dataset.xAxisID)) {
10055
10056
  return; // ignore trend lines
10056
10057
  }
10057
10058
  for (let i = 0; i < dataset._parsed.length; i++) {
@@ -10167,6 +10168,7 @@ stores.inject(MyMetaStore, storeInstance);
10167
10168
  canvas = owl.useRef("graphContainer");
10168
10169
  chart;
10169
10170
  currentRuntime;
10171
+ currentDevicePixelRatio = window.devicePixelRatio;
10170
10172
  get background() {
10171
10173
  return this.chartRuntime.background;
10172
10174
  }
@@ -10200,6 +10202,10 @@ stores.inject(MyMetaStore, storeInstance);
10200
10202
  }
10201
10203
  this.currentRuntime = runtime;
10202
10204
  }
10205
+ else if (this.currentDevicePixelRatio !== window.devicePixelRatio) {
10206
+ this.currentDevicePixelRatio = window.devicePixelRatio;
10207
+ this.updateChartJs(deepCopy(this.currentRuntime.chartJsConfig));
10208
+ }
10203
10209
  });
10204
10210
  }
10205
10211
  createChart(chartData) {
@@ -10455,9 +10461,11 @@ stores.inject(MyMetaStore, storeInstance);
10455
10461
  };
10456
10462
  function drawScoreChart(structure, canvas) {
10457
10463
  const ctx = canvas.getContext("2d");
10458
- canvas.width = structure.canvas.width;
10459
- const availableWidth = canvas.width - CHART_PADDING$1 * 2;
10460
- canvas.height = structure.canvas.height;
10464
+ const dpr = window.devicePixelRatio || 1;
10465
+ canvas.width = dpr * structure.canvas.width;
10466
+ canvas.height = dpr * structure.canvas.height;
10467
+ ctx.scale(dpr, dpr);
10468
+ const availableWidth = structure.canvas.width - CHART_PADDING$1 * 2;
10461
10469
  ctx.fillStyle = structure.canvas.backgroundColor;
10462
10470
  ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
10463
10471
  if (structure.title) {
@@ -10820,7 +10828,7 @@ stores.inject(MyMetaStore, storeInstance);
10820
10828
  owl.useEffect(this.createChart.bind(this), () => {
10821
10829
  const canvas = this.canvas.el;
10822
10830
  const rect = canvas.getBoundingClientRect();
10823
- return [rect.width, rect.height, this.runtime, this.canvas.el];
10831
+ return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
10824
10832
  });
10825
10833
  }
10826
10834
  createChart() {
@@ -22409,9 +22417,11 @@ stores.inject(MyMetaStore, storeInstance);
22409
22417
  const GAUGE_TITLE_SECTION_HEIGHT = 25;
22410
22418
  function drawGaugeChart(canvas, runtime) {
22411
22419
  const canvasBoundingRect = canvas.getBoundingClientRect();
22412
- canvas.width = canvasBoundingRect.width;
22413
- canvas.height = canvasBoundingRect.height;
22420
+ const dpr = window.devicePixelRatio || 1;
22421
+ canvas.width = dpr * canvasBoundingRect.width;
22422
+ canvas.height = dpr * canvasBoundingRect.height;
22414
22423
  const ctx = canvas.getContext("2d");
22424
+ ctx.scale(dpr, dpr);
22415
22425
  const config = getGaugeRenderingConfig(canvasBoundingRect, runtime, ctx);
22416
22426
  drawBackground(ctx, config);
22417
22427
  drawGauge(ctx, config);
@@ -22746,7 +22756,7 @@ stores.inject(MyMetaStore, storeInstance);
22746
22756
  owl.useEffect(() => drawGaugeChart(this.canvas.el, this.runtime), () => {
22747
22757
  const canvas = this.canvas.el;
22748
22758
  const rect = canvas.getBoundingClientRect();
22749
- return [rect.width, rect.height, this.runtime, this.canvas.el];
22759
+ return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
22750
22760
  });
22751
22761
  }
22752
22762
  }
@@ -29558,7 +29568,7 @@ stores.inject(MyMetaStore, storeInstance);
29558
29568
  };
29559
29569
  scales[MOVING_AVERAGE_TREND_LINE_XAXIS_ID] = {
29560
29570
  ...scales.x,
29561
- offset: false,
29571
+ offset: true,
29562
29572
  display: false,
29563
29573
  };
29564
29574
  }
@@ -30155,9 +30165,6 @@ stores.inject(MyMetaStore, storeInstance);
30155
30165
  };
30156
30166
  }
30157
30167
  getDefinitionForExcel() {
30158
- // Excel does not support aggregating labels
30159
- if (this.aggregated)
30160
- return undefined;
30161
30168
  const dataSets = this.dataSets
30162
30169
  .map((ds) => toExcelDataset(this.getters, ds))
30163
30170
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -30838,9 +30845,6 @@ stores.inject(MyMetaStore, storeInstance);
30838
30845
  return new LineChart(definition, this.sheetId, this.getters);
30839
30846
  }
30840
30847
  getDefinitionForExcel() {
30841
- // Excel does not support aggregating labels
30842
- if (this.aggregated)
30843
- return undefined;
30844
30848
  const dataSets = this.dataSets
30845
30849
  .map((ds) => toExcelDataset(this.getters, ds))
30846
30850
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -30977,9 +30981,6 @@ stores.inject(MyMetaStore, storeInstance);
30977
30981
  return new PieChart(definition, sheetId, this.getters);
30978
30982
  }
30979
30983
  getDefinitionForExcel() {
30980
- // Excel does not support aggregating labels
30981
- if (this.aggregated)
30982
- return undefined;
30983
30984
  const dataSets = this.dataSets
30984
30985
  .map((ds) => toExcelDataset(this.getters, ds))
30985
30986
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -33455,18 +33456,28 @@ stores.inject(MyMetaStore, storeInstance);
33455
33456
  function useInterval(callback, delay) {
33456
33457
  let intervalId;
33457
33458
  const { setInterval, clearInterval } = window;
33459
+ const pause = () => {
33460
+ clearInterval(intervalId);
33461
+ intervalId = undefined;
33462
+ };
33463
+ const safeCallback = () => {
33464
+ try {
33465
+ callback();
33466
+ }
33467
+ catch (e) {
33468
+ pause();
33469
+ throw e;
33470
+ }
33471
+ };
33458
33472
  owl.useEffect(() => {
33459
- intervalId = setInterval(callback, delay);
33473
+ intervalId = setInterval(safeCallback, delay);
33460
33474
  return () => clearInterval(intervalId);
33461
33475
  }, () => [delay]);
33462
33476
  return {
33463
- pause: () => {
33464
- clearInterval(intervalId);
33465
- intervalId = undefined;
33466
- },
33477
+ pause,
33467
33478
  resume: () => {
33468
33479
  if (intervalId === undefined) {
33469
- intervalId = setInterval(callback, delay);
33480
+ intervalId = setInterval(safeCallback, delay);
33470
33481
  }
33471
33482
  },
33472
33483
  };
@@ -50455,7 +50466,7 @@ stores.inject(MyMetaStore, storeInstance);
50455
50466
  position: absolute;
50456
50467
  top: 0;
50457
50468
  left: ${HEADER_WIDTH}px;
50458
- right: 0;
50469
+ right: ${SCROLLBAR_WIDTH}px;
50459
50470
  height: ${HEADER_HEIGHT}px;
50460
50471
  &.o-dragging {
50461
50472
  cursor: grabbing;
@@ -50621,9 +50632,8 @@ stores.inject(MyMetaStore, storeInstance);
50621
50632
  position: absolute;
50622
50633
  top: ${HEADER_HEIGHT}px;
50623
50634
  left: 0;
50624
- right: 0;
50635
+ bottom: ${SCROLLBAR_WIDTH}px;
50625
50636
  width: ${HEADER_WIDTH}px;
50626
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
50627
50637
  &.o-dragging {
50628
50638
  cursor: grabbing;
50629
50639
  }
@@ -58624,6 +58634,15 @@ stores.inject(MyMetaStore, storeInstance);
58624
58634
  }
58625
58635
  }
58626
58636
  class SpreadsheetPivotCorePlugin extends CorePlugin {
58637
+ allowDispatch(cmd) {
58638
+ switch (cmd.type) {
58639
+ case "ADD_PIVOT":
58640
+ case "UPDATE_PIVOT":
58641
+ const definition = cmd.pivot;
58642
+ return this.checkDataSetValidity(definition);
58643
+ }
58644
+ return "Success" /* CommandResult.Success */;
58645
+ }
58627
58646
  adaptRanges(applyChange) {
58628
58647
  for (const pivotId of this.getters.getPivotIds()) {
58629
58648
  const definition = this.getters.getPivotCoreDefinition(pivotId);
@@ -58642,6 +58661,16 @@ stores.inject(MyMetaStore, storeInstance);
58642
58661
  }
58643
58662
  }
58644
58663
  }
58664
+ checkDataSetValidity(definition) {
58665
+ if (definition.type === "SPREADSHEET" && definition.dataSet) {
58666
+ const { zone, sheetId } = definition.dataSet;
58667
+ if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) {
58668
+ return "InvalidDataSet" /* CommandResult.InvalidDataSet */;
58669
+ }
58670
+ return this.getters.checkZonesExistInSheet(sheetId, [zone]);
58671
+ }
58672
+ return "Success" /* CommandResult.Success */;
58673
+ }
58645
58674
  }
58646
58675
 
58647
58676
  class TableStylePlugin extends CorePlugin {
@@ -61441,7 +61470,7 @@ stores.inject(MyMetaStore, storeInstance);
61441
61470
  tables = {};
61442
61471
  handle(cmd) {
61443
61472
  if (invalidateEvaluationCommands.has(cmd.type) ||
61444
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
61473
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
61445
61474
  cmd.type === "EVALUATE_CELLS") {
61446
61475
  this.tables = {};
61447
61476
  return;
@@ -65298,7 +65327,7 @@ stores.inject(MyMetaStore, storeInstance);
65298
65327
  tableStyles = {};
65299
65328
  handle(cmd) {
65300
65329
  if (invalidateEvaluationCommands.has(cmd.type) ||
65301
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
65330
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
65302
65331
  cmd.type === "EVALUATE_CELLS") {
65303
65332
  this.tableStyles = {};
65304
65333
  return;
@@ -67262,6 +67291,8 @@ stores.inject(MyMetaStore, storeInstance);
67262
67291
  });
67263
67292
  this.selectCell(col, row);
67264
67293
  }
67294
+ const { col, row } = this.gridSelection.anchor.cell;
67295
+ this.moveClient({ sheetId: this.activeSheet.id, col, row });
67265
67296
  }
67266
67297
  /**
67267
67298
  * Ensure selections are not outside sheet boundaries.
@@ -68001,8 +68032,11 @@ stores.inject(MyMetaStore, storeInstance);
68001
68032
  case "REMOVE_TABLE":
68002
68033
  case "UPDATE_TABLE":
68003
68034
  case "UPDATE_FILTER":
68004
- this.sheetsWithDirtyViewports.add(cmd.sheetId);
68005
- break;
68035
+ case "UNFREEZE_ROWS":
68036
+ case "UNFREEZE_COLUMNS":
68037
+ case "FREEZE_COLUMNS":
68038
+ case "FREEZE_ROWS":
68039
+ case "UNFREEZE_COLUMNS_ROWS":
68006
68040
  case "REMOVE_COLUMNS_ROWS":
68007
68041
  case "RESIZE_COLUMNS_ROWS":
68008
68042
  case "HIDE_COLUMNS_ROWS":
@@ -68015,11 +68049,9 @@ stores.inject(MyMetaStore, storeInstance);
68015
68049
  case "FOLD_HEADER_GROUPS_IN_ZONE":
68016
68050
  case "UNFOLD_HEADER_GROUPS_IN_ZONE":
68017
68051
  case "UNFOLD_ALL_HEADER_GROUPS":
68018
- case "FOLD_ALL_HEADER_GROUPS": {
68019
- const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.getActiveSheetId();
68020
- this.sheetsWithDirtyViewports.add(sheetId);
68052
+ case "FOLD_ALL_HEADER_GROUPS":
68053
+ this.sheetsWithDirtyViewports.add(cmd.sheetId);
68021
68054
  break;
68022
- }
68023
68055
  case "UPDATE_CELL":
68024
68056
  // update cell content or format can change hidden rows because of data filters
68025
68057
  if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
@@ -68035,13 +68067,6 @@ stores.inject(MyMetaStore, storeInstance);
68035
68067
  case "ACTIVATE_SHEET":
68036
68068
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
68037
68069
  break;
68038
- case "UNFREEZE_ROWS":
68039
- case "UNFREEZE_COLUMNS":
68040
- case "FREEZE_COLUMNS":
68041
- case "FREEZE_ROWS":
68042
- case "UNFREEZE_COLUMNS_ROWS":
68043
- this.resetViewports(this.getters.getActiveSheetId());
68044
- break;
68045
68070
  case "SCROLL_TO_CELL":
68046
68071
  this.refreshViewport(this.getters.getActiveSheetId(), { col: cmd.col, row: cmd.row });
68047
68072
  break;
@@ -69219,7 +69244,7 @@ stores.inject(MyMetaStore, storeInstance);
69219
69244
  }
69220
69245
  handle(cmd) {
69221
69246
  if (invalidateEvaluationCommands.has(cmd.type) ||
69222
- (cmd.type === "UPDATE_CELL" && "content" in cmd)) {
69247
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
69223
69248
  this.isDirty = true;
69224
69249
  }
69225
69250
  switch (cmd.type) {
@@ -75780,9 +75805,9 @@ stores.inject(MyMetaStore, storeInstance);
75780
75805
  exports.tokenize = tokenize;
75781
75806
 
75782
75807
 
75783
- __info__.version = "18.1.17";
75784
- __info__.date = "2025-04-25T08:08:46.599Z";
75785
- __info__.hash = "a63687f";
75808
+ __info__.version = "18.1.18";
75809
+ __info__.date = "2025-05-02T12:30:47.822Z";
75810
+ __info__.hash = "29c21c6";
75786
75811
 
75787
75812
 
75788
75813
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);