@odoo/o-spreadsheet 18.3.18 → 18.3.19

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.3.18
6
- * @date 2025-08-26T10:14:21.408Z
7
- * @hash ec2777d
5
+ * @version 18.3.19
6
+ * @date 2025-09-05T07:38:30.661Z
7
+ * @hash 77fd307
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3498,6 +3498,7 @@
3498
3498
  "AUTOFILL_CELL",
3499
3499
  "SET_BORDER",
3500
3500
  "SET_ZONE_BORDERS",
3501
+ "SET_BORDERS_ON_TARGET",
3501
3502
  ]);
3502
3503
  const readonlyAllowedCommands = new Set([
3503
3504
  "START",
@@ -6443,40 +6444,44 @@
6443
6444
  };
6444
6445
  }
6445
6446
  function getRangeAdapter(cmd) {
6446
- switch (cmd.type) {
6447
- case "REMOVE_COLUMNS_ROWS":
6448
- return {
6449
- applyChange: getApplyRangeChangeRemoveColRow(cmd),
6450
- sheetId: cmd.sheetId,
6451
- sheetName: cmd.sheetName,
6452
- };
6453
- case "ADD_COLUMNS_ROWS":
6454
- return {
6455
- applyChange: getApplyRangeChangeAddColRow(cmd),
6456
- sheetId: cmd.sheetId,
6457
- sheetName: cmd.sheetName,
6458
- };
6459
- case "DELETE_SHEET":
6460
- return {
6461
- applyChange: getApplyRangeChangeDeleteSheet(cmd),
6462
- sheetId: cmd.sheetId,
6463
- sheetName: cmd.sheetName,
6464
- };
6465
- case "RENAME_SHEET":
6466
- return {
6467
- applyChange: getApplyRangeChangeRenameSheet(cmd),
6468
- sheetId: cmd.sheetId,
6469
- sheetName: cmd.oldName,
6470
- };
6471
- case "MOVE_RANGES":
6472
- return {
6473
- applyChange: getApplyRangeChangeMoveRange(cmd),
6474
- sheetId: cmd.sheetId,
6475
- sheetName: cmd.sheetName,
6476
- };
6447
+ return rangeAdapterRegistry.get(cmd.type)?.(cmd);
6448
+ }
6449
+ class RangeAdapterRegistry extends Registry {
6450
+ add(cmdType, fn) {
6451
+ super.add(cmdType, fn);
6452
+ return this;
6453
+ }
6454
+ get(cmdType) {
6455
+ return this.content[cmdType];
6477
6456
  }
6478
- return undefined;
6479
6457
  }
6458
+ const rangeAdapterRegistry = new RangeAdapterRegistry();
6459
+ rangeAdapterRegistry
6460
+ .add("REMOVE_COLUMNS_ROWS", (cmd) => ({
6461
+ applyChange: getApplyRangeChangeRemoveColRow(cmd),
6462
+ sheetId: cmd.sheetId,
6463
+ sheetName: { old: cmd.sheetName, current: cmd.sheetName },
6464
+ }))
6465
+ .add("ADD_COLUMNS_ROWS", (cmd) => ({
6466
+ applyChange: getApplyRangeChangeAddColRow(cmd),
6467
+ sheetId: cmd.sheetId,
6468
+ sheetName: { old: cmd.sheetName, current: cmd.sheetName },
6469
+ }))
6470
+ .add("DELETE_SHEET", (cmd) => ({
6471
+ applyChange: getApplyRangeChangeDeleteSheet(cmd),
6472
+ sheetId: cmd.sheetId,
6473
+ sheetName: { old: cmd.sheetName, current: cmd.sheetName },
6474
+ }))
6475
+ .add("RENAME_SHEET", (cmd) => ({
6476
+ applyChange: getApplyRangeChangeRenameSheet(cmd),
6477
+ sheetId: cmd.sheetId,
6478
+ sheetName: { old: cmd.oldName, current: cmd.newName },
6479
+ }))
6480
+ .add("MOVE_RANGES", (cmd) => ({
6481
+ applyChange: getApplyRangeChangeMoveRange(cmd),
6482
+ sheetId: cmd.sheetId,
6483
+ sheetName: { old: cmd.sheetName, current: cmd.sheetName },
6484
+ }));
6480
6485
  function getApplyRangeChangeRemoveColRow(cmd) {
6481
6486
  let start = cmd.dimension === "COL" ? "left" : "top";
6482
6487
  let end = cmd.dimension === "COL" ? "right" : "bottom";
@@ -7827,8 +7832,11 @@
7827
7832
  // (a) Swap 2 rows. This multiply the determinant by -1.
7828
7833
  // (b) Multiply a row by a scalar. This multiply the determinant by that scalar.
7829
7834
  // (c) Add to a row a multiple of another row. This does not change the determinant.
7835
+ if (M.length < 1 || M[0].length < 1) {
7836
+ throw new Error("invertMatrix: an empty matrix cannot be inverted.");
7837
+ }
7830
7838
  if (M.length !== M[0].length) {
7831
- throw new EvaluationError(_t("Function [[FUNCTION_NAME]] invert matrix error, only square matrices are invertible"));
7839
+ throw new Error("invertMatrix: only square matrices are invertible");
7832
7840
  }
7833
7841
  let determinant = 1;
7834
7842
  const dim = M.length;
@@ -7897,8 +7905,11 @@
7897
7905
  * Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
7898
7906
  */
7899
7907
  function multiplyMatrices(matrix1, matrix2) {
7908
+ if (matrix1.length < 1 || matrix2.length < 1) {
7909
+ throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
7910
+ }
7900
7911
  if (matrix1.length !== matrix2[0].length) {
7901
- throw new EvaluationError(_t("Cannot multiply matrices : incompatible matrices size."));
7912
+ throw new Error("multiplyMatrices: incompatible matrices size.");
7902
7913
  }
7903
7914
  const rowsM1 = matrix1[0].length;
7904
7915
  const colsM2 = matrix2.length;
@@ -7924,7 +7935,7 @@
7924
7935
  return arg;
7925
7936
  }
7926
7937
  if (!isSingleElementMatrix(arg)) {
7927
- throw new EvaluationError(_t("The value should be a scalar or a 1x1 matrix"));
7938
+ throw new Error("The value should be a scalar or a 1x1 matrix");
7928
7939
  }
7929
7940
  return arg[0][0];
7930
7941
  }
@@ -8161,6 +8172,16 @@
8161
8172
  }
