@odoo/o-spreadsheet 18.3.17 → 18.3.19
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 +156 -111
- package/dist/o-spreadsheet.d.ts +67 -62
- package/dist/o-spreadsheet.esm.js +156 -111
- package/dist/o-spreadsheet.iife.js +156 -111
- package/dist/o-spreadsheet.iife.min.js +381 -381
- package/dist/o_spreadsheet.xml +17 -9
- package/package.json +1 -1
|
@@ -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.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.19
|
|
6
|
+
* @date 2025-09-05T07:38:30.661Z
|
|
7
|
+
* @hash 77fd307
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -3498,6 +3498,7 @@
|
|
|
3498
3498
|
"AUTOFILL_CELL",
|
|
3499
3499
|
"SET_BORDER",
|
|
3500
3500
|
"SET_ZONE_BORDERS",
|
|
3501
|
+
"SET_BORDERS_ON_TARGET",
|
|
3501
3502
|
]);
|
|
3502
3503
|
const readonlyAllowedCommands = new Set([
|
|
3503
3504
|
"START",
|
|
@@ -6443,40 +6444,44 @@
|
|
|
6443
6444
|
};
|
|
6444
6445
|
}
|
|
6445
6446
|
function getRangeAdapter(cmd) {
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
applyChange: getApplyRangeChangeAddColRow(cmd),
|
|
6456
|
-
sheetId: cmd.sheetId,
|
|
6457
|
-
sheetName: cmd.sheetName,
|
|
6458
|
-
};
|
|
6459
|
-
case "DELETE_SHEET":
|
|
6460
|
-
return {
|
|
6461
|
-
applyChange: getApplyRangeChangeDeleteSheet(cmd),
|
|
6462
|
-
sheetId: cmd.sheetId,
|
|
6463
|
-
sheetName: cmd.sheetName,
|
|
6464
|
-
};
|
|
6465
|
-
case "RENAME_SHEET":
|
|
6466
|
-
return {
|
|
6467
|
-
applyChange: getApplyRangeChangeRenameSheet(cmd),
|
|
6468
|
-
sheetId: cmd.sheetId,
|
|
6469
|
-
sheetName: cmd.oldName,
|
|
6470
|
-
};
|
|
6471
|
-
case "MOVE_RANGES":
|
|
6472
|
-
return {
|
|
6473
|
-
applyChange: getApplyRangeChangeMoveRange(cmd),
|
|
6474
|
-
sheetId: cmd.sheetId,
|
|
6475
|
-
sheetName: cmd.sheetName,
|
|
6476
|
-
};
|
|
6447
|
+
return rangeAdapterRegistry.get(cmd.type)?.(cmd);
|
|
6448
|
+
}
|
|
6449
|
+
class RangeAdapterRegistry extends Registry {
|
|
6450
|
+
add(cmdType, fn) {
|
|
6451
|
+
super.add(cmdType, fn);
|
|
6452
|
+
return this;
|
|
6453
|
+
}
|
|
6454
|
+
get(cmdType) {
|
|
6455
|
+
return this.content[cmdType];
|
|
6477
6456
|
}
|
|
6478
|
-
return undefined;
|
|
6479
6457
|
}
|
|
6458
|
+
const rangeAdapterRegistry = new RangeAdapterRegistry();
|
|
6459
|
+
rangeAdapterRegistry
|
|
6460
|
+
.add("REMOVE_COLUMNS_ROWS", (cmd) => ({
|
|
6461
|
+
applyChange: getApplyRangeChangeRemoveColRow(cmd),
|
|
6462
|
+
sheetId: cmd.sheetId,
|
|
6463
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6464
|
+
}))
|
|
6465
|
+
.add("ADD_COLUMNS_ROWS", (cmd) => ({
|
|
6466
|
+
applyChange: getApplyRangeChangeAddColRow(cmd),
|
|
6467
|
+
sheetId: cmd.sheetId,
|
|
6468
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6469
|
+
}))
|
|
6470
|
+
.add("DELETE_SHEET", (cmd) => ({
|
|
6471
|
+
applyChange: getApplyRangeChangeDeleteSheet(cmd),
|
|
6472
|
+
sheetId: cmd.sheetId,
|
|
6473
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6474
|
+
}))
|
|
6475
|
+
.add("RENAME_SHEET", (cmd) => ({
|
|
6476
|
+
applyChange: getApplyRangeChangeRenameSheet(cmd),
|
|
6477
|
+
sheetId: cmd.sheetId,
|
|
6478
|
+
sheetName: { old: cmd.oldName, current: cmd.newName },
|
|
6479
|
+
}))
|
|
6480
|
+
.add("MOVE_RANGES", (cmd) => ({
|
|
6481
|
+
applyChange: getApplyRangeChangeMoveRange(cmd),
|
|
6482
|
+
sheetId: cmd.sheetId,
|
|
6483
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6484
|
+
}));
|
|
6480
6485
|
function getApplyRangeChangeRemoveColRow(cmd) {
|
|
6481
6486
|
let start = cmd.dimension === "COL" ? "left" : "top";
|
|
6482
6487
|
let end = cmd.dimension === "COL" ? "right" : "bottom";
|
|
@@ -7104,14 +7109,11 @@
|
|
|
7104
7109
|
const width = content[0].length, height = content.length;
|
|
7105
7110
|
return target.map((t) => splitZoneForPaste(t, width, height)).flat();
|
|
7106
7111
|
}
|
|
7107
|
-
function parseOSClipboardContent(content
|
|
7112
|
+
function parseOSClipboardContent(content) {
|
|
7108
7113
|
let spreadsheetContent = undefined;
|
|
7109
7114
|
if (content[ClipboardMIMEType.Html]) {
|
|
7110
7115
|
const htmlDocument = new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html");
|
|
7111
|
-
|
|
7112
|
-
.querySelector("div")
|
|
7113
|
-
?.getAttribute("data-osheet-clipboard");
|
|
7114
|
-
spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
|
|
7116
|
+
spreadsheetContent = getOSheetDataFromHTML(htmlDocument);
|
|
7115
7117
|
}
|
|
7116
7118
|
const textContent = content[ClipboardMIMEType.PlainText] || "";
|
|
7117
7119
|
let imageBlob = undefined;
|
|
@@ -7130,6 +7132,17 @@
|
|
|
7130
7132
|
};
|
|
7131
7133
|
return osClipboardContent;
|
|
7132
7134
|
}
|
|
7135
|
+
function getOSheetDataFromHTML(htmlDocument) {
|
|
7136
|
+
const attributes = [...htmlDocument.documentElement.attributes];
|
|
7137
|
+
// Check if it's a Microsoft Office clipboard data (it will have some namespaces defined in the root element)
|
|
7138
|
+
if (attributes.some((attr) => attr.value.includes("microsoft"))) {
|
|
7139
|
+
return undefined;
|
|
7140
|
+
}
|
|
7141
|
+
const oSheetClipboardData = htmlDocument
|
|
7142
|
+
.querySelector("div")
|
|
7143
|
+
?.getAttribute("data-osheet-clipboard");
|
|
7144
|
+
return oSheetClipboardData && JSON.parse(oSheetClipboardData);
|
|
7145
|
+
}
|
|
7133
7146
|
/**
|
|
7134
7147
|
* Applies each clipboard handler to paste its corresponding data into the target.
|
|
7135
7148
|
*/
|
|
@@ -7819,8 +7832,11 @@
|
|
|
7819
7832
|
// (a) Swap 2 rows. This multiply the determinant by -1.
|
|
7820
7833
|
// (b) Multiply a row by a scalar. This multiply the determinant by that scalar.
|
|
7821
7834
|
// (c) Add to a row a multiple of another row. This does not change the determinant.
|
|
7835
|
+
if (M.length < 1 || M[0].length < 1) {
|
|
7836
|
+
throw new Error("invertMatrix: an empty matrix cannot be inverted.");
|
|
7837
|
+
}
|
|
7822
7838
|
if (M.length !== M[0].length) {
|
|
7823
|
-
throw new
|
|
7839
|
+
throw new Error("invertMatrix: only square matrices are invertible");
|
|
7824
7840
|
}
|
|
7825
7841
|
let determinant = 1;
|
|
7826
7842
|
const dim = M.length;
|
|
@@ -7889,8 +7905,11 @@
|
|
|
7889
7905
|
* Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
|
|
7890
7906
|
*/
|
|
7891
7907
|
function multiplyMatrices(matrix1, matrix2) {
|
|
7908
|
+
if (matrix1.length < 1 || matrix2.length < 1) {
|
|
7909
|
+
throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
|
|
7910
|
+
}
|
|
7892
7911
|
if (matrix1.length !== matrix2[0].length) {
|
|
7893
|
-
throw new
|
|
7912
|
+
throw new Error("multiplyMatrices: incompatible matrices size.");
|
|
7894
7913
|
}
|
|
7895
7914
|
const rowsM1 = matrix1[0].length;
|
|
7896
7915
|
const colsM2 = matrix2.length;
|
|
@@ -7916,7 +7935,7 @@
|
|
|
7916
7935
|
return arg;
|
|
7917
7936
|
}
|
|
7918
7937
|
if (!isSingleElementMatrix(arg)) {
|
|
7919
|
-
throw new
|
|
7938
|
+
throw new Error("The value should be a scalar or a 1x1 matrix");
|
|
7920
7939
|
}
|
|
7921
7940
|
return arg[0][0];
|
|
7922
7941
|
}
|
|
@@ -8153,6 +8172,16 @@
|
|
|
8153
8172
|
}
|
|
8154
8173
|
return values;
|
|
8155
8174
|
}
|
|
8175
|
+
function assertNonEmptyMatrix(matrix, argName) {
|
|
8176
|
+
assert(() => matrix.length > 0 && matrix[0].length > 0, _t("[[FUNCTION_NAME]] expects the provided values of %(argName)s to be a non-empty matrix.", {
|
|
8177
|
+
argName,
|
|
8178
|
+
}));
|
|
8179
|
+
}
|
|
8180
|
+
function assertNonEmpty(...data) {
|
|
8181
|
+
if (data.length === 0 || data.some((arg) => arg.length === 0)) {
|
|
8182
|
+
throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input data."));
|
|
8183
|
+
}
|
|
8184
|
+
}
|
|
8156
8185
|
|
|
8157
8186
|
const PREVIOUS_VALUE = "(previous)";
|
|
8158
8187
|
const NEXT_VALUE = "(next)";
|
|
@@ -10976,6 +11005,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10976
11005
|
compute: function (matrix1, matrix2) {
|
|
10977
11006
|
const _matrix1 = toNumberMatrix(matrix1, "matrix1");
|
|
10978
11007
|
const _matrix2 = toNumberMatrix(matrix2, "matrix2");
|
|
11008
|
+
assert(() => _matrix1.length > 0 && _matrix2.length > 0, _t("The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices."));
|
|
10979
11009
|
assert(() => _matrix1.length === _matrix2[0].length, _t("In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the \
|
|
10980
11010
|
number of rows of the second matrix (%s).", _matrix1.length.toString(), _matrix2[0].length.toString()));
|
|
10981
11011
|
return multiplyMatrices(_matrix1, _matrix2);
|
|
@@ -12771,6 +12801,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12771
12801
|
],
|
|
12772
12802
|
compute: function (x, dataY, dataX) {
|
|
12773
12803
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
12804
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
12774
12805
|
return predictLinearValues([flatDataY], [flatDataX], matrixMap(toMatrix(x), (value) => toNumber(value, this.locale)), true);
|
|
12775
12806
|
},
|
|
12776
12807
|
isExported: true,
|
|
@@ -12787,6 +12818,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12787
12818
|
arg("b (boolean, default=TRUE)", _t("Given a general exponential form of y = b*m^x for a curve fit, calculates b if TRUE or forces b to be 1 and only calculates the m values if FALSE.")),
|
|
12788
12819
|
],
|
|
12789
12820
|
compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
|
|
12821
|
+
assertNonEmptyMatrix(knownDataY, "known_data_y");
|
|
12790
12822
|
return expM(predictLinearValues(logM(toNumberMatrix(knownDataY, "the first argument (known_data_y)")), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b)));
|
|
12791
12823
|
},
|
|
12792
12824
|
};
|
|
@@ -12801,6 +12833,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12801
12833
|
],
|
|
12802
12834
|
compute: function (dataY, dataX) {
|
|
12803
12835
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
12836
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
12804
12837
|
const [[], [intercept]] = fullLinearRegression([flatDataX], [flatDataY]);
|
|
12805
12838
|
return intercept;
|
|
12806
12839
|
},
|
|
@@ -12850,6 +12883,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12850
12883
|
arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
|
|
12851
12884
|
],
|
|
12852
12885
|
compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
|
|
12886
|
+
assertNonEmptyMatrix(dataY, "data_y");
|
|
12853
12887
|
return fullLinearRegression(toNumberMatrix(dataX, "the first argument (data_y)"), toNumberMatrix(dataY, "the second argument (data_x)"), toBoolean(calculateB), toBoolean(verbose));
|
|
12854
12888
|
},
|
|
12855
12889
|
isExported: true,
|
|
@@ -12866,6 +12900,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12866
12900
|
arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
|
|
12867
12901
|
],
|
|
12868
12902
|
compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
|
|
12903
|
+
assertNonEmptyMatrix(dataY, "data_y");
|
|
12869
12904
|
const coeffs = fullLinearRegression(toNumberMatrix(dataX, "the second argument (data_x)"), logM(toNumberMatrix(dataY, "the first argument (data_y)")), toBoolean(calculateB), toBoolean(verbose));
|
|
12870
12905
|
for (let i = 0; i < coeffs.length; i++) {
|
|
12871
12906
|
coeffs[i][0] = Math.exp(coeffs[i][0]);
|
|
@@ -12887,9 +12922,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12887
12922
|
const flatX = dataX.flat();
|
|
12888
12923
|
const flatY = dataY.flat();
|
|
12889
12924
|
assertSameNumberOfElements(flatX, flatY);
|
|
12890
|
-
|
|
12891
|
-
return new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
|
|
12892
|
-
}
|
|
12925
|
+
assertNonEmpty(flatX, flatY);
|
|
12893
12926
|
const n = flatX.length;
|
|
12894
12927
|
let trueN = 0, trueP = 0, falseP = 0, falseN = 0;
|
|
12895
12928
|
for (let i = 0; i < n; ++i) {
|
|
@@ -13053,12 +13086,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13053
13086
|
// -----------------------------------------------------------------------------
|
|
13054
13087
|
function pearson(dataY, dataX) {
|
|
13055
13088
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13056
|
-
|
|
13057
|
-
throw new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
|
|
13058
|
-
}
|
|
13059
|
-
if (flatDataX.length < 2) {
|
|
13060
|
-
throw new EvaluationError(_t("[[FUNCTION_NAME]] needs at least two values for both parameters."));
|
|
13061
|
-
}
|
|
13089
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13062
13090
|
const n = flatDataX.length;
|
|
13063
13091
|
let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0, sumYY = 0;
|
|
13064
13092
|
for (let i = 0; i < n; i++) {
|
|
@@ -13147,6 +13175,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13147
13175
|
],
|
|
13148
13176
|
compute: function (dataY, dataX, order, intercept = { value: true }) {
|
|
13149
13177
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13178
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13150
13179
|
return polynomialRegression(flatDataY, flatDataX, toNumber(order, this.locale), toBoolean(intercept));
|
|
13151
13180
|
},
|
|
13152
13181
|
isExported: false,
|
|
@@ -13166,6 +13195,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13166
13195
|
compute: function (x, dataY, dataX, order, intercept = { value: true }) {
|
|
13167
13196
|
const _order = toNumber(order, this.locale);
|
|
13168
13197
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13198
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13169
13199
|
const coeffs = polynomialRegression(flatDataY, flatDataX, _order, toBoolean(intercept)).flat();
|
|
13170
13200
|
return matrixMap(toMatrix(x), (xij) => evaluatePolynomial(coeffs, toNumber(xij, this.locale), _order));
|
|
13171
13201
|
},
|
|
@@ -13282,6 +13312,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13282
13312
|
],
|
|
13283
13313
|
compute: function (dataY, dataX) {
|
|
13284
13314
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13315
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13285
13316
|
const [[slope]] = fullLinearRegression([flatDataX], [flatDataY]);
|
|
13286
13317
|
return slope;
|
|
13287
13318
|
},
|
|
@@ -13330,6 +13361,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13330
13361
|
],
|
|
13331
13362
|
compute: function (dataX, dataY) {
|
|
13332
13363
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13364
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13333
13365
|
const n = flatDataX.length;
|
|
13334
13366
|
const order = flatDataX.map((e, i) => [e, flatDataY[i]]);
|
|
13335
13367
|
order.sort((a, b) => a[0] - b[0]);
|
|
@@ -13440,6 +13472,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13440
13472
|
],
|
|
13441
13473
|
compute: function (dataY, dataX) {
|
|
13442
13474
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13475
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13443
13476
|
const data = fullLinearRegression([flatDataX], [flatDataY], true, true);
|
|
13444
13477
|
return data[1][2];
|
|
13445
13478
|
},
|
|
@@ -13457,6 +13490,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
13457
13490
|
arg("b (boolean, optional, default=TRUE)", _t("Given a general linear form of y = m*x+b for a curve fit, calculates b if TRUE or forces b to be 0 and only calculates the m values if FALSE, i.e. forces the curve fit to pass through the origin.")),
|
|
13458
13491
|
],
|
|
13459
13492
|
compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
|
|
13493
|
+
assertNonEmptyMatrix(knownDataY, "known_data_y");
|
|
13460
13494
|
return predictLinearValues(toNumberMatrix(knownDataY, "the first argument (known_data_y)"), toNumberMatrix(knownDataX, "the second argument (known_data_x)"), toNumberMatrix(newDataX, "the third argument (new_data_y)"), toBoolean(b));
|
|
13461
13495
|
},
|
|
13462
13496
|
};
|
|
@@ -20593,7 +20627,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20593
20627
|
function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
|
|
20594
20628
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
20595
20629
|
if (sheetName
|
|
20596
|
-
? !isSheetNameEqual(sheetName, applyChange.sheetName)
|
|
20630
|
+
? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
|
|
20597
20631
|
: defaultSheetId !== applyChange.sheetId) {
|
|
20598
20632
|
return sheetXC;
|
|
20599
20633
|
}
|
|
@@ -20610,7 +20644,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20610
20644
|
}
|
|
20611
20645
|
function getSheetNameGetter(applyChange) {
|
|
20612
20646
|
return (sheetId) => {
|
|
20613
|
-
return sheetId === applyChange.sheetId ? applyChange.sheetName : "";
|
|
20647
|
+
return sheetId === applyChange.sheetId ? applyChange.sheetName.current : "";
|
|
20614
20648
|
};
|
|
20615
20649
|
}
|
|
20616
20650
|
function defaultGetSheetSize(sheetId) {
|
|
@@ -27201,10 +27235,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27201
27235
|
};
|
|
27202
27236
|
}
|
|
27203
27237
|
getDefinitionForExcel() {
|
|
27204
|
-
// Excel does not support aggregating labels
|
|
27205
|
-
if (this.aggregated) {
|
|
27206
|
-
return undefined;
|
|
27207
|
-
}
|
|
27208
27238
|
const dataSets = this.dataSets
|
|
27209
27239
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
27210
27240
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -27577,9 +27607,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
27577
27607
|
: undefined,
|
|
27578
27608
|
};
|
|
27579
27609
|
}
|
|
27580
|
-
updateRanges(applyChange) {
|
|
27610
|
+
updateRanges(applyChange, sheetId, adaptSheetName) {
|
|
27581
27611
|
const dataRange = adaptChartRange(this.dataRange, applyChange);
|
|
27582
|
-
const adaptFormula = (formula) =>
|
|
27612
|
+
const adaptFormula = (formula) => adaptFormulaStringRanges(this.sheetId, formula, {
|
|
27613
|
+
applyChange,
|
|
27614
|
+
sheetId,
|
|
27615
|
+
sheetName: adaptSheetName,
|
|
27616
|
+
});
|
|
27583
27617
|
const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
|
|
27584
27618
|
const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
|
|
27585
27619
|
return new GaugeChart(definition, this.sheetId, this.getters);
|
|
@@ -28502,10 +28536,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
28502
28536
|
return new ScatterChart(definition, this.sheetId, this.getters);
|
|
28503
28537
|
}
|
|
28504
28538
|
getDefinitionForExcel() {
|
|
28505
|
-
// Excel does not support aggregating labels
|
|
28506
|
-
if (this.aggregated) {
|
|
28507
|
-
return undefined;
|
|
28508
|
-
}
|
|
28509
28539
|
const dataSets = this.dataSets
|
|
28510
28540
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
28511
28541
|
.filter((ds) => ds.range !== "");
|
|
@@ -30210,7 +30240,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30210
30240
|
.add("HIDE_COLUMNS_ROWS", inverseHideColumnsRows)
|
|
30211
30241
|
.add("UNHIDE_COLUMNS_ROWS", inverseUnhideColumnsRows)
|
|
30212
30242
|
.add("CREATE_TABLE_STYLE", inverseCreateTableStyle)
|
|
30213
|
-
.add("ADD_PIVOT", inverseAddPivot)
|
|
30243
|
+
.add("ADD_PIVOT", inverseAddPivot)
|
|
30244
|
+
.add("RENAME_SHEET", inverseRenameSheet);
|
|
30214
30245
|
for (const cmd of coreTypes.values()) {
|
|
30215
30246
|
if (!inverseCommandRegistry.contains(cmd)) {
|
|
30216
30247
|
inverseCommandRegistry.add(cmd, identity);
|
|
@@ -30308,6 +30339,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30308
30339
|
function inverseCreateTableStyle(cmd) {
|
|
30309
30340
|
return [{ type: "REMOVE_TABLE_STYLE", tableStyleId: cmd.tableStyleId }];
|
|
30310
30341
|
}
|
|
30342
|
+
function inverseRenameSheet(cmd) {
|
|
30343
|
+
return [
|
|
30344
|
+
{
|
|
30345
|
+
type: "RENAME_SHEET",
|
|
30346
|
+
sheetId: cmd.sheetId,
|
|
30347
|
+
oldName: cmd.newName,
|
|
30348
|
+
newName: cmd.oldName,
|
|
30349
|
+
},
|
|
30350
|
+
];
|
|
30351
|
+
}
|
|
30311
30352
|
|
|
30312
30353
|
/**
|
|
30313
30354
|
* The class Registry is extended in order to add the function addChild
|
|
@@ -31557,9 +31598,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31557
31598
|
if (!rule.operator || !rule.formula || rule.formula.length === 0)
|
|
31558
31599
|
continue;
|
|
31559
31600
|
operator = convertCFCellIsOperator(rule.operator);
|
|
31560
|
-
values.push(rule.formula[0]);
|
|
31601
|
+
values.push(prefixFormula(rule.formula[0]));
|
|
31561
31602
|
if (rule.formula.length === 2) {
|
|
31562
|
-
values.push(rule.formula[1]);
|
|
31603
|
+
values.push(prefixFormula(rule.formula[1]));
|
|
31563
31604
|
}
|
|
31564
31605
|
break;
|
|
31565
31606
|
}
|
|
@@ -31717,6 +31758,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31717
31758
|
? ICON_SETS[iconSet].neutral
|
|
31718
31759
|
: ICON_SETS[iconSet].good;
|
|
31719
31760
|
}
|
|
31761
|
+
/** Prefix the string by "=" if the string looks like a formula */
|
|
31762
|
+
function prefixFormula(formula) {
|
|
31763
|
+
const tokens = tokenize(formula);
|
|
31764
|
+
return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
|
|
31765
|
+
}
|
|
31720
31766
|
// ---------------------------------------------------------------------------
|
|
31721
31767
|
// Warnings
|
|
31722
31768
|
// ---------------------------------------------------------------------------
|
|
@@ -31979,7 +32025,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31979
32025
|
function getRowPosition(rowIndex, sheetData) {
|
|
31980
32026
|
let position = 0;
|
|
31981
32027
|
for (let i = 0; i < rowIndex; i++) {
|
|
31982
|
-
const rowAtIndex = sheetData.rows
|
|
32028
|
+
const rowAtIndex = sheetData.rows.find((row) => row.index - 1 === i);
|
|
31983
32029
|
if (rowAtIndex?.height) {
|
|
31984
32030
|
position += rowAtIndex.height;
|
|
31985
32031
|
}
|
|
@@ -32119,8 +32165,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32119
32165
|
}
|
|
32120
32166
|
function convertAnchor(XLSXanchor) {
|
|
32121
32167
|
const offset = {
|
|
32122
|
-
x: convertEMUToDotValue(XLSXanchor.colOffset),
|
|
32123
|
-
y: convertEMUToDotValue(XLSXanchor.rowOffset),
|
|
32168
|
+
x: convertEMUToDotValue(XLSXanchor.colOffset) - FIGURE_BORDER_WIDTH,
|
|
32169
|
+
y: convertEMUToDotValue(XLSXanchor.rowOffset) - FIGURE_BORDER_WIDTH,
|
|
32124
32170
|
};
|
|
32125
32171
|
return { col: XLSXanchor.col, row: XLSXanchor.row, offset };
|
|
32126
32172
|
}
|
|
@@ -32503,8 +32549,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32503
32549
|
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
32504
32550
|
dims[1] = Math.max(dims[1], row.index);
|
|
32505
32551
|
}
|
|
32506
|
-
|
|
32507
|
-
|
|
32552
|
+
for (const fig of sheet.figures) {
|
|
32553
|
+
dims[0] = Math.max(dims[0], fig.anchors[fig.anchors.length - 1]?.col ?? 0);
|
|
32554
|
+
dims[1] = Math.max(dims[1], fig.anchors[fig.anchors.length - 1]?.row ?? 0);
|
|
32555
|
+
}
|
|
32556
|
+
dims[0] = Math.max(dims[0] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
32557
|
+
dims[1] = Math.max(dims[1] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_ROWS);
|
|
32508
32558
|
return dims;
|
|
32509
32559
|
}
|
|
32510
32560
|
/**
|
|
@@ -34509,7 +34559,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
34509
34559
|
return relsFile;
|
|
34510
34560
|
}
|
|
34511
34561
|
|
|
34512
|
-
const EXCEL_IMPORT_VERSION = "18.3";
|
|
34562
|
+
const EXCEL_IMPORT_VERSION = "18.3.1";
|
|
34513
34563
|
class XlsxReader {
|
|
34514
34564
|
warningManager;
|
|
34515
34565
|
xmls;
|
|
@@ -38513,7 +38563,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38513
38563
|
const reinsertDynamicPivotMenu = {
|
|
38514
38564
|
id: "reinsert_dynamic_pivot",
|
|
38515
38565
|
name: _t("Re-insert dynamic pivot"),
|
|
38516
|
-
sequence:
|
|
38566
|
+
sequence: 60,
|
|
38517
38567
|
icon: "o-spreadsheet-Icon.INSERT_PIVOT",
|
|
38518
38568
|
children: [REINSERT_DYNAMIC_PIVOT_CHILDREN],
|
|
38519
38569
|
isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
|
|
@@ -38521,7 +38571,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
38521
38571
|
const reinsertStaticPivotMenu = {
|
|
38522
38572
|
id: "reinsert_static_pivot",
|
|
38523
38573
|
name: _t("Re-insert static pivot"),
|
|
38524
|
-
sequence:
|
|
38574
|
+
sequence: 70,
|
|
38525
38575
|
icon: "o-spreadsheet-Icon.INSERT_PIVOT",
|
|
38526
38576
|
children: [REINSERT_STATIC_PIVOT_CHILDREN],
|
|
38527
38577
|
isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
|
|
@@ -40190,8 +40240,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40190
40240
|
sequence: 40,
|
|
40191
40241
|
separator: true,
|
|
40192
40242
|
})
|
|
40193
|
-
.addChild("
|
|
40243
|
+
.addChild("pivot_data_sources", ["data"], (env) => {
|
|
40194
40244
|
const sequence = 50;
|
|
40245
|
+
const numberOfPivots = env.model.getters.getPivotIds().length;
|
|
40195
40246
|
return env.model.getters.getPivotIds().map((pivotId, index) => {
|
|
40196
40247
|
const highlightProvider = {
|
|
40197
40248
|
get highlights() {
|
|
@@ -40201,7 +40252,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40201
40252
|
return {
|
|
40202
40253
|
id: `item_pivot_${env.model.getters.getPivotFormulaId(pivotId)}`,
|
|
40203
40254
|
name: env.model.getters.getPivotDisplayName(pivotId),
|
|
40204
|
-
sequence: sequence + index,
|
|
40255
|
+
sequence: sequence + index / numberOfPivots,
|
|
40205
40256
|
isReadonlyAllowed: true,
|
|
40206
40257
|
execute: (env) => env.openSidePanel("PivotSidePanel", { pivotId }),
|
|
40207
40258
|
onStartHover: (env) => env.getStore(HighlightStore).register(highlightProvider),
|
|
@@ -43759,6 +43810,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43759
43810
|
this.contentHelper.removeSelection();
|
|
43760
43811
|
}
|
|
43761
43812
|
onMouseup() {
|
|
43813
|
+
if (this.env.model.getters.isReadonly()) {
|
|
43814
|
+
return;
|
|
43815
|
+
}
|
|
43762
43816
|
const selection = this.contentHelper.getCurrentSelection();
|
|
43763
43817
|
if (selection.start !== selection.end) {
|
|
43764
43818
|
this.props.composerStore.hoverToken(undefined);
|
|
@@ -57196,7 +57250,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57196
57250
|
* the type of change that occurred.
|
|
57197
57251
|
*
|
|
57198
57252
|
* @param applyChange a function that, when called, will adapt the range according to the change on the grid
|
|
57199
|
-
* @param sheetId an
|
|
57253
|
+
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
57254
|
+
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
57200
57255
|
*/
|
|
57201
57256
|
adaptRanges(applyChange, sheetId, sheetName) { }
|
|
57202
57257
|
/**
|
|
@@ -57799,9 +57854,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57799
57854
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
57800
57855
|
if (cell.isFormula) {
|
|
57801
57856
|
for (const range of cell.compiledFormula.dependencies) {
|
|
57802
|
-
if (
|
|
57803
|
-
range.sheetId === sheetId ||
|
|
57804
|
-
(sheetName && range.invalidSheetName === sheetName)) {
|
|
57857
|
+
if (range.sheetId === sheetId || range.invalidSheetName === sheetName.old) {
|
|
57805
57858
|
const change = applyChange(range);
|
|
57806
57859
|
if (change.changeType !== "NONE") {
|
|
57807
57860
|
this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
|
|
@@ -58417,9 +58470,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58417
58470
|
charts = {};
|
|
58418
58471
|
createChart = chartFactory(this.getters);
|
|
58419
58472
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
58420
|
-
adaptRanges(applyChange) {
|
|
58473
|
+
adaptRanges(applyChange, sheetId, adaptSheetName) {
|
|
58421
58474
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
58422
|
-
this.history.update("charts", chartId, chart?.updateRanges(applyChange));
|
|
58475
|
+
this.history.update("charts", chartId, chart?.updateRanges(applyChange, sheetId, adaptSheetName));
|
|
58423
58476
|
}
|
|
58424
58477
|
}
|
|
58425
58478
|
// ---------------------------------------------------------------------------
|
|
@@ -58682,7 +58735,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58682
58735
|
}
|
|
58683
58736
|
}
|
|
58684
58737
|
}
|
|
58685
|
-
adaptRanges(applyChange, sheetId
|
|
58738
|
+
adaptRanges(applyChange, sheetId) {
|
|
58686
58739
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
58687
58740
|
for (const sheetId of sheetIds) {
|
|
58688
58741
|
this.adaptCFRanges(sheetId, applyChange);
|
|
@@ -59078,11 +59131,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59078
59131
|
"getValidationRuleForCell",
|
|
59079
59132
|
];
|
|
59080
59133
|
rules = {};
|
|
59081
|
-
adaptRanges(applyChange, sheetId
|
|
59082
|
-
|
|
59083
|
-
for (const sheetId of sheetIds) {
|
|
59084
|
-
this.adaptDVRanges(sheetId, applyChange);
|
|
59085
|
-
}
|
|
59134
|
+
adaptRanges(applyChange, sheetId) {
|
|
59135
|
+
this.adaptDVRanges(sheetId, applyChange);
|
|
59086
59136
|
this.adaptDVFormulas(applyChange);
|
|
59087
59137
|
}
|
|
59088
59138
|
adaptDVFormulas(applyChange) {
|
|
@@ -59372,9 +59422,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59372
59422
|
// Command Handling
|
|
59373
59423
|
// ---------------------------------------------------------------------------
|
|
59374
59424
|
adaptRanges(applyChange, sheetId) {
|
|
59375
|
-
if (!sheetId) {
|
|
59376
|
-
return;
|
|
59377
|
-
}
|
|
59378
59425
|
for (const figure of this.getFigures(sheetId)) {
|
|
59379
59426
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
59380
59427
|
left: figure.col,
|
|
@@ -60182,11 +60229,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
60182
60229
|
break;
|
|
60183
60230
|
}
|
|
60184
60231
|
}
|
|
60185
|
-
adaptRanges(applyChange, sheetId
|
|
60186
|
-
|
|
60187
|
-
for (const sheetId of sheetIds) {
|
|
60188
|
-
this.applyRangeChangeOnSheet(sheetId, applyChange);
|
|
60189
|
-
}
|
|
60232
|
+
adaptRanges(applyChange, sheetId) {
|
|
60233
|
+
this.applyRangeChangeOnSheet(sheetId, applyChange);
|
|
60190
60234
|
}
|
|
60191
60235
|
// ---------------------------------------------------------------------------
|
|
60192
60236
|
// Getters
|
|
@@ -61694,12 +61738,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61694
61738
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
61695
61739
|
tables = {};
|
|
61696
61740
|
nextTableId = 1;
|
|
61697
|
-
adaptRanges(applyChange, sheetId
|
|
61698
|
-
const
|
|
61699
|
-
|
|
61700
|
-
for (const table of this.getCoreTables(sheetId)) {
|
|
61701
|
-
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
61702
|
-
}
|
|
61741
|
+
adaptRanges(applyChange, sheetId) {
|
|
61742
|
+
for (const table of this.getCoreTables(sheetId)) {
|
|
61743
|
+
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
61703
61744
|
}
|
|
61704
61745
|
}
|
|
61705
61746
|
allowDispatch(cmd) {
|
|
@@ -62662,7 +62703,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62662
62703
|
}
|
|
62663
62704
|
}
|
|
62664
62705
|
}
|
|
62665
|
-
adaptRanges(applyChange
|
|
62706
|
+
adaptRanges(applyChange) {
|
|
62666
62707
|
for (const sheetId in this.compiledMeasureFormulas) {
|
|
62667
62708
|
for (const formulaString in this.compiledMeasureFormulas[sheetId]) {
|
|
62668
62709
|
const compiledFormula = this.compiledMeasureFormulas[sheetId][formulaString];
|
|
@@ -66823,7 +66864,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66823
66864
|
if (!result) {
|
|
66824
66865
|
return EMPTY_PIVOT_CELL;
|
|
66825
66866
|
}
|
|
66826
|
-
|
|
66867
|
+
let { functionName, args } = result;
|
|
66827
66868
|
const formulaId = args[0];
|
|
66828
66869
|
if (!formulaId) {
|
|
66829
66870
|
return EMPTY_PIVOT_CELL;
|
|
@@ -66853,6 +66894,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66853
66894
|
return pivotCells[pivotCol][pivotRow];
|
|
66854
66895
|
}
|
|
66855
66896
|
try {
|
|
66897
|
+
const offsetRow = position.row - mainPosition.row;
|
|
66898
|
+
const offsetCol = position.col - mainPosition.col;
|
|
66899
|
+
args = args.map((arg) => (isMatrix(arg) ? arg[offsetCol][offsetRow] : arg));
|
|
66856
66900
|
if (functionName === "PIVOT.HEADER" && args.at(-2) === "measure") {
|
|
66857
66901
|
const domain = pivot.parseArgsToPivotDomain(args.slice(1, -2).map((value) => ({ value })));
|
|
66858
66902
|
return {
|
|
@@ -68051,7 +68095,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68051
68095
|
// If the executed command is not in the registry, we skip it
|
|
68052
68096
|
// because we know there won't be any transformation impacting the
|
|
68053
68097
|
// commands to transform.
|
|
68054
|
-
if (possibleTransformations.has(executedCommand.type)
|
|
68098
|
+
if (possibleTransformations.has(executedCommand.type) ||
|
|
68099
|
+
rangeAdapterRegistry.contains(executedCommand.type)) {
|
|
68055
68100
|
transformedCommands = transformedCommands.reduce((acc, cmd) => {
|
|
68056
68101
|
const transformed = transform(cmd, executedCommand);
|
|
68057
68102
|
if (transformed) {
|
|
@@ -79212,7 +79257,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
79212
79257
|
for (const [headerIndex, header] of headers.slice(anchor).entries()) {
|
|
79213
79258
|
if (currentPosition <= offset && offset < currentPosition + header.size) {
|
|
79214
79259
|
return {
|
|
79215
|
-
index: headerIndex,
|
|
79260
|
+
index: anchor + headerIndex,
|
|
79216
79261
|
offset: convertDotValueToEMU(offset - currentPosition + FIGURE_BORDER_WIDTH),
|
|
79217
79262
|
};
|
|
79218
79263
|
}
|
|
@@ -80208,7 +80253,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80208
80253
|
handlers = [];
|
|
80209
80254
|
uiHandlers = [];
|
|
80210
80255
|
coreHandlers = [];
|
|
80211
|
-
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport =
|
|
80256
|
+
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
|
|
80212
80257
|
const start = performance.now();
|
|
80213
80258
|
console.debug("##### Model creation #####");
|
|
80214
80259
|
super();
|
|
@@ -80951,9 +80996,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80951
80996
|
exports.tokenize = tokenize;
|
|
80952
80997
|
|
|
80953
80998
|
|
|
80954
|
-
__info__.version = "18.3.
|
|
80955
|
-
__info__.date = "2025-
|
|
80956
|
-
__info__.hash = "
|
|
80999
|
+
__info__.version = "18.3.19";
|
|
81000
|
+
__info__.date = "2025-09-05T07:38:30.661Z";
|
|
81001
|
+
__info__.hash = "77fd307";
|
|
80957
81002
|
|
|
80958
81003
|
|
|
80959
81004
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|