@odoo/o-spreadsheet 17.2.18 → 17.2.20

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.18
7
- * @date 2024-07-24T10:28:05.353Z
8
- * @hash 6c65743
6
+ * @version 17.2.20
7
+ * @date 2024-08-09T12:24:12.002Z
8
+ * @hash d667a15
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -486,7 +486,7 @@
486
486
  let timeout = undefined;
487
487
  const debounced = function () {
488
488
  const context = this;
489
- const args = arguments;
489
+ const args = Array.from(arguments);
490
490
  function later() {
491
491
  timeout = undefined;
492
492
  if (!immediate) {
@@ -714,7 +714,7 @@
714
714
  */
715
715
  function largeMax(array) {
716
716
  let len = array.length;
717
- if (len < 100000)
717
+ if (len < 100_000)
718
718
  return Math.max(...array);
719
719
  let max = -Infinity;
720
720
  while (len--) {
@@ -728,7 +728,7 @@
728
728
  */
729
729
  function largeMin(array) {
730
730
  let len = array.length;
731
- if (len < 100000)
731
+ if (len < 100_000)
732
732
  return Math.min(...array);
733
733
  let min = +Infinity;
734
734
  while (len--) {
@@ -2669,13 +2669,16 @@
2669
2669
  }
2670
2670
  return new RegExp("^" + exp + "$", "i");
2671
2671
  });
2672
- function evaluatePredicate(value = "", criterion) {
2672
+ function evaluatePredicate(value = "", criterion, locale) {
2673
2673
  const { operator, operand } = criterion;
2674
2674
  if (operand === undefined || value === null || operand === null) {
2675
2675
  return false;
2676
2676
  }
2677
2677
  if (typeof operand === "number" && operator === "=") {
2678
- return value.toString() === operand.toString();
2678
+ if (typeof value === "string" && (isNumber(value, locale) || isDateTime(value, locale))) {
2679
+ return toNumber(value, locale) === operand;
2680
+ }
2681
+ return value === operand;
2679
2682
  }
2680
2683
  if (operator === "<>" || operator === "=") {
2681
2684
  let result;
@@ -2757,7 +2760,7 @@
2757
2760
  for (let k = 0; k < countArg - 1; k += 2) {
2758
2761
  const criteriaValue = toMatrix(args[k])[i][j].value;
2759
2762
  const criterion = predicates[k / 2];
2760
- validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion);
2763
+ validatedPredicates = evaluatePredicate(criteriaValue ?? undefined, criterion, locale);
2761
2764
  if (!validatedPredicates) {
2762
2765
  break;
2763
2766
  }
@@ -7181,7 +7184,7 @@
7181
7184
  }
7182
7185
  function numberCell(value, format, formattedValue) {
7183
7186
  return {
7184
- value: value || 0,
7187
+ value: value || 0, // necessary to avoid "-0" and NaN values,
7185
7188
  format,
7186
7189
  formattedValue,
7187
7190
  type: CellValueType.number,
@@ -19629,8 +19632,8 @@ stores.inject(MyMetaStore, storeInstance);
19629
19632
  function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true }) {
19630
19633
  const options = {
19631
19634
  // https://www.chartjs.org/docs/latest/general/responsive.html
19632
- responsive: true,
19633
- maintainAspectRatio: false,
19635
+ responsive: true, // will resize when its container is resized
19636
+ maintainAspectRatio: false, // doesn't maintain the aspect ration (width/height =2 by default) so the user has the choice of the exact layout
19634
19637
  layout: {
19635
19638
  padding: { left: 20, right: 20, top: chart.title ? 10 : 25, bottom: 10 },
19636
19639
  },
@@ -19676,7 +19679,7 @@ stores.inject(MyMetaStore, storeInstance);
19676
19679
  labels: truncateLabels ? labels.map(truncateLabel) : labels,
19677
19680
  datasets: [],
19678
19681
  },
19679
- platform: undefined,
19682
+ platform: undefined, // This key is optional and will be set by chart.js
19680
19683
  plugins: [],
19681
19684
  };
19682
19685
  }
@@ -19953,7 +19956,7 @@ stores.inject(MyMetaStore, storeInstance);
19953
19956
  },
19954
19957
  y: {
19955
19958
  position: chart.verticalAxisPosition,
19956
- beginAtZero: true,
19959
+ beginAtZero: true, // the origin of the y axis is always zero
19957
19960
  ticks: {
19958
19961
  color: fontColor,
19959
19962
  callback: (value) => {
@@ -20477,7 +20480,7 @@ stores.inject(MyMetaStore, storeInstance);
20477
20480
  },
20478
20481
  y: {
20479
20482
  position: chart.verticalAxisPosition,
20480
- beginAtZero: true,
20483
+ beginAtZero: true, // the origin of the y axis is always zero
20481
20484
  ticks: {
20482
20485
  color: fontColor,
20483
20486
  callback: (value) => {
@@ -20567,7 +20570,7 @@ stores.inject(MyMetaStore, storeInstance);
20567
20570
  const dataset = {
20568
20571
  label,
20569
20572
  data,
20570
- tension: 0,
20573
+ tension: 0, // 0 -> render straight lines, which is much faster
20571
20574
  borderColor: color,
20572
20575
  backgroundColor,
20573
20576
  pointBackgroundColor: color,
@@ -20789,7 +20792,7 @@ stores.inject(MyMetaStore, storeInstance);
20789
20792
  ...this.getDefinition(),
20790
20793
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
20791
20794
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
20792
- verticalAxisPosition: "left",
20795
+ verticalAxisPosition: "left", //TODO ExcelChartDefinition should be adapted, but can be done later
20793
20796
  dataSets,
20794
20797
  labelRange,
20795
20798
  };
@@ -23356,7 +23359,7 @@ stores.inject(MyMetaStore, storeInstance);
23356
23359
  style: { fillColor: colorSet.highlight, textColor: "#FFFFFF" },
23357
23360
  border: { bottom: { color: colorSet.highlight, style: "thin" } },
23358
23361
  },
23359
- totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } },
23362
+ totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } }, // @compatibility: should be double line
23360
23363
  firstRowStripe: { border: { bottom: { color: colorSet.highlight, style: "thin" } } },
23361
23364
  secondRowStripe: { border: { bottom: { color: colorSet.highlight, style: "thin" } } },
23362
23365
  });
@@ -23374,7 +23377,7 @@ stores.inject(MyMetaStore, storeInstance);
23374
23377
  },
23375
23378
  },
