@odoo/o-spreadsheet 18.3.18 → 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 +140 -98
- package/dist/o-spreadsheet.d.ts +67 -62
- package/dist/o-spreadsheet.esm.js +140 -98
- package/dist/o-spreadsheet.iife.js +140 -98
- package/dist/o-spreadsheet.iife.min.js +381 -381
- package/dist/o_spreadsheet.xml +3 -3
- 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
|
'use strict';
|
|
@@ -3499,6 +3499,7 @@ const invalidateBordersCommands = new Set([
|
|
|
3499
3499
|
"AUTOFILL_CELL",
|
|
3500
3500
|
"SET_BORDER",
|
|
3501
3501
|
"SET_ZONE_BORDERS",
|
|
3502
|
+
"SET_BORDERS_ON_TARGET",
|
|
3502
3503
|
]);
|
|
3503
3504
|
const readonlyAllowedCommands = new Set([
|
|
3504
3505
|
"START",
|
|
@@ -6444,40 +6445,44 @@ function orderRange(range) {
|
|
|
6444
6445
|
};
|
|
6445
6446
|
}
|
|
6446
6447
|
function getRangeAdapter(cmd) {
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
applyChange: getApplyRangeChangeAddColRow(cmd),
|
|
6457
|
-
sheetId: cmd.sheetId,
|
|
6458
|
-
sheetName: cmd.sheetName,
|
|
6459
|
-
};
|
|
6460
|
-
case "DELETE_SHEET":
|
|
6461
|
-
return {
|
|
6462
|
-
applyChange: getApplyRangeChangeDeleteSheet(cmd),
|
|
6463
|
-
sheetId: cmd.sheetId,
|
|
6464
|
-
sheetName: cmd.sheetName,
|
|
6465
|
-
};
|
|
6466
|
-
case "RENAME_SHEET":
|
|
6467
|
-
return {
|
|
6468
|
-
applyChange: getApplyRangeChangeRenameSheet(cmd),
|
|
6469
|
-
sheetId: cmd.sheetId,
|
|
6470
|
-
sheetName: cmd.oldName,
|
|
6471
|
-
};
|
|
6472
|
-
case "MOVE_RANGES":
|
|
6473
|
-
return {
|
|
6474
|
-
applyChange: getApplyRangeChangeMoveRange(cmd),
|
|
6475
|
-
sheetId: cmd.sheetId,
|
|
6476
|
-
sheetName: cmd.sheetName,
|
|
6477
|
-
};
|
|
6448
|
+
return rangeAdapterRegistry.get(cmd.type)?.(cmd);
|
|
6449
|
+
}
|
|
6450
|
+
class RangeAdapterRegistry extends Registry {
|
|
6451
|
+
add(cmdType, fn) {
|
|
6452
|
+
super.add(cmdType, fn);
|
|
6453
|
+
return this;
|
|
6454
|
+
}
|
|
6455
|
+
get(cmdType) {
|
|
6456
|
+
return this.content[cmdType];
|
|
6478
6457
|
}
|
|
6479
|
-
return undefined;
|
|
6480
6458
|
}
|
|
6459
|
+
const rangeAdapterRegistry = new RangeAdapterRegistry();
|
|
6460
|
+
rangeAdapterRegistry
|
|
6461
|
+
.add("REMOVE_COLUMNS_ROWS", (cmd) => ({
|
|
6462
|
+
applyChange: getApplyRangeChangeRemoveColRow(cmd),
|
|
6463
|
+
sheetId: cmd.sheetId,
|
|
6464
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6465
|
+
}))
|
|
6466
|
+
.add("ADD_COLUMNS_ROWS", (cmd) => ({
|
|
6467
|
+
applyChange: getApplyRangeChangeAddColRow(cmd),
|
|
6468
|
+
sheetId: cmd.sheetId,
|
|
6469
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6470
|
+
}))
|
|
6471
|
+
.add("DELETE_SHEET", (cmd) => ({
|
|
6472
|
+
applyChange: getApplyRangeChangeDeleteSheet(cmd),
|
|
6473
|
+
sheetId: cmd.sheetId,
|
|
6474
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6475
|
+
}))
|
|
6476
|
+
.add("RENAME_SHEET", (cmd) => ({
|
|
6477
|
+
applyChange: getApplyRangeChangeRenameSheet(cmd),
|
|
6478
|
+
sheetId: cmd.sheetId,
|
|
6479
|
+
sheetName: { old: cmd.oldName, current: cmd.newName },
|
|
6480
|
+
}))
|
|
6481
|
+
.add("MOVE_RANGES", (cmd) => ({
|
|
6482
|
+
applyChange: getApplyRangeChangeMoveRange(cmd),
|
|
6483
|
+
sheetId: cmd.sheetId,
|
|
6484
|
+
sheetName: { old: cmd.sheetName, current: cmd.sheetName },
|
|
6485
|
+
}));
|
|
6481
6486
|
function getApplyRangeChangeRemoveColRow(cmd) {
|
|
6482
6487
|
let start = cmd.dimension === "COL" ? "left" : "top";
|
|
6483
6488
|
let end = cmd.dimension === "COL" ? "right" : "bottom";
|
|
@@ -7828,8 +7833,11 @@ function invertMatrix(M) {
|
|
|
7828
7833
|
// (a) Swap 2 rows. This multiply the determinant by -1.
|
|
7829
7834
|
// (b) Multiply a row by a scalar. This multiply the determinant by that scalar.
|
|
7830
7835
|
// (c) Add to a row a multiple of another row. This does not change the determinant.
|
|
7836
|
+
if (M.length < 1 || M[0].length < 1) {
|
|
7837
|
+
throw new Error("invertMatrix: an empty matrix cannot be inverted.");
|
|
7838
|
+
}
|
|
7831
7839
|
if (M.length !== M[0].length) {
|
|
7832
|
-
throw new
|
|
7840
|
+
throw new Error("invertMatrix: only square matrices are invertible");
|
|
7833
7841
|
}
|
|
7834
7842
|
let determinant = 1;
|
|
7835
7843
|
const dim = M.length;
|
|
@@ -7898,8 +7906,11 @@ function swapMatrixRows(matrix, row1, row2) {
|
|
|
7898
7906
|
* Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
|
|
7899
7907
|
*/
|
|
7900
7908
|
function multiplyMatrices(matrix1, matrix2) {
|
|
7909
|
+
if (matrix1.length < 1 || matrix2.length < 1) {
|
|
7910
|
+
throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
|
|
7911
|
+
}
|
|
7901
7912
|
if (matrix1.length !== matrix2[0].length) {
|
|
7902
|
-
throw new
|
|
7913
|
+
throw new Error("multiplyMatrices: incompatible matrices size.");
|
|
7903
7914
|
}
|
|
7904
7915
|
const rowsM1 = matrix1[0].length;
|
|
7905
7916
|
const colsM2 = matrix2.length;
|
|
@@ -7925,7 +7936,7 @@ function toScalar(arg) {
|
|
|
7925
7936
|
return arg;
|
|
7926
7937
|
}
|
|
7927
7938
|
if (!isSingleElementMatrix(arg)) {
|
|
7928
|
-
throw new
|
|
7939
|
+
throw new Error("The value should be a scalar or a 1x1 matrix");
|
|
7929
7940
|
}
|
|
7930
7941
|
return arg[0][0];
|
|
7931
7942
|
}
|
|
@@ -8162,6 +8173,16 @@ function getMovingAverageValues(dataset, labels, windowSize = DEFAULT_WINDOW_SIZ
|
|
|
8162
8173
|
}
|
|
8163
8174
|
return values;
|
|
8164
8175
|
}
|
|
8176
|
+
function assertNonEmptyMatrix(matrix, argName) {
|
|
8177
|
+
assert(() => matrix.length > 0 && matrix[0].length > 0, _t("[[FUNCTION_NAME]] expects the provided values of %(argName)s to be a non-empty matrix.", {
|
|
8178
|
+
argName,
|
|
8179
|
+
}));
|
|
8180
|
+
}
|
|
8181
|
+
function assertNonEmpty(...data) {
|
|
8182
|
+
if (data.length === 0 || data.some((arg) => arg.length === 0)) {
|
|
8183
|
+
throw new NotAvailableError(_t("[[FUNCTION_NAME]] has no valid input data."));
|
|
8184
|
+
}
|
|
8185
|
+
}
|
|
8165
8186
|
|
|
8166
8187
|
const PREVIOUS_VALUE = "(previous)";
|
|
8167
8188
|
const NEXT_VALUE = "(next)";
|
|
@@ -10985,6 +11006,7 @@ const MMULT = {
|
|
|
10985
11006
|
compute: function (matrix1, matrix2) {
|
|
10986
11007
|
const _matrix1 = toNumberMatrix(matrix1, "matrix1");
|
|
10987
11008
|
const _matrix2 = toNumberMatrix(matrix2, "matrix2");
|
|
11009
|
+
assert(() => _matrix1.length > 0 && _matrix2.length > 0, _t("The first and second arguments of [[FUNCTION_NAME]] must be non-empty matrices."));
|
|
10988
11010
|
assert(() => _matrix1.length === _matrix2[0].length, _t("In [[FUNCTION_NAME]], the number of columns of the first matrix (%s) must be equal to the \
|
|
10989
11011
|
number of rows of the second matrix (%s).", _matrix1.length.toString(), _matrix2[0].length.toString()));
|
|
10990
11012
|
return multiplyMatrices(_matrix1, _matrix2);
|
|
@@ -12780,6 +12802,7 @@ const FORECAST = {
|
|
|
12780
12802
|
],
|
|
12781
12803
|
compute: function (x, dataY, dataX) {
|
|
12782
12804
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
12805
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
12783
12806
|
return predictLinearValues([flatDataY], [flatDataX], matrixMap(toMatrix(x), (value) => toNumber(value, this.locale)), true);
|
|
12784
12807
|
},
|
|
12785
12808
|
isExported: true,
|
|
@@ -12796,6 +12819,7 @@ const GROWTH = {
|
|
|
12796
12819
|
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.")),
|
|
12797
12820
|
],
|
|
12798
12821
|
compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
|
|
12822
|
+
assertNonEmptyMatrix(knownDataY, "known_data_y");
|
|
12799
12823
|
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)));
|
|
12800
12824
|
},
|
|
12801
12825
|
};
|
|
@@ -12810,6 +12834,7 @@ const INTERCEPT = {
|
|
|
12810
12834
|
],
|
|
12811
12835
|
compute: function (dataY, dataX) {
|
|
12812
12836
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
12837
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
12813
12838
|
const [[], [intercept]] = fullLinearRegression([flatDataX], [flatDataY]);
|
|
12814
12839
|
return intercept;
|
|
12815
12840
|
},
|
|
@@ -12859,6 +12884,7 @@ const LINEST = {
|
|
|
12859
12884
|
arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
|
|
12860
12885
|
],
|
|
12861
12886
|
compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
|
|
12887
|
+
assertNonEmptyMatrix(dataY, "data_y");
|
|
12862
12888
|
return fullLinearRegression(toNumberMatrix(dataX, "the first argument (data_y)"), toNumberMatrix(dataY, "the second argument (data_x)"), toBoolean(calculateB), toBoolean(verbose));
|
|
12863
12889
|
},
|
|
12864
12890
|
isExported: true,
|
|
@@ -12875,6 +12901,7 @@ const LOGEST = {
|
|
|
12875
12901
|
arg("verbose (boolean, default=FALSE)", _t("A flag specifying whether to return additional regression statistics or only the linear coefficients and the y-intercept")),
|
|
12876
12902
|
],
|
|
12877
12903
|
compute: function (dataY, dataX = [[]], calculateB = { value: true }, verbose = { value: false }) {
|
|
12904
|
+
assertNonEmptyMatrix(dataY, "data_y");
|
|
12878
12905
|
const coeffs = fullLinearRegression(toNumberMatrix(dataX, "the second argument (data_x)"), logM(toNumberMatrix(dataY, "the first argument (data_y)")), toBoolean(calculateB), toBoolean(verbose));
|
|
12879
12906
|
for (let i = 0; i < coeffs.length; i++) {
|
|
12880
12907
|
coeffs[i][0] = Math.exp(coeffs[i][0]);
|
|
@@ -12896,9 +12923,7 @@ const MATTHEWS = {
|
|
|
12896
12923
|
const flatX = dataX.flat();
|
|
12897
12924
|
const flatY = dataY.flat();
|
|
12898
12925
|
assertSameNumberOfElements(flatX, flatY);
|
|
12899
|
-
|
|
12900
|
-
return new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
|
|
12901
|
-
}
|
|
12926
|
+
assertNonEmpty(flatX, flatY);
|
|
12902
12927
|
const n = flatX.length;
|
|
12903
12928
|
let trueN = 0, trueP = 0, falseP = 0, falseN = 0;
|
|
12904
12929
|
for (let i = 0; i < n; ++i) {
|
|
@@ -13062,12 +13087,7 @@ const MINIFS = {
|
|
|
13062
13087
|
// -----------------------------------------------------------------------------
|
|
13063
13088
|
function pearson(dataY, dataX) {
|
|
13064
13089
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13065
|
-
|
|
13066
|
-
throw new EvaluationError(_t("[[FUNCTION_NAME]] expects non-empty ranges for both parameters."));
|
|
13067
|
-
}
|
|
13068
|
-
if (flatDataX.length < 2) {
|
|
13069
|
-
throw new EvaluationError(_t("[[FUNCTION_NAME]] needs at least two values for both parameters."));
|
|
13070
|
-
}
|
|
13090
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13071
13091
|
const n = flatDataX.length;
|
|
13072
13092
|
let sumX = 0, sumY = 0, sumXY = 0, sumXX = 0, sumYY = 0;
|
|
13073
13093
|
for (let i = 0; i < n; i++) {
|
|
@@ -13156,6 +13176,7 @@ const POLYFIT_COEFFS = {
|
|
|
13156
13176
|
],
|
|
13157
13177
|
compute: function (dataY, dataX, order, intercept = { value: true }) {
|
|
13158
13178
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13179
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13159
13180
|
return polynomialRegression(flatDataY, flatDataX, toNumber(order, this.locale), toBoolean(intercept));
|
|
13160
13181
|
},
|
|
13161
13182
|
isExported: false,
|
|
@@ -13175,6 +13196,7 @@ const POLYFIT_FORECAST = {
|
|
|
13175
13196
|
compute: function (x, dataY, dataX, order, intercept = { value: true }) {
|
|
13176
13197
|
const _order = toNumber(order, this.locale);
|
|
13177
13198
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13199
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13178
13200
|
const coeffs = polynomialRegression(flatDataY, flatDataX, _order, toBoolean(intercept)).flat();
|
|
13179
13201
|
return matrixMap(toMatrix(x), (xij) => evaluatePolynomial(coeffs, toNumber(xij, this.locale), _order));
|
|
13180
13202
|
},
|
|
@@ -13291,6 +13313,7 @@ const SLOPE = {
|
|
|
13291
13313
|
],
|
|
13292
13314
|
compute: function (dataY, dataX) {
|
|
13293
13315
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13316
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13294
13317
|
const [[slope]] = fullLinearRegression([flatDataX], [flatDataY]);
|
|
13295
13318
|
return slope;
|
|
13296
13319
|
},
|
|
@@ -13339,6 +13362,7 @@ const SPEARMAN = {
|
|
|
13339
13362
|
],
|
|
13340
13363
|
compute: function (dataX, dataY) {
|
|
13341
13364
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13365
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13342
13366
|
const n = flatDataX.length;
|
|
13343
13367
|
const order = flatDataX.map((e, i) => [e, flatDataY[i]]);
|
|
13344
13368
|
order.sort((a, b) => a[0] - b[0]);
|
|
@@ -13449,6 +13473,7 @@ const STEYX = {
|
|
|
13449
13473
|
],
|
|
13450
13474
|
compute: function (dataY, dataX) {
|
|
13451
13475
|
const { flatDataX, flatDataY } = filterAndFlatData(dataY, dataX);
|
|
13476
|
+
assertNonEmpty(flatDataX, flatDataY);
|
|
13452
13477
|
const data = fullLinearRegression([flatDataX], [flatDataY], true, true);
|
|
13453
13478
|
return data[1][2];
|
|
13454
13479
|
},
|
|
@@ -13466,6 +13491,7 @@ const TREND = {
|
|
|
13466
13491
|
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.")),
|
|
13467
13492
|
],
|
|
13468
13493
|
compute: function (knownDataY, knownDataX = [[]], newDataX = [[]], b = { value: true }) {
|
|
13494
|
+
assertNonEmptyMatrix(knownDataY, "known_data_y");
|
|
13469
13495
|
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));
|
|
13470
13496
|
},
|
|
13471
13497
|
};
|
|
@@ -20602,7 +20628,7 @@ function adaptFormulaStringRanges(defaultSheetId, formula, applyChange) {
|
|
|
20602
20628
|
function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
|
|
20603
20629
|
const sheetName = splitReference(sheetXC).sheetName;
|
|
20604
20630
|
if (sheetName
|
|
20605
|
-
? !isSheetNameEqual(sheetName, applyChange.sheetName)
|
|
20631
|
+
? !isSheetNameEqual(sheetName, applyChange.sheetName.old)
|
|
20606
20632
|
: defaultSheetId !== applyChange.sheetId) {
|
|
20607
20633
|
return sheetXC;
|
|
20608
20634
|
}
|
|
@@ -20619,7 +20645,7 @@ function adaptStringRange(defaultSheetId, sheetXC, applyChange) {
|
|
|
20619
20645
|
}
|
|
20620
20646
|
function getSheetNameGetter(applyChange) {
|
|
20621
20647
|
return (sheetId) => {
|
|
20622
|
-
return sheetId === applyChange.sheetId ? applyChange.sheetName : "";
|
|
20648
|
+
return sheetId === applyChange.sheetId ? applyChange.sheetName.current : "";
|
|
20623
20649
|
};
|
|
20624
20650
|
}
|
|
20625
20651
|
function defaultGetSheetSize(sheetId) {
|
|
@@ -27582,9 +27608,13 @@ class GaugeChart extends AbstractChart {
|
|
|
27582
27608
|
: undefined,
|
|
27583
27609
|
};
|
|
27584
27610
|
}
|
|
27585
|
-
updateRanges(applyChange) {
|
|
27611
|
+
updateRanges(applyChange, sheetId, adaptSheetName) {
|
|
27586
27612
|
const dataRange = adaptChartRange(this.dataRange, applyChange);
|
|
27587
|
-
const adaptFormula = (formula) =>
|
|
27613
|
+
const adaptFormula = (formula) => adaptFormulaStringRanges(this.sheetId, formula, {
|
|
27614
|
+
applyChange,
|
|
27615
|
+
sheetId,
|
|
27616
|
+
sheetName: adaptSheetName,
|
|
27617
|
+
});
|
|
27588
27618
|
const sectionRule = adaptSectionRuleFormulas(this.sectionRule, adaptFormula);
|
|
27589
27619
|
const definition = this.getDefinitionWithSpecificRanges(dataRange, sectionRule);
|
|
27590
27620
|
return new GaugeChart(definition, this.sheetId, this.getters);
|
|
@@ -30211,7 +30241,8 @@ const inverseCommandRegistry = new Registry()
|
|
|
30211
30241
|
.add("HIDE_COLUMNS_ROWS", inverseHideColumnsRows)
|
|
30212
30242
|
.add("UNHIDE_COLUMNS_ROWS", inverseUnhideColumnsRows)
|
|
30213
30243
|
.add("CREATE_TABLE_STYLE", inverseCreateTableStyle)
|
|
30214
|
-
.add("ADD_PIVOT", inverseAddPivot)
|
|
30244
|
+
.add("ADD_PIVOT", inverseAddPivot)
|
|
30245
|
+
.add("RENAME_SHEET", inverseRenameSheet);
|
|
30215
30246
|
for (const cmd of coreTypes.values()) {
|
|
30216
30247
|
if (!inverseCommandRegistry.contains(cmd)) {
|
|
30217
30248
|
inverseCommandRegistry.add(cmd, identity);
|
|
@@ -30309,6 +30340,16 @@ function inverseUnhideColumnsRows(cmd) {
|
|
|
30309
30340
|
function inverseCreateTableStyle(cmd) {
|
|
30310
30341
|
return [{ type: "REMOVE_TABLE_STYLE", tableStyleId: cmd.tableStyleId }];
|
|
30311
30342
|
}
|
|
30343
|
+
function inverseRenameSheet(cmd) {
|
|
30344
|
+
return [
|
|
30345
|
+
{
|
|
30346
|
+
type: "RENAME_SHEET",
|
|
30347
|
+
sheetId: cmd.sheetId,
|
|
30348
|
+
oldName: cmd.newName,
|
|
30349
|
+
newName: cmd.oldName,
|
|
30350
|
+
},
|
|
30351
|
+
];
|
|
30352
|
+
}
|
|
30312
30353
|
|
|
30313
30354
|
/**
|
|
30314
30355
|
* The class Registry is extended in order to add the function addChild
|
|
@@ -31558,9 +31599,9 @@ function convertConditionalFormats(xlsxCfs, dxfs, warningManager) {
|
|
|
31558
31599
|
if (!rule.operator || !rule.formula || rule.formula.length === 0)
|
|
31559
31600
|
continue;
|
|
31560
31601
|
operator = convertCFCellIsOperator(rule.operator);
|
|
31561
|
-
values.push(rule.formula[0]);
|
|
31602
|
+
values.push(prefixFormula(rule.formula[0]));
|
|
31562
31603
|
if (rule.formula.length === 2) {
|
|
31563
|
-
values.push(rule.formula[1]);
|
|
31604
|
+
values.push(prefixFormula(rule.formula[1]));
|
|
31564
31605
|
}
|
|
31565
31606
|
break;
|
|
31566
31607
|
}
|
|
@@ -31718,6 +31759,11 @@ function convertIcons(xlsxIconSet, index) {
|
|
|
31718
31759
|
? ICON_SETS[iconSet].neutral
|
|
31719
31760
|
: ICON_SETS[iconSet].good;
|
|
31720
31761
|
}
|
|
31762
|
+
/** Prefix the string by "=" if the string looks like a formula */
|
|
31763
|
+
function prefixFormula(formula) {
|
|
31764
|
+
const tokens = tokenize(formula);
|
|
31765
|
+
return tokens.length === 1 && tokens[0].type !== "REFERENCE" ? formula : "=" + formula;
|
|
31766
|
+
}
|
|
31721
31767
|
// ---------------------------------------------------------------------------
|
|
31722
31768
|
// Warnings
|
|
31723
31769
|
// ---------------------------------------------------------------------------
|
|
@@ -31980,7 +32026,7 @@ function getColPosition(colIndex, sheetData) {
|
|
|
31980
32026
|
function getRowPosition(rowIndex, sheetData) {
|
|
31981
32027
|
let position = 0;
|
|
31982
32028
|
for (let i = 0; i < rowIndex; i++) {
|
|
31983
|
-
const rowAtIndex = sheetData.rows
|
|
32029
|
+
const rowAtIndex = sheetData.rows.find((row) => row.index - 1 === i);
|
|
31984
32030
|
if (rowAtIndex?.height) {
|
|
31985
32031
|
position += rowAtIndex.height;
|
|
31986
32032
|
}
|
|
@@ -32120,8 +32166,8 @@ function convertExcelRangeToSheetXC(range, dataSetsHaveTitle) {
|
|
|
32120
32166
|
}
|
|
32121
32167
|
function convertAnchor(XLSXanchor) {
|
|
32122
32168
|
const offset = {
|
|
32123
|
-
x: convertEMUToDotValue(XLSXanchor.colOffset),
|
|
32124
|
-
y: convertEMUToDotValue(XLSXanchor.rowOffset),
|
|
32169
|
+
x: convertEMUToDotValue(XLSXanchor.colOffset) - FIGURE_BORDER_WIDTH,
|
|
32170
|
+
y: convertEMUToDotValue(XLSXanchor.rowOffset) - FIGURE_BORDER_WIDTH,
|
|
32125
32171
|
};
|
|
32126
32172
|
return { col: XLSXanchor.col, row: XLSXanchor.row, offset };
|
|
32127
32173
|
}
|
|
@@ -32504,8 +32550,12 @@ function getSheetDims(sheet) {
|
|
|
32504
32550
|
dims[0] = Math.max(dims[0], largeMax(row.cells.map((cell) => toCartesian(cell.xc).col)));
|
|
32505
32551
|
dims[1] = Math.max(dims[1], row.index);
|
|
32506
32552
|
}
|
|
32507
|
-
|
|
32508
|
-
|
|
32553
|
+
for (const fig of sheet.figures) {
|
|
32554
|
+
dims[0] = Math.max(dims[0], fig.anchors[fig.anchors.length - 1]?.col ?? 0);
|
|
32555
|
+
dims[1] = Math.max(dims[1], fig.anchors[fig.anchors.length - 1]?.row ?? 0);
|
|
32556
|
+
}
|
|
32557
|
+
dims[0] = Math.max(dims[0] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_COLS);
|
|
32558
|
+
dims[1] = Math.max(dims[1] + 5, EXCEL_IMPORT_DEFAULT_NUMBER_OF_ROWS);
|
|
32509
32559
|
return dims;
|
|
32510
32560
|
}
|
|
32511
32561
|
/**
|
|
@@ -34510,7 +34560,7 @@ function getRelationFile(file, xmls) {
|
|
|
34510
34560
|
return relsFile;
|
|
34511
34561
|
}
|
|
34512
34562
|
|
|
34513
|
-
const EXCEL_IMPORT_VERSION = "18.3";
|
|
34563
|
+
const EXCEL_IMPORT_VERSION = "18.3.1";
|
|
34514
34564
|
class XlsxReader {
|
|
34515
34565
|
warningManager;
|
|
34516
34566
|
xmls;
|
|
@@ -38514,7 +38564,7 @@ const splitToColumns = {
|
|
|
38514
38564
|
const reinsertDynamicPivotMenu = {
|
|
38515
38565
|
id: "reinsert_dynamic_pivot",
|
|
38516
38566
|
name: _t("Re-insert dynamic pivot"),
|
|
38517
|
-
sequence:
|
|
38567
|
+
sequence: 60,
|
|
38518
38568
|
icon: "o-spreadsheet-Icon.INSERT_PIVOT",
|
|
38519
38569
|
children: [REINSERT_DYNAMIC_PIVOT_CHILDREN],
|
|
38520
38570
|
isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
|
|
@@ -38522,7 +38572,7 @@ const reinsertDynamicPivotMenu = {
|
|
|
38522
38572
|
const reinsertStaticPivotMenu = {
|
|
38523
38573
|
id: "reinsert_static_pivot",
|
|
38524
38574
|
name: _t("Re-insert static pivot"),
|
|
38525
|
-
sequence:
|
|
38575
|
+
sequence: 70,
|
|
38526
38576
|
icon: "o-spreadsheet-Icon.INSERT_PIVOT",
|
|
38527
38577
|
children: [REINSERT_STATIC_PIVOT_CHILDREN],
|
|
38528
38578
|
isVisible: (env) => env.model.getters.getPivotIds().some((id) => env.model.getters.getPivot(id).isValid()),
|
|
@@ -40191,8 +40241,9 @@ topbarMenuRegistry
|
|
|
40191
40241
|
sequence: 40,
|
|
40192
40242
|
separator: true,
|
|
40193
40243
|
})
|
|
40194
|
-
.addChild("
|
|
40244
|
+
.addChild("pivot_data_sources", ["data"], (env) => {
|
|
40195
40245
|
const sequence = 50;
|
|
40246
|
+
const numberOfPivots = env.model.getters.getPivotIds().length;
|
|
40196
40247
|
return env.model.getters.getPivotIds().map((pivotId, index) => {
|
|
40197
40248
|
const highlightProvider = {
|
|
40198
40249
|
get highlights() {
|
|
@@ -40202,7 +40253,7 @@ topbarMenuRegistry
|
|
|
40202
40253
|
return {
|
|
40203
40254
|
id: `item_pivot_${env.model.getters.getPivotFormulaId(pivotId)}`,
|
|
40204
40255
|
name: env.model.getters.getPivotDisplayName(pivotId),
|
|
40205
|
-
sequence: sequence + index,
|
|
40256
|
+
sequence: sequence + index / numberOfPivots,
|
|
40206
40257
|
isReadonlyAllowed: true,
|
|
40207
40258
|
execute: (env) => env.openSidePanel("PivotSidePanel", { pivotId }),
|
|
40208
40259
|
onStartHover: (env) => env.getStore(HighlightStore).register(highlightProvider),
|
|
@@ -57200,7 +57251,8 @@ class CorePlugin extends BasePlugin {
|
|
|
57200
57251
|
* the type of change that occurred.
|
|
57201
57252
|
*
|
|
57202
57253
|
* @param applyChange a function that, when called, will adapt the range according to the change on the grid
|
|
57203
|
-
* @param sheetId an
|
|
57254
|
+
* @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
|
|
57255
|
+
* @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
|
|
57204
57256
|
*/
|
|
57205
57257
|
adaptRanges(applyChange, sheetId, sheetName) { }
|
|
57206
57258
|
/**
|
|
@@ -57803,9 +57855,7 @@ class CellPlugin extends CorePlugin {
|
|
|
57803
57855
|
for (const cell of Object.values(this.cells[sheet] || {})) {
|
|
57804
57856
|
if (cell.isFormula) {
|
|
57805
57857
|
for (const range of cell.compiledFormula.dependencies) {
|
|
57806
|
-
if (
|
|
57807
|
-
range.sheetId === sheetId ||
|
|
57808
|
-
(sheetName && range.invalidSheetName === sheetName)) {
|
|
57858
|
+
if (range.sheetId === sheetId || range.invalidSheetName === sheetName.old) {
|
|
57809
57859
|
const change = applyChange(range);
|
|
57810
57860
|
if (change.changeType !== "NONE") {
|
|
57811
57861
|
this.history.update("cells", sheet, cell.id, "compiledFormula", "dependencies", cell.compiledFormula.dependencies.indexOf(range), change.range);
|
|
@@ -58421,9 +58471,9 @@ class ChartPlugin extends CorePlugin {
|
|
|
58421
58471
|
charts = {};
|
|
58422
58472
|
createChart = chartFactory(this.getters);
|
|
58423
58473
|
validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
58424
|
-
adaptRanges(applyChange) {
|
|
58474
|
+
adaptRanges(applyChange, sheetId, adaptSheetName) {
|
|
58425
58475
|
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
58426
|
-
this.history.update("charts", chartId, chart?.updateRanges(applyChange));
|
|
58476
|
+
this.history.update("charts", chartId, chart?.updateRanges(applyChange, sheetId, adaptSheetName));
|
|
58427
58477
|
}
|
|
58428
58478
|
}
|
|
58429
58479
|
// ---------------------------------------------------------------------------
|
|
@@ -58686,7 +58736,7 @@ class ConditionalFormatPlugin extends CorePlugin {
|
|
|
58686
58736
|
}
|
|
58687
58737
|
}
|
|
58688
58738
|
}
|
|
58689
|
-
adaptRanges(applyChange, sheetId
|
|
58739
|
+
adaptRanges(applyChange, sheetId) {
|
|
58690
58740
|
const sheetIds = sheetId ? [sheetId] : Object.keys(this.cfRules);
|
|
58691
58741
|
for (const sheetId of sheetIds) {
|
|
58692
58742
|
this.adaptCFRanges(sheetId, applyChange);
|
|
@@ -59082,11 +59132,8 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
59082
59132
|
"getValidationRuleForCell",
|
|
59083
59133
|
];
|
|
59084
59134
|
rules = {};
|
|
59085
|
-
adaptRanges(applyChange, sheetId
|
|
59086
|
-
|
|
59087
|
-
for (const sheetId of sheetIds) {
|
|
59088
|
-
this.adaptDVRanges(sheetId, applyChange);
|
|
59089
|
-
}
|
|
59135
|
+
adaptRanges(applyChange, sheetId) {
|
|
59136
|
+
this.adaptDVRanges(sheetId, applyChange);
|
|
59090
59137
|
this.adaptDVFormulas(applyChange);
|
|
59091
59138
|
}
|
|
59092
59139
|
adaptDVFormulas(applyChange) {
|
|
@@ -59376,9 +59423,6 @@ class FigurePlugin extends CorePlugin {
|
|
|
59376
59423
|
// Command Handling
|
|
59377
59424
|
// ---------------------------------------------------------------------------
|
|
59378
59425
|
adaptRanges(applyChange, sheetId) {
|
|
59379
|
-
if (!sheetId) {
|
|
59380
|
-
return;
|
|
59381
|
-
}
|
|
59382
59426
|
for (const figure of this.getFigures(sheetId)) {
|
|
59383
59427
|
const change = applyChange(this.getters.getRangeFromZone(sheetId, {
|
|
59384
59428
|
left: figure.col,
|
|
@@ -60186,11 +60230,8 @@ class MergePlugin extends CorePlugin {
|
|
|
60186
60230
|
break;
|
|
60187
60231
|
}
|
|
60188
60232
|
}
|
|
60189
|
-
adaptRanges(applyChange, sheetId
|
|
60190
|
-
|
|
60191
|
-
for (const sheetId of sheetIds) {
|
|
60192
|
-
this.applyRangeChangeOnSheet(sheetId, applyChange);
|
|
60193
|
-
}
|
|
60233
|
+
adaptRanges(applyChange, sheetId) {
|
|
60234
|
+
this.applyRangeChangeOnSheet(sheetId, applyChange);
|
|
60194
60235
|
}
|
|
60195
60236
|
// ---------------------------------------------------------------------------
|
|
60196
60237
|
// Getters
|
|
@@ -61698,12 +61739,9 @@ class TablePlugin extends CorePlugin {
|
|
|
61698
61739
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
61699
61740
|
tables = {};
|
|
61700
61741
|
nextTableId = 1;
|
|
61701
|
-
adaptRanges(applyChange, sheetId
|
|
61702
|
-
const
|
|
61703
|
-
|
|
61704
|
-
for (const table of this.getCoreTables(sheetId)) {
|
|
61705
|
-
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
61706
|
-
}
|
|
61742
|
+
adaptRanges(applyChange, sheetId) {
|
|
61743
|
+
for (const table of this.getCoreTables(sheetId)) {
|
|
61744
|
+
this.applyRangeChangeOnTable(sheetId, table, applyChange);
|
|
61707
61745
|
}
|
|
61708
61746
|
}
|
|
61709
61747
|
allowDispatch(cmd) {
|
|
@@ -62666,7 +62704,7 @@ class PivotCorePlugin extends CorePlugin {
|
|
|
62666
62704
|
}
|
|
62667
62705
|
}
|
|
62668
62706
|
}
|
|
62669
|
-
adaptRanges(applyChange
|
|
62707
|
+
adaptRanges(applyChange) {
|
|
62670
62708
|
for (const sheetId in this.compiledMeasureFormulas) {
|
|
62671
62709
|
for (const formulaString in this.compiledMeasureFormulas[sheetId]) {
|
|
62672
62710
|
const compiledFormula = this.compiledMeasureFormulas[sheetId][formulaString];
|
|
@@ -66827,7 +66865,7 @@ class PivotUIPlugin extends CoreViewPlugin {
|
|
|
66827
66865
|
if (!result) {
|
|
66828
66866
|
return EMPTY_PIVOT_CELL;
|
|
66829
66867
|
}
|
|
66830
|
-
|
|
66868
|
+
let { functionName, args } = result;
|
|
66831
66869
|
const formulaId = args[0];
|
|
66832
66870
|
if (!formulaId) {
|
|
66833
66871
|
return EMPTY_PIVOT_CELL;
|
|
@@ -66857,6 +66895,9 @@ class PivotUIPlugin extends CoreViewPlugin {
|
|
|
66857
66895
|
return pivotCells[pivotCol][pivotRow];
|
|
66858
66896
|
}
|
|
66859
66897
|
try {
|
|
66898
|
+
const offsetRow = position.row - mainPosition.row;
|
|
66899
|
+
const offsetCol = position.col - mainPosition.col;
|
|
66900
|
+
args = args.map((arg) => (isMatrix(arg) ? arg[offsetCol][offsetRow] : arg));
|
|
66860
66901
|
if (functionName === "PIVOT.HEADER" && args.at(-2) === "measure") {
|
|
66861
66902
|
const domain = pivot.parseArgsToPivotDomain(args.slice(1, -2).map((value) => ({ value })));
|
|
66862
66903
|
return {
|
|
@@ -68055,7 +68096,8 @@ function transformAll(toTransform, executed) {
|
|
|
68055
68096
|
// If the executed command is not in the registry, we skip it
|
|
68056
68097
|
// because we know there won't be any transformation impacting the
|
|
68057
68098
|
// commands to transform.
|
|
68058
|
-
if (possibleTransformations.has(executedCommand.type)
|
|
68099
|
+
if (possibleTransformations.has(executedCommand.type) ||
|
|
68100
|
+
rangeAdapterRegistry.contains(executedCommand.type)) {
|
|
68059
68101
|
transformedCommands = transformedCommands.reduce((acc, cmd) => {
|
|
68060
68102
|
const transformed = transform(cmd, executedCommand);
|
|
68061
68103
|
if (transformed) {
|
|
@@ -79216,7 +79258,7 @@ function figureCoordinates(headers, anchor, offset) {
|
|
|
79216
79258
|
for (const [headerIndex, header] of headers.slice(anchor).entries()) {
|
|
79217
79259
|
if (currentPosition <= offset && offset < currentPosition + header.size) {
|
|
79218
79260
|
return {
|
|
79219
|
-
index: headerIndex,
|
|
79261
|
+
index: anchor + headerIndex,
|
|
79220
79262
|
offset: convertDotValueToEMU(offset - currentPosition + FIGURE_BORDER_WIDTH),
|
|
79221
79263
|
};
|
|
79222
79264
|
}
|
|
@@ -80212,7 +80254,7 @@ class Model extends EventBus {
|
|
|
80212
80254
|
handlers = [];
|
|
80213
80255
|
uiHandlers = [];
|
|
80214
80256
|
coreHandlers = [];
|
|
80215
|
-
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport =
|
|
80257
|
+
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
|
|
80216
80258
|
const start = performance.now();
|
|
80217
80259
|
console.debug("##### Model creation #####");
|
|
80218
80260
|
super();
|
|
@@ -80955,6 +80997,6 @@ exports.tokenColors = tokenColors;
|
|
|
80955
80997
|
exports.tokenize = tokenize;
|
|
80956
80998
|
|
|
80957
80999
|
|
|
80958
|
-
__info__.version = "18.3.
|
|
80959
|
-
__info__.date = "2025-
|
|
80960
|
-
__info__.hash = "
|
|
81000
|
+
__info__.version = "18.3.19";
|
|
81001
|
+
__info__.date = "2025-09-05T07:38:30.661Z";
|
|
81002
|
+
__info__.hash = "77fd307";
|