@odoo/o-spreadsheet 18.0.29 → 18.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o-spreadsheet.cjs.js +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 +352 -352
- 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.0.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.30
|
|
6
|
+
* @date 2025-05-26T12:35:05.184Z
|
|
7
|
+
* @hash 838c4f7
|
|
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';
|
|
@@ -3971,6 +3971,113 @@ function transposeMatrix(matrix) {
|
|
|
3971
3971
|
}
|
|
3972
3972
|
return generateMatrix(matrix[0].length, matrix.length, (i, j) => matrix[j][i]);
|
|
3973
3973
|
}
|
|
3974
|
+
/**
|
|
3975
|
+
* Enables a formula function to accept matrix or vector inputs instead of simple value, computing results across multiple dimensions.
|
|
3976
|
+
*
|
|
3977
|
+
* ```
|
|
3978
|
+
* / |‾ ‾| \ |‾ ‾|
|
|
3979
|
+
* | | [A] | | | compute(A, D, E), compute(A, D, F), compute(A, D, G) |
|
|
3980
|
+
* applyVectorization| compute, | [B], D, [E, F, G] | | <=> | compute(B, D, E), compute(B, D, F), compute(B, D, G) |
|
|
3981
|
+
* | | [C] | | | compute(C, D, E), compute(C, D, F), compute(C, D, G) |
|
|
3982
|
+
* \ |_ _| / |_ _|
|
|
3983
|
+
* ```
|
|
3984
|
+
*
|
|
3985
|
+
* By default, all arguments are vectorized. To control which arguments are vectorized,
|
|
3986
|
+
* pass an `acceptToVectorize` boolean array of the same length as `args`:
|
|
3987
|
+
* - `true` enables vectorization for that argument
|
|
3988
|
+
* - `false` disables vectorization for that argument
|
|
3989
|
+
*
|
|
3990
|
+
* For example, with `[true, true, false]` on previous example you get:
|
|
3991
|
+
*
|
|
3992
|
+
* ```
|
|
3993
|
+
* |‾ ‾|
|
|
3994
|
+
* | compute(A, D, [E, F, G]) |
|
|
3995
|
+
* | compute(B, D, [E, F, G]) |
|
|
3996
|
+
* | compute(C, D, [E, F, G]) |
|
|
3997
|
+
* |_ _|
|
|
3998
|
+
* ```
|
|
3999
|
+
*
|
|
4000
|
+
* @remarks
|
|
4001
|
+
* This helper is automatically applied (by default) to **all** `compute` functions
|
|
4002
|
+
* across the various spreadsheet formula modules:
|
|
4003
|
+
* - If an argument is declared **scalar** (not `"range"`), it is vectorized.
|
|
4004
|
+
* - If **all** arguments are declared **ranges**, no vectorization occurs.
|
|
4005
|
+
* - e.g. `SUM(A1:B2)` returns a 1×1 sum over the range.
|
|
4006
|
+
* - e.g. `COS(A1:B2)` over `A1:B2` returns a 2×2 element-wise result.
|
|
4007
|
+
* - For special behaviors (e.g. the `IF` function), you may declare all arguments
|
|
4008
|
+
* as ranges and invoke this helper directly within your `compute` implementation.
|
|
4009
|
+
*/
|
|
4010
|
+
function applyVectorization(formula, args, acceptToVectorize = undefined) {
|
|
4011
|
+
let countVectorizedCol = 1;
|
|
4012
|
+
let countVectorizedRow = 1;
|
|
4013
|
+
let vectorizedColLimit = Infinity;
|
|
4014
|
+
let vectorizedRowLimit = Infinity;
|
|
4015
|
+
let vectorArgsType = undefined;
|
|
4016
|
+
for (let i = 0; i < args.length; i++) {
|
|
4017
|
+
const arg = args[i];
|
|
4018
|
+
if (isMatrix(arg) && (acceptToVectorize === undefined || acceptToVectorize[i])) {
|
|
4019
|
+
const nColumns = arg.length;
|
|
4020
|
+
const nRows = arg[0].length;
|
|
4021
|
+
if (nColumns !== 1 || nRows !== 1) {
|
|
4022
|
+
vectorArgsType ??= new Array(args.length);
|
|
4023
|
+
if (nColumns !== 1 && nRows !== 1) {
|
|
4024
|
+
vectorArgsType[i] = "matrix";
|
|
4025
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4026
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4027
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4028
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4029
|
+
}
|
|
4030
|
+
else if (nColumns !== 1) {
|
|
4031
|
+
vectorArgsType[i] = "horizontal";
|
|
4032
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4033
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4034
|
+
}
|
|
4035
|
+
else if (nRows !== 1) {
|
|
4036
|
+
vectorArgsType[i] = "vertical";
|
|
4037
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4038
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
else {
|
|
4042
|
+
args[i] = arg[0][0];
|
|
4043
|
+
}
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
if (countVectorizedCol === 1 && countVectorizedRow === 1) {
|
|
4047
|
+
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
4048
|
+
return formula(...args);
|
|
4049
|
+
}
|
|
4050
|
+
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
4051
|
+
switch (vectorArgsType?.[index]) {
|
|
4052
|
+
case "matrix":
|
|
4053
|
+
return arg[i][j];
|
|
4054
|
+
case "horizontal":
|
|
4055
|
+
return arg[i][0];
|
|
4056
|
+
case "vertical":
|
|
4057
|
+
return arg[0][j];
|
|
4058
|
+
case undefined:
|
|
4059
|
+
return arg;
|
|
4060
|
+
}
|
|
4061
|
+
});
|
|
4062
|
+
return generateMatrix(countVectorizedCol, countVectorizedRow, (col, row) => {
|
|
4063
|
+
if (col > vectorizedColLimit - 1 || row > vectorizedRowLimit - 1) {
|
|
4064
|
+
return new NotAvailableError(_t("Array arguments to [[FUNCTION_NAME]] are of different size."));
|
|
4065
|
+
}
|
|
4066
|
+
const singleCellComputeResult = formula(...getArgOffset(col, row));
|
|
4067
|
+
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
4068
|
+
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
4069
|
+
// we won't be able to return the values.
|
|
4070
|
+
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
4071
|
+
// create an array with these parts.
|
|
4072
|
+
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
4073
|
+
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
4074
|
+
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
4075
|
+
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
4076
|
+
return isMatrix(singleCellComputeResult)
|
|
4077
|
+
? singleCellComputeResult[0][0]
|
|
4078
|
+
: singleCellComputeResult;
|
|
4079
|
+
});
|
|
4080
|
+
}
|
|
3974
4081
|
// -----------------------------------------------------------------------------
|
|
3975
4082
|
// CONDITIONAL EXPLORE FUNCTIONS
|
|
3976
4083
|
// -----------------------------------------------------------------------------
|
|
@@ -7277,14 +7384,20 @@ function multiplyMatrices(matrix1, matrix2) {
|
|
|
7277
7384
|
/**
|
|
7278
7385
|
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
7279
7386
|
*/
|
|
7280
|
-
function toScalar(
|
|
7281
|
-
if (!isMatrix(
|
|
7282
|
-
return
|
|
7387
|
+
function toScalar(arg) {
|
|
7388
|
+
if (!isMatrix(arg)) {
|
|
7389
|
+
return arg;
|
|
7283
7390
|
}
|
|
7284
|
-
if (
|
|
7391
|
+
if (!isSingleElementMatrix(arg)) {
|
|
7285
7392
|
throw new EvaluationError(_t("The value should be a scalar or a 1x1 matrix"));
|
|
7286
7393
|
}
|
|
7287
|
-
return
|
|
7394
|
+
return arg[0][0];
|
|
7395
|
+
}
|
|
7396
|
+
function isSingleElementMatrix(matrix) {
|
|
7397
|
+
return matrix.length === 1 && matrix[0].length === 1;
|
|
7398
|
+
}
|
|
7399
|
+
function isMultipleElementMatrix(arg) {
|
|
7400
|
+
return isMatrix(arg) && !isSingleElementMatrix(arg);
|
|
7288
7401
|
}
|
|
7289
7402
|
|
|
7290
7403
|
function assertSameNumberOfElements(...args) {
|
|
@@ -21485,7 +21598,7 @@ const FILTER = {
|
|
|
21485
21598
|
}
|
|
21486
21599
|
return mode === "row" ? transposeMatrix(result) : result;
|
|
21487
21600
|
},
|
|
21488
|
-
isExported:
|
|
21601
|
+
isExported: false,
|
|
21489
21602
|
};
|
|
21490
21603
|
// -----------------------------------------------------------------------------
|
|
21491
21604
|
// SORT
|
|
@@ -24453,16 +24566,23 @@ const FALSE = {
|
|
|
24453
24566
|
const IF = {
|
|
24454
24567
|
description: _t("Returns value depending on logical expression."),
|
|
24455
24568
|
args: [
|
|
24456
|
-
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.")),
|
|
24457
|
-
arg("value_if_true (any)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
24458
|
-
arg("value_if_false (any, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
24569
|
+
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.")),
|
|
24570
|
+
arg("value_if_true (any, range)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
24571
|
+
arg("value_if_false (any, range, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
24459
24572
|
],
|
|
24460
24573
|
compute: function (logicalExpression, valueIfTrue, valueIfFalse) {
|
|
24461
|
-
|
|
24574
|
+
if (isMultipleElementMatrix(logicalExpression)) {
|
|
24575
|
+
return applyVectorization(IF.compute, [logicalExpression, valueIfTrue, valueIfFalse]);
|
|
24576
|
+
}
|
|
24577
|
+
let result = toBoolean(toScalar(logicalExpression)) ? valueIfTrue : valueIfFalse;
|
|
24578
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
24579
|
+
if (!isMultipleElementMatrix(result)) {
|
|
24580
|
+
result = toScalar(result);
|
|
24581
|
+
}
|
|
24462
24582
|
if (result === undefined) {
|
|
24463
24583
|
return { value: "" };
|
|
24464
24584
|
}
|
|
24465
|
-
if (result.value === null) {
|
|
24585
|
+
if (!isMatrix(result) && result.value === null) {
|
|
24466
24586
|
return { ...result, value: "" };
|
|
24467
24587
|
}
|
|
24468
24588
|
return result;
|
|
@@ -24475,15 +24595,22 @@ const IF = {
|
|
|
24475
24595
|
const IFERROR = {
|
|
24476
24596
|
description: _t("Value if it is not an error, otherwise 2nd argument."),
|
|
24477
24597
|
args: [
|
|
24478
|
-
arg("value (any)", _t("The value to return if value itself is not an error.")),
|
|
24479
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
24598
|
+
arg("value (any, range)", _t("The value to return if value itself is not an error.")),
|
|
24599
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
24480
24600
|
],
|
|
24481
|
-
compute: function (value, valueIfError
|
|
24482
|
-
|
|
24601
|
+
compute: function (value, valueIfError) {
|
|
24602
|
+
if (isMultipleElementMatrix(value)) {
|
|
24603
|
+
return applyVectorization(IFERROR.compute, [value, valueIfError]);
|
|
24604
|
+
}
|
|
24605
|
+
let result = isEvaluationError(toScalar(value)?.value) ? valueIfError : value;
|
|
24606
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
24607
|
+
if (!isMultipleElementMatrix(result)) {
|
|
24608
|
+
result = toScalar(result);
|
|
24609
|
+
}
|
|
24483
24610
|
if (result === undefined) {
|
|
24484
24611
|
return { value: "" };
|
|
24485
24612
|
}
|
|
24486
|
-
if (result.value === null) {
|
|
24613
|
+
if (!isMatrix(result) && result.value === null) {
|
|
24487
24614
|
return { ...result, value: "" };
|
|
24488
24615
|
}
|
|
24489
24616
|
return result;
|
|
@@ -24496,15 +24623,22 @@ const IFERROR = {
|
|
|
24496
24623
|
const IFNA = {
|
|
24497
24624
|
description: _t("Value if it is not an #N/A error, otherwise 2nd argument."),
|
|
24498
24625
|
args: [
|
|
24499
|
-
arg("value (any)", _t("The value to return if value itself is not #N/A an error.")),
|
|
24500
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
24626
|
+
arg("value (any, range)", _t("The value to return if value itself is not #N/A an error.")),
|
|
24627
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
24501
24628
|
],
|
|
24502
|
-
compute: function (value, valueIfError
|
|
24503
|
-
|
|
24629
|
+
compute: function (value, valueIfError) {
|
|
24630
|
+
if (isMultipleElementMatrix(value)) {
|
|
24631
|
+
return applyVectorization(IFNA.compute, [value, valueIfError]);
|
|
24632
|
+
}
|
|
24633
|
+
let result = toScalar(value)?.value === CellErrorType.NotAvailable ? valueIfError : value;
|
|
24634
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
24635
|
+
if (!isMultipleElementMatrix(result)) {
|
|
24636
|
+
result = toScalar(result);
|
|
24637
|
+
}
|
|
24504
24638
|
if (result === undefined) {
|
|
24505
24639
|
return { value: "" };
|
|
24506
24640
|
}
|
|
24507
|
-
if (result.value === null) {
|
|
24641
|
+
if (!isMatrix(result) && result.value === null) {
|
|
24508
24642
|
return { ...result, value: "" };
|
|
24509
24643
|
}
|
|
24510
24644
|
return result;
|
|
@@ -24517,23 +24651,31 @@ const IFNA = {
|
|
|
24517
24651
|
const IFS = {
|
|
24518
24652
|
description: _t("Returns a value depending on multiple logical expressions."),
|
|
24519
24653
|
args: [
|
|
24520
|
-
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.")),
|
|
24521
|
-
arg("value1 (any)", _t("The returned value if condition1 is TRUE.")),
|
|
24522
|
-
arg("condition2 (boolean, any, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
24523
|
-
arg("value2 (any, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
24654
|
+
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.")),
|
|
24655
|
+
arg("value1 (any, range)", _t("The returned value if condition1 is TRUE.")),
|
|
24656
|
+
arg("condition2 (boolean, any, range, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
24657
|
+
arg("value2 (any, range, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
24524
24658
|
],
|
|
24525
24659
|
compute: function (...values) {
|
|
24526
24660
|
assert(() => values.length % 2 === 0, _t("Wrong number of arguments. Expected an even number of arguments."));
|
|
24527
|
-
|
|
24528
|
-
if (
|
|
24529
|
-
|
|
24530
|
-
|
|
24661
|
+
while (values.length > 0) {
|
|
24662
|
+
if (isMultipleElementMatrix(values[0])) {
|
|
24663
|
+
return applyVectorization(IFS.compute, values);
|
|
24664
|
+
}
|
|
24665
|
+
const condition = toBoolean(toScalar(values.shift()));
|
|
24666
|
+
let valueIfTrue = values.shift();
|
|
24667
|
+
if (condition) {
|
|
24668
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
24669
|
+
if (!isMultipleElementMatrix(valueIfTrue)) {
|
|
24670
|
+
valueIfTrue = toScalar(valueIfTrue);
|
|
24671
|
+
}
|
|
24672
|
+
if (valueIfTrue === undefined) {
|
|
24531
24673
|
return { value: "" };
|
|
24532
24674
|
}
|
|
24533
|
-
if (
|
|
24534
|
-
return { ...
|
|
24675
|
+
if (!isMatrix(valueIfTrue) && valueIfTrue.value === null) {
|
|
24676
|
+
return { ...valueIfTrue, value: "" };
|
|
24535
24677
|
}
|
|
24536
|
-
return
|
|
24678
|
+
return valueIfTrue;
|
|
24537
24679
|
}
|
|
24538
24680
|
}
|
|
24539
24681
|
return new EvaluationError(_t("No match."));
|
|
@@ -26177,7 +26319,7 @@ const SPLIT = {
|
|
|
26177
26319
|
}
|
|
26178
26320
|
return transposeMatrix([result]);
|
|
26179
26321
|
},
|
|
26180
|
-
isExported:
|
|
26322
|
+
isExported: false,
|
|
26181
26323
|
};
|
|
26182
26324
|
// -----------------------------------------------------------------------------
|
|
26183
26325
|
// SUBSTITUTE
|
|
@@ -26370,86 +26512,21 @@ for (let category of categories) {
|
|
|
26370
26512
|
functionRegistry.add(name, { isExported: false, ...addDescr });
|
|
26371
26513
|
}
|
|
26372
26514
|
}
|
|
26373
|
-
|
|
26515
|
+
//------------------------------------------------------------------------------
|
|
26516
|
+
// CREATE COMPUTE FUNCTION
|
|
26517
|
+
//------------------------------------------------------------------------------
|
|
26374
26518
|
function createComputeFunction(descr, functionName) {
|
|
26375
26519
|
function vectorizedCompute(...args) {
|
|
26376
|
-
|
|
26377
|
-
let countVectorizableRow = 1;
|
|
26378
|
-
let vectorizableColLimit = Infinity;
|
|
26379
|
-
let vectorizableRowLimit = Infinity;
|
|
26380
|
-
let vectorArgsType = undefined;
|
|
26381
|
-
//#region Compute vectorisation limits
|
|
26520
|
+
const acceptToVectorize = [];
|
|
26382
26521
|
for (let i = 0; i < args.length; i++) {
|
|
26383
26522
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
26384
26523
|
const arg = args[i];
|
|
26385
|
-
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
26386
|
-
// if argDefinition does not accept a matrix but arg is still a matrix
|
|
26387
|
-
// --> triggers the arguments vectorization
|
|
26388
|
-
const nColumns = arg.length;
|
|
26389
|
-
const nRows = arg[0].length;
|
|
26390
|
-
if (nColumns !== 1 || nRows !== 1) {
|
|
26391
|
-
vectorArgsType ??= new Array(args.length);
|
|
26392
|
-
if (nColumns !== 1 && nRows !== 1) {
|
|
26393
|
-
vectorArgsType[i] = "matrix";
|
|
26394
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
26395
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
26396
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
26397
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
26398
|
-
}
|
|
26399
|
-
else if (nColumns !== 1) {
|
|
26400
|
-
vectorArgsType[i] = "horizontal";
|
|
26401
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
26402
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
26403
|
-
}
|
|
26404
|
-
else if (nRows !== 1) {
|
|
26405
|
-
vectorArgsType[i] = "vertical";
|
|
26406
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
26407
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
26408
|
-
}
|
|
26409
|
-
}
|
|
26410
|
-
else {
|
|
26411
|
-
args[i] = arg[0][0];
|
|
26412
|
-
}
|
|
26413
|
-
}
|
|
26414
26524
|
if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
|
|
26415
26525
|
throw new BadExpressionError(_t("Function %s expects the parameter '%s' to be reference to a cell or range.", functionName, (i + 1).toString()));
|
|
26416
26526
|
}
|
|
26527
|
+
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
26417
26528
|
}
|
|
26418
|
-
|
|
26419
|
-
if (countVectorizableCol === 1 && countVectorizableRow === 1) {
|
|
26420
|
-
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
26421
|
-
return errorHandlingCompute.apply(this, args);
|
|
26422
|
-
}
|
|
26423
|
-
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
26424
|
-
switch (vectorArgsType?.[index]) {
|
|
26425
|
-
case "matrix":
|
|
26426
|
-
return arg[i][j];
|
|
26427
|
-
case "horizontal":
|
|
26428
|
-
return arg[i][0];
|
|
26429
|
-
case "vertical":
|
|
26430
|
-
return arg[0][j];
|
|
26431
|
-
case undefined:
|
|
26432
|
-
return arg;
|
|
26433
|
-
}
|
|
26434
|
-
});
|
|
26435
|
-
return generateMatrix(countVectorizableCol, countVectorizableRow, (col, row) => {
|
|
26436
|
-
if (col > vectorizableColLimit - 1 || row > vectorizableRowLimit - 1) {
|
|
26437
|
-
return notAvailableError;
|
|
26438
|
-
}
|
|
26439
|
-
const singleCellComputeResult = errorHandlingCompute.apply(this, getArgOffset(col, row));
|
|
26440
|
-
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
26441
|
-
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
26442
|
-
// we won't be able to return the values.
|
|
26443
|
-
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
26444
|
-
// create an array with these parts.
|
|
26445
|
-
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
26446
|
-
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
26447
|
-
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
26448
|
-
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
26449
|
-
return isMatrix(singleCellComputeResult)
|
|
26450
|
-
? singleCellComputeResult[0][0]
|
|
26451
|
-
: singleCellComputeResult;
|
|
26452
|
-
});
|
|
26529
|
+
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
26453
26530
|
}
|
|
26454
26531
|
function errorHandlingCompute(...args) {
|
|
26455
26532
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -39438,7 +39515,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
39438
39515
|
proposals &&
|
|
39439
39516
|
!["ARG_SEPARATOR", "LEFT_PAREN", "OPERATOR"].includes(tokenAtCursor.type)) {
|
|
39440
39517
|
const filteredProposals = fuzzyLookup(searchTerm, proposals, (p) => p.fuzzySearchKey || p.text);
|
|
39441
|
-
if (!exactMatch || filteredProposals.length
|
|
39518
|
+
if (!exactMatch || filteredProposals.length) {
|
|
39442
39519
|
proposals = filteredProposals;
|
|
39443
39520
|
}
|
|
39444
39521
|
}
|
|
@@ -44047,7 +44124,9 @@ function compareDimensionValues(dimension, a, b) {
|
|
|
44047
44124
|
return dimension.order === "asc" ? -1 : 1;
|
|
44048
44125
|
}
|
|
44049
44126
|
if (dimension.type === "integer" || dimension.type === "datetime") {
|
|
44050
|
-
return dimension.order === "asc"
|
|
44127
|
+
return dimension.order === "asc"
|
|
44128
|
+
? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
|
|
44129
|
+
: toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
|
|
44051
44130
|
}
|
|
44052
44131
|
return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
|
|
44053
44132
|
}
|
|
@@ -46788,8 +46867,7 @@ class CellComposerStore extends AbstractComposerStore {
|
|
|
46788
46867
|
if (!spreader) {
|
|
46789
46868
|
return undefined;
|
|
46790
46869
|
}
|
|
46791
|
-
|
|
46792
|
-
return cell?.content;
|
|
46870
|
+
return this.getters.getCellText(spreader, { showFormula: true });
|
|
46793
46871
|
}
|
|
46794
46872
|
get currentEditedCell() {
|
|
46795
46873
|
return {
|
|
@@ -49592,6 +49670,7 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
49592
49670
|
const friction = 0.95;
|
|
49593
49671
|
const verticalScrollFactor = 1;
|
|
49594
49672
|
const horizontalScrollFactor = 1;
|
|
49673
|
+
const resetTimeoutDuration = 100;
|
|
49595
49674
|
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
49596
49675
|
let lastX = 0;
|
|
49597
49676
|
let lastY = 0;
|
|
@@ -49599,6 +49678,7 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
49599
49678
|
let velocityY = 0;
|
|
49600
49679
|
let isMouseDown = false;
|
|
49601
49680
|
let lastTime = 0;
|
|
49681
|
+
let resetTimeout = null;
|
|
49602
49682
|
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
49603
49683
|
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
49604
49684
|
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
@@ -49611,6 +49691,10 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
49611
49691
|
function onTouchMove(event) {
|
|
49612
49692
|
if (!isMouseDown)
|
|
49613
49693
|
return;
|
|
49694
|
+
if (resetTimeout) {
|
|
49695
|
+
clearTimeout(resetTimeout);
|
|
49696
|
+
resetTimeout = null;
|
|
49697
|
+
}
|
|
49614
49698
|
const currentTime = Date.now();
|
|
49615
49699
|
const { clientX, clientY } = event.touches[0];
|
|
49616
49700
|
let deltaX = lastX - clientX;
|
|
@@ -49627,6 +49711,10 @@ function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
|
49627
49711
|
}
|
|
49628
49712
|
event.stopPropagation();
|
|
49629
49713
|
}
|
|
49714
|
+
resetTimeout = setTimeout(() => {
|
|
49715
|
+
velocityX = 0;
|
|
49716
|
+
velocityY = 0;
|
|
49717
|
+
}, resetTimeoutDuration);
|
|
49630
49718
|
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
49631
49719
|
}
|
|
49632
49720
|
function onTouchEnd(ev) {
|
|
@@ -74271,6 +74359,6 @@ const constants = {
|
|
|
74271
74359
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
|
|
74272
74360
|
|
|
74273
74361
|
|
|
74274
|
-
__info__.version = "18.0.
|
|
74275
|
-
__info__.date = "2025-05-
|
|
74276
|
-
__info__.hash = "
|
|
74362
|
+
__info__.version = "18.0.30";
|
|
74363
|
+
__info__.date = "2025-05-26T12:35:05.184Z";
|
|
74364
|
+
__info__.hash = "838c4f7";
|