@odoo/o-spreadsheet 18.4.9 → 18.4.10

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.4.9
6
- * @date 2025-09-05T07:38:32.126Z
7
- * @hash a261873
5
+ * @version 18.4.10
6
+ * @date 2025-09-11T08:45:39.178Z
7
+ * @hash 15a11a4
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -7355,7 +7355,7 @@
7355
7355
  this.getters = getters;
7356
7356
  this.dispatch = dispatch;
7357
7357
  }
7358
- copy(data, isCutOperation) {
7358
+ copy(data, isCutOperation, mode = "copyPaste") {
7359
7359
  return;
7360
7360
  }
7361
7361
  paste(target, clippedContent, options) { }
@@ -7374,7 +7374,7 @@
7374
7374
  }
7375
7375
 
7376
7376
  class AbstractCellClipboardHandler extends ClipboardHandler {
7377
- copy(data) {
7377
+ copy(data, isCutOperation, mode = "copyPaste") {
7378
7378
  return;
7379
7379
  }
7380
7380
  pasteFromCopy(sheetId, target, content, options) {
@@ -8904,7 +8904,7 @@
8904
8904
  }
8905
8905
  return "Success" /* CommandResult.Success */;
8906
8906
  }
8907
- copy(data) {
8907
+ copy(data, isCutOperation, mode = "copyPaste") {
8908
8908
  const sheetId = data.sheetId;
8909
8909
  const { clippedZones, rowsIndexes, columnsIndexes } = data;
8910
8910
  const clippedCells = [];
@@ -8917,7 +8917,7 @@
8917
8917
  const evaluatedCell = this.getters.getEvaluatedCell(position);
8918
8918
  const pivotId = this.getters.getPivotIdFromPosition(position);
8919
8919
  const spreader = this.getters.getArrayFormulaSpreadingOn(position);
8920
- if (pivotId && spreader) {
8920
+ if (mode !== "shiftCells" && pivotId && spreader) {
8921
8921
  const pivotZone = this.getters.getSpreadZone(spreader);
8922
8922
  if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
8923
8923
  pivotZone &&
@@ -8935,7 +8935,7 @@
8935
8935
  };
8936
8936
  }
8937
8937
  }
8938
- else {
8938
+ else if (mode !== "shiftCells") {
8939
8939
  if (spreader && !deepEquals(spreader, position)) {
8940
8940
  const isSpreaderCopied = rowsIndexes.includes(spreader.row) && columnsIndexes.includes(spreader.col);
8941
8941
  const content = isSpreaderCopied
@@ -9633,7 +9633,7 @@
9633
9633
  }
9634
9634
 
9635
9635
  class TableClipboardHandler extends AbstractCellClipboardHandler {
9636
- copy(data, isCutOperation) {
9636
+ copy(data, isCutOperation, mode = "copyPaste") {
9637
9637
  const sheetId = data.sheetId;
9638
9638
  const { rowsIndexes, columnsIndexes, zones } = data;
9639
9639
  const copiedTablesIds = new Set();
@@ -9671,11 +9671,13 @@
9671
9671
  type: coreTable.type,
9672
9672
  };
9673
9673
  }
9674
- tableCellsInRow.push({
9675
- table: copiedTable,
9676
- style: this.getTableStyleToCopy(position),
9677
- isWholeTableCopied: copiedTablesIds.has(table.id),
9678
- });
9674
+ if (mode !== "shiftCells") {
9675
+ tableCellsInRow.push({
9676
+ table: copiedTable,
9677
+ style: this.getTableStyleToCopy(position),
9678
+ isWholeTableCopied: copiedTablesIds.has(table.id),
9679
+ });
9680
+ }
9679
9681
  }
9680
9682
  }
9681
9683
  return {
@@ -37513,7 +37515,7 @@ stores.inject(MyMetaStore, storeInstance);
37513
37515
  ];
37514
37516
  const SUPPORTED_VERTICAL_ALIGNMENTS = ["top", "center", "bottom"];
37515
37517
  const SUPPORTED_FONTS = ["Arial"];
37516
- const SUPPORTED_FILL_PATTERNS = ["solid"];
37518
+ const SUPPORTED_FILL_PATTERNS = ["solid", "none"];
37517
37519
  const SUPPORTED_CF_TYPES = [
37518
37520
  "expression",
37519
37521
  "cellIs",
@@ -37713,7 +37715,7 @@ stores.inject(MyMetaStore, storeInstance);
37713
37715
  };
37714
37716
  /** Mapping between Excel format indexes (see XLSX_FORMAT_MAP) and some supported formats */
37715
37717
  const XLSX_FORMATS_CONVERSION_MAP = {
37716
- 0: "",
37718
+ 0: "General",
37717
37719
  1: "0",
37718
37720
  2: "0.00",
37719
37721
  3: "#,#00",
@@ -38039,11 +38041,11 @@ stores.inject(MyMetaStore, storeInstance);
38039
38041
  * Excel format are defined in openXML §18.8.31
38040
38042
  */
38041
38043
  function convertXlsxFormat(numFmtId, formats, warningManager) {
38042
- if (numFmtId === 0) {
38043
- return undefined;
38044
- }
38045
38044
  // Format is either defined in the imported data, or the formatId is defined in openXML §18.8.30
38046
38045
  const format = XLSX_FORMATS_CONVERSION_MAP[numFmtId] || formats.find((f) => f.id === numFmtId)?.format;
38046
+ if (format === "General") {
38047
+ return undefined;
38048
+ }
38047
38049
  if (format) {
38048
38050
  try {
38049
38051
  let convertedFormat = format.replace(/\[(.*)-[A-Z0-9]{3}\]/g, "[$1]"); // remove currency and locale/date system/number system info (ECMA §18.8.31)
@@ -40621,10 +40623,11 @@ stores.inject(MyMetaStore, storeInstance);
40621
40623
  });
40622
40624
  }
40623
40625
  extractRows(worksheet) {
40626
+ const spilledCells = new Set();
40624
40627
  return this.mapOnElements({ parent: worksheet, query: "sheetData row" }, (rowElement) => {
40625
40628
  return {
40626
40629
  index: this.extractAttr(rowElement, "r", { required: true })?.asNum(),
40627
- cells: this.extractCells(rowElement),
40630
+ cells: this.extractCells(rowElement, spilledCells),
40628
40631
  height: this.extractAttr(rowElement, "ht")?.asNum(),
40629
40632
  customHeight: this.extractAttr(rowElement, "customHeight")?.asBool(),
40630
40633
  hidden: this.extractAttr(rowElement, "hidden")?.asBool(),
@@ -40634,14 +40637,26 @@ stores.inject(MyMetaStore, storeInstance);
40634
40637
  };
40635
40638
  });
40636
40639
  }
40637
- extractCells(row) {
40640
+ extractCells(row, spilledCells) {
40638
40641
  return this.mapOnElements({ parent: row, query: "c" }, (cellElement) => {
40642
+ const xc = this.extractAttr(cellElement, "r", { required: true })?.asString();
40643
+ const formula = this.extractCellFormula(cellElement);
40644
+ if (formula?.ref && formula.sharedIndex === undefined) {
40645
+ const zone = toZone(formula.ref);
40646
+ for (const { col, row } of positions(zone)) {
40647
+ const followerXc = toXC(col, row);
40648
+ if (followerXc !== xc) {
40649
+ spilledCells.add(followerXc);
40650
+ }
40651
+ }
40652
+ }
40653
+ const isSpilled = spilledCells.has(xc);
40639
40654
  return {
40640
- xc: this.extractAttr(cellElement, "r", { required: true })?.asString(),
40655
+ xc,
40641
40656
  styleIndex: this.extractAttr(cellElement, "s")?.asNum(),
40642
40657
  type: CELL_TYPE_CONVERSION_MAP[this.extractAttr(cellElement, "t", { default: "n" })?.asString()],
40643
- value: this.extractChildTextContent(cellElement, "v"),
40644
- formula: this.extractCellFormula(cellElement),
40658
+ value: isSpilled ? undefined : this.extractChildTextContent(cellElement, "v") ?? undefined,
40659
+ formula: isSpilled ? undefined : formula,
40645
40660
  };
40646
40661
  });
40647
40662
  }
@@ -40649,11 +40664,14 @@ stores.inject(MyMetaStore, storeInstance);
40649
40664
  const formulaElement = this.querySelector(cellElement, "f");
40650
40665
  if (!formulaElement)
40651
40666
  return undefined;
40652
- return {
40653
- content: this.extractTextContent(formulaElement),
40654
- sharedIndex: this.extractAttr(formulaElement, "si")?.asNum(),
40655
- ref: this.extractAttr(formulaElement, "ref")?.asString(),
40656
- };
40667
+ const content = this.extractTextContent(formulaElement);
40668
+ const sharedIndex = this.extractAttr(formulaElement, "si")?.asNum();
40669
+ const ref = this.extractAttr(formulaElement, "ref")?.asString();
40670
+ // This is the case of spilled cells of array formulas where <f> is empty
40671
+ if ((content === undefined || content.trim() === "") && sharedIndex === undefined) {
40672
+ return undefined;
40673
+ }
40674
+ return { content, sharedIndex, ref };
40657
40675
  }
40658
40676
  extractHyperLinks(worksheet) {
40659
40677
  return this.mapOnElements({ parent: worksheet, query: "hyperlink" }, (linkElement) => {
@@ -70991,7 +71009,7 @@ stores.inject(MyMetaStore, storeInstance);
70991
71009
  bottom: rowIndex,
70992
71010
  }));
70993
71011
  const handler = new CellClipboardHandler(this.getters, this.dispatch);
70994
- const data = handler.copy(getClipboardDataPositions(sheetId, rowsToKeep));
71012
+ const data = handler.copy(getClipboardDataPositions(sheetId, rowsToKeep), false);
70995
71013
  if (!data) {
70996
71014
  return;
70997
71015
  }
@@ -73076,12 +73094,12 @@ stores.inject(MyMetaStore, storeInstance);
73076
73094
  }
73077
73095
  case "INSERT_CELL": {
73078
73096
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
73079
- const copiedData = this.copy(cut);
73097
+ const copiedData = this.copy(cut, "shiftCells");
73080
73098
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
73081
73099
  }
73082
73100
  case "DELETE_CELL": {
73083
73101
  const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
73084
- const copiedData = this.copy(cut);
73102
+ const copiedData = this.copy(cut, "shiftCells");
73085
73103
  return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
73086
73104
  }
73087
73105
  }
@@ -73192,13 +73210,13 @@ stores.inject(MyMetaStore, storeInstance);
73192
73210
  });