23376
23379
  headerRow: { border: { bottom: { color: colorSet.highlight, style: "medium" } } },
23377
- totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } },
23380
+ totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } }, // @compatibility: should be double line
23378
23381
  firstRowStripe: { style: { fillColor: colorSet.light } },
23379
23382
  firstColumnStripe: { style: { fillColor: colorSet.light } },
23380
23383
  });
@@ -23393,7 +23396,7 @@ stores.inject(MyMetaStore, storeInstance);
23393
23396
  headerRow: {
23394
23397
  style: { fillColor: colorSet.highlight, textColor: "#FFFFFF" },
23395
23398
  },
23396
- totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } },
23399
+ totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } }, // @compatibility: should be double line
23397
23400
  firstRowStripe: { style: { fillColor: colorSet.light } },
23398
23401
  firstColumnStripe: { style: { fillColor: colorSet.light } },
23399
23402
  });
@@ -23429,7 +23432,7 @@ stores.inject(MyMetaStore, storeInstance);
23429
23432
  bottom: { color: "#000000", style: "medium" },
23430
23433
  },
23431
23434
  },
23432
- totalRow: { border: { top: { color: "#000000", style: "medium" } } },
23435
+ totalRow: { border: { top: { color: "#000000", style: "medium" } } }, // @compatibility: should be double line
23433
23436
  headerRow: {
23434
23437
  style: { fillColor: colorSet.highlight, textColor: "#FFFFFF" },
23435
23438
  border: { bottom: { color: "#000000", style: "medium" } },
@@ -23453,7 +23456,7 @@ stores.inject(MyMetaStore, storeInstance);
23453
23456
  },