8162
8173
  return values;
8163
8174
  }
8175
+ function assertNonEmptyMatrix(matrix, argName) {
8176
+ assert(() => matrix.length > 0 && matrix[0].length > 0, _t("[[FUNCTION_NAME]] expects the provided values of %(argName)s to be a non-empty matrix.", {
8177
+ argName,
8178
+ }));
8179
+ }
8180
+ function assertNonEmpty(...data) {
8181
+ if (data.length === 0 || data.some((arg) => arg.length === 0)) {
8182
+ throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input data."));
8183
+ }
8184
+ }
8164
8185
 
8165
8186
  const PREVIOUS_VALUE = "(previous)";
8166
8187
  const NEXT_VALUE = "(next)";
@@ -10984,6 +11005,7 @@ stores.inject(MyMetaStore, storeInstance);
10984
11005
  compute: function (matrix1, matrix2) {
10985
11006
  const _matrix1 = toNumberMatrix(matrix1, "matrix1");
10986
11007
  const _matrix2 = toNumberMatrix(matrix2, "matrix2");
11008
+ assert(() => _matrix1.length > 0 && _matrix2.length > 0, _t("The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices."));
10987
11009
  assert(() => _matrix1.length === _matrix2[0].length, _t("In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the \
10988
11010
  number of rows of the second matrix (%s).", _matrix1.length.toString(), _matrix2[0].length.toString()));
10989
11011
  return multiplyMatrices(_matrix1, _matrix2);
@@ -12779,6 +12801,7 @@ stores.inject(MyMetaStore, storeInstance);
12779
12801
  ],
12780
12802
  compute: function (x, dataY, dataX) {
12781
12803
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
12804
+ assertNonEmpty(flatDataX, flatDataY);
12782
12805
  return predictLinearValues([flatDataY], [flatDataX], matrixMap(toMatrix(x), (value) => toNumber(value, this.locale)), true);
12783
12806
  },
12784
12807
  isExported: true,
@@ -12795,6 +12818,7 @@ stores.inject(MyMetaStore, storeInstance);
12795
12818
  arg("b (boolean, default=TRUE)", _t("Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.")),
12796
12819
  ],
12797
12820
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
12821
+ assertNonEmptyMatrix(knownDataY, "known_data_y");
12798
12822
  return expM(predictLinearValues(logM(toNumberMatrix(knownDataY, "the first argument (known_data_y)")), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b)));
