@odoo/o-spreadsheet 18.0.25 → 18.0.26

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.25
6
- * @date 2025-04-25T08:08:43.377Z
7
- * @hash 24aac2c
5
+ * @version 18.0.26
6
+ * @date 2025-05-02T12:30:31.966Z
7
+ * @hash 5bdf504
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3592,6 +3592,7 @@
3592
3592
  CommandResult["ValueCellIsInvalidFormula"] = "ValueCellIsInvalidFormula";
3593
3593
  CommandResult["InvalidDefinition"] = "InvalidDefinition";
3594
3594
  CommandResult["InvalidColor"] = "InvalidColor";
3595
+ CommandResult["InvalidPivotDataSet"] = "InvalidPivotDataSet";
3595
3596
  })(exports.CommandResult || (exports.CommandResult = {}));
3596
3597
 
3597
3598
  const DEFAULT_LOCALES = [
@@ -16916,6 +16917,7 @@ stores.inject(MyMetaStore, storeInstance);
16916
16917
  canvas = owl.useRef("graphContainer");
16917
16918
  chart;
16918
16919
  currentRuntime;
16920
+ currentDevicePixelRatio = window.devicePixelRatio;
16919
16921
  get background() {
16920
16922
  return this.chartRuntime.background;
16921
16923
  }
@@ -16949,11 +16951,11 @@ stores.inject(MyMetaStore, storeInstance);
16949
16951
  }
16950
16952
  this.currentRuntime = runtime;
16951
16953
  }
16954
+ else if (this.currentDevicePixelRatio !== window.devicePixelRatio) {
16955
+ this.currentDevicePixelRatio = window.devicePixelRatio;
16956
+ this.updateChartJs(deepCopy(this.currentRuntime));
16957
+ }
16952
16958
  });
16953
- owl.useEffect(() => {
16954
- this.currentRuntime = this.chartRuntime;
16955
- this.updateChartJs(deepCopy(this.currentRuntime));
16956
- }, () => [window.devicePixelRatio]);
16957
16959
  }
16958
16960
  createChart(chartData) {
16959
16961
  const canvas = this.canvas.el;
@@ -29058,9 +29060,6 @@ stores.inject(MyMetaStore, storeInstance);
29058
29060
  };
29059
29061
  }
29060
29062
  getDefinitionForExcel() {
29061
- // Excel does not support aggregating labels
29062
- if (this.aggregated)
29063
- return undefined;
29064
29063
  const dataSets = this.dataSets
29065
29064
  .map((ds) => toExcelDataset(this.getters, ds))
29066
29065
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -30301,9 +30300,6 @@ stores.inject(MyMetaStore, storeInstance);
30301
30300
  return new LineChart(definition, this.sheetId, this.getters);
30302
30301
  }
30303
30302
  getDefinitionForExcel() {
30304
- // Excel does not support aggregating labels
30305
- if (this.aggregated)
30306
- return undefined;
30307
30303
  const dataSets = this.dataSets
30308
30304
  .map((ds) => toExcelDataset(this.getters, ds))
30309
30305
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -30414,9 +30410,6 @@ stores.inject(MyMetaStore, storeInstance);
30414
30410
  return new PieChart(definition, sheetId, this.getters);
30415
30411
  }