23454
23457
  style: { fillColor: colorSet.light },
23455
23458
  },
23456
- totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } },
23459
+ totalRow: { border: { top: { color: colorSet.highlight, style: "medium" } } }, // @compatibility: should be double line
23457
23460
  firstRowStripe: { style: { fillColor: colorSet.medium } },
23458
23461
  firstColumnStripe: { style: { fillColor: colorSet.medium } },
23459
23462
  });
@@ -23484,7 +23487,7 @@ stores.inject(MyMetaStore, storeInstance);
23484
23487
  category: "dark",
23485
23488
  colorName: colorSet.name,
23486
23489
  wholeTable: { style: { fillColor: colorSet.light } },
23487
- totalRow: { border: { top: { color: "#000000", style: "medium" } } },
23490
+ totalRow: { border: { top: { color: "#000000", style: "medium" } } }, // @compatibility: should be double line
23488
23491
  headerRow: { style: { fillColor: colorSet.highlight, textColor: "#FFFFFF" } },
23489
23492
  firstRowStripe: { style: { fillColor: colorSet.medium } },
23490
23493
  firstColumnStripe: { style: { fillColor: colorSet.medium } },
@@ -32256,7 +32259,9 @@ stores.inject(MyMetaStore, storeInstance);
32256
32259
  argToFocus: 0,
32257
32260
  });
32258
32261
  compositionActive = false;
32262
+ spreadsheetRect = useSpreadsheetRect();
32259
32263
  get assistantStyle() {
32264
+ const composerRect = this.composerRef.el.getBoundingClientRect();
32260
32265
  const assistantStyle = {};
32261
32266
  assistantStyle["min-width"] = `${this.props.rect?.width || ASSISTANT_WIDTH}px`;
32262
32267
  const proposals = this.autoCompleteState.provider?.proposals;
@@ -32283,6 +32288,9 @@ stores.inject(MyMetaStore, storeInstance);
32283
32288
  }
32284
32289
  else if (this.props.delimitation) {
32285
32290
  assistantStyle["max-height"] = `${this.props.delimitation.height}px`;
32291
+ if (composerRect.left + ASSISTANT_WIDTH > this.spreadsheetRect.width) {
32292
+ assistantStyle.right = `0px`;
32293
+ }
32286
32294
  }
32287
32295
  return cssPropertiesToCss(assistantStyle);
32288
32296
  }
@@ -35682,7 +35690,7 @@ stores.inject(MyMetaStore, storeInstance);
35682
35690
  onScroll(offset) {
35683
35691
  const { scrollX } = this.env.model.getters.getActiveSheetDOMScrollInfo();
35684
35692
  this.env.model.dispatch("SET_VIEWPORT_OFFSET", {
35685
- offsetX: scrollX,
35693
+ offsetX: scrollX, // offsetX is the same
35686
35694
  offsetY: offset,
35687
35695
  });
35688
35696
  }
@@ -35971,8 +35979,8 @@ stores.inject(MyMetaStore, storeInstance);
35971
35979
  "Ctrl+Shift+L": () => this.setHorizontalAlign("left"),
35972
35980
  "Ctrl+Shift+R": () => this.setHorizontalAlign("right"),
35973
35981
  "Ctrl+Shift+V": () => PASTE_AS_VALUE_ACTION(this.env),
35974
- "Ctrl+Shift+<": () => this.clearFormatting(),
35975
- "Ctrl+<": () => this.clearFormatting(),
35982
+ "Ctrl+Shift+<": () => this.clearFormatting(), // for qwerty
35983
+ "Ctrl+<": () => this.clearFormatting(), // for azerty
35976
35984
  "Ctrl+Shift+ ": () => {
35977
35985
  this.env.model.selection.selectAll();
35978
35986
  },