12799
12823
  },
12800
12824
  };
@@ -12809,6 +12833,7 @@ stores.inject(MyMetaStore, storeInstance);
12809
12833
  ],
12810
12834
  compute: function (dataY, dataX) {
12811
12835
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
12836
+ assertNonEmpty(flatDataX, flatDataY);
12812
12837
  const [[], [intercept]] = fullLinearRegression([flatDataX], [flatDataY]);
12813
12838
  return intercept;
12814
12839
  },
@@ -12858,6 +12883,7 @@ stores.inject(MyMetaStore, storeInstance);
12858
12883
  arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
12859
12884
  ],
12860
12885
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
12886
+ assertNonEmptyMatrix(dataY, "data_y");
12861
12887
  return fullLinearRegression(toNumberMatrix(dataX, "the first argument (data_y)"), toNumberMatrix(dataY, "the second argument (data_x)"), toBoolean(calculateB), toBoolean(verbose));
12862
12888
  },
12863
12889
  isExported: true,
@@ -12874,6 +12900,7 @@ stores.inject(MyMetaStore, storeInstance);
12874
12900
  arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
12875
12901
  ],
12876
12902
  compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
12903
+ assertNonEmptyMatrix(dataY, "data_y");
12877
12904
  const coeffs = fullLinearRegression(toNumberMatrix(dataX, "the second argument (data_x)"), logM(toNumberMatrix(dataY, "the first argument (data_y)")), toBoolean(calculateB), toBoolean(verbose));
12878
12905
  for (let i = 0; i < coeffs.length; i++) {
12879
12906
  coeffs[i][0] = Math.exp(coeffs[i][0]);
@@ -12895,9 +12922,7 @@ stores.inject(MyMetaStore, storeInstance);
12895
12922
  const flatX = dataX.flat();
12896
12923
  const flatY = dataY.flat();
12897
12924
  assertSameNumberOfElements(flatX, flatY);
12898
- if (flatX.length === 0) {
12899
- return new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
12900
- }
12925
+ assertNonEmpty(flatX, flatY);
12901
12926
  const n = flatX.length;
12902
12927
  let trueN = 0, trueP = 0, falseP = 0, falseN = 0;
12903
12928
  for (let i = 0; i < n; ++i) {
@@ -13061,12 +13086,7 @@ stores.inject(MyMetaStore, storeInstance);
13061
13086
  // -----------------------------------------------------------------------------
13062
13087
  function pearson(dataY, dataX) {
13063
13088
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13064
- if (flatDataX.length === 0) {
13065
- throw new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
13066
- }
13067
- if (flatDataX.length < 2) {
13068
- throw new EvaluationError(_t("[[FUNCTION_NAME]] needs at least two values for both parameters."));
13069
- }
13089
+ assertNonEmpty(flatDataX, flatDataY);
13070
13090
  const n = flatDataX.length;
13071
13091
  let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0, sumYY = 0;
13072
13092
  for (let i = 0; i < n; i++) {
@@ -13155,6 +13175,7 @@ stores.inject(MyMetaStore, storeInstance);
13155
13175
  ],
13156
13176
  compute: function (dataY, dataX, order, intercept = { value: true }) {
13157
13177
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13178
+ assertNonEmpty(flatDataX, flatDataY);
13158
13179
  return polynomialRegression(flatDataY, flatDataX, toNumber(order, this.locale), toBoolean(intercept));
13159
13180
  },
13160
13181
  isExported: false,
@@ -13174,6 +13195,7 @@ stores.inject(MyMetaStore, storeInstance);
13174
13195
  compute: function (x, dataY, dataX, order, intercept = { value: true }) {
13175
13196
  const _order = toNumber(order, this.locale);
13176
13197
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13198
+ assertNonEmpty(flatDataX, flatDataY);
13177
13199
  const coeffs = polynomialRegression(flatDataY, flatDataX, _order, toBoolean(intercept)).flat();
13178
13200
  return matrixMap(toMatrix(x), (xij) => evaluatePolynomial(coeffs, toNumber(xij, this.locale), _order));
13179
13201
  },
@@ -13290,6 +13312,7 @@ stores.inject(MyMetaStore, storeInstance);
13290
13312
  ],
13291
13313
  compute: function (dataY, dataX) {
13292
13314
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13315
+ assertNonEmpty(flatDataX, flatDataY);
13293
13316
  const [[slope]] = fullLinearRegression([flatDataX], [flatDataY]);
13294
13317
  return slope;
13295
13318
  },
@@ -13338,6 +13361,7 @@ stores.inject(MyMetaStore, storeInstance);
13338
13361
  ],
13339
13362
  compute: function (dataX, dataY) {
13340
13363
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13364
+ assertNonEmpty(flatDataX, flatDataY);
13341
13365
  const n = flatDataX.length;
13342
13366
  const order = flatDataX.map((e, i) => [e, flatDataY[i]]);
13343
13367
  order.sort((a, b) => a[0] - b[0]);
@@ -13448,6 +13472,7 @@ stores.inject(MyMetaStore, storeInstance);
13448
13472
  ],
13449
13473
  compute: function (dataY, dataX) {
13450
13474
  const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
13475
+ assertNonEmpty(flatDataX, flatDataY);
13451
13476
  const data = fullLinearRegression([flatDataX], [flatDataY], true, true);
13452
13477
  return data[1][2];
13453
13478
  },
@@ -13465,6 +13490,7 @@ stores.inject(MyMetaStore, storeInstance);
13465
13490
  arg("b (boolean, optional, default=TRUE)", _t("Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.")),
13466
13491
  ],
