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