@@ -36773,10 +36781,10 @@ stores.inject(MyMetaStore, storeInstance);
36773
36781
  const CF_TYPE_CONVERSION_MAP = {
36774
36782
  aboveAverage: undefined,
36775
36783
  expression: undefined,
36776
- cellIs: undefined,
36777
- colorScale: undefined,
36784
+ cellIs: undefined, // exist but isn't an operator in o_spreadsheet
36785
+ colorScale: undefined, // exist but isn't an operator in o_spreadsheet
36778
36786
  dataBar: undefined,
36779
- iconSet: undefined,
36787
+ iconSet: undefined, // exist but isn't an operator in o_spreadsheet
36780
36788
  top10: undefined,
36781
36789
  uniqueValues: undefined,
36782
36790
  duplicateValues: undefined,
@@ -37011,7 +37019,7 @@ stores.inject(MyMetaStore, storeInstance);
37011
37019
  61: "993366",
37012
37020
  62: "333399",
37013
37021
  63: "333333",
37014
- 64: "000000",
37022
+ 64: "000000", // system foreground
37015
37023
  65: "FFFFFF", // system background
37016
37024
  };
37017
37025
  const IMAGE_MIMETYPE_TO_EXTENSION_MAPPING = {
@@ -40654,12 +40662,13 @@ stores.inject(MyMetaStore, storeInstance);
40654
40662
  this.clearBorders(cmd.sheetId, cmd.target);
40655
40663
  break;
40656
40664
  case "REMOVE_COLUMNS_ROWS":
40657
- for (let el of [...cmd.elements].sort((a, b) => b - a)) {
40665
+ const elements = [...cmd.elements].sort((a, b) => b - a);
40666
+ for (const group of groupConsecutive(elements)) {
40658
40667
  if (cmd.dimension === "COL") {
40659
- this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
40668
+ this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
40660
40669
  }
40661
40670
  else {
40662
- this.shiftBordersVertically(cmd.sheetId, el + 1, -1);
40671
+ this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
40663
40672
  }
40664
40673
  }
40665
40674
  break;
@@ -44130,7 +44139,7 @@ stores.inject(MyMetaStore, storeInstance);
44130
44139
  * @param sheetXC the string description of a range, in the form SheetName!XC:XC
44131
44140
  */
44132
44141
  getRangeFromSheetXC(defaultSheetId, sheetXC) {
44133
- if (!rangeReference.test(sheetXC)) {
44142
+ if (!rangeReference.test(sheetXC) || !this.getters.tryGetSheet(defaultSheetId)) {
44134
44143
  return new RangeImpl({
44135
44144
  sheetId: "",
44136
44145
  zone: { left: -1, top: -1, right: -1, bottom: -1 },
@@ -45024,12 +45033,7 @@ stores.inject(MyMetaStore, storeInstance);
45024
45033
  });
45025
45034
  }
45026
45035
  if (colIndex > deletedColumn) {
45027
- this.dispatch("UPDATE_CELL_POSITION", {
45028
- sheetId: sheet.id,
45029
- cellId: cellId,
45030
- col: colIndex - 1,
45031
- row: rowIndex,
45032
- });
45036
+ this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
45033
45037
  }
45034
45038
  }
45035
45039
  }
@@ -45039,7 +45043,7 @@ stores.inject(MyMetaStore, storeInstance);
45039
45043
  * Move the cells after a column or rows insertion
45040
45044
  */
45041
45045
  moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
45042
- const commands = [];
45046
+ const updates = [];
45043
45047
  for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
45044
45048
  const row = sheet.rows[rowIndex];
45045
45049
  if (dimension !== "rows" || rowIndex >= addedElement) {
@@ -45048,20 +45052,20 @@ stores.inject(MyMetaStore, storeInstance);
45048
45052
  const cellId = row.cells[i];
45049
45053
  if (cellId) {
45050
45054
  if (dimension === "rows" || colIndex >= addedElement) {
45051
- commands.push({
45052
- type: "UPDATE_CELL_POSITION",
45055
+ updates.push({
45053
45056
  sheetId: sheet.id,
45054
45057
  cellId: cellId,
45055
45058
  col: colIndex + (dimension === "columns" ? quantity : 0),
45056
45059
  row: rowIndex + (dimension === "rows" ? quantity : 0),
45060
+ type: "UPDATE_CELL_POSITION",
45057
45061
  });
45058
45062
  }
45059
45063
  }
45060
45064
  }
45061
45065
  }
45062
45066
  }
45063
- for (let cmd of commands.reverse()) {
45064
- this.dispatch(cmd.type, cmd);
45067
+ for (let update of updates.reverse()) {
45068
+ this.updateCellPosition(update);
45065
45069
  }
45066
45070
  }
45067
45071
  /**
@@ -45094,12 +45098,7 @@ stores.inject(MyMetaStore, storeInstance);
45094
45098
  const colIndex = Number(i);
45095
45099
  const cellId = row.cells[i];
45096
45100
  if (cellId) {
45097
- this.dispatch("UPDATE_CELL_POSITION", {
45098
- sheetId: sheet.id,
45099
- cellId: cellId,
45100
- col: colIndex,
45101
- row: rowIndex - numberRows,
45102
- });
45101
+ this.setNewPosition(cellId, sheet.id, colIndex, rowIndex - numberRows);
45103
45102
  }
45104
45103
  }
45105
45104
  }
@@ -47729,18 +47728,23 @@ stores.inject(MyMetaStore, storeInstance);
47729
47728
  this.evaluatedCells = new PositionMap();
47730
47729
  this.evaluate(this.getAllCells());
47731
47730
  }
47732
- evaluateFormula(sheetId, formulaString) {
47733
- const compiledFormula = compile(formulaString);
47734
- const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
47735
- this.updateCompilationParameters();
47736
- const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
47737
- if (isMatrix(result)) {
47738
- return matrixMap(result, (cell) => cell.value);
47731
+ evaluateFormulaResult(sheetId, formulaString) {
47732
+ try {
47733
+ const compiledFormula = compile(formulaString);
47734
+ const ranges = compiledFormula.dependencies.map((xc) => this.getters.getRangeFromSheetXC(sheetId, xc));
47735
+ this.updateCompilationParameters();
47736
+ const result = updateEvalContextAndExecute({ ...compiledFormula, dependencies: ranges }, this.compilationParams, sheetId);
47737
+ if (isMatrix(result)) {
47738
+ return result;
47739
+ }
47740
+ if (result.value === null) {
47741
+ return { value: 0, format: result.format };
47742
+ }
47743
+ return result;
47739
47744
  }
47740
- if (result.value === null) {
47741
- return 0;
47745
+ catch (error) {
47746
+ return handleError(error, "");
47742
47747
  }
47743
- return result.value;
47744
47748
  }
47745
47749
  getAllCells() {
47746
47750
  const positions = this.createEmptyPositionSet();
@@ -48084,6 +48088,7 @@ stores.inject(MyMetaStore, storeInstance);
48084
48088
  class EvaluationPlugin extends UIPlugin {
48085
48089
  static getters = [
48086
48090
  "evaluateFormula",
48091
+ "evaluateFormulaResult",
48087
48092
  "getCorrespondingFormulaCell",
48088
48093
  "getRangeFormattedValues",
48089
48094
  "getRangeValues",
@@ -48146,12 +48151,14 @@ stores.inject(MyMetaStore, storeInstance);
48146
48151
  // Getters
48147
48152
  // ---------------------------------------------------------------------------
48148
48153
  evaluateFormula(sheetId, formulaString) {
48149
- try {
48150
- return this.evaluator.evaluateFormula(sheetId, formulaString);
48151
- }
48152
- catch (error) {
48153
- return error.value || CellErrorType.GenericError;
48154
+ const result = this.evaluateFormulaResult(sheetId, formulaString);
48155
+ if (isMatrix(result)) {
48156
+ return matrixMap(result, (cell) => cell.value);
48154
48157
  }
48158
+ return result.value;
48159
+ }
48160
+ evaluateFormulaResult(sheetId, formulaString) {
48161
+ return this.evaluator.evaluateFormulaResult(sheetId, formulaString);
48155
48162
  }
48156
48163
  /**
48157
48164
  * Return the value of each cell in the range as they are displayed in the grid.
@@ -48292,17 +48299,17 @@ stores.inject(MyMetaStore, storeInstance);
48292
48299
  */
48293
48300
  function sortWithClusters(colorsToSort) {
48294
48301
  const clusters = [
48295
- { leadColor: rgba(255, 0, 0), colors: [] },
48296
- { leadColor: rgba(255, 128, 0), colors: [] },
48297
- { leadColor: rgba(128, 128, 0), colors: [] },
48298
- { leadColor: rgba(128, 255, 0), colors: [] },
48299
- { leadColor: rgba(0, 255, 0), colors: [] },
48300
- { leadColor: rgba(0, 255, 128), colors: [] },
48301
- { leadColor: rgba(0, 255, 255), colors: [] },
48302
- { leadColor: rgba(0, 127, 255), colors: [] },
48303
- { leadColor: rgba(0, 0, 255), colors: [] },
48304
- { leadColor: rgba(127, 0, 255), colors: [] },
48305
- { leadColor: rgba(128, 0, 128), colors: [] },
48302
+ { leadColor: rgba(255, 0, 0), colors: [] }, // red
48303
+ { leadColor: rgba(255, 128, 0), colors: [] }, // orange
48304
+ { leadColor: rgba(128, 128, 0), colors: [] }, // yellow
48305
+ { leadColor: rgba(128, 255, 0), colors: [] }, // chartreuse
48306
+ { leadColor: rgba(0, 255, 0), colors: [] }, // green
48307
+ { leadColor: rgba(0, 255, 128), colors: [] }, // spring green
48308
+ { leadColor: rgba(0, 255, 255), colors: [] }, // cyan
48309
+ { leadColor: rgba(0, 127, 255), colors: [] }, // azure
48310
+ { leadColor: rgba(0, 0, 255), colors: [] }, // blue
48311
+ { leadColor: rgba(127, 0, 255), colors: [] }, // violet
48312
+ { leadColor: rgba(128, 0, 128), colors: [] }, // magenta
48306
48313
  { leadColor: rgba(255, 0, 128), colors: [] }, // rose
48307
48314
  ];
48308
48315
  for (const color of colorsToSort.map(colorToRGBA)) {
@@ -51010,6 +51017,7 @@ stores.inject(MyMetaStore, storeInstance);
51010
51017
  * evaluated and updated with the number type.
51011
51018
  */
51012
51019
  setDecimal(sheetId, zones, step) {
51020
+ const positionsByFormat = {};
51013
51021
  // Find the each cell with a number value and get the format
51014
51022
  for (const zone of zones) {
51015
51023
  for (const position of positions(zone)) {
@@ -51019,15 +51027,20 @@ stores.inject(MyMetaStore, storeInstance);
51019
51027
  // of the format
51020
51028
  this.getters.getLocale();
51021
51029
  const newFormat = changeDecimalPlaces(numberFormat, step);
51022
- // Apply the new format on the whole zone
51023
- this.dispatch("SET_FORMATTING", {
51024
- sheetId,
51025
- target: [positionToZone(position)],
51026
- format: newFormat,
51027
- });
51030
+ positionsByFormat[newFormat] = positionsByFormat[newFormat] || [];
51031
+ positionsByFormat[newFormat].push(position);
51028
51032
  }
51029
51033
  }
51030
51034
  }
51035
+ // consolidate all positions with the same format in bigger zones
51036
+ for (const newFormat in positionsByFormat) {
51037
+ const zones = futureRecomputeZones(positionsByFormat[newFormat].map((position) => positionToZone(position)));
51038
+ this.dispatch("SET_FORMATTING", {
51039
+ sheetId,
51040
+ format: newFormat,
51041
+ target: zones,
51042
+ });
51043
+ }
51031
51044
  }
51032
51045
  /**
51033
51046
  * Take a range of cells and return the format of the first cell containing a
@@ -55423,7 +55436,7 @@ stores.inject(MyMetaStore, storeInstance);
55423
55436
  .map((sheetEl) => sheetEl.getBoundingClientRect())
55424
55437
  .map((rect) => ({
55425
55438
  x: rect.x,
55426
- width: rect.width - 1,
55439
+ width: rect.width - 1, // -1 to compensate negative margin
55427
55440
  y: rect.y,
55428
55441
  height: rect.height,
55429
55442
  }));
@@ -55645,7 +55658,7 @@ stores.inject(MyMetaStore, storeInstance);
55645
55658
  }
55646
55659
  return cssPropertiesToCss({
55647
55660
  top: `${groupBox.headerRect.height / 2}px`,
55648
- left: `calc(50% - 1px)`,
55661
+ left: `calc(50% - 1px)`, // -1px: we want the border to be on the center
55649
55662
  width: `30%`,
55650
55663
  height: `calc(100% - ${groupBox.headerRect.height / 2}px)`,
55651
55664
  "border-left": `1px solid ${HEADER_GROUPING_BORDER_COLOR}`,
@@ -55697,7 +55710,7 @@ stores.inject(MyMetaStore, storeInstance);
55697
55710
  return "";
55698
55711
  }
55699
55712
  return cssPropertiesToCss({
55700
- top: `calc(50% - 1px)`,
55713
+ top: `calc(50% - 1px)`, // -1px: we want the border to be on the center
55701
55714
  left: `${groupBox.headerRect.width / 2}px`,
55702
55715
  width: `calc(100% - ${groupBox.headerRect.width / 2}px)`,
55703
55716
  height: `30%`,
@@ -57115,7 +57128,7 @@ stores.inject(MyMetaStore, storeInstance);
57115
57128
  const gridColSize = GROUP_LAYER_WIDTH * this.rowLayers.length;
57116
57129
  const gridRowSize = GROUP_LAYER_WIDTH * this.colLayers.length;
57117
57130
  return cssPropertiesToCss({
57118
- "grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`,
57131
+ "grid-template-columns": `${gridColSize ? gridColSize + 2 : 0}px auto`, // +2: margins
57119
57132
  "grid-template-rows": `${gridRowSize ? gridRowSize + 2 : 0}px auto`,
57120
57133
  });
57121
57134
  }
@@ -58565,7 +58578,7 @@ stores.inject(MyMetaStore, storeInstance);
58565
58578
  }
58566
58579
 
58567
58580
  class StateObserver {
58568
- changes = [];
58581
+ changes;
58569
58582
  commands = [];
58570
58583
  /**
58571
58584
  * Record the changes which could happen in the given callback, save them in a
@@ -58597,7 +58610,7 @@ stores.inject(MyMetaStore, storeInstance);
58597
58610
  if (value[key] === val) {
58598
58611
  return;
58599
58612
  }
58600
- this.changes.push({
58613
+ this.changes?.push({
58601
58614
  path: args,
58602
58615
  before: value[key],
58603
58616
  after: val,
@@ -59728,7 +59741,7 @@ stores.inject(MyMetaStore, storeInstance);
59728
59741
  const colHeaderXc = toXC(tableZone.left + i, tableZone.top);
59729
59742
  const colName = sheetData.cells[colHeaderXc]?.content || `col${i}`;
59730
59743
  const colAttributes = [
59731
- ["id", i + 1],
59744
+ ["id", i + 1], // id cannot be 0
59732
59745
  ["name", colName],
59733
59746
  ];
59734
59747
  columns.push(escapeXml /*xml*/ `<tableColumn ${formatAttributes(colAttributes)}/>`);
@@ -60885,9 +60898,9 @@ stores.inject(MyMetaStore, storeInstance);
60885
60898
  exports.tokenize = tokenize;
60886
60899
 
60887
60900
 
60888
- __info__.version = "17.2.18";
60889
- __info__.date = "2024-07-24T10:28:05.353Z";
60890
- __info__.hash = "6c65743";
60901
+ __info__.version = "17.2.20";
60902
+ __info__.date = "2024-08-09T12:24:12.002Z";
60903
+ __info__.hash = "d667a15";
60891
60904
 
60892
60905
 
60893
60906
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);