@odoo/o-spreadsheet 18.2.28 → 18.2.30
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.
- package/dist/o-spreadsheet.cjs.js +89 -55
- package/dist/o-spreadsheet.d.ts +4 -3
- package/dist/o-spreadsheet.esm.js +89 -55
- package/dist/o-spreadsheet.iife.js +89 -55
- package/dist/o-spreadsheet.iife.min.js +7 -7
- package/dist/o_spreadsheet.xml +10 -7
- package/package.json +15 -2
|
@@ -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.
|
|
6
|
-
* @date 2025-09-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.30
|
|
6
|
+
* @date 2025-09-19T07:24:27.894Z
|
|
7
|
+
* @hash 16428fd
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -859,8 +859,19 @@
|
|
|
859
859
|
},
|
|
860
860
|
}[funcName];
|
|
861
861
|
}
|
|
862
|
+
/**
|
|
863
|
+
* Removes the specified indexes from the array.
|
|
864
|
+
* Sparse (empty) elements are transformed to undefined (unless their index is explicitly removed).
|
|
865
|
+
*/
|
|
862
866
|
function removeIndexesFromArray(array, indexes) {
|
|
863
|
-
|
|
867
|
+
const toRemove = new Set(indexes);
|
|
868
|
+
const newArray = [];
|
|
869
|
+
for (let i = 0; i < array.length; i++) {
|
|
870
|
+
if (!toRemove.has(i)) {
|
|
871
|
+
newArray.push(array[i]);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
return newArray;
|
|
864
875
|
}
|
|
865
876
|
function insertItemsAtIndex(array, items, index) {
|
|
866
877
|
const newArray = [...array];
|
|
@@ -6904,7 +6915,7 @@
|
|
|
6904
6915
|
this.getters = getters;
|
|
6905
6916
|
this.dispatch = dispatch;
|
|
6906
6917
|
}
|
|
6907
|
-
copy(data) {
|
|
6918
|
+
copy(data, mode = "copyPaste") {
|
|
6908
6919
|
return;
|
|
6909
6920
|
}
|
|
6910
6921
|
paste(target, clippedContent, options) { }
|
|
@@ -6923,7 +6934,7 @@
|
|
|
6923
6934
|
}
|
|
6924
6935
|
|
|
6925
6936
|
class AbstractCellClipboardHandler extends ClipboardHandler {
|
|
6926
|
-
copy(data) {
|
|
6937
|
+
copy(data, mode = "copyPaste") {
|
|
6927
6938
|
return;
|
|
6928
6939
|
}
|
|
6929
6940
|
pasteFromCopy(sheetId, target, content, options) {
|
|
@@ -8640,7 +8651,7 @@
|
|
|
8640
8651
|
}
|
|
8641
8652
|
return "Success" /* CommandResult.Success */;
|
|
8642
8653
|
}
|
|
8643
|
-
copy(data) {
|
|
8654
|
+
copy(data, mode = "copyPaste") {
|
|
8644
8655
|
const sheetId = data.sheetId;
|
|
8645
8656
|
const { clippedZones, rowsIndexes, columnsIndexes } = data;
|
|
8646
8657
|
const clippedCells = [];
|
|
@@ -8653,7 +8664,7 @@
|
|
|
8653
8664
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
8654
8665
|
const pivotId = this.getters.getPivotIdFromPosition(position);
|
|
8655
8666
|
const spreader = this.getters.getArrayFormulaSpreadingOn(position);
|
|
8656
|
-
if (pivotId && spreader) {
|
|
8667
|
+
if (mode !== "shiftCells" && pivotId && spreader) {
|
|
8657
8668
|
const pivotZone = this.getters.getSpreadZone(spreader);
|
|
8658
8669
|
if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
|
|
8659
8670
|
pivotZone &&
|
|
@@ -8671,7 +8682,7 @@
|
|
|
8671
8682
|
};
|
|
8672
8683
|
}
|
|
8673
8684
|
}
|
|
8674
|
-
else {
|
|
8685
|
+
else if (mode !== "shiftCells") {
|
|
8675
8686
|
if (spreader && !deepEquals(spreader, position)) {
|
|
8676
8687
|
const isSpreaderCopied = rowsIndexes.includes(spreader.row) && columnsIndexes.includes(spreader.col);
|
|
8677
8688
|
const content = isSpreaderCopied
|
|
@@ -9364,7 +9375,7 @@
|
|
|
9364
9375
|
}
|
|
9365
9376
|
|
|
9366
9377
|
class TableClipboardHandler extends AbstractCellClipboardHandler {
|
|
9367
|
-
copy(data) {
|
|
9378
|
+
copy(data, mode = "copyPaste") {
|
|
9368
9379
|
const sheetId = data.sheetId;
|
|
9369
9380
|
const { rowsIndexes, columnsIndexes, zones } = data;
|
|
9370
9381
|
const copiedTablesIds = new Set();
|
|
@@ -9394,11 +9405,13 @@
|
|
|
9394
9405
|
type: coreTable.type,
|
|
9395
9406
|
};
|
|
9396
9407
|
}
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9408
|
+
if (mode !== "shiftCells") {
|
|
9409
|
+
tableCellsInRow.push({
|
|
9410
|
+
table: copiedTable,
|
|
9411
|
+
style: this.getTableStyleToCopy(position),
|
|
9412
|
+
isWholeTableCopied: copiedTablesIds.has(table.id),
|
|
9413
|
+
});
|
|
9414
|
+
}
|
|
9402
9415
|
}
|
|
9403
9416
|
}
|
|
9404
9417
|
return {
|
|
@@ -15617,8 +15630,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15617
15630
|
}
|
|
15618
15631
|
|
|
15619
15632
|
function sortMatrix(matrix, locale, ...criteria) {
|
|
15620
|
-
for (
|
|
15621
|
-
|
|
15633
|
+
for (let i = 0; i < criteria.length; i++) {
|
|
15634
|
+
const param = i % 2 === 0 ? "sort_column" : "is_ascending";
|
|
15635
|
+
assert(() => criteria[i] !== undefined, _t("Value for parameter %s is missing in [[FUNCTION_NAME]].", param));
|
|
15622
15636
|
}
|
|
15623
15637
|
const sortingOrders = [];
|
|
15624
15638
|
const sortColumns = [];
|
|
@@ -23794,7 +23808,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
23794
23808
|
];
|
|
23795
23809
|
const SUPPORTED_VERTICAL_ALIGNMENTS = ["top", "center", "bottom"];
|
|
23796
23810
|
const SUPPORTED_FONTS = ["Arial"];
|
|
23797
|
-
const SUPPORTED_FILL_PATTERNS = ["solid"];
|
|
23811
|
+
const SUPPORTED_FILL_PATTERNS = ["solid", "none"];
|
|
23798
23812
|
const SUPPORTED_CF_TYPES = [
|
|
23799
23813
|
"expression",
|
|
23800
23814
|
"cellIs",
|
|
@@ -23979,7 +23993,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
23979
23993
|
};
|
|
23980
23994
|
/** Mapping between Excel format indexes (see XLSX_FORMAT_MAP) and some supported formats */
|
|
23981
23995
|
const XLSX_FORMATS_CONVERSION_MAP = {
|
|
23982
|
-
0: "",
|
|
23996
|
+
0: "General",
|
|
23983
23997
|
1: "0",
|
|
23984
23998
|
2: "0.00",
|
|
23985
23999
|
3: "#,#00",
|
|
@@ -24305,11 +24319,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24305
24319
|
* Excel format are defined in openXML §18.8.31
|
|
24306
24320
|
*/
|
|
24307
24321
|
function convertXlsxFormat(numFmtId, formats, warningManager) {
|
|
24308
|
-
if (numFmtId === 0) {
|
|
24309
|
-
return undefined;
|
|
24310
|
-
}
|
|
24311
24322
|
// Format is either defined in the imported data, or the formatId is defined in openXML §18.8.30
|
|
24312
24323
|
let format = XLSX_FORMATS_CONVERSION_MAP[numFmtId] || formats.find((f) => f.id === numFmtId)?.format;
|
|
24324
|
+
if (format === "General") {
|
|
24325
|
+
return undefined;
|
|
24326
|
+
}
|
|
24313
24327
|
if (format) {
|
|
24314
24328
|
try {
|
|
24315
24329
|
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 +27284,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27270
27284
|
});
|
|
27271
27285
|
}
|
|
27272
27286
|
extractRows(worksheet) {
|
|
27287
|
+
const spilledCells = new Set();
|
|
27273
27288
|
return this.mapOnElements({ parent: worksheet, query: "sheetData row" }, (rowElement) => {
|
|
27274
27289
|
return {
|
|
27275
27290
|
index: this.extractAttr(rowElement, "r", { required: true })?.asNum(),
|
|
27276
|
-
cells: this.extractCells(rowElement),
|
|
27291
|
+
cells: this.extractCells(rowElement, spilledCells),
|
|
27277
27292
|
height: this.extractAttr(rowElement, "ht")?.asNum(),
|
|
27278
27293
|
customHeight: this.extractAttr(rowElement, "customHeight")?.asBool(),
|
|
27279
27294
|
hidden: this.extractAttr(rowElement, "hidden")?.asBool(),
|
|
@@ -27283,14 +27298,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27283
27298
|
};
|
|
27284
27299
|
});
|
|
27285
27300
|
}
|
|
27286
|
-
extractCells(row) {
|
|
27301
|
+
extractCells(row, spilledCells) {
|
|
27287
27302
|
return this.mapOnElements({ parent: row, query: "c" }, (cellElement) => {
|
|
27303
|
+
const xc = this.extractAttr(cellElement, "r", { required: true })?.asString();
|
|
27304
|
+
const formula = this.extractCellFormula(cellElement);
|
|
27305
|
+
if (formula?.ref && formula.sharedIndex === undefined) {
|
|
27306
|
+
const zone = toZone(formula.ref);
|
|
27307
|
+
for (const { col, row } of positions(zone)) {
|
|
27308
|
+
const followerXc = toXC(col, row);
|
|
27309
|
+
if (followerXc !== xc) {
|
|
27310
|
+
spilledCells.add(followerXc);
|
|
27311
|
+
}
|
|
27312
|
+
}
|
|
27313
|
+
}
|
|
27314
|
+
const isSpilled = spilledCells.has(xc);
|
|
27288
27315
|
return {
|
|
27289
|
-
xc
|
|
27316
|
+
xc,
|
|
27290
27317
|
styleIndex: this.extractAttr(cellElement, "s")?.asNum(),
|
|
27291
27318
|
type: CELL_TYPE_CONVERSION_MAP[this.extractAttr(cellElement, "t", { default: "n" })?.asString()],
|
|
27292
|
-
value: this.extractChildTextContent(cellElement, "v"),
|
|
27293
|
-
formula:
|
|
27319
|
+
value: isSpilled ? undefined : this.extractChildTextContent(cellElement, "v") ?? undefined,
|
|
27320
|
+
formula: isSpilled ? undefined : formula,
|
|
27294
27321
|
};
|
|
27295
27322
|
});
|
|
27296
27323
|
}
|
|
@@ -27298,11 +27325,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27298
27325
|
const formulaElement = this.querySelector(cellElement, "f");
|
|
27299
27326
|
if (!formulaElement)
|
|
27300
27327
|
return undefined;
|
|
27301
|
-
|
|
27302
|
-
|
|
27303
|
-
|
|
27304
|
-
|
|
27305
|
-
|
|
27328
|
+
const content = this.extractTextContent(formulaElement);
|
|
27329
|
+
const sharedIndex = this.extractAttr(formulaElement, "si")?.asNum();
|
|
27330
|
+
const ref = this.extractAttr(formulaElement, "ref")?.asString();
|
|
27331
|
+
// This is the case of spilled cells of array formulas where <f> is empty
|
|
27332
|
+
if ((content === undefined || content.trim() === "") && sharedIndex === undefined) {
|
|
27333
|
+
return undefined;
|
|
27334
|
+
}
|
|
27335
|
+
return { content, sharedIndex, ref };
|
|
27306
27336
|
}
|
|
27307
27337
|
extractHyperLinks(worksheet) {
|
|
27308
27338
|
return this.mapOnElements({ parent: worksheet, query: "hyperlink" }, (linkElement) => {
|
|
@@ -46113,12 +46143,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46113
46143
|
addCalculatedMeasure() {
|
|
46114
46144
|
const { measures } = this.props.definition;
|
|
46115
46145
|
const measureName = this.env.model.getters.generateNewCalculatedMeasureName(measures);
|
|
46146
|
+
const aggregator = "sum";
|
|
46116
46147
|
this.props.onDimensionsUpdated({
|
|
46117
46148
|
measures: measures.concat([
|
|
46118
46149
|
{
|
|
46119
|
-
id: this.getMeasureId(measureName),
|
|
46150
|
+
id: this.getMeasureId(measureName, aggregator),
|
|
46120
46151
|
fieldName: measureName,
|
|
46121
|
-
aggregator
|
|
46152
|
+
aggregator,
|
|
46122
46153
|
computedBy: {
|
|
46123
46154
|
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
46124
46155
|
formula: "=0",
|
|
@@ -63278,7 +63309,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63278
63309
|
return { value: 0 };
|
|
63279
63310
|
}
|
|
63280
63311
|
const { columns, rows } = super.definition;
|
|
63281
|
-
if (columns.length + rows.length !== domain.length) {
|
|
63312
|
+
if (measure.aggregator && columns.length + rows.length !== domain.length) {
|
|
63282
63313
|
const values = this.getValuesToAggregate(measure, domain);
|
|
63283
63314
|
const aggregator = AGGREGATORS_FN[measure.aggregator];
|
|
63284
63315
|
if (!aggregator) {
|
|
@@ -63297,11 +63328,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63297
63328
|
if (columns.find((col) => col.nameWithGranularity === symbolName)) {
|
|
63298
63329
|
const { colDomain } = domainToColRowDomain(this, domain);
|
|
63299
63330
|
const symbolIndex = colDomain.findIndex((node) => node.field === symbolName);
|
|
63331
|
+
if (symbolIndex === -1) {
|
|
63332
|
+
return new NotAvailableError();
|
|
63333
|
+
}
|
|
63300
63334
|
return this.getPivotHeaderValueAndFormat(colDomain.slice(0, symbolIndex + 1));
|
|
63301
63335
|
}
|
|
63302
63336
|
if (rows.find((row) => row.nameWithGranularity === symbolName)) {
|
|
63303
63337
|
const { rowDomain } = domainToColRowDomain(this, domain);
|
|
63304
63338
|
const symbolIndex = rowDomain.findIndex((row) => row.field === symbolName);
|
|
63339
|
+
if (symbolIndex === -1) {
|
|
63340
|
+
return new NotAvailableError();
|
|
63341
|
+
}
|
|
63305
63342
|
return this.getPivotHeaderValueAndFormat(rowDomain.slice(0, symbolIndex + 1));
|
|
63306
63343
|
}
|
|
63307
63344
|
return this.getPivotCellValueAndFormat(symbolName, domain);
|
|
@@ -67807,12 +67844,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67807
67844
|
}
|
|
67808
67845
|
case "INSERT_CELL": {
|
|
67809
67846
|
const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
67810
|
-
const copiedData = this.copy(cut);
|
|
67847
|
+
const copiedData = this.copy(cut, "shiftCells");
|
|
67811
67848
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
67812
67849
|
}
|
|
67813
67850
|
case "DELETE_CELL": {
|
|
67814
67851
|
const { cut, paste } = this.getDeleteCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
67815
|
-
const copiedData = this.copy(cut);
|
|
67852
|
+
const copiedData = this.copy(cut, "shiftCells");
|
|
67816
67853
|
return this.isPasteAllowed(paste, copiedData, { isCutOperation: true });
|
|
67817
67854
|
}
|
|
67818
67855
|
}
|
|
@@ -67902,13 +67939,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67902
67939
|
});
|
|
67903
67940
|
break;
|
|
67904
67941
|
}
|
|
67905
|
-
const copiedData = this.copy(cut);
|
|
67942
|
+
const copiedData = this.copy(cut, "shiftCells");
|
|
67906
67943
|
this.paste(paste, copiedData, { isCutOperation: true });
|
|
67907
67944
|
break;
|
|
67908
67945
|
}
|
|
67909
67946
|
case "INSERT_CELL": {
|
|
67910
67947
|
const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
|
|
67911
|
-
const copiedData = this.copy(cut);
|
|
67948
|
+
const copiedData = this.copy(cut, "shiftCells");
|
|
67912
67949
|
this.paste(paste, copiedData, { isCutOperation: true });
|
|
67913
67950
|
break;
|
|
67914
67951
|
}
|
|
@@ -68023,11 +68060,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68023
68060
|
}
|
|
68024
68061
|
return false;
|
|
68025
68062
|
}
|
|
68026
|
-
copy(zones) {
|
|
68063
|
+
copy(zones, mode = "copyPaste") {
|
|
68027
68064
|
let copiedData = {};
|
|
68028
68065
|
const clipboardData = this.getClipboardData(zones);
|
|
68029
68066
|
for (const { handlerName, handler } of this.selectClipboardHandlers(clipboardData)) {
|
|
68030
|
-
const data = handler.copy(clipboardData);
|
|
68067
|
+
const data = handler.copy(clipboardData, mode);
|
|
68031
68068
|
copiedData[handlerName] = data;
|
|
68032
68069
|
const minimalKeys = ["sheetId", "cells", "zones", "figureId"];
|
|
68033
68070
|
for (const key of minimalKeys) {
|
|
@@ -68864,13 +68901,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68864
68901
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
68865
68902
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
68866
68903
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
68867
|
-
const originalSize =
|
|
68868
|
-
|
|
68869
|
-
|
|
68870
|
-
|
|
68871
|
-
const isDefaultCol = isCol && size === DEFAULT_CELL_WIDTH;
|
|
68872
|
-
return [element, isDefaultCol ? undefined : size];
|
|
68873
|
-
}));
|
|
68904
|
+
const originalSize = {};
|
|
68905
|
+
for (const element of toRemove) {
|
|
68906
|
+
originalSize[element] = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
68907
|
+
}
|
|
68874
68908
|
const target = [
|
|
68875
68909
|
{
|
|
68876
68910
|
left: isCol ? start + deltaCol : 0,
|
|
@@ -68891,7 +68925,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68891
68925
|
];
|
|
68892
68926
|
for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
|
|
68893
68927
|
const handler = new Handler(this.getters, this.dispatch);
|
|
68894
|
-
const data = handler.copy(getClipboardDataPositions(sheetId, target));
|
|
68928
|
+
const data = handler.copy(getClipboardDataPositions(sheetId, target), "shiftCells");
|
|
68895
68929
|
if (!data) {
|
|
68896
68930
|
continue;
|
|
68897
68931
|
}
|
|
@@ -68906,11 +68940,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68906
68940
|
for (const element of toRemove) {
|
|
68907
68941
|
const size = originalSize[element];
|
|
68908
68942
|
const currentSize = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, currentIndex);
|
|
68909
|
-
if (size
|
|
68943
|
+
if (size != currentSize) {
|
|
68910
68944
|
resizingGroups[size] ??= [];
|
|
68911
68945
|
resizingGroups[size].push(currentIndex);
|
|
68912
|
-
currentIndex += 1;
|
|
68913
68946
|
}
|
|
68947
|
+
currentIndex += 1;
|
|
68914
68948
|
}
|
|
68915
68949
|
for (const size in resizingGroups) {
|
|
68916
68950
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -76579,7 +76613,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76579
76613
|
handlers = [];
|
|
76580
76614
|
uiHandlers = [];
|
|
76581
76615
|
coreHandlers = [];
|
|
76582
|
-
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport =
|
|
76616
|
+
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = false) {
|
|
76583
76617
|
const start = performance.now();
|
|
76584
76618
|
console.debug("##### Model creation #####");
|
|
76585
76619
|
super();
|
|
@@ -77315,9 +77349,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77315
77349
|
exports.tokenize = tokenize;
|
|
77316
77350
|
|
|
77317
77351
|
|
|
77318
|
-
__info__.version = "18.2.
|
|
77319
|
-
__info__.date = "2025-09-
|
|
77320
|
-
__info__.hash = "
|
|
77352
|
+
__info__.version = "18.2.30";
|
|
77353
|
+
__info__.date = "2025-09-19T07:24:27.894Z";
|
|
77354
|
+
__info__.hash = "16428fd";
|
|
77321
77355
|
|
|
77322
77356
|
|
|
77323
77357
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|