@odoo/o-spreadsheet 18.2.28 → 18.2.29

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.2.28
6
- * @date 2025-09-05T07:38:26.582Z
7
- * @hash 84335fb
5
+ * @version 18.2.29
6
+ * @date 2025-09-11T08:44:31.801Z
7
+ * @hash 665bc43
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6904,7 +6904,7 @@
6904
6904
  this.getters = getters;
6905
6905
  this.dispatch = dispatch;
6906
6906
  }
6907
- copy(data) {
6907
+ copy(data, mode = "copyPaste") {
6908
6908
  return;
6909
6909
  }
6910
6910
  paste(target, clippedContent, options) { }
@@ -6923,7 +6923,7 @@
6923
6923
  }
6924
6924
 
6925
6925
  class AbstractCellClipboardHandler extends ClipboardHandler {
6926
- copy(data) {
6926
+ copy(data, mode = "copyPaste") {
6927
6927
  return;
6928
6928
  }
6929
6929
  pasteFromCopy(sheetId, target, content, options) {
@@ -8640,7 +8640,7 @@
8640
8640
  }
8641
8641
  return "Success" /* CommandResult.Success */;
8642
8642
  }
8643
- copy(data) {
8643
+ copy(data, mode = "copyPaste") {
8644
8644
  const sheetId = data.sheetId;
8645
8645
  const { clippedZones, rowsIndexes, columnsIndexes } = data;
8646
8646
  const clippedCells = [];
@@ -8653,7 +8653,7 @@
8653
8653
  const evaluatedCell = this.getters.getEvaluatedCell(position);
8654
8654
  const pivotId = this.getters.getPivotIdFromPosition(position);
8655
8655
  const spreader = this.getters.getArrayFormulaSpreadingOn(position);
8656
- if (pivotId && spreader) {
8656
+ if (mode !== "shiftCells" && pivotId && spreader) {
8657
8657
  const pivotZone = this.getters.getSpreadZone(spreader);
8658
8658
  if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
8659
8659
  pivotZone &&
@@ -8671,7 +8671,7 @@
8671
8671
  };
8672
8672
  }
8673
8673
  }
8674
- else {
8674
+ else if (mode !== "shiftCells") {
8675
8675
  if (spreader && !deepEquals(spreader, position)) {
8676
8676
  const isSpreaderCopied = rowsIndexes.includes(spreader.row) && columnsIndexes.includes(spreader.col);
8677
8677
  const content = isSpreaderCopied
@@ -9364,7 +9364,7 @@
9364
9364
  }
9365
9365
 
9366
9366
  class TableClipboardHandler extends AbstractCellClipboardHandler {
9367
- copy(data) {
9367
+ copy(data, mode = "copyPaste") {
9368
9368
  const sheetId = data.sheetId;
9369
9369
  const { rowsIndexes, columnsIndexes, zones } = data;
9370
9370
  const copiedTablesIds = new Set();
@@ -9394,11 +9394,13 @@
9394
9394
  type: coreTable.type,
9395
9395
  };
9396
9396
  }
9397
- tableCellsInRow.push({
9398
- table: copiedTable,
9399
- style: this.getTableStyleToCopy(position),
9400
- isWholeTableCopied: copiedTablesIds.has(table.id),
9401
- });
9397
+ if (mode !== "shiftCells") {
9398
+ tableCellsInRow.push({
9399
+ table: copiedTable,
9400
+ style: this.getTableStyleToCopy(position),
9401
+ isWholeTableCopied: copiedTablesIds.has(table.id),
9402
+ });
9403
+ }
9402
9404
  }
9403
9405
  }
9404
9406
  return {
@@ -23794,7 +23796,7 @@ stores.inject(MyMetaStore, storeInstance);
23794
23796
  ];
23795
23797
  const SUPPORTED_VERTICAL_ALIGNMENTS = ["top", "center", "bottom"];
23796
23798
  const SUPPORTED_FONTS = ["Arial"];
23797
- const SUPPORTED_FILL_PATTERNS = ["solid"];
23799
+ const SUPPORTED_FILL_PATTERNS = ["solid", "none"];
23798
23800
  const SUPPORTED_CF_TYPES = [
23799
23801
  "expression",
23800
23802
  "cellIs",
@@ -23979,7 +23981,7 @@ stores.inject(MyMetaStore, storeInstance);
23979
23981
  };
23980
23982
  /** Mapping between Excel format indexes (see XLSX_FORMAT_MAP) and some supported formats */
23981
23983
  const XLSX_FORMATS_CONVERSION_MAP = {
23982
- 0: "",
23984
+ 0: "General",
23983
23985
  1: "0",
23984
23986
  2: "0.00",
23985
23987
  3: "#,#00",
@@ -24305,11 +24307,11 @@ stores.inject(MyMetaStore, storeInstance);
24305
24307
  * Excel format are defined in openXML §18.8.31
24306
24308
  */
24307
24309
  function convertXlsxFormat(numFmtId, formats, warningManager) {
24308
- if (numFmtId === 0) {
24309
- return undefined;
24310
- }
24311
24310
  // Format is either defined in the imported data, or the formatId is defined in openXML §18.8.30
24312
24311
  let format = XLSX_FORMATS_CONVERSION_MAP[numFmtId] || formats.find((f) => f.id === numFmtId)?.format;
24312
+ if (format === "General") {
24313
+ return undefined;
24314
+ }
24313
24315
  if (format) {
24314
24316
  try {
24315
24317
  let convertedFormat = format.replace(/\[(.*)-[A-Z0-9]{3}\]/g, "[$1]"); // remove currency and locale/date system/number system info (ECMA §18.8.31)
@@ -27270,10 +27272,11 @@ stores.inject(MyMetaStore, storeInstance);
27270
27272
  });
27271
27273
  }
27272
27274
  extractRows(worksheet) {
27275
+ const spilledCells = new Set();
27273
27276
  return this.mapOnElements({ parent: worksheet, query: "sheetData row" }, (rowElement) => {
27274
27277
  return {
27275
27278
  index: this.extractAttr(rowElement, "r", { required: true })?.asNum(),
27276
- cells: this.extractCells(rowElement),
27279
+ cells: this.extractCells(rowElement, spilledCells),
27277
27280
  height: this.extractAttr(rowElement, "ht")?.asNum(),
27278
27281
  customHeight: this.extractAttr(rowElement, "customHeight")?.asBool(),
27279
27282
  hidden: this.extractAttr(rowElement, "hidden")?.asBool(),
@@ -27283,14 +27286,26 @@ stores.inject(MyMetaStore, storeInstance);
27283
27286
  };
27284
27287
  });
27285
27288
  }
27286
- extractCells(row) {
27289
+ extractCells(row, spilledCells) {
27287
27290
  return this.mapOnElements({ parent: row, query: "c" }, (cellElement) => {
27291
+ const xc = this.extractAttr(cellElement, "r", { required: true })?.asString();
27292
+ const formula = this.extractCellFormula(cellElement);
27293
+ if (formula?.ref && formula.sharedIndex === undefined) {
27294
+ const zone = toZone(formula.ref);
27295
+ for (const { col, row } of positions(zone)) {
27296
+ const followerXc = toXC(col, row);
27297
+ if (followerXc !== xc) {
27298
+ spilledCells.add(followerXc);
27299
+ }
27300
+ }
27301
+ }
27302
+ const isSpilled = spilledCells.has(xc);
27288
27303
  return {
27289
- xc: this.extractAttr(cellElement, "r", { required: true })?.asString(),
27304
+ xc,
27290
27305
  styleIndex: this.extractAttr(cellElement, "s")?.asNum(),
27291
27306
  type: CELL_TYPE_CONVERSION_MAP[this.extractAttr(cellElement, "t", { default: "n" })?.asString()],
27292
- value: this.extractChildTextContent(cellElement, "v"),
27293
- formula: this.extractCellFormula(cellElement),
27307
+ value: isSpilled ? undefined : this.extractChildTextContent(cellElement, "v") ?? undefined,
27308
+ formula: isSpilled ? undefined : formula,
27294
27309
  };
27295
27310
  });
27296
27311
  }
@@ -27298,11 +27313,14 @@ stores.inject(MyMetaStore, storeInstance);
27298
27313
  const formulaElement = this.querySelector(cellElement, "f");
27299
27314
  if (!formulaElement)
27300
27315
  return undefined;
27301
- return {
27302
- content: this.extractTextContent(formulaElement),
27303
- sharedIndex: this.extractAttr(formulaElement, "si")?.asNum(),
27304
- ref: this.extractAttr(formulaElement, "ref")?.asString(),
27305
- };
27316
+ const content = this.extractTextContent(formulaElement);
27317
+ const sharedIndex = this.extractAttr(formulaElement, "si")?.asNum();
27318
+ const ref = this.extractAttr(formulaElement, "ref")?.asString();
27319
+ // This is the case of spilled cells of array formulas where <f> is empty
27320
+ if ((content === undefined || content.trim() === "") && sharedIndex === undefined) {
27321
+ return undefined;
27322
+ }
27323
+ return { content, sharedIndex, ref };
27306
27324
  }
27307
27325
  extractHyperLinks(worksheet) {
27308
27326
  return this.mapOnElements({ parent: worksheet, query: "hyperlink" }, (linkElement) => {
@@ -67807,12 +67825,12 @@ stores.inject(MyMetaStore, storeInstance);
67807
67825
  }
67808
67826
  case "INSERT_CELL": {
67809
67827
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
67810
- const copiedData = this.copy(cut);
67828
+ const copiedData = this.copy(cut, "shiftCells");
67811
67829
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
67812
67830
  }
67813
67831
  case "DELETE_CELL": {
67814
67832
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
67815
- const copiedData = this.copy(cut);
67833
+ const copiedData = this.copy(cut, "shiftCells");
67816
67834
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
67817
67835
  }
67818
67836
  }
@@ -67902,13 +67920,13 @@ stores.inject(MyMetaStore, storeInstance);
67902
67920
  });
67903
67921
  break;
67904
67922
  }
67905
- const copiedData = this.copy(cut);
67923
+ const copiedData = this.copy(cut, "shiftCells");
67906
67924
  this.paste(paste, copiedData, { isCutOperation: true });
67907
67925
  break;
67908
67926
  }
67909
67927
  case "INSERT_CELL": {
67910
67928
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
67911
- const copiedData = this.copy(cut);
67929
+ const copiedData = this.copy(cut, "shiftCells");
67912
67930
  this.paste(paste, copiedData, { isCutOperation: true });
67913
67931
  break;
67914
67932
  }
@@ -68023,11 +68041,11 @@ stores.inject(MyMetaStore, storeInstance);
68023
68041
  }