30416
30412
  getDefinitionForExcel() {
30417
- // Excel does not support aggregating labels
30418
- if (this.aggregated)
30419
- return undefined;
30420
30413
  const dataSets = this.dataSets
30421
30414
  .map((ds) => toExcelDataset(this.getters, ds))
30422
30415
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -32635,18 +32628,28 @@ stores.inject(MyMetaStore, storeInstance);
32635
32628
  function useInterval(callback, delay) {
32636
32629
  let intervalId;
32637
32630
  const { setInterval, clearInterval } = window;
32631
+ const pause = () => {
32632
+ clearInterval(intervalId);
32633
+ intervalId = undefined;
32634
+ };
32635
+ const safeCallback = () => {
32636
+ try {
32637
+ callback();
32638
+ }
32639
+ catch (e) {
32640
+ pause();
32641
+ throw e;
32642
+ }
32643
+ };
32638
32644
  owl.useEffect(() => {
32639
- intervalId = setInterval(callback, delay);
32645
+ intervalId = setInterval(safeCallback, delay);
32640
32646
  return () => clearInterval(intervalId);
32641
32647
  }, () => [delay]);
32642
32648
  return {
32643
- pause: () => {
32644
- clearInterval(intervalId);
32645
- intervalId = undefined;
32646
- },
32649
+ pause,
32647
32650
  resume: () => {
32648
32651
  if (intervalId === undefined) {
32649
- intervalId = setInterval(callback, delay);
32652
+ intervalId = setInterval(safeCallback, delay);
32650
32653
  }
32651
32654
  },
32652
32655
  };
@@ -48366,7 +48369,7 @@ stores.inject(MyMetaStore, storeInstance);
48366
48369
  position: absolute;
48367
48370
  top: 0;
48368
48371
  left: ${HEADER_WIDTH}px;
48369
- right: 0;
48372
+ right: ${SCROLLBAR_WIDTH}px;
48370
48373
  height: ${HEADER_HEIGHT}px;
48371
48374
  &.o-dragging {
48372
48375
  cursor: grabbing;
@@ -48532,9 +48535,8 @@ stores.inject(MyMetaStore, storeInstance);
48532
48535
  position: absolute;
48533
48536
  top: ${HEADER_HEIGHT}px;
48534
48537
  left: 0;
48535
- right: 0;
48538
+ bottom: ${SCROLLBAR_WIDTH}px;
48536
48539
  width: ${HEADER_WIDTH}px;
48537
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
48538
48540
  &.o-dragging {
48539
48541
  cursor: grabbing;
48540
48542
  }
@@ -56619,6 +56621,15 @@ stores.inject(MyMetaStore, storeInstance);
56619
56621
  }
56620
56622
  }
56621
56623
  class SpreadsheetPivotCorePlugin extends CorePlugin {
56624
+ allowDispatch(cmd) {
56625
+ switch (cmd.type) {
56626
+ case "ADD_PIVOT":
56627
+ case "UPDATE_PIVOT":
56628
+ const definition = cmd.pivot;
56629
+ return this.checkDataSetValidity(definition);
56630
+ }
56631
+ return "Success" /* CommandResult.Success */;
56632
+ }
56622
56633
  adaptRanges(applyChange) {
56623
56634
  for (const pivotId of this.getters.getPivotIds()) {
56624
56635
  const definition = this.getters.getPivotCoreDefinition(pivotId);
@@ -56637,6 +56648,16 @@ stores.inject(MyMetaStore, storeInstance);
56637
56648
  }
56638
56649
  }
56639
56650
  }
56651
+ checkDataSetValidity(definition) {
56652
+ if (definition.type === "SPREADSHEET" && definition.dataSet) {
56653
+ const { zone, sheetId } = definition.dataSet;
56654
+ if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) {
56655
+ return "InvalidDataSet" /* CommandResult.InvalidDataSet */;
56656
+ }
56657
+ return this.getters.checkZonesExistInSheet(sheetId, [zone]);
56658
+ }
56659
+ return "Success" /* CommandResult.Success */;
56660
+ }
56640
56661
  }
56641
56662
 
