@odoo/o-spreadsheet 18.0.43 → 18.0.44

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.43
6
- * @date 2025-09-05T07:38:36.406Z
7
- * @hash 0f02dde
5
+ * @version 18.0.44
6
+ * @date 2025-09-11T08:43:01.459Z
7
+ * @hash 7e6662c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6740,7 +6740,7 @@
6740
6740
  this.getters = getters;
6741
6741
  this.dispatch = dispatch;
6742
6742
  }
6743
- copy(data) {
6743
+ copy(data, mode = "copyPaste") {
6744
6744
  return;
6745
6745
  }
6746
6746
  paste(target, clippedContent, options) { }
@@ -6759,7 +6759,7 @@
6759
6759
  }
6760
6760
 
6761
6761
  class AbstractCellClipboardHandler extends ClipboardHandler {
6762
- copy(data) {
6762
+ copy(data, mode = "copyPaste") {
6763
6763
  return;
6764
6764
  }
6765
6765
  pasteFromCopy(sheetId, target, content, options) {
@@ -8428,7 +8428,7 @@
8428
8428
  }
8429
8429
  return "Success" /* CommandResult.Success */;
8430
8430
  }
8431
- copy(data) {
8431
+ copy(data, mode = "copyPaste") {
8432
8432
  const sheetId = data.sheetId;
8433
8433
  const { clippedZones, rowsIndexes, columnsIndexes } = data;
8434
8434
  const clippedCells = [];
@@ -8441,7 +8441,7 @@
8441
8441
  const evaluatedCell = this.getters.getEvaluatedCell(position);
8442
8442
  const pivotId = this.getters.getPivotIdFromPosition(position);
8443
8443
  const spreader = this.getters.getArrayFormulaSpreadingOn(position);
8444
- if (pivotId && spreader) {
8444
+ if (mode !== "shiftCells" && pivotId && spreader) {
8445
8445
  const pivotZone = this.getters.getSpreadZone(spreader);
8446
8446
  if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
8447
8447
  pivotZone &&
@@ -8459,7 +8459,7 @@
8459
8459
  };
8460
8460
  }
8461
8461
  }
8462
- else {
8462
+ else if (mode !== "shiftCells") {
8463
8463
  if (spreader && !deepEquals(spreader, position)) {
8464
8464
  const isSpreaderCopied = rowsIndexes.includes(spreader.row) && columnsIndexes.includes(spreader.col);
8465
8465
  const content = isSpreaderCopied
@@ -9152,7 +9152,7 @@
9152
9152
  }
9153
9153
 
9154
9154
  class TableClipboardHandler extends AbstractCellClipboardHandler {
9155
- copy(data) {
9155
+ copy(data, mode = "copyPaste") {
9156
9156
  const sheetId = data.sheetId;
9157
9157
  const { rowsIndexes, columnsIndexes, zones } = data;
9158
9158
  const copiedTablesIds = new Set();
@@ -9186,11 +9186,13 @@
9186
9186
  type: coreTable.type,
9187
9187
  };
9188
9188
  }
9189
- tableCellsInRow.push({
9190
- table: copiedTable,
9191
- style: this.getTableStyleToCopy(position),
9192
- isWholeTableCopied: copiedTablesIds.has(table.id),
9193
- });
9189
+ if (mode !== "shiftCells") {
9190
+ tableCellsInRow.push({
9191
+ table: copiedTable,
9192
+ style: this.getTableStyleToCopy(position),
9193
+ isWholeTableCopied: copiedTablesIds.has(table.id),
9194
+ });
9195
+ }
9194
9196
  }
9195
9197
  }
9196
9198
  return {
@@ -20788,7 +20790,7 @@ stores.inject(MyMetaStore, storeInstance);
20788
20790
  ];
20789
20791
  const SUPPORTED_VERTICAL_ALIGNMENTS = ["top", "center", "bottom"];
20790
20792
  const SUPPORTED_FONTS = ["Arial"];
20791
- const SUPPORTED_FILL_PATTERNS = ["solid"];
20793
+ const SUPPORTED_FILL_PATTERNS = ["solid", "none"];
20792
20794
  const SUPPORTED_CF_TYPES = [
20793
20795
  "expression",
20794
20796
  "cellIs",
@@ -20973,7 +20975,7 @@ stores.inject(MyMetaStore, storeInstance);
20973
20975
  };
20974
20976
  /** Mapping between Excel format indexes (see XLSX_FORMAT_MAP) and some supported formats */
20975
20977
  const XLSX_FORMATS_CONVERSION_MAP = {
20976
- 0: "",
20978
+ 0: "General",
20977
20979
  1: "0",
20978
20980
  2: "0.00",
20979
20981
  3: "#,#00",
@@ -21299,11 +21301,11 @@ stores.inject(MyMetaStore, storeInstance);
21299
21301
  * Excel format are defined in openXML §18.8.31
21300
21302
  */
21301
21303
  function convertXlsxFormat(numFmtId, formats, warningManager) {
21302
- if (numFmtId === 0) {
21303
- return undefined;
21304
- }
21305
21304
  // Format is either defined in the imported data, or the formatId is defined in openXML §18.8.30
21306
21305
  let format = XLSX_FORMATS_CONVERSION_MAP[numFmtId] || formats.find((f) => f.id === numFmtId)?.format;
21306
+ if (format === "General") {
21307
+ return undefined;
21308
+ }
21307
21309
  if (format) {
21308
21310
  try {
21309
21311
  let convertedFormat = format.replace(/\[(.*)-[A-Z0-9]{3}\]/g, "[$1]"); // remove currency and locale/date system/number system info (ECMA §18.8.31)
@@ -24261,10 +24263,11 @@ stores.inject(MyMetaStore, storeInstance);
24261
24263
  });
24262
24264
  }
24263
24265
  extractRows(worksheet) {
24266
+ const spilledCells = new Set();
24264
24267
  return this.mapOnElements({ parent: worksheet, query: "sheetData row" }, (rowElement) => {
24265
24268
  return {
24266
24269
  index: this.extractAttr(rowElement, "r", { required: true })?.asNum(),
24267
- cells: this.extractCells(rowElement),
24270
+ cells: this.extractCells(rowElement, spilledCells),
24268
24271
  height: this.extractAttr(rowElement, "ht")?.asNum(),
24269
24272
  customHeight: this.extractAttr(rowElement, "customHeight")?.asBool(),
24270
24273
  hidden: this.extractAttr(rowElement, "hidden")?.asBool(),
@@ -24274,14 +24277,26 @@ stores.inject(MyMetaStore, storeInstance);
24274
24277
  };
24275
24278
  });
24276
24279
  }
24277
- extractCells(row) {
24280
+ extractCells(row, spilledCells) {
24278
24281
  return this.mapOnElements({ parent: row, query: "c" }, (cellElement) => {
24282
+ const xc = this.extractAttr(cellElement, "r", { required: true })?.asString();
24283
+ const formula = this.extractCellFormula(cellElement);
24284
+ if (formula?.ref && formula.sharedIndex === undefined) {
24285
+ const zone = toZone(formula.ref);
24286
+ for (const { col, row } of positions(zone)) {
24287
+ const followerXc = toXC(col, row);
24288
+ if (followerXc !== xc) {
24289
+ spilledCells.add(followerXc);
24290
+ }
24291
+ }
24292
+ }
24293
+ const isSpilled = spilledCells.has(xc);
24279
24294
  return {
24280
- xc: this.extractAttr(cellElement, "r", { required: true })?.asString(),
24295
+ xc,
24281
24296
  styleIndex: this.extractAttr(cellElement, "s")?.asNum(),
24282
24297
  type: CELL_TYPE_CONVERSION_MAP[this.extractAttr(cellElement, "t", { default: "n" })?.asString()],
24283
- value: this.extractChildTextContent(cellElement, "v"),
24284
- formula: this.extractCellFormula(cellElement),
24298
+ value: isSpilled ? undefined : this.extractChildTextContent(cellElement, "v") ?? undefined,
24299
+ formula: isSpilled ? undefined : formula,
24285
24300
  };
24286
24301
  });
24287
24302
  }
@@ -24289,11 +24304,14 @@ stores.inject(MyMetaStore, storeInstance);
24289
24304
  const formulaElement = this.querySelector(cellElement, "f");
24290
24305
  if (!formulaElement)
24291
24306
  return undefined;
24292
- return {
24293
- content: this.extractTextContent(formulaElement),
24294
- sharedIndex: this.extractAttr(formulaElement, "si")?.asNum(),
24295
- ref: this.extractAttr(formulaElement, "ref")?.asString(),
24296
- };
24307
+ const content = this.extractTextContent(formulaElement);
24308
+ const sharedIndex = this.extractAttr(formulaElement, "si")?.asNum();
24309
+ const ref = this.extractAttr(formulaElement, "ref")?.asString();
24310
+ // This is the case of spilled cells of array formulas where <f> is empty
24311
+ if ((content === undefined || content.trim() === "") && sharedIndex === undefined) {
24312
+ return undefined;
24313
+ }
24314
+ return { content, sharedIndex, ref };
24297
24315
  }
24298
24316
  extractHyperLinks(worksheet) {
24299
24317
  return this.mapOnElements({ parent: worksheet, query: "hyperlink" }, (linkElement) => {
@@ -65167,12 +65185,12 @@ stores.inject(MyMetaStore, storeInstance);
65167
65185
  }
65168
65186
  case "INSERT_CELL": {
65169
65187
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
65170
- const copiedData = this.copy(cut);
65188
+ const copiedData = this.copy(cut, "shiftCells");
65171
65189
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
65172
65190
  }
65173
65191
  case "DELETE_CELL": {
65174
65192
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
65175
- const copiedData = this.copy(cut);
65193
+ const copiedData = this.copy(cut, "shiftCells");
65176
65194
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
65177
65195
  }
65178
65196
  }
@@ -65262,13 +65280,13 @@ stores.inject(MyMetaStore, storeInstance);
65262
65280
  });
65263
65281
  break;
65264
65282
  }
65265
- const copiedData = this.copy(cut);
65283
+ const copiedData = this.copy(cut, "shiftCells");
65266
65284
  this.paste(paste, copiedData, { isCutOperation: true });
65267
65285
  break;
65268
65286
  }
65269
65287
  case "INSERT_CELL": {
65270
65288
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
65271
- const copiedData = this.copy(cut);
65289
+ const copiedData = this.copy(cut, "shiftCells");
65272
65290
  this.paste(paste, copiedData, { isCutOperation: true });
65273
65291
  break;
65274
65292
  }
@@ -65383,11 +65401,11 @@ stores.inject(MyMetaStore, storeInstance);
65383
65401
  }