13467
13492
  compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
13493
+ assertNonEmptyMatrix(knownDataY, "known_data_y");
13468
13494
  return predictLinearValues(toNumberMatrix(knownDataY, "the first argument (known_data_y)"), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b));
13469
13495
  },
13470
13496
  };
@@ -20601,7 +20627,7 @@ stores.inject(MyMetaStore, storeInstance);
20601
20627
  function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
20602
20628
  const sheetName = splitReference(sheetXC).sheetName;
20603
20629
  if (sheetName
20604
- ? !isSheetNameEqual(sheetName, applyChange.sheetName)
20630
+ ? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
20605
20631
  : defaultSheetId !== applyChange.sheetId) {
20606
20632
  return sheetXC;
20607
20633
  }
@@ -20618,7 +20644,7 @@ stores.inject(MyMetaStore, storeInstance);
20618
20644
  }
20619
20645
  function getSheetNameGetter(applyChange) {
20620
20646
  return (sheetId) => {
20621
- return sheetId === applyChange.sheetId ? applyChange.sheetName : "";
20647
+ return sheetId === applyChange.sheetId ? applyChange.sheetName.current : "";
20622
20648
  };
20623
20649
  }
20624
20650
  function defaultGetSheetSize(sheetId) {
@@ -27581,9 +27607,13 @@ stores.inject(MyMetaStore, storeInstance);
27581
27607
  : undefined,
27582
27608
  };
27583
27609
  }