56642
56663
  class TableStylePlugin extends CorePlugin {
@@ -59474,7 +59495,7 @@ stores.inject(MyMetaStore, storeInstance);
59474
59495
  tables = {};
59475
59496
  handle(cmd) {
59476
59497
  if (invalidateEvaluationCommands.has(cmd.type) ||
59477
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
59498
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
59478
59499
  cmd.type === "EVALUATE_CELLS") {
59479
59500
  this.tables = {};
59480
59501
  return;
@@ -63278,7 +63299,7 @@ stores.inject(MyMetaStore, storeInstance);
63278
63299
  tableStyles = {};
63279
63300
  handle(cmd) {
63280
63301
  if (invalidateEvaluationCommands.has(cmd.type) ||
63281
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
63302
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
63282
63303
  cmd.type === "EVALUATE_CELLS") {
63283
63304
  this.tableStyles = {};
63284
63305
  return;
@@ -65242,6 +65263,8 @@ stores.inject(MyMetaStore, storeInstance);
65242
65263
  });
65243
65264
  this.selectCell(col, row);
65244
65265
  }
65266
+ const { col, row } = this.gridSelection.anchor.cell;
65267
+ this.moveClient({ sheetId: this.activeSheet.id, col, row });
65245
65268
  }
65246
65269
  /**
65247
65270
  * Ensure selections are not outside sheet boundaries.
@@ -65974,8 +65997,11 @@ stores.inject(MyMetaStore, storeInstance);
65974
65997
  case "REMOVE_TABLE":
65975
65998
  case "UPDATE_TABLE":
65976
65999
  case "UPDATE_FILTER":
65977
- this.sheetsWithDirtyViewports.add(cmd.sheetId);
65978
- break;
66000
+ case "UNFREEZE_ROWS":
66001
+ case "UNFREEZE_COLUMNS":
66002
+ case "FREEZE_COLUMNS":
66003
+ case "FREEZE_ROWS":
66004
+ case "UNFREEZE_COLUMNS_ROWS":
65979
66005
  case "REMOVE_COLUMNS_ROWS":
65980
66006
  case "RESIZE_COLUMNS_ROWS":
65981
66007
  case "HIDE_COLUMNS_ROWS":
@@ -65988,11 +66014,9 @@ stores.inject(MyMetaStore, storeInstance);
65988
66014
  case "FOLD_HEADER_GROUPS_IN_ZONE":
65989
66015
  case "UNFOLD_HEADER_GROUPS_IN_ZONE":
65990
66016
  case "UNFOLD_ALL_HEADER_GROUPS":
65991
- case "FOLD_ALL_HEADER_GROUPS": {
65992
- const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.getActiveSheetId();
65993
- this.sheetsWithDirtyViewports.add(sheetId);
66017
+ case "FOLD_ALL_HEADER_GROUPS":
66018
+ this.sheetsWithDirtyViewports.add(cmd.sheetId);
65994
66019
  break;
65995
- }
65996
66020
  case "UPDATE_CELL":
65997
66021
  // update cell content or format can change hidden rows because of data filters
65998
66022
  if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
@@ -66008,13 +66032,6 @@ stores.inject(MyMetaStore, storeInstance);
66008
66032
  case "ACTIVATE_SHEET":
66009
66033
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
66010
66034
  break;
66011
- case "UNFREEZE_ROWS":
66012
- case "UNFREEZE_COLUMNS":
66013
- case "FREEZE_COLUMNS":
66014
- case "FREEZE_ROWS":
66015
- case "UNFREEZE_COLUMNS_ROWS":
66016
- this.resetViewports(this.getters.getActiveSheetId());
66017
- break;
66018
66035
  case "DELETE_SHEET":
66019
66036
  this.sheetsWithDirtyViewports.delete(cmd.sheetId);
66020
66037
  break;
@@ -67194,7 +67211,7 @@ stores.inject(MyMetaStore, storeInstance);
67194
67211
  }
67195
67212
  handle(cmd) {
67196
67213
  if (invalidateEvaluationCommands.has(cmd.type) ||
67197
- (cmd.type === "UPDATE_CELL" && "content" in cmd)) {
67214
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
67198
67215
  this.isDirty = true;
67199
67216
  }
67200
67217
  switch (cmd.type) {
@@ -73776,9 +73793,9 @@ stores.inject(MyMetaStore, storeInstance);
73776
73793
  exports.tokenize = tokenize;
73777
73794
 
73778
73795
 
73779
- __info__.version = "18.0.25";
73780
- __info__.date = "2025-04-25T08:08:43.377Z";
73781
- __info__.hash = "24aac2c";
73796
+ __info__.version = "18.0.26";
73797
+ __info__.date = "2025-05-02T12:30:31.966Z";
73798
+ __info__.hash = "5bdf504";
73782
73799
 
73783
73800
 
73784
73801
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);