65384
65402
  return false;
65385
65403
  }
65386
- copy(zones) {
65404
+ copy(zones, mode = "copyPaste") {
65387
65405
  let copiedData = {};
65388
65406
  const clipboardData = this.getClipboardData(zones);
65389
65407
  for (const { handlerName, handler } of this.selectClipboardHandlers(clipboardData)) {
65390
- const data = handler.copy(clipboardData);
65408
+ const data = handler.copy(clipboardData, mode);
65391
65409
  copiedData[handlerName] = data;
65392
65410
  const minimalKeys = ["sheetId", "cells", "zones", "figureId"];
65393
65411
  for (const key of minimalKeys) {
@@ -66258,7 +66276,7 @@ stores.inject(MyMetaStore, storeInstance);
66258
66276
  ];
66259
66277
  for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
66260
66278
  const handler = new Handler(this.getters, this.dispatch);
66261
- const data = handler.copy(getClipboardDataPositions(sheetId, target));
66279
+ const data = handler.copy(getClipboardDataPositions(sheetId, target), "shiftCells");
66262
66280
  if (!data) {
66263
66281
  continue;
66264
66282
  }
@@ -73997,7 +74015,7 @@ stores.inject(MyMetaStore, storeInstance);
73997
74015
  handlers = [];
73998
74016
  uiHandlers = [];
73999
74017
  coreHandlers = [];
74000
- constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
74018
+ constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
74001
74019
  const start = performance.now();
74002
74020
  console.debug("##### Model creation #####");
74003
74021
  super();
@@ -74710,9 +74728,9 @@ stores.inject(MyMetaStore, storeInstance);
74710
74728
  exports.tokenize = tokenize;
74711
74729
 
74712
74730
 
74713
- __info__.version = "18.0.43";
74714
- __info__.date = "2025-09-05T07:38:36.406Z";
74715
- __info__.hash = "0f02dde";
74731
+ __info__.version = "18.0.44";
74732
+ __info__.date = "2025-09-11T08:43:01.459Z";
74733
+ __info__.hash = "7e6662c";
74716
74734
 
74717
74735
 
74718
74736
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);