27584
- updateRanges(applyChange) {
27610
+ updateRanges(applyChange, sheetId, adaptSheetName) {
27585
27611
  const dataRange = adaptChartRange(this.dataRange, applyChange);
27586
- const adaptFormula = (formula) => this.getters.adaptFormulaStringDependencies(this.sheetId, formula, applyChange);
27612
+ const adaptFormula = (formula) => adaptFormulaStringRanges(this.sheetId, formula, {
27613
+ applyChange,
27614
+ sheetId,
27615
+ sheetName: adaptSheetName,
27616
+ });
27587
27617
  const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
27588
27618
  const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
27589
27619
  return new GaugeChart(definition, this.sheetId, this.getters);
@@ -30210,7 +30240,8 @@ stores.inject(MyMetaStore, storeInstance);
30210
30240
  .add("HIDE_COLUMNS_ROWS", inverseHideColumnsRows)
30211
30241
  .add("UNHIDE_COLUMNS_ROWS", inverseUnhideColumnsRows)
30212
30242
  .add("CREATE_TABLE_STYLE", inverseCreateTableStyle)
30213
- .add("ADD_PIVOT", inverseAddPivot);
30243
+ .add("ADD_PIVOT", inverseAddPivot)
30244
+ .add("RENAME_SHEET", inverseRenameSheet);
30214
30245
  for (const cmd of coreTypes.values()) {
30215
30246
  if (!inverseCommandRegistry.contains(cmd)) {
30216
30247
  inverseCommandRegistry.add(cmd, identity);
@@ -30308,6 +30339,16 @@ stores.inject(MyMetaStore, storeInstance);
30308
30339
  function inverseCreateTableStyle(cmd) {
30309
30340
  return [{ type: "REMOVE_TABLE_STYLE", tableStyleId: cmd.tableStyleId }];
30310
30341
  }
30342
+ function inverseRenameSheet(cmd) {
30343
+ return [
30344
+ {
30345
+ type: "RENAME_SHEET",
30346
+ sheetId: cmd.sheetId,
30347
+ oldName: cmd.newName,
30348
+ newName: cmd.oldName,
30349
+ },
30350
+ ];
30351
+ }
30311
30352
 
30312
30353
  /**
30313
30354
  * The class Registry is extended in order to add the function addChild
@@ -31557,9 +31598,9 @@ stores.inject(MyMetaStore, storeInstance);
31557
31598
  if (!rule.operator || !rule.formula || rule.formula.length === 0)
31558
31599
  continue;
31559
31600
  operator = convertCFCellIsOperator(rule.operator);
31560
- values.push(rule.formula[0]);
31601
+ values.push(prefixFormula(rule.formula[0]));
31561
31602
  if (rule.formula.length === 2) {
31562
- values.push(rule.formula[1]);
31603
+ values.push(prefixFormula(rule.formula[1]));
31563
31604
  }
31564
31605
  break;
31565
31606
  }
@@ -31717,6 +31758,11 @@ stores.inject(MyMetaStore, storeInstance);
31717
31758
  ? ICON_SETS[iconSet].neutral
31718
31759
  : ICON_SETS[iconSet].good;
31719
31760
  }
31761
+ /** Prefix the string by "=" if the string looks like a formula */
31762
+ function prefixFormula(formula) {
31763
+ const tokens = tokenize(formula);
31764
+ return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
31765
+ }
31720
31766
  // ---------------------------------------------------------------------------
31721
31767
  // Warnings
31722
31768
  // ---------------------------------------------------------------------------
@@ -31979,7 +32025,7 @@ stores.inject(MyMetaStore, storeInstance);
31979
32025
  function getRowPosition(rowIndex, sheetData) {
31980
32026
  let position = 0;
31981
32027
  for (let i = 0; i < rowIndex; i++) {
31982
- const rowAtIndex = sheetData.rows[i];
32028
+ const rowAtIndex = sheetData.rows.find((row) => row.index - 1 === i);
31983
32029
  if (rowAtIndex?.height) {
31984
32030
  position += rowAtIndex.height;
31985
32031
  }
@@ -32119,8 +32165,8 @@ stores.inject(MyMetaStore, storeInstance);
32119
32165
  }
32120
32166
  function convertAnchor(XLSXanchor) {
32121
32167
  const offset = {
32122
- x: convertEMUToDotValue(XLSXanchor.colOffset),
32123
- y: convertEMUToDotValue(XLSXanchor.rowOffset),
32168
+ x: convertEMUToDotValue(XLSXanchor.colOffset) - FIGURE_BORDER_WIDTH,
32169
+ y: convertEMUToDotValue(XLSXanchor.rowOffset) - FIGURE_BORDER_WIDTH,
32124
32170
  };
32125
32171
  return { col: XLSXanchor.col, row: XLSXanchor.row, offset };
32126
32172
  }
@@ -32503,8 +32549,12 @@ stores.inject(MyMetaStore, storeInstance);
32503
32549
  dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
32504
32550
  dims[1] = Math.max(dims[1], row.index);
32505
32551
  }
32506
- dims[0] = Math.max(dims[0], EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
32507
- dims[1] = Math.max(dims[1], EXCEL_IMPORT_DEFAULT_NUMBER_OF_ROWS);
32552
+ for (const fig of sheet.figures) {
32553
+ dims[0] = Math.max(dims[0], fig.anchors[fig.anchors.length - 1]?.col ?? 0);
32554
+ dims[1] = Math.max(dims[1], fig.anchors[fig.anchors.length - 1]?.row ?? 0);
32555
+ }
32556
+ dims[0] = Math.max(dims[0] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
32557
+ dims[1] = Math.max(dims[1] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_ROWS);
32508
32558
  return dims;
32509
32559
  }
32510
32560
  /**
@@ -34509,7 +34559,7 @@ stores.inject(MyMetaStore, storeInstance);
34509
34559
  return relsFile;
34510
34560
  }
34511
34561
 
34512
- const EXCEL_IMPORT_VERSION = "18.3";
34562
+ const EXCEL_IMPORT_VERSION = "18.3.1";
34513
34563
  class XlsxReader {
34514
34564
  warningManager;
34515
34565
  xmls;
@@ -38513,7 +38563,7 @@ stores.inject(MyMetaStore, storeInstance);
38513
38563
  const reinsertDynamicPivotMenu = {
38514
38564
  id: "reinsert_dynamic_pivot",
38515
38565
  name: _t("Re-insert dynamic pivot"),
38516
- sequence: 1020,
38566
+ sequence: 60,
38517
38567
  icon: "o-spreadsheet-Icon.INSERT_PIVOT",
38518
38568
  children: [REINSERT_DYNAMIC_PIVOT_CHILDREN],
38519
38569
  isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
@@ -38521,7 +38571,7 @@ stores.inject(MyMetaStore, storeInstance);
38521
38571
  const reinsertStaticPivotMenu = {
38522
38572
  id: "reinsert_static_pivot",
38523
38573
  name: _t("Re-insert static pivot"),
38524
- sequence: 1020,
38574
+ sequence: 70,
38525
38575
  icon: "o-spreadsheet-Icon.INSERT_PIVOT",
38526
38576
  children: [REINSERT_STATIC_PIVOT_CHILDREN],
38527
38577
  isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
@@ -40190,8 +40240,9 @@ stores.inject(MyMetaStore, storeInstance);
40190
40240
  sequence: 40,
40191
40241
  separator: true,
40192
40242
  })
40193
- .addChild("data_sources_data", ["data"], (env) => {
40243
+ .addChild("pivot_data_sources", ["data"], (env) => {
40194
40244
  const sequence = 50;
40245
+ const numberOfPivots = env.model.getters.getPivotIds().length;
40195
40246
  return env.model.getters.getPivotIds().map((pivotId, index) => {
40196
40247
  const highlightProvider = {
40197
40248
  get highlights() {
@@ -40201,7 +40252,7 @@ stores.inject(MyMetaStore, storeInstance);
40201
40252
  return {
40202
40253
  id: `item_pivot_${env.model.getters.getPivotFormulaId(pivotId)}`,
40203
40254
  name: env.model.getters.getPivotDisplayName(pivotId),
40204
- sequence: sequence + index,
40255
+ sequence: sequence + index / numberOfPivots,
40205
40256
  isReadonlyAllowed: true,
40206
40257
  execute: (env) => env.openSidePanel("PivotSidePanel", { pivotId }),
40207
40258
  onStartHover: (env) => env.getStore(HighlightStore).register(highlightProvider),
@@ -57199,7 +57250,8 @@ stores.inject(MyMetaStore, storeInstance);
57199
57250
  * the type of change that occurred.
57200
57251
  *
57201
57252
  * @param applyChange a function that, when called, will adapt the range according to the change on the grid
57202
- * @param sheetId an optional sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
57253
+ * @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
57254
+ * @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
57203
57255
  */
57204
57256
  adaptRanges(applyChange, sheetId, sheetName) { }
57205
57257
  /**
@@ -57802,9 +57854,7 @@ stores.inject(MyMetaStore, storeInstance);
57802
57854
  for (const cell of Object.values(this.cells[sheet] || {})) {
57803
57855
  if (cell.isFormula) {
57804
57856
  for (const range of cell.compiledFormula.dependencies) {
57805
- if (!sheetId ||
57806
- range.sheetId === sheetId ||
57807
- (sheetName && range.invalidSheetName === sheetName)) {
57857
+ if (range.sheetId === sheetId || range.invalidSheetName === sheetName.old) {
57808
57858
  const change = applyChange(range);
57809
57859
  if (change.changeType !== "NONE") {
57810
57860
  this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
@@ -58420,9 +58470,9 @@ stores.inject(MyMetaStore, storeInstance);
58420
58470
  charts = {};
58421
58471
  createChart = chartFactory(this.getters);
58422
58472
  validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
58423
- adaptRanges(applyChange) {
58473
+ adaptRanges(applyChange, sheetId, adaptSheetName) {
58424
58474
  for (const [chartId, chart] of Object.entries(this.charts)) {
58425
- this.history.update("charts", chartId, chart?.updateRanges(applyChange));
58475
+ this.history.update("charts", chartId, chart?.updateRanges(applyChange, sheetId, adaptSheetName));
58426
58476
  }
58427
58477
  }
58428
58478
  // ---------------------------------------------------------------------------
@@ -58685,7 +58735,7 @@ stores.inject(MyMetaStore, storeInstance);
58685
58735
  }
58686
58736
  }
58687
58737
  }
58688
- adaptRanges(applyChange, sheetId, sheetName) {
58738
+ adaptRanges(applyChange, sheetId) {
58689
58739
  const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
58690
58740
  for (const sheetId of sheetIds) {
58691
58741
  this.adaptCFRanges(sheetId, applyChange);
@@ -59081,11 +59131,8 @@ stores.inject(MyMetaStore, storeInstance);
59081
59131
  "getValidationRuleForCell",
59082
59132
  ];
59083
59133
  rules = {};
59084
- adaptRanges(applyChange, sheetId, sheetName) {
59085
- const sheetIds = sheetId ? [sheetId] : Object.keys(this.rules);
59086
- for (const sheetId of sheetIds) {
59087
- this.adaptDVRanges(sheetId, applyChange);
59088
- }
59134
+ adaptRanges(applyChange, sheetId) {
59135
+ this.adaptDVRanges(sheetId, applyChange);
59089
59136
  this.adaptDVFormulas(applyChange);
59090
59137
  }
59091
59138
  adaptDVFormulas(applyChange) {
@@ -59375,9 +59422,6 @@ stores.inject(MyMetaStore, storeInstance);
59375
59422
  // Command Handling
59376
59423
  // ---------------------------------------------------------------------------
59377
59424
  adaptRanges(applyChange, sheetId) {
59378
- if (!sheetId) {
59379
- return;
59380
- }
59381
59425
  for (const figure of this.getFigures(sheetId)) {
59382
59426
  const change = applyChange(this.getters.getRangeFromZone(sheetId, {
59383
59427
  left: figure.col,
@@ -60185,11 +60229,8 @@ stores.inject(MyMetaStore, storeInstance);
60185
60229
  break;
60186
60230
  }
60187
60231
  }
60188
- adaptRanges(applyChange, sheetId, sheetName) {
60189
- const sheetIds = sheetId ? [sheetId] : Object.keys(this.merges);
60190
- for (const sheetId of sheetIds) {
60191
- this.applyRangeChangeOnSheet(sheetId, applyChange);
60192
- }
60232
+ adaptRanges(applyChange, sheetId) {
60233
+ this.applyRangeChangeOnSheet(sheetId, applyChange);
60193
60234
  }
60194
60235
  // ---------------------------------------------------------------------------
60195
60236
  // Getters
@@ -61697,12 +61738,9 @@ stores.inject(MyMetaStore, storeInstance);
61697
61738
  static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
61698
61739
  tables = {};
61699
61740
  nextTableId = 1;
61700
- adaptRanges(applyChange, sheetId, sheetName) {
61701
- const sheetIds = sheetId ? [sheetId] : this.getters.getSheetIds();
61702
- for (const sheetId of sheetIds) {
61703
- for (const table of this.getCoreTables(sheetId)) {
61704
- this.applyRangeChangeOnTable(sheetId, table, applyChange);
61705
- }
61741
+ adaptRanges(applyChange, sheetId) {
61742
+ for (const table of this.getCoreTables(sheetId)) {
61743
+ this.applyRangeChangeOnTable(sheetId, table, applyChange);
61706
61744
  }
61707
61745
  }
61708
61746
  allowDispatch(cmd) {
@@ -62665,7 +62703,7 @@ stores.inject(MyMetaStore, storeInstance);
62665
62703
  }
62666
62704
  }
62667
62705
  }
62668
- adaptRanges(applyChange, sheetId, sheetName) {
62706
+ adaptRanges(applyChange) {
62669
62707
  for (const sheetId in this.compiledMeasureFormulas) {
62670
62708
  for (const formulaString in this.compiledMeasureFormulas[sheetId]) {
62671
62709
  const compiledFormula = this.compiledMeasureFormulas[sheetId][formulaString];
@@ -66826,7 +66864,7 @@ stores.inject(MyMetaStore, storeInstance);
66826
66864
  if (!result) {
66827
66865
  return EMPTY_PIVOT_CELL;
66828
66866
  }
66829
- const { functionName, args } = result;
66867
+ let { functionName, args } = result;
66830
66868
  const formulaId = args[0];
66831
66869
  if (!formulaId) {
66832
66870
  return EMPTY_PIVOT_CELL;
@@ -66856,6 +66894,9 @@ stores.inject(MyMetaStore, storeInstance);
66856
66894
  return pivotCells[pivotCol][pivotRow];
66857
66895
  }
66858
66896
  try {
66897
+ const offsetRow = position.row - mainPosition.row;
66898
+ const offsetCol = position.col - mainPosition.col;
66899
+ args = args.map((arg) => (isMatrix(arg) ? arg[offsetCol][offsetRow] : arg));
66859
66900
  if (functionName === "PIVOT.HEADER" && args.at(-2) === "measure") {
66860
66901
  const domain = pivot.parseArgsToPivotDomain(args.slice(1, -2).map((value) => ({ value })));
66861
66902
  return {
@@ -68054,7 +68095,8 @@ stores.inject(MyMetaStore, storeInstance);
68054
68095
  // If the executed command is not in the registry, we skip it
68055
68096
  // because we know there won't be any transformation impacting the
68056
68097
  // commands to transform.
68057
- if (possibleTransformations.has(executedCommand.type)) {
68098
+ if (possibleTransformations.has(executedCommand.type) ||
68099
+ rangeAdapterRegistry.contains(executedCommand.type)) {
68058
68100
  transformedCommands = transformedCommands.reduce((acc, cmd) => {
68059
68101
  const transformed = transform(cmd, executedCommand);
68060
68102
  if (transformed) {
@@ -79215,7 +79257,7 @@ stores.inject(MyMetaStore, storeInstance);
79215
79257
  for (const [headerIndex, header] of headers.slice(anchor).entries()) {
79216
79258
  if (currentPosition <= offset && offset < currentPosition + header.size) {
79217
79259
  return {
79218
- index: headerIndex,
79260
+ index: anchor + headerIndex,
79219
79261
  offset: convertDotValueToEMU(offset - currentPosition + FIGURE_BORDER_WIDTH),
79220
79262
  };
79221
79263
  }
@@ -80211,7 +80253,7 @@ stores.inject(MyMetaStore, storeInstance);
80211
80253
  handlers = [];
80212
80254
  uiHandlers = [];
80213
80255
  coreHandlers = [];
80214
- constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
80256
+ constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
80215
80257
  const start = performance.now();
80216
80258
  console.debug("##### Model creation #####");
80217
80259
  super();
@@ -80954,9 +80996,9 @@ stores.inject(MyMetaStore, storeInstance);
80954
80996
  exports.tokenize = tokenize;
80955
80997
 
80956
80998
 
80957
- __info__.version = "18.3.18";
80958
- __info__.date = "2025-08-26T10:14:21.408Z";
80959
- __info__.hash = "ec2777d";
80999
+ __info__.version = "18.3.19";
81000
+ __info__.date = "2025-09-05T07:38:30.661Z";
81001
+ __info__.hash = "77fd307";
80960
81002
 
80961
81003
 
80962
81004
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);