68024
68042
  return false;
68025
68043
  }
68026
- copy(zones) {
68044
+ copy(zones, mode = "copyPaste") {
68027
68045
  let copiedData = {};
68028
68046
  const clipboardData = this.getClipboardData(zones);
68029
68047
  for (const { handlerName, handler } of this.selectClipboardHandlers(clipboardData)) {
68030
- const data = handler.copy(clipboardData);
68048
+ const data = handler.copy(clipboardData, mode);
68031
68049
  copiedData[handlerName] = data;
68032
68050
  const minimalKeys = ["sheetId", "cells", "zones", "figureId"];
68033
68051
  for (const key of minimalKeys) {
@@ -68891,7 +68909,7 @@ stores.inject(MyMetaStore, storeInstance);
68891
68909
  ];
68892
68910
  for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
68893
68911
  const handler = new Handler(this.getters, this.dispatch);
68894
- const data = handler.copy(getClipboardDataPositions(sheetId, target));
68912
+ const data = handler.copy(getClipboardDataPositions(sheetId, target), "shiftCells");
68895
68913
  if (!data) {
68896
68914
  continue;
68897
68915
  }
@@ -76579,7 +76597,7 @@ stores.inject(MyMetaStore, storeInstance);
76579
76597
  handlers = [];
76580
76598
  uiHandlers = [];
76581
76599
  coreHandlers = [];
76582
- constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
76600
+ constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
76583
76601
  const start = performance.now();
76584
76602
  console.debug("##### Model creation #####");
76585
76603
  super();
@@ -77315,9 +77333,9 @@ stores.inject(MyMetaStore, storeInstance);
77315
77333
  exports.tokenize = tokenize;
77316
77334
 
77317
77335
 
77318
- __info__.version = "18.2.28";
77319
- __info__.date = "2025-09-05T07:38:26.582Z";
77320
- __info__.hash = "84335fb";
77336
+ __info__.version = "18.2.29";
77337
+ __info__.date = "2025-09-11T08:44:31.801Z";
77338
+ __info__.hash = "665bc43";
77321
77339
 
77322
77340
 
77323
77341
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);