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