@odoo/o-spreadsheet 18.3.19 → 18.3.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.
@@ -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.19
6
- * @date 2025-09-05T07:38:30.661Z
7
- * @hash 77fd307
5
+ * @version 18.3.20
6
+ * @date 2025-09-11T08:45:37.934Z
7
+ * @hash ef829f4
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -7208,7 +7208,7 @@
7208
7208
  this.getters = getters;
7209
7209
  this.dispatch = dispatch;
7210
7210
  }
7211
- copy(data, isCutOperation) {
7211
+ copy(data, isCutOperation, mode = "copyPaste") {
7212
7212
  return;
7213
7213
  }
7214
7214
  paste(target, clippedContent, options) { }
@@ -7227,7 +7227,7 @@
7227
7227
  }
7228
7228
 
7229
7229
  class AbstractCellClipboardHandler extends ClipboardHandler {
7230
- copy(data) {
7230
+ copy(data, isCutOperation, mode = "copyPaste") {
7231
7231
  return;
7232
7232
  }
7233
7233
  pasteFromCopy(sheetId, target, content, options) {
@@ -8950,7 +8950,7 @@
8950
8950
  }
8951
8951
  return "Success" /* CommandResult.Success */;
8952
8952
  }
8953
- copy(data) {
8953
+ copy(data, isCutOperation, mode = "copyPaste") {
8954
8954
  const sheetId = data.sheetId;
8955
8955
  const { clippedZones, rowsIndexes, columnsIndexes } = data;
8956
8956
  const clippedCells = [];
@@ -8963,7 +8963,7 @@
8963
8963
  const evaluatedCell = this.getters.getEvaluatedCell(position);
8964
8964
  const pivotId = this.getters.getPivotIdFromPosition(position);
8965
8965
  const spreader = this.getters.getArrayFormulaSpreadingOn(position);
8966
- if (pivotId && spreader) {
8966
+ if (mode !== "shiftCells" && pivotId && spreader) {
8967
8967
  const pivotZone = this.getters.getSpreadZone(spreader);
8968
8968
  if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
8969
8969
  pivotZone &&
@@ -8981,7 +8981,7 @@
8981
8981
  };
8982
8982
  }
8983
8983
  }
8984
- else {
8984
+ else if (mode !== "shiftCells") {
8985
8985
  if (spreader && !deepEquals(spreader, position)) {
8986
8986
  const isSpreaderCopied = rowsIndexes.includes(spreader.row) && columnsIndexes.includes(spreader.col);
8987
8987
  const content = isSpreaderCopied
@@ -9681,7 +9681,7 @@
9681
9681
  }
9682
9682
 
9683
9683
  class TableClipboardHandler extends AbstractCellClipboardHandler {
9684
- copy(data, isCutOperation) {
9684
+ copy(data, isCutOperation, mode = "copyPaste") {
9685
9685
  const sheetId = data.sheetId;
9686
9686
  const { rowsIndexes, columnsIndexes, zones } = data;
9687
9687
  const copiedTablesIds = new Set();
@@ -9719,11 +9719,13 @@
9719
9719
  type: coreTable.type,
9720
9720
  };
9721
9721
  }
9722
- tableCellsInRow.push({
9723
- table: copiedTable,
9724
- style: this.getTableStyleToCopy(position),
9725
- isWholeTableCopied: copiedTablesIds.has(table.id),
9726
- });
9722
+ if (mode !== "shiftCells") {
9723
+ tableCellsInRow.push({
9724
+ table: copiedTable,
9725
+ style: this.getTableStyleToCopy(position),
9726
+ isWholeTableCopied: copiedTablesIds.has(table.id),
9727
+ });
9728
+ }
9727
9729
  }
9728
9730
  }
9729
9731
  return {
@@ -30885,7 +30887,7 @@ stores.inject(MyMetaStore, storeInstance);
30885
30887
  ];
30886
30888
  const SUPPORTED_VERTICAL_ALIGNMENTS = ["top", "center", "bottom"];
30887
30889
  const SUPPORTED_FONTS = ["Arial"];
30888
- const SUPPORTED_FILL_PATTERNS = ["solid"];
30890
+ const SUPPORTED_FILL_PATTERNS = ["solid", "none"];
30889
30891
  const SUPPORTED_CF_TYPES = [
30890
30892
  "expression",
30891
30893
  "cellIs",
@@ -31070,7 +31072,7 @@ stores.inject(MyMetaStore, storeInstance);
31070
31072
  };
31071
31073
  /** Mapping between Excel format indexes (see XLSX_FORMAT_MAP) and some supported formats */
31072
31074
  const XLSX_FORMATS_CONVERSION_MAP = {
31073
- 0: "",
31075
+ 0: "General",
31074
31076
  1: "0",
31075
31077
  2: "0.00",
31076
31078
  3: "#,#00",
@@ -31396,11 +31398,11 @@ stores.inject(MyMetaStore, storeInstance);
31396
31398
  * Excel format are defined in openXML §18.8.31
31397
31399
  */
31398
31400
  function convertXlsxFormat(numFmtId, formats, warningManager) {
31399
- if (numFmtId === 0) {
31400
- return undefined;
31401
- }
31402
31401
  // Format is either defined in the imported data, or the formatId is defined in openXML §18.8.30
31403
31402
  let format = XLSX_FORMATS_CONVERSION_MAP[numFmtId] || formats.find((f) => f.id === numFmtId)?.format;
31403
+ if (format === "General") {
31404
+ return undefined;
31405
+ }
31404
31406
  if (format) {
31405
31407
  try {
31406
31408
  let convertedFormat = format.replace(/\[(.*)-[A-Z0-9]{3}\]/g, "[$1]"); // remove currency and locale/date system/number system info (ECMA §18.8.31)
@@ -34245,10 +34247,11 @@ stores.inject(MyMetaStore, storeInstance);
34245
34247
  });
34246
34248
  }
34247
34249
  extractRows(worksheet) {
34250
+ const spilledCells = new Set();
34248
34251
  return this.mapOnElements({ parent: worksheet, query: "sheetData row" }, (rowElement) => {
34249
34252
  return {
34250
34253
  index: this.extractAttr(rowElement, "r", { required: true })?.asNum(),
34251
- cells: this.extractCells(rowElement),
34254
+ cells: this.extractCells(rowElement, spilledCells),
34252
34255
  height: this.extractAttr(rowElement, "ht")?.asNum(),
34253
34256
  customHeight: this.extractAttr(rowElement, "customHeight")?.asBool(),
34254
34257
  hidden: this.extractAttr(rowElement, "hidden")?.asBool(),
@@ -34258,14 +34261,26 @@ stores.inject(MyMetaStore, storeInstance);
34258
34261
  };
34259
34262
  });
34260
34263
  }
34261
- extractCells(row) {
34264
+ extractCells(row, spilledCells) {
34262
34265
  return this.mapOnElements({ parent: row, query: "c" }, (cellElement) => {
34266
+ const xc = this.extractAttr(cellElement, "r", { required: true })?.asString();
34267
+ const formula = this.extractCellFormula(cellElement);
34268
+ if (formula?.ref && formula.sharedIndex === undefined) {
34269
+ const zone = toZone(formula.ref);
34270
+ for (const { col, row } of positions(zone)) {
34271
+ const followerXc = toXC(col, row);
34272
+ if (followerXc !== xc) {
34273
+ spilledCells.add(followerXc);
34274
+ }
34275
+ }
34276
+ }
34277
+ const isSpilled = spilledCells.has(xc);
34263
34278
  return {
34264
- xc: this.extractAttr(cellElement, "r", { required: true })?.asString(),
34279
+ xc,
34265
34280
  styleIndex: this.extractAttr(cellElement, "s")?.asNum(),
34266
34281
  type: CELL_TYPE_CONVERSION_MAP[this.extractAttr(cellElement, "t", { default: "n" })?.asString()],
34267
- value: this.extractChildTextContent(cellElement, "v"),
34268
- formula: this.extractCellFormula(cellElement),
34282
+ value: isSpilled ? undefined : this.extractChildTextContent(cellElement, "v") ?? undefined,
34283
+ formula: isSpilled ? undefined : formula,
34269
34284
  };
34270
34285
  });
34271
34286
  }
@@ -34273,11 +34288,14 @@ stores.inject(MyMetaStore, storeInstance);
34273
34288
  const formulaElement = this.querySelector(cellElement, "f");
34274
34289
  if (!formulaElement)
34275
34290
  return undefined;
34276
- return {
34277
- content: this.extractTextContent(formulaElement),
34278
- sharedIndex: this.extractAttr(formulaElement, "si")?.asNum(),
34279
- ref: this.extractAttr(formulaElement, "ref")?.asString(),
34280
- };
34291
+ const content = this.extractTextContent(formulaElement);
34292
+ const sharedIndex = this.extractAttr(formulaElement, "si")?.asNum();
34293
+ const ref = this.extractAttr(formulaElement, "ref")?.asString();
34294
+ // This is the case of spilled cells of array formulas where <f> is empty
34295
+ if ((content === undefined || content.trim() === "") && sharedIndex === undefined) {
34296
+ return undefined;
34297
+ }
34298
+ return { content, sharedIndex, ref };
34281
34299
  }
34282
34300
  extractHyperLinks(worksheet) {
34283
34301
  return this.mapOnElements({ parent: worksheet, query: "hyperlink" }, (linkElement) => {
@@ -68830,7 +68848,7 @@ stores.inject(MyMetaStore, storeInstance);
68830
68848
  bottom: rowIndex,
68831
68849
  }));
68832
68850
  const handler = new CellClipboardHandler(this.getters, this.dispatch);
68833
- const data = handler.copy(getClipboardDataPositions(sheetId, rowsToKeep));
68851
+ const data = handler.copy(getClipboardDataPositions(sheetId, rowsToKeep), false);
68834
68852
  if (!data) {
68835
68853
  return;
68836
68854
  }
@@ -70870,12 +70888,12 @@ stores.inject(MyMetaStore, storeInstance);
70870
70888
  }
70871
70889
  case "INSERT_CELL": {
70872
70890
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
70873
- const copiedData = this.copy(cut);
70891
+ const copiedData = this.copy(cut, "shiftCells");
70874
70892
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
70875
70893
  }
70876
70894
  case "DELETE_CELL": {
70877
70895
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
70878
- const copiedData = this.copy(cut);
70896
+ const copiedData = this.copy(cut, "shiftCells");
70879
70897
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
70880
70898
  }
70881
70899
  }
@@ -70986,13 +71004,13 @@ stores.inject(MyMetaStore, storeInstance);
70986
71004
  });
