@odoo/o-spreadsheet 18.1.21 → 18.1.22
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 +202 -114
- package/dist/o-spreadsheet.esm.js +202 -114
- package/dist/o-spreadsheet.iife.js +202 -114
- package/dist/o-spreadsheet.iife.min.js +367 -367
- package/dist/o_spreadsheet.xml +5 -5
- 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.1.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.22
|
|
6
|
+
* @date 2025-05-26T12:35:56.145Z
|
|
7
|
+
* @hash ff4b0ba
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -4140,6 +4140,113 @@ function transposeMatrix(matrix) {
|
|
|
4140
4140
|
}
|
|
4141
4141
|
return generateMatrix(matrix[0].length, matrix.length, (i, j) => matrix[j][i]);
|
|
4142
4142
|
}
|
|
4143
|
+
/**
|
|
4144
|
+
* Enables a formula function to accept matrix or vector inputs instead of simple value, computing results across multiple dimensions.
|
|
4145
|
+
*
|
|
4146
|
+
* ```
|
|
4147
|
+
* / |‾ ‾| \ |‾ ‾|
|
|
4148
|
+
* | | [A] | | | compute(A, D, E), compute(A, D, F), compute(A, D, G) |
|
|
4149
|
+
* applyVectorization| compute, | [B], D, [E, F, G] | | <=> | compute(B, D, E), compute(B, D, F), compute(B, D, G) |
|
|
4150
|
+
* | | [C] | | | compute(C, D, E), compute(C, D, F), compute(C, D, G) |
|
|
4151
|
+
* \ |_ _| / |_ _|
|
|
4152
|
+
* ```
|
|
4153
|
+
*
|
|
4154
|
+
* By default, all arguments are vectorized. To control which arguments are vectorized,
|
|
4155
|
+
* pass an `acceptToVectorize` boolean array of the same length as `args`:
|
|
4156
|
+
* - `true` enables vectorization for that argument
|
|
4157
|
+
* - `false` disables vectorization for that argument
|
|
4158
|
+
*
|
|
4159
|
+
* For example, with `[true, true, false]` on previous example you get:
|
|
4160
|
+
*
|
|
4161
|
+
* ```
|
|
4162
|
+
* |‾ ‾|
|
|
4163
|
+
* | compute(A, D, [E, F, G]) |
|
|
4164
|
+
* | compute(B, D, [E, F, G]) |
|
|
4165
|
+
* | compute(C, D, [E, F, G]) |
|
|
4166
|
+
* |_ _|
|
|
4167
|
+
* ```
|
|
4168
|
+
*
|
|
4169
|
+
* @remarks
|
|
4170
|
+
* This helper is automatically applied (by default) to **all** `compute` functions
|
|
4171
|
+
* across the various spreadsheet formula modules:
|
|
4172
|
+
* - If an argument is declared **scalar** (not `"range"`), it is vectorized.
|
|
4173
|
+
* - If **all** arguments are declared **ranges**, no vectorization occurs.
|
|
4174
|
+
* - e.g. `SUM(A1:B2)` returns a 1×1 sum over the range.
|
|
4175
|
+
* - e.g. `COS(A1:B2)` over `A1:B2` returns a 2×2 element-wise result.
|
|
4176
|
+
* - For special behaviors (e.g. the `IF` function), you may declare all arguments
|
|
4177
|
+
* as ranges and invoke this helper directly within your `compute` implementation.
|
|
4178
|
+
*/
|
|
4179
|
+
function applyVectorization(formula, args, acceptToVectorize = undefined) {
|
|
4180
|
+
let countVectorizedCol = 1;
|
|
4181
|
+
let countVectorizedRow = 1;
|
|
4182
|
+
let vectorizedColLimit = Infinity;
|
|
4183
|
+
let vectorizedRowLimit = Infinity;
|
|
4184
|
+
let vectorArgsType = undefined;
|
|
4185
|
+
for (let i = 0; i < args.length; i++) {
|
|
4186
|
+
const arg = args[i];
|
|
4187
|
+
if (isMatrix(arg) && (acceptToVectorize === undefined || acceptToVectorize[i])) {
|
|
4188
|
+
const nColumns = arg.length;
|
|
4189
|
+
const nRows = arg[0].length;
|
|
4190
|
+
if (nColumns !== 1 || nRows !== 1) {
|
|
4191
|
+
vectorArgsType ??= new Array(args.length);
|
|
4192
|
+
if (nColumns !== 1 && nRows !== 1) {
|
|
4193
|
+
vectorArgsType[i] = "matrix";
|
|
4194
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4195
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4196
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4197
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4198
|
+
}
|
|
4199
|
+
else if (nColumns !== 1) {
|
|
4200
|
+
vectorArgsType[i] = "horizontal";
|
|
4201
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4202
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4203
|
+
}
|
|
4204
|
+
else if (nRows !== 1) {
|
|
4205
|
+
vectorArgsType[i] = "vertical";
|
|
4206
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4207
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
else {
|
|
4211
|
+
args[i] = arg[0][0];
|
|
4212
|
+
}
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
if (countVectorizedCol === 1 && countVectorizedRow === 1) {
|
|
4216
|
+
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
4217
|
+
return formula(...args);
|
|
4218
|
+
}
|
|
4219
|
+
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
4220
|
+
switch (vectorArgsType?.[index]) {
|
|
4221
|
+
case "matrix":
|
|
4222
|
+
return arg[i][j];
|
|
4223
|
+
case "horizontal":
|
|
4224
|
+
return arg[i][0];
|
|
4225
|
+
case "vertical":
|
|
4226
|
+
return arg[0][j];
|
|
4227
|
+
case undefined:
|
|
4228
|
+
return arg;
|
|
4229
|
+
}
|
|
4230
|
+
});
|
|
4231
|
+
return generateMatrix(countVectorizedCol, countVectorizedRow, (col, row) => {
|
|
4232
|
+
if (col > vectorizedColLimit - 1 || row > vectorizedRowLimit - 1) {
|
|
4233
|
+
return new NotAvailableError(_t("Array arguments to [[FUNCTION_NAME]] are of different size."));
|
|
4234
|
+
}
|
|
4235
|
+
const singleCellComputeResult = formula(...getArgOffset(col, row));
|
|
4236
|
+
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
4237
|
+
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
4238
|
+
// we won't be able to return the values.
|
|
4239
|
+
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
4240
|
+
// create an array with these parts.
|
|
4241
|
+
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
4242
|
+
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
4243
|
+
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
4244
|
+
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
4245
|
+
return isMatrix(singleCellComputeResult)
|
|
4246
|
+
? singleCellComputeResult[0][0]
|
|
4247
|
+
: singleCellComputeResult;
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4143
4250
|
// -----------------------------------------------------------------------------
|
|
4144
4251
|
// CONDITIONAL EXPLORE FUNCTIONS
|
|
4145
4252
|
// -----------------------------------------------------------------------------
|
|
@@ -7431,14 +7538,20 @@ function multiplyMatrices(matrix1, matrix2) {
|
|
|
7431
7538
|
/**
|
|
7432
7539
|
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
7433
7540
|
*/
|
|
7434
|
-
function toScalar(
|
|
7435
|
-
if (!isMatrix(
|
|
7436
|
-
return
|
|
7541
|
+
function toScalar(arg) {
|
|
7542
|
+
if (!isMatrix(arg)) {
|
|
7543
|
+
return arg;
|
|
7437
7544
|
}
|
|
7438
|
-
if (
|
|
7545
|
+
if (!isSingleElementMatrix(arg)) {
|
|
7439
7546
|
throw new EvaluationError(_t("The value should be a scalar or a 1x1 matrix"));
|
|
7440
7547
|
}
|
|
7441
|
-
return
|
|
7548
|
+
return arg[0][0];
|
|
7549
|
+
}
|
|
7550
|
+
function isSingleElementMatrix(matrix) {
|
|
7551
|
+
return matrix.length === 1 && matrix[0].length === 1;
|
|
7552
|
+
}
|
|
7553
|
+
function isMultipleElementMatrix(arg) {
|
|
7554
|
+
return isMatrix(arg) && !isSingleElementMatrix(arg);
|
|
7442
7555
|
}
|
|
7443
7556
|
|
|
7444
7557
|
function assertSameNumberOfElements(...args) {
|
|
@@ -15282,7 +15395,7 @@ const FILTER = {
|
|
|
15282
15395
|
}
|
|
15283
15396
|
return mode === "row" ? transposeMatrix(result) : result;
|
|
15284
15397
|
},
|
|
15285
|
-
isExported:
|
|
15398
|
+
isExported: false,
|
|
15286
15399
|
};
|
|
15287
15400
|
// -----------------------------------------------------------------------------
|
|
15288
15401
|
// SORT
|
|
@@ -18413,16 +18526,23 @@ const FALSE = {
|
|
|
18413
18526
|
const IF = {
|
|
18414
18527
|
description: _t("Returns value depending on logical expression."),
|
|
18415
18528
|
args: [
|
|
18416
|
-
arg("logical_expression (boolean)", _t("An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.")),
|
|
18417
|
-
arg("value_if_true (any)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
18418
|
-
arg("value_if_false (any, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
18529
|
+
arg("logical_expression (boolean, range<boolean>)", _t("An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE.")),
|
|
18530
|
+
arg("value_if_true (any, range)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
18531
|
+
arg("value_if_false (any, range, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
18419
18532
|
],
|
|
18420
18533
|
compute: function (logicalExpression, valueIfTrue, valueIfFalse) {
|
|
18421
|
-
|
|
18534
|
+
if (isMultipleElementMatrix(logicalExpression)) {
|
|
18535
|
+
return applyVectorization(IF.compute, [logicalExpression, valueIfTrue, valueIfFalse]);
|
|
18536
|
+
}
|
|
18537
|
+
let result = toBoolean(toScalar(logicalExpression)) ? valueIfTrue : valueIfFalse;
|
|
18538
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18539
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18540
|
+
result = toScalar(result);
|
|
18541
|
+
}
|
|
18422
18542
|
if (result === undefined) {
|
|
18423
18543
|
return { value: "" };
|
|
18424
18544
|
}
|
|
18425
|
-
if (result.value === null) {
|
|
18545
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18426
18546
|
return { ...result, value: "" };
|
|
18427
18547
|
}
|
|
18428
18548
|
return result;
|
|
@@ -18435,15 +18555,22 @@ const IF = {
|
|
|
18435
18555
|
const IFERROR = {
|
|
18436
18556
|
description: _t("Value if it is not an error, otherwise 2nd argument."),
|
|
18437
18557
|
args: [
|
|
18438
|
-
arg("value (any)", _t("The value to return if value itself is not an error.")),
|
|
18439
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
18558
|
+
arg("value (any, range)", _t("The value to return if value itself is not an error.")),
|
|
18559
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
18440
18560
|
],
|
|
18441
|
-
compute: function (value, valueIfError
|
|
18442
|
-
|
|
18561
|
+
compute: function (value, valueIfError) {
|
|
18562
|
+
if (isMultipleElementMatrix(value)) {
|
|
18563
|
+
return applyVectorization(IFERROR.compute, [value, valueIfError]);
|
|
18564
|
+
}
|
|
18565
|
+
let result = isEvaluationError(toScalar(value)?.value) ? valueIfError : value;
|
|
18566
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18567
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18568
|
+
result = toScalar(result);
|
|
18569
|
+
}
|
|
18443
18570
|
if (result === undefined) {
|
|
18444
18571
|
return { value: "" };
|
|
18445
18572
|
}
|
|
18446
|
-
if (result.value === null) {
|
|
18573
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18447
18574
|
return { ...result, value: "" };
|
|
18448
18575
|
}
|
|
18449
18576
|
return result;
|
|
@@ -18456,15 +18583,22 @@ const IFERROR = {
|
|
|
18456
18583
|
const IFNA = {
|
|
18457
18584
|
description: _t("Value if it is not an #N/A error, otherwise 2nd argument."),
|
|
18458
18585
|
args: [
|
|
18459
|
-
arg("value (any)", _t("The value to return if value itself is not #N/A an error.")),
|
|
18460
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
18586
|
+
arg("value (any, range)", _t("The value to return if value itself is not #N/A an error.")),
|
|
18587
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
18461
18588
|
],
|
|
18462
|
-
compute: function (value, valueIfError
|
|
18463
|
-
|
|
18589
|
+
compute: function (value, valueIfError) {
|
|
18590
|
+
if (isMultipleElementMatrix(value)) {
|
|
18591
|
+
return applyVectorization(IFNA.compute, [value, valueIfError]);
|
|
18592
|
+
}
|
|
18593
|
+
let result = toScalar(value)?.value === CellErrorType.NotAvailable ? valueIfError : value;
|
|
18594
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18595
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18596
|
+
result = toScalar(result);
|
|
18597
|
+
}
|
|
18464
18598
|
if (result === undefined) {
|
|
18465
18599
|
return { value: "" };
|
|
18466
18600
|
}
|
|
18467
|
-
if (result.value === null) {
|
|
18601
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18468
18602
|
return { ...result, value: "" };
|
|
18469
18603
|
}
|
|
18470
18604
|
return result;
|
|
@@ -18477,23 +18611,31 @@ const IFNA = {
|
|
|
18477
18611
|
const IFS = {
|
|
18478
18612
|
description: _t("Returns a value depending on multiple logical expressions."),
|
|
18479
18613
|
args: [
|
|
18480
|
-
arg("condition1 (boolean)", _t("The first condition to be evaluated. This can be a boolean, a number, an array, or a reference to any of those.")),
|
|
18481
|
-
arg("value1 (any)", _t("The returned value if condition1 is TRUE.")),
|
|
18482
|
-
arg("condition2 (boolean, any, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
18483
|
-
arg("value2 (any, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
18614
|
+
arg("condition1 (boolean, range<boolean>)", _t("The first condition to be evaluated. This can be a boolean, a number, an array, or a reference to any of those.")),
|
|
18615
|
+
arg("value1 (any, range)", _t("The returned value if condition1 is TRUE.")),
|
|
18616
|
+
arg("condition2 (boolean, any, range, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
18617
|
+
arg("value2 (any, range, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
18484
18618
|
],
|
|
18485
18619
|
compute: function (...values) {
|
|
18486
18620
|
assert(() => values.length % 2 === 0, _t("Wrong number of arguments. Expected an even number of arguments."));
|
|
18487
|
-
|
|
18488
|
-
if (
|
|
18489
|
-
|
|
18490
|
-
|
|
18621
|
+
while (values.length > 0) {
|
|
18622
|
+
if (isMultipleElementMatrix(values[0])) {
|
|
18623
|
+
return applyVectorization(IFS.compute, values);
|
|
18624
|
+
}
|
|
18625
|
+
const condition = toBoolean(toScalar(values.shift()));
|
|
18626
|
+
let valueIfTrue = values.shift();
|
|
18627
|
+
if (condition) {
|
|
18628
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18629
|
+
if (!isMultipleElementMatrix(valueIfTrue)) {
|
|
18630
|
+
valueIfTrue = toScalar(valueIfTrue);
|
|
18631
|
+
}
|
|
18632
|
+
if (valueIfTrue === undefined) {
|
|
18491
18633
|
return { value: "" };
|
|
18492
18634
|
}
|
|
18493
|
-
if (
|
|
18494
|
-
return { ...
|
|
18635
|
+
if (!isMatrix(valueIfTrue) && valueIfTrue.value === null) {
|
|
18636
|
+
return { ...valueIfTrue, value: "" };
|
|
18495
18637
|
}
|
|
18496
|
-
return
|
|
18638
|
+
return valueIfTrue;
|
|
18497
18639
|
}
|
|
18498
18640
|
}
|
|
18499
18641
|
return new EvaluationError(_t("No match."));
|
|
@@ -20155,7 +20297,7 @@ const SPLIT = {
|
|
|
20155
20297
|
}
|
|
20156
20298
|
return transposeMatrix([result]);
|
|
20157
20299
|
},
|
|
20158
|
-
isExported:
|
|
20300
|
+
isExported: false,
|
|
20159
20301
|
};
|
|
20160
20302
|
// -----------------------------------------------------------------------------
|
|
20161
20303
|
// SUBSTITUTE
|
|
@@ -20348,86 +20490,21 @@ for (let category of categories) {
|
|
|
20348
20490
|
functionRegistry.add(name, { isExported: false, ...addDescr });
|
|
20349
20491
|
}
|
|
20350
20492
|
}
|
|
20351
|
-
|
|
20493
|
+
//------------------------------------------------------------------------------
|
|
20494
|
+
// CREATE COMPUTE FUNCTION
|
|
20495
|
+
//------------------------------------------------------------------------------
|
|
20352
20496
|
function createComputeFunction(descr, functionName) {
|
|
20353
20497
|
function vectorizedCompute(...args) {
|
|
20354
|
-
|
|
20355
|
-
let countVectorizableRow = 1;
|
|
20356
|
-
let vectorizableColLimit = Infinity;
|
|
20357
|
-
let vectorizableRowLimit = Infinity;
|
|
20358
|
-
let vectorArgsType = undefined;
|
|
20359
|
-
//#region Compute vectorisation limits
|
|
20498
|
+
const acceptToVectorize = [];
|
|
20360
20499
|
for (let i = 0; i < args.length; i++) {
|
|
20361
20500
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
20362
20501
|
const arg = args[i];
|
|
20363
|
-
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
20364
|
-
// if argDefinition does not accept a matrix but arg is still a matrix
|
|
20365
|
-
// --> triggers the arguments vectorization
|
|
20366
|
-
const nColumns = arg.length;
|
|
20367
|
-
const nRows = arg[0].length;
|
|
20368
|
-
if (nColumns !== 1 || nRows !== 1) {
|
|
20369
|
-
vectorArgsType ??= new Array(args.length);
|
|
20370
|
-
if (nColumns !== 1 && nRows !== 1) {
|
|
20371
|
-
vectorArgsType[i] = "matrix";
|
|
20372
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20373
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20374
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20375
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20376
|
-
}
|
|
20377
|
-
else if (nColumns !== 1) {
|
|
20378
|
-
vectorArgsType[i] = "horizontal";
|
|
20379
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20380
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20381
|
-
}
|
|
20382
|
-
else if (nRows !== 1) {
|
|
20383
|
-
vectorArgsType[i] = "vertical";
|
|
20384
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20385
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20386
|
-
}
|
|
20387
|
-
}
|
|
20388
|
-
else {
|
|
20389
|
-
args[i] = arg[0][0];
|
|
20390
|
-
}
|
|
20391
|
-
}
|
|
20392
20502
|
if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
|
|
20393
20503
|
throw new BadExpressionError(_t("Function %s expects the parameter '%s' to be reference to a cell or range.", functionName, (i + 1).toString()));
|
|
20394
20504
|
}
|
|
20505
|
+
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20395
20506
|
}
|
|
20396
|
-
|
|
20397
|
-
if (countVectorizableCol === 1 && countVectorizableRow === 1) {
|
|
20398
|
-
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
20399
|
-
return errorHandlingCompute.apply(this, args);
|
|
20400
|
-
}
|
|
20401
|
-
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
20402
|
-
switch (vectorArgsType?.[index]) {
|
|
20403
|
-
case "matrix":
|
|
20404
|
-
return arg[i][j];
|
|
20405
|
-
case "horizontal":
|
|
20406
|
-
return arg[i][0];
|
|
20407
|
-
case "vertical":
|
|
20408
|
-
return arg[0][j];
|
|
20409
|
-
case undefined:
|
|
20410
|
-
return arg;
|
|
20411
|
-
}
|
|
20412
|
-
});
|
|
20413
|
-
return generateMatrix(countVectorizableCol, countVectorizableRow, (col, row) => {
|
|
20414
|
-
if (col > vectorizableColLimit - 1 || row > vectorizableRowLimit - 1) {
|
|
20415
|
-
return notAvailableError;
|
|
20416
|
-
}
|
|
20417
|
-
const singleCellComputeResult = errorHandlingCompute.apply(this, getArgOffset(col, row));
|
|
20418
|
-
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
20419
|
-
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
20420
|
-
// we won't be able to return the values.
|
|
20421
|
-
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
20422
|
-
// create an array with these parts.
|
|
20423
|
-
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
20424
|
-
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
20425
|
-
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
20426
|
-
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
20427
|
-
return isMatrix(singleCellComputeResult)
|
|
20428
|
-
? singleCellComputeResult[0][0]
|
|
20429
|
-
: singleCellComputeResult;
|
|
20430
|
-
});
|
|
20507
|
+
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
20431
20508
|
}
|
|
20432
20509
|
function errorHandlingCompute(...args) {
|
|
20433
20510
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -21272,7 +21349,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
21272
21349
|
proposals &&
|
|
21273
21350
|
!["ARG_SEPARATOR", "LEFT_PAREN", "OPERATOR"].includes(tokenAtCursor.type)) {
|
|
21274
21351
|
const filteredProposals = fuzzyLookup(searchTerm, proposals, (p) => p.fuzzySearchKey || p.text);
|
|
21275
|
-
if (!exactMatch || filteredProposals.length
|
|
21352
|
+
if (!exactMatch || filteredProposals.length) {
|
|
21276
21353
|
proposals = filteredProposals;
|
|
21277
21354
|
}
|
|
21278
21355
|
}
|
|
@@ -46139,7 +46216,9 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
46139
46216
|
return dimension.order === "asc" ? -1 : 1;
|
|
46140
46217
|
}
|
|
46141
46218
|
if (dimension.type === "integer" || dimension.type === "datetime") {
|
|
46142
|
-
return dimension.order === "asc"
|
|
46219
|
+
return dimension.order === "asc"
|
|
46220
|
+
? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
|
|
46221
|
+
: toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
|
|
46143
46222
|
}
|
|
46144
46223
|
return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
|
|
46145
46224
|
}
|
|
@@ -48905,8 +48984,7 @@ class CellComposerStore extends AbstractComposerStore {
|
|
|
48905
48984
|
if (!spreader) {
|
|
48906
48985
|
return undefined;
|
|
48907
48986
|
}
|
|
48908
|
-
|
|
48909
|
-
return cell?.content;
|
|
48987
|
+
return this.getters.getCellText(spreader, { showFormula: true });
|
|
48910
48988
|
}
|
|
48911
48989
|
get currentEditedCell() {
|
|
48912
48990
|
return {
|
|
@@ -51717,6 +51795,7 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
51717
51795
|
const friction = 0.95;
|
|
51718
51796
|
const verticalScrollFactor = 1;
|
|
51719
51797
|
const horizontalScrollFactor = 1;
|
|
51798
|
+
const resetTimeoutDuration = 100;
|
|
51720
51799
|
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
51721
51800
|
let lastX = 0;
|
|
51722
51801
|
let lastY = 0;
|
|
@@ -51724,6 +51803,7 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
51724
51803
|
let velocityY = 0;
|
|
51725
51804
|
let isMouseDown = false;
|
|
51726
51805
|
let lastTime = 0;
|
|
51806
|
+
let resetTimeout = null;
|
|
51727
51807
|
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
51728
51808
|
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
51729
51809
|
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
@@ -51736,6 +51816,10 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
51736
51816
|
function onTouchMove(event) {
|
|
51737
51817
|
if (!isMouseDown)
|
|
51738
51818
|
return;
|
|
51819
|
+
if (resetTimeout) {
|
|
51820
|
+
clearTimeout(resetTimeout);
|
|
51821
|
+
resetTimeout = null;
|
|
51822
|
+
}
|
|
51739
51823
|
const currentTime = Date.now();
|
|
51740
51824
|
const { clientX, clientY } = event.touches[0];
|
|
51741
51825
|
let deltaX = lastX - clientX;
|
|
@@ -51752,6 +51836,10 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
51752
51836
|
}
|
|
51753
51837
|
event.stopPropagation();
|
|
51754
51838
|
}
|
|
51839
|
+
resetTimeout = setTimeout(() => {
|
|
51840
|
+
velocityX = 0;
|
|
51841
|
+
velocityY = 0;
|
|
51842
|
+
}, resetTimeoutDuration);
|
|
51755
51843
|
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
51756
51844
|
}
|
|
51757
51845
|
function onTouchEnd(ev) {
|
|
@@ -76303,6 +76391,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
76303
76391
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
76304
76392
|
|
|
76305
76393
|
|
|
76306
|
-
__info__.version = "18.1.
|
|
76307
|
-
__info__.date = "2025-05-
|
|
76308
|
-
__info__.hash = "
|
|
76394
|
+
__info__.version = "18.1.22";
|
|
76395
|
+
__info__.date = "2025-05-26T12:35:56.145Z";
|
|
76396
|
+
__info__.hash = "ff4b0ba";
|