73193
73211
  break;
73194
73212
  }
73195
- const copiedData = this.copy(cut);
73213
+ const copiedData = this.copy(cut, "shiftCells");
73196
73214
  this.paste(paste, copiedData, { isCutOperation: true });
73197
73215
  break;
73198
73216
  }
73199
73217
  case "INSERT_CELL": {
73200
73218
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
73201
- const copiedData = this.copy(cut);
73219
+ const copiedData = this.copy(cut, "shiftCells");
73202
73220
  this.paste(paste, copiedData, { isCutOperation: true });
73203
73221
  break;
73204
73222
  }
@@ -73313,11 +73331,11 @@ stores.inject(MyMetaStore, storeInstance);
73313
73331
  }
73314
73332
  return false;
73315
73333
  }
73316
- copy(zones) {
73334
+ copy(zones, mode = "copyPaste") {
73317
73335
  const copiedData = {};
73318
73336
  const clipboardData = this.getClipboardData(zones);
73319
73337
  for (const { handlerName, handler } of this.selectClipboardHandlers(clipboardData)) {
73320
- const data = handler.copy(clipboardData, this._isCutOperation);
73338
+ const data = handler.copy(clipboardData, this._isCutOperation, mode);
73321
73339
  copiedData[handlerName] = data;
73322
73340
  const minimalKeys = ["sheetId", "cells", "zones", "figureId"];
73323
73341
  for (const key of minimalKeys) {
@@ -74331,7 +74349,7 @@ stores.inject(MyMetaStore, storeInstance);
74331
74349
  ];
74332
74350
  for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
74333
74351
  const handler = new Handler(this.getters, this.dispatch);
74334
- const data = handler.copy(getClipboardDataPositions(sheetId, target));
74352
+ const data = handler.copy(getClipboardDataPositions(sheetId, target), false, "shiftCells");
74335
74353
  if (!data) {
74336
74354
  continue;
74337
74355
  }
@@ -84071,7 +84089,7 @@ stores.inject(MyMetaStore, storeInstance);
84071
84089
  handlers = [];
84072
84090
  uiHandlers = [];
84073
84091
  coreHandlers = [];
84074
- constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
84092
+ constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
84075
84093
  const start = performance.now();
84076
84094
  console.debug("##### Model creation #####");
84077
84095
  super();
@@ -84821,9 +84839,9 @@ stores.inject(MyMetaStore, storeInstance);
84821
84839
  exports.tokenize = tokenize;
84822
84840
 
84823
84841
 
84824
- __info__.version = "18.4.9";
84825
- __info__.date = "2025-09-05T07:38:32.126Z";
84826
- __info__.hash = "a261873";
84842
+ __info__.version = "18.4.10";
84843
+ __info__.date = "2025-09-11T08:45:39.178Z";
84844
+ __info__.hash = "15a11a4";
84827
84845
 
84828
84846
 
84829
84847
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);