@odoo/o-spreadsheet 18.2.13 → 18.2.14
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 +368 -368
- 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.2.
|
|
6
|
-
* @date 2025-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.14
|
|
6
|
+
* @date 2025-05-26T12:35:51.528Z
|
|
7
|
+
* @hash db90fca
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -4150,6 +4150,113 @@
|
|
|
4150
4150
|
}
|
|
4151
4151
|
return generateMatrix(matrix[0].length, matrix.length, (i, j) => matrix[j][i]);
|
|
4152
4152
|
}
|
|
4153
|
+
/**
|
|
4154
|
+
* Enables a formula function to accept matrix or vector inputs instead of simple value, computing results across multiple dimensions.
|
|
4155
|
+
*
|
|
4156
|
+
* ```
|
|
4157
|
+
* / |‾ ‾| \ |‾ ‾|
|
|
4158
|
+
* | | [A] | | | compute(A, D, E), compute(A, D, F), compute(A, D, G) |
|
|
4159
|
+
* applyVectorization| compute, | [B], D, [E, F, G] | | <=> | compute(B, D, E), compute(B, D, F), compute(B, D, G) |
|
|
4160
|
+
* | | [C] | | | compute(C, D, E), compute(C, D, F), compute(C, D, G) |
|
|
4161
|
+
* \ |_ _| / |_ _|
|
|
4162
|
+
* ```
|
|
4163
|
+
*
|
|
4164
|
+
* By default, all arguments are vectorized. To control which arguments are vectorized,
|
|
4165
|
+
* pass an `acceptToVectorize` boolean array of the same length as `args`:
|
|
4166
|
+
* - `true` enables vectorization for that argument
|
|
4167
|
+
* - `false` disables vectorization for that argument
|
|
4168
|
+
*
|
|
4169
|
+
* For example, with `[true, true, false]` on previous example you get:
|
|
4170
|
+
*
|
|
4171
|
+
* ```
|
|
4172
|
+
* |‾ ‾|
|
|
4173
|
+
* | compute(A, D, [E, F, G]) |
|
|
4174
|
+
* | compute(B, D, [E, F, G]) |
|
|
4175
|
+
* | compute(C, D, [E, F, G]) |
|
|
4176
|
+
* |_ _|
|
|
4177
|
+
* ```
|
|
4178
|
+
*
|
|
4179
|
+
* @remarks
|
|
4180
|
+
* This helper is automatically applied (by default) to **all** `compute` functions
|
|
4181
|
+
* across the various spreadsheet formula modules:
|
|
4182
|
+
* - If an argument is declared **scalar** (not `"range"`), it is vectorized.
|
|
4183
|
+
* - If **all** arguments are declared **ranges**, no vectorization occurs.
|
|
4184
|
+
* - e.g. `SUM(A1:B2)` returns a 1×1 sum over the range.
|
|
4185
|
+
* - e.g. `COS(A1:B2)` over `A1:B2` returns a 2×2 element-wise result.
|
|
4186
|
+
* - For special behaviors (e.g. the `IF` function), you may declare all arguments
|
|
4187
|
+
* as ranges and invoke this helper directly within your `compute` implementation.
|
|
4188
|
+
*/
|
|
4189
|
+
function applyVectorization(formula, args, acceptToVectorize = undefined) {
|
|
4190
|
+
let countVectorizedCol = 1;
|
|
4191
|
+
let countVectorizedRow = 1;
|
|
4192
|
+
let vectorizedColLimit = Infinity;
|
|
4193
|
+
let vectorizedRowLimit = Infinity;
|
|
4194
|
+
let vectorArgsType = undefined;
|
|
4195
|
+
for (let i = 0; i < args.length; i++) {
|
|
4196
|
+
const arg = args[i];
|
|
4197
|
+
if (isMatrix(arg) && (acceptToVectorize === undefined || acceptToVectorize[i])) {
|
|
4198
|
+
const nColumns = arg.length;
|
|
4199
|
+
const nRows = arg[0].length;
|
|
4200
|
+
if (nColumns !== 1 || nRows !== 1) {
|
|
4201
|
+
vectorArgsType ??= new Array(args.length);
|
|
4202
|
+
if (nColumns !== 1 && nRows !== 1) {
|
|
4203
|
+
vectorArgsType[i] = "matrix";
|
|
4204
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4205
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4206
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4207
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4208
|
+
}
|
|
4209
|
+
else if (nColumns !== 1) {
|
|
4210
|
+
vectorArgsType[i] = "horizontal";
|
|
4211
|
+
countVectorizedCol = Math.max(countVectorizedCol, nColumns);
|
|
4212
|
+
vectorizedColLimit = Math.min(vectorizedColLimit, nColumns);
|
|
4213
|
+
}
|
|
4214
|
+
else if (nRows !== 1) {
|
|
4215
|
+
vectorArgsType[i] = "vertical";
|
|
4216
|
+
countVectorizedRow = Math.max(countVectorizedRow, nRows);
|
|
4217
|
+
vectorizedRowLimit = Math.min(vectorizedRowLimit, nRows);
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
else {
|
|
4221
|
+
args[i] = arg[0][0];
|
|
4222
|
+
}
|
|
4223
|
+
}
|
|
4224
|
+
}
|
|
4225
|
+
if (countVectorizedCol === 1 && countVectorizedRow === 1) {
|
|
4226
|
+
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
4227
|
+
return formula(...args);
|
|
4228
|
+
}
|
|
4229
|
+
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
4230
|
+
switch (vectorArgsType?.[index]) {
|
|
4231
|
+
case "matrix":
|
|
4232
|
+
return arg[i][j];
|
|
4233
|
+
case "horizontal":
|
|
4234
|
+
return arg[i][0];
|
|
4235
|
+
case "vertical":
|
|
4236
|
+
return arg[0][j];
|
|
4237
|
+
case undefined:
|
|
4238
|
+
return arg;
|
|
4239
|
+
}
|
|
4240
|
+
});
|
|
4241
|
+
return generateMatrix(countVectorizedCol, countVectorizedRow, (col, row) => {
|
|
4242
|
+
if (col > vectorizedColLimit - 1 || row > vectorizedRowLimit - 1) {
|
|
4243
|
+
return new NotAvailableError(_t("Array arguments to [[FUNCTION_NAME]] are of different size."));
|
|
4244
|
+
}
|
|
4245
|
+
const singleCellComputeResult = formula(...getArgOffset(col, row));
|
|
4246
|
+
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
4247
|
+
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
4248
|
+
// we won't be able to return the values.
|
|
4249
|
+
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
4250
|
+
// create an array with these parts.
|
|
4251
|
+
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
4252
|
+
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
4253
|
+
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
4254
|
+
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
4255
|
+
return isMatrix(singleCellComputeResult)
|
|
4256
|
+
? singleCellComputeResult[0][0]
|
|
4257
|
+
: singleCellComputeResult;
|
|
4258
|
+
});
|
|
4259
|
+
}
|
|
4153
4260
|
// -----------------------------------------------------------------------------
|
|
4154
4261
|
// CONDITIONAL EXPLORE FUNCTIONS
|
|
4155
4262
|
// -----------------------------------------------------------------------------
|
|
@@ -7441,14 +7548,20 @@
|
|
|
7441
7548
|
/**
|
|
7442
7549
|
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
7443
7550
|
*/
|
|
7444
|
-
function toScalar(
|
|
7445
|
-
if (!isMatrix(
|
|
7446
|
-
return
|
|
7551
|
+
function toScalar(arg) {
|
|
7552
|
+
if (!isMatrix(arg)) {
|
|
7553
|
+
return arg;
|
|
7447
7554
|
}
|
|
7448
|
-
if (
|
|
7555
|
+
if (!isSingleElementMatrix(arg)) {
|
|
7449
7556
|
throw new EvaluationError(_t("The value should be a scalar or a 1x1 matrix"));
|
|
7450
7557
|
}
|
|
7451
|
-
return
|
|
7558
|
+
return arg[0][0];
|
|
7559
|
+
}
|
|
7560
|
+
function isSingleElementMatrix(matrix) {
|
|
7561
|
+
return matrix.length === 1 && matrix[0].length === 1;
|
|
7562
|
+
}
|
|
7563
|
+
function isMultipleElementMatrix(arg) {
|
|
7564
|
+
return isMatrix(arg) && !isSingleElementMatrix(arg);
|
|
7452
7565
|
}
|
|
7453
7566
|
|
|
7454
7567
|
function assertSameNumberOfElements(...args) {
|
|
@@ -15456,7 +15569,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
15456
15569
|
}
|
|
15457
15570
|
return mode === "row" ? transposeMatrix(result) : result;
|
|
15458
15571
|
},
|
|
15459
|
-
isExported:
|
|
15572
|
+
isExported: false,
|
|
15460
15573
|
};
|
|
15461
15574
|
// -----------------------------------------------------------------------------
|
|
15462
15575
|
// SORT
|
|
@@ -18587,16 +18700,23 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18587
18700
|
const IF = {
|
|
18588
18701
|
description: _t("Returns value depending on logical expression."),
|
|
18589
18702
|
args: [
|
|
18590
|
-
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.")),
|
|
18591
|
-
arg("value_if_true (any)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
18592
|
-
arg("value_if_false (any, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
18703
|
+
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.")),
|
|
18704
|
+
arg("value_if_true (any, range)", _t("The value the function returns if logical_expression is TRUE.")),
|
|
18705
|
+
arg("value_if_false (any, range, default=FALSE)", _t("The value the function returns if logical_expression is FALSE.")),
|
|
18593
18706
|
],
|
|
18594
18707
|
compute: function (logicalExpression, valueIfTrue, valueIfFalse) {
|
|
18595
|
-
|
|
18708
|
+
if (isMultipleElementMatrix(logicalExpression)) {
|
|
18709
|
+
return applyVectorization(IF.compute, [logicalExpression, valueIfTrue, valueIfFalse]);
|
|
18710
|
+
}
|
|
18711
|
+
let result = toBoolean(toScalar(logicalExpression)) ? valueIfTrue : valueIfFalse;
|
|
18712
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18713
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18714
|
+
result = toScalar(result);
|
|
18715
|
+
}
|
|
18596
18716
|
if (result === undefined) {
|
|
18597
18717
|
return { value: "" };
|
|
18598
18718
|
}
|
|
18599
|
-
if (result.value === null) {
|
|
18719
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18600
18720
|
return { ...result, value: "" };
|
|
18601
18721
|
}
|
|
18602
18722
|
return result;
|
|
@@ -18609,15 +18729,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18609
18729
|
const IFERROR = {
|
|
18610
18730
|
description: _t("Value if it is not an error, otherwise 2nd argument."),
|
|
18611
18731
|
args: [
|
|
18612
|
-
arg("value (any)", _t("The value to return if value itself is not an error.")),
|
|
18613
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
18732
|
+
arg("value (any, range)", _t("The value to return if value itself is not an error.")),
|
|
18733
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an error.")),
|
|
18614
18734
|
],
|
|
18615
|
-
compute: function (value, valueIfError
|
|
18616
|
-
|
|
18735
|
+
compute: function (value, valueIfError) {
|
|
18736
|
+
if (isMultipleElementMatrix(value)) {
|
|
18737
|
+
return applyVectorization(IFERROR.compute, [value, valueIfError]);
|
|
18738
|
+
}
|
|
18739
|
+
let result = isEvaluationError(toScalar(value)?.value) ? valueIfError : value;
|
|
18740
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18741
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18742
|
+
result = toScalar(result);
|
|
18743
|
+
}
|
|
18617
18744
|
if (result === undefined) {
|
|
18618
18745
|
return { value: "" };
|
|
18619
18746
|
}
|
|
18620
|
-
if (result.value === null) {
|
|
18747
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18621
18748
|
return { ...result, value: "" };
|
|
18622
18749
|
}
|
|
18623
18750
|
return result;
|
|
@@ -18630,15 +18757,22 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18630
18757
|
const IFNA = {
|
|
18631
18758
|
description: _t("Value if it is not an #N/A error, otherwise 2nd argument."),
|
|
18632
18759
|
args: [
|
|
18633
|
-
arg("value (any)", _t("The value to return if value itself is not #N/A an error.")),
|
|
18634
|
-
arg(`value_if_error (any, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
18760
|
+
arg("value (any, range)", _t("The value to return if value itself is not #N/A an error.")),
|
|
18761
|
+
arg(`value_if_error (any, range, default="empty")`, _t("The value the function returns if value is an #N/A error.")),
|
|
18635
18762
|
],
|
|
18636
|
-
compute: function (value, valueIfError
|
|
18637
|
-
|
|
18763
|
+
compute: function (value, valueIfError) {
|
|
18764
|
+
if (isMultipleElementMatrix(value)) {
|
|
18765
|
+
return applyVectorization(IFNA.compute, [value, valueIfError]);
|
|
18766
|
+
}
|
|
18767
|
+
let result = toScalar(value)?.value === CellErrorType.NotAvailable ? valueIfError : value;
|
|
18768
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18769
|
+
if (!isMultipleElementMatrix(result)) {
|
|
18770
|
+
result = toScalar(result);
|
|
18771
|
+
}
|
|
18638
18772
|
if (result === undefined) {
|
|
18639
18773
|
return { value: "" };
|
|
18640
18774
|
}
|
|
18641
|
-
if (result.value === null) {
|
|
18775
|
+
if (!isMatrix(result) && result.value === null) {
|
|
18642
18776
|
return { ...result, value: "" };
|
|
18643
18777
|
}
|
|
18644
18778
|
return result;
|
|
@@ -18651,23 +18785,31 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
18651
18785
|
const IFS = {
|
|
18652
18786
|
description: _t("Returns a value depending on multiple logical expressions."),
|
|
18653
18787
|
args: [
|
|
18654
|
-
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.")),
|
|
18655
|
-
arg("value1 (any)", _t("The returned value if condition1 is TRUE.")),
|
|
18656
|
-
arg("condition2 (boolean, any, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
18657
|
-
arg("value2 (any, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
18788
|
+
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.")),
|
|
18789
|
+
arg("value1 (any, range)", _t("The returned value if condition1 is TRUE.")),
|
|
18790
|
+
arg("condition2 (boolean, any, range, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
|
|
18791
|
+
arg("value2 (any, range, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
|
|
18658
18792
|
],
|
|
18659
18793
|
compute: function (...values) {
|
|
18660
18794
|
assert(() => values.length % 2 === 0, _t("Wrong number of arguments. Expected an even number of arguments."));
|
|
18661
|
-
|
|
18662
|
-
if (
|
|
18663
|
-
|
|
18664
|
-
|
|
18795
|
+
while (values.length > 0) {
|
|
18796
|
+
if (isMultipleElementMatrix(values[0])) {
|
|
18797
|
+
return applyVectorization(IFS.compute, values);
|
|
18798
|
+
}
|
|
18799
|
+
const condition = toBoolean(toScalar(values.shift()));
|
|
18800
|
+
let valueIfTrue = values.shift();
|
|
18801
|
+
if (condition) {
|
|
18802
|
+
// useful for interpreting empty cell references as empty strings. But must be removed to make empty cell references equal to zero
|
|
18803
|
+
if (!isMultipleElementMatrix(valueIfTrue)) {
|
|
18804
|
+
valueIfTrue = toScalar(valueIfTrue);
|
|
18805
|
+
}
|
|
18806
|
+
if (valueIfTrue === undefined) {
|
|
18665
18807
|
return { value: "" };
|
|
18666
18808
|
}
|
|
18667
|
-
if (
|
|
18668
|
-
return { ...
|
|
18809
|
+
if (!isMatrix(valueIfTrue) && valueIfTrue.value === null) {
|
|
18810
|
+
return { ...valueIfTrue, value: "" };
|
|
18669
18811
|
}
|
|
18670
|
-
return
|
|
18812
|
+
return valueIfTrue;
|
|
18671
18813
|
}
|
|
18672
18814
|
}
|
|
18673
18815
|
return new EvaluationError(_t("No match."));
|
|
@@ -20329,7 +20471,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20329
20471
|
}
|
|
20330
20472
|
return transposeMatrix([result]);
|
|
20331
20473
|
},
|
|
20332
|
-
isExported:
|
|
20474
|
+
isExported: false,
|
|
20333
20475
|
};
|
|
20334
20476
|
// -----------------------------------------------------------------------------
|
|
20335
20477
|
// SUBSTITUTE
|
|
@@ -20522,86 +20664,21 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20522
20664
|
functionRegistry.add(name, { isExported: false, ...addDescr });
|
|
20523
20665
|
}
|
|
20524
20666
|
}
|
|
20525
|
-
|
|
20667
|
+
//------------------------------------------------------------------------------
|
|
20668
|
+
// CREATE COMPUTE FUNCTION
|
|
20669
|
+
//------------------------------------------------------------------------------
|
|
20526
20670
|
function createComputeFunction(descr, functionName) {
|
|
20527
20671
|
function vectorizedCompute(...args) {
|
|
20528
|
-
|
|
20529
|
-
let countVectorizableRow = 1;
|
|
20530
|
-
let vectorizableColLimit = Infinity;
|
|
20531
|
-
let vectorizableRowLimit = Infinity;
|
|
20532
|
-
let vectorArgsType = undefined;
|
|
20533
|
-
//#region Compute vectorisation limits
|
|
20672
|
+
const acceptToVectorize = [];
|
|
20534
20673
|
for (let i = 0; i < args.length; i++) {
|
|
20535
20674
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
20536
20675
|
const arg = args[i];
|
|
20537
|
-
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
20538
|
-
// if argDefinition does not accept a matrix but arg is still a matrix
|
|
20539
|
-
// --> triggers the arguments vectorization
|
|
20540
|
-
const nColumns = arg.length;
|
|
20541
|
-
const nRows = arg[0].length;
|
|
20542
|
-
if (nColumns !== 1 || nRows !== 1) {
|
|
20543
|
-
vectorArgsType ??= new Array(args.length);
|
|
20544
|
-
if (nColumns !== 1 && nRows !== 1) {
|
|
20545
|
-
vectorArgsType[i] = "matrix";
|
|
20546
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20547
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20548
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20549
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20550
|
-
}
|
|
20551
|
-
else if (nColumns !== 1) {
|
|
20552
|
-
vectorArgsType[i] = "horizontal";
|
|
20553
|
-
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20554
|
-
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20555
|
-
}
|
|
20556
|
-
else if (nRows !== 1) {
|
|
20557
|
-
vectorArgsType[i] = "vertical";
|
|
20558
|
-
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20559
|
-
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20560
|
-
}
|
|
20561
|
-
}
|
|
20562
|
-
else {
|
|
20563
|
-
args[i] = arg[0][0];
|
|
20564
|
-
}
|
|
20565
|
-
}
|
|
20566
20676
|
if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
|
|
20567
20677
|
throw new BadExpressionError(_t("Function %s expects the parameter '%s' to be reference to a cell or range.", functionName, (i + 1).toString()));
|
|
20568
20678
|
}
|
|
20679
|
+
acceptToVectorize.push(!argDefinition.acceptMatrix);
|
|
20569
20680
|
}
|
|
20570
|
-
|
|
20571
|
-
if (countVectorizableCol === 1 && countVectorizableRow === 1) {
|
|
20572
|
-
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
20573
|
-
return errorHandlingCompute.apply(this, args);
|
|
20574
|
-
}
|
|
20575
|
-
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
20576
|
-
switch (vectorArgsType?.[index]) {
|
|
20577
|
-
case "matrix":
|
|
20578
|
-
return arg[i][j];
|
|
20579
|
-
case "horizontal":
|
|
20580
|
-
return arg[i][0];
|
|
20581
|
-
case "vertical":
|
|
20582
|
-
return arg[0][j];
|
|
20583
|
-
case undefined:
|
|
20584
|
-
return arg;
|
|
20585
|
-
}
|
|
20586
|
-
});
|
|
20587
|
-
return generateMatrix(countVectorizableCol, countVectorizableRow, (col, row) => {
|
|
20588
|
-
if (col > vectorizableColLimit - 1 || row > vectorizableRowLimit - 1) {
|
|
20589
|
-
return notAvailableError;
|
|
20590
|
-
}
|
|
20591
|
-
const singleCellComputeResult = errorHandlingCompute.apply(this, getArgOffset(col, row));
|
|
20592
|
-
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
20593
|
-
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
20594
|
-
// we won't be able to return the values.
|
|
20595
|
-
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
20596
|
-
// create an array with these parts.
|
|
20597
|
-
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
20598
|
-
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
20599
|
-
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
20600
|
-
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
20601
|
-
return isMatrix(singleCellComputeResult)
|
|
20602
|
-
? singleCellComputeResult[0][0]
|
|
20603
|
-
: singleCellComputeResult;
|
|
20604
|
-
});
|
|
20681
|
+
return applyVectorization(errorHandlingCompute.bind(this), args, acceptToVectorize);
|
|
20605
20682
|
}
|
|
20606
20683
|
function errorHandlingCompute(...args) {
|
|
20607
20684
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -21446,7 +21523,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21446
21523
|
proposals &&
|
|
21447
21524
|
!["ARG_SEPARATOR", "LEFT_PAREN", "OPERATOR"].includes(tokenAtCursor.type)) {
|
|
21448
21525
|
const filteredProposals = fuzzyLookup(searchTerm, proposals, (p) => p.fuzzySearchKey || p.text);
|
|
21449
|
-
if (!exactMatch || filteredProposals.length
|
|
21526
|
+
if (!exactMatch || filteredProposals.length) {
|
|
21450
21527
|
proposals = filteredProposals;
|
|
21451
21528
|
}
|
|
21452
21529
|
}
|
|
@@ -46482,7 +46559,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46482
46559
|
return dimension.order === "asc" ? -1 : 1;
|
|
46483
46560
|
}
|
|
46484
46561
|
if (dimension.type === "integer" || dimension.type === "datetime") {
|
|
46485
|
-
return dimension.order === "asc"
|
|
46562
|
+
return dimension.order === "asc"
|
|
46563
|
+
? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
|
|
46564
|
+
: toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
|
|
46486
46565
|
}
|
|
46487
46566
|
return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
|
|
46488
46567
|
}
|
|
@@ -49245,8 +49324,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49245
49324
|
if (!spreader) {
|
|
49246
49325
|
return undefined;
|
|
49247
49326
|
}
|
|
49248
|
-
|
|
49249
|
-
return cell?.content;
|
|
49327
|
+
return this.getters.getCellText(spreader, { showFormula: true });
|
|
49250
49328
|
}
|
|
49251
49329
|
get currentEditedCell() {
|
|
49252
49330
|
return {
|
|
@@ -52167,6 +52245,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52167
52245
|
const friction = 0.95;
|
|
52168
52246
|
const verticalScrollFactor = 1;
|
|
52169
52247
|
const horizontalScrollFactor = 1;
|
|
52248
|
+
const resetTimeoutDuration = 100;
|
|
52170
52249
|
function useTouchScroll(ref, updateScroll, canMoveUp) {
|
|
52171
52250
|
let lastX = 0;
|
|
52172
52251
|
let lastY = 0;
|
|
@@ -52174,6 +52253,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52174
52253
|
let velocityY = 0;
|
|
52175
52254
|
let isMouseDown = false;
|
|
52176
52255
|
let lastTime = 0;
|
|
52256
|
+
let resetTimeout = null;
|
|
52177
52257
|
useRefListener(ref, "touchstart", onTouchStart, { capture: false });
|
|
52178
52258
|
useRefListener(ref, "touchmove", onTouchMove, { capture: false });
|
|
52179
52259
|
useRefListener(ref, "touchend", onTouchEnd, { capture: false });
|
|
@@ -52186,6 +52266,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52186
52266
|
function onTouchMove(event) {
|
|
52187
52267
|
if (!isMouseDown)
|
|
52188
52268
|
return;
|
|
52269
|
+
if (resetTimeout) {
|
|
52270
|
+
clearTimeout(resetTimeout);
|
|
52271
|
+
resetTimeout = null;
|
|
52272
|
+
}
|
|
52189
52273
|
const currentTime = Date.now();
|
|
52190
52274
|
const { clientX, clientY } = event.touches[0];
|
|
52191
52275
|
let deltaX = lastX - clientX;
|
|
@@ -52202,6 +52286,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52202
52286
|
}
|
|
52203
52287
|
event.stopPropagation();
|
|
52204
52288
|
}
|
|
52289
|
+
resetTimeout = setTimeout(() => {
|
|
52290
|
+
velocityX = 0;
|
|
52291
|
+
velocityY = 0;
|
|
52292
|
+
}, resetTimeoutDuration);
|
|
52205
52293
|
updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
|
|
52206
52294
|
}
|
|
52207
52295
|
function onTouchEnd(ev) {
|
|
@@ -76826,9 +76914,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76826
76914
|
exports.tokenize = tokenize;
|
|
76827
76915
|
|
|
76828
76916
|
|
|
76829
|
-
__info__.version = "18.2.
|
|
76830
|
-
__info__.date = "2025-05-
|
|
76831
|
-
__info__.hash = "
|
|
76917
|
+
__info__.version = "18.2.14";
|
|
76918
|
+
__info__.date = "2025-05-26T12:35:51.528Z";
|
|
76919
|
+
__info__.hash = "db90fca";
|
|
76832
76920
|
|
|
76833
76921
|
|
|
76834
76922
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|