70987
71005
  break;
70988
71006
  }
70989
- const copiedData = this.copy(cut);
71007
+ const copiedData = this.copy(cut, "shiftCells");
70990
71008
  this.paste(paste, copiedData, { isCutOperation: true });
70991
71009
  break;
70992
71010
  }
70993
71011
  case "INSERT_CELL": {
70994
71012
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
70995
- const copiedData = this.copy(cut);
71013
+ const copiedData = this.copy(cut, "shiftCells");
70996
71014
  this.paste(paste, copiedData, { isCutOperation: true });
70997
71015
  break;
70998
71016
  }
@@ -71107,11 +71125,11 @@ stores.inject(MyMetaStore, storeInstance);
71107
71125
  }
71108
71126
  return false;
71109
71127
  }
71110
- copy(zones) {
71128
+ copy(zones, mode = "copyPaste") {
71111
71129
  let copiedData = {};
71112
71130
  const clipboardData = this.getClipboardData(zones);
71113
71131
  for (const { handlerName, handler } of this.selectClipboardHandlers(clipboardData)) {
71114
- const data = handler.copy(clipboardData, this._isCutOperation);
71132
+ const data = handler.copy(clipboardData, this._isCutOperation, mode);
71115
71133
  copiedData[handlerName] = data;
71116
71134
  const minimalKeys = ["sheetId", "cells", "zones", "figureId"];
71117
71135
  for (const key of minimalKeys) {
@@ -72062,7 +72080,7 @@ stores.inject(MyMetaStore, storeInstance);
72062
72080
  ];
72063
72081
  for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
72064
72082
  const handler = new Handler(this.getters, this.dispatch);
72065
- const data = handler.copy(getClipboardDataPositions(sheetId, target));
72083
+ const data = handler.copy(getClipboardDataPositions(sheetId, target), false, "shiftCells");
72066
72084
  if (!data) {
72067
72085
  continue;
72068
72086
  }
@@ -80253,7 +80271,7 @@ stores.inject(MyMetaStore, storeInstance);
80253
80271
  handlers = [];
80254
80272
  uiHandlers = [];
80255
80273
  coreHandlers = [];
80256
- constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
80274
+ constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
80257
80275
  const start = performance.now();
80258
80276
  console.debug("##### Model creation #####");
80259
80277
  super();
@@ -80996,9 +81014,9 @@ stores.inject(MyMetaStore, storeInstance);
80996
81014
  exports.tokenize = tokenize;
80997
81015
 
80998
81016
 
80999
- __info__.version = "18.3.19";
81000
- __info__.date = "2025-09-05T07:38:30.661Z";
81001
- __info__.hash = "77fd307";
81017
+ __info__.version = "18.3.20";
81018
+ __info__.date = "2025-09-11T08:45:37.934Z";
81019
+ __info__.hash = "ef829f4";
81002
81020
 
81003
81021
 
81004
81022
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);