@odoo/o-spreadsheet 19.1.0-alpha.10 → 19.1.0-alpha.11

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.
@@ -3,8 +3,8 @@
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
5
  * @version 19.1.0-alpha.3
6
- * @date 2025-10-30T12:25:48.501Z
7
- * @hash d0b65e9
6
+ * @date 2025-11-03T12:33:46.742Z
7
+ * @hash d9230f3
8
8
  */
9
9
 
10
10
  (function (exports) {
@@ -180,13 +180,13 @@
180
180
  let optionalArg = 0;
181
181
  for (const arg of addDescr.args) {
182
182
  countArg++;
183
- if (!arg.optional && !arg.repeating && !arg.default) {
183
+ if (!arg.optional && !arg.default) {
184
184
  minArg++;
185
185
  }
186
186
  if (arg.repeating) {
187
187
  repeatingArg++;
188
188
  }
189
- if (arg.optional || arg.default) {
189
+ if ((arg.optional || arg.default) && !arg.repeating) {
190
190
  optionalArg++;
191
191
  }
192
192
  }
@@ -194,7 +194,7 @@
194
194
  descr.minArgRequired = minArg;
195
195
  descr.maxArgPossible = repeatingArg ? Infinity : countArg;
196
196
  descr.nbrArgRepeating = repeatingArg;
197
- descr.nbrArgOptional = optionalArg;
197
+ descr.nbrOptionalNonRepeatingArgs = optionalArg;
198
198
  descr.hidden = addDescr.hidden || false;
199
199
  descr.name = name;
200
200
  return descr;
@@ -222,9 +222,9 @@
222
222
  * and rows representing the correspondence with the argument index.
223
223
  *
224
224
  * The tables are built based on the following conventions:
225
- * - `m`: Mandatory argument
226
- * - `o`: Optional argument
227
- * - `r`: Repeating argument
225
+ * - `m`: Mandatory argument (count as one argument)
226
+ * - `o`: Optional argument (count as zero or one argument)
227
+ * - `r`: Repeating argument (count as one or more arguments)
228
228
  *
229
229
  *
230
230
  * Configuration 1: (m, o) like the CEILING function
@@ -237,39 +237,39 @@
237
237
  *
238
238
  * Configuration 2: (m, m, m, r, r) like the SUMIFS function
239
239
  *
240
- * | | 3 | 5 | 7 | 3 + 2n |
241
- * |---|---|---|------|------------|
242
- * | m | 0 | 0 | 0 | 0 |
243
- * | m | 1 | 1 | 1 | 1 |
244
- * | m | 2 | 2 | 2 | 2 |
245
- * | r | | 3 | 3, 5 | 3 + 2n |
246
- * | r | | 4 | 4, 6 | 3 + 2n + 1 |
240
+ * | | 5 | 7 | 3 + 2n |
241
+ * |---|---|------|------------|
242
+ * | m | 0 | 0 | 0 |
243
+ * | m | 1 | 1 | 1 |
244
+ * | m | 2 | 2 | 2 |
245
+ * | r | 3 | 3, 5 | 3 + 2n |
246
+ * | r | 4 | 4, 6 | 3 + 2n + 1 |
247
247
  *
248
248
  *
249
249
  * Configuration 3: (m, m, m, r, r, o) like the SWITCH function
250
250
  *
251
- * | | 3 | 4 | 5 | 6 | 7 | 8 | 3 + 2n | 3 + 2n + 1 |
252
- * |---|---|---|---|---|------|------|------------|----------------|
253
- * | m | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
254
- * | m | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
255
- * | m | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
256
- * | r | | | 3 | 3 | 3, 5 | 3, 5 | 3 + 2n | 3 + 2n |
257
- * | r | | | 4 | 4 | 4, 6 | 4, 6 | 3 + 2n + 1 | 3 + 2n + 1 |
258
- * | o | | 3 | | 5 | | 7 | | 3 + 2N + 2 |
251
+ * | | 5 | 6 | 7 | 8 | 3 + 2n | 3 + 2n + 1 |
252
+ * |---|---|---|------|------|------------|----------------|
253
+ * | m | 0 | 0 | 0 | 0 | 0 | 0 |
254
+ * | m | 1 | 1 | 1 | 1 | 1 | 1 |
255
+ * | m | 2 | 2 | 2 | 2 | 2 | 2 |
256
+ * | r | 3 | 3 | 3, 5 | 3, 5 | 3 + 2n | 3 + 2n |
257
+ * | r | 4 | 4 | 4, 6 | 4, 6 | 3 + 2n + 1 | 3 + 2n + 1 |
258
+ * | o | | 5 | | 7 | | 3 + 2N + 2 |
259
259
  *
260
260
  *
261
261
  * Configuration 4: (m, o, m, o, r, r, r, m) a complex case to understand subtleties
262
262
  *
263
- * | | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ... |
264
- * |---|---|---|---|---|---|---|------|------|------|-----|
265
- * | m | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... |
266
- * | o | | 1 | 1 | | 1 | 1 | | 1 | 1 | ... |
267
- * | m | 1 | 2 | 2 | 1 | 2 | 2 | 1 | 2 | 2 | ... |
268
- * | o | | | 3 | | | 3 | | | 3 | ... |
269
- * | r | | | | 2 | 3 | 4 | 2, 5 | 3, 6 | 4, 7 | ... |
270
- * | r | | | | 3 | 4 | 5 | 3, 6 | 4, 7 | 5, 8 | ... |
271
- * | r | | | | 4 | 5 | 6 | 4, 7 | 5, 8 | 6, 9 | ... |
272
- * | m | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... |
263
+ * | | 6 | 7 | 8 | 9 | 10 | 11 | ... |
264
+ * |---|---|---|---|------|------|------|-----|
265
+ * | m | 0 | 0 | 0 | 0 | 0 | 0 | ... |
266
+ * | o | | 1 | 1 | | 1 | 1 | ... |
267
+ * | m | 1 | 2 | 2 | 1 | 2 | 2 | ... |
268
+ * | o | | | 3 | | | 3 | ... |
269
+ * | r | 2 | 3 | 4 | 2, 5 | 3, 6 | 4, 7 | ... |
270
+ * | r | 3 | 4 | 5 | 3, 6 | 4, 7 | 5, 8 | ... |
271
+ * | r | 4 | 5 | 6 | 4, 7 | 5, 8 | 6, 9 | ... |
272
+ * | m | 5 | 6 | 7 | 8 | 9 | 10 | ... |
273
273
  *
274
274
  */
275
275
  function argTargeting(functionDescription, nbrArgSupplied) {
@@ -288,30 +288,31 @@
288
288
  }
289
289
  function _argTargeting(functionDescription, nbrArgSupplied) {
290
290
  const valueIndexToArgPosition = {};
291
- const groupsOfRepeatingValues = functionDescription.nbrArgRepeating
291
+ const groupsOfOptionalRepeatingValues = functionDescription.nbrArgRepeating
292
292
  ? Math.floor((nbrArgSupplied - functionDescription.minArgRequired) / functionDescription.nbrArgRepeating)
293
293
  : 0;
294
- const nbrValueRepeating = functionDescription.nbrArgRepeating * groupsOfRepeatingValues;
295
- const nbrValueOptional = nbrArgSupplied - functionDescription.minArgRequired - nbrValueRepeating;
294
+ const nbrValueOptionalRepeating = functionDescription.nbrArgRepeating * groupsOfOptionalRepeatingValues;
295
+ const nbrValueOptional = nbrArgSupplied - functionDescription.minArgRequired - nbrValueOptionalRepeating;
296
296
  let countValueSupplied = 0;
297
297
  let countValueOptional = 0;
298
298
  for (let i = 0; i < functionDescription.args.length; i++) {
299
299
  const arg = functionDescription.args[i];
300
- if (arg.optional || arg.default) {
300
+ if ((arg.optional || arg.default) && !arg.repeating) {
301
301
  if (countValueOptional < nbrValueOptional) {
302
- valueIndexToArgPosition[countValueSupplied] = i;
302
+ valueIndexToArgPosition[countValueSupplied] = { index: i };
303
303
  countValueSupplied++;
304
304
  }
305
305
  countValueOptional++;
306
306
  continue;
307
307
  }
308
308
  if (arg.repeating) {
309
+ const groupOfMandatoryRepeatingValues = arg.optional ? 0 : 1;
309
310
  // As we know all repeating arguments are consecutive,
310
311
  // --> we will treat all repeating arguments in one go
311
312
  // --> the index i will be incremented by the number of repeating values at the end of the loop
312
- for (let j = 0; j < groupsOfRepeatingValues; j++) {
313
+ for (let j = 0; j < groupsOfOptionalRepeatingValues + groupOfMandatoryRepeatingValues; j++) {
313
314
  for (let k = 0; k < functionDescription.nbrArgRepeating; k++) {
314
- valueIndexToArgPosition[countValueSupplied] = i + k;
315
+ valueIndexToArgPosition[countValueSupplied] = { index: i + k, repeatingGroupIndex: j };
315
316
  countValueSupplied++;
316
317
  }
317
318
  }
@@ -319,7 +320,7 @@
319
320
  continue;
320
321
  }
321
322
  // End case: it's a required argument
322
- valueIndexToArgPosition[countValueSupplied] = i;
323
+ valueIndexToArgPosition[countValueSupplied] = { index: i };
323
324
  countValueSupplied++;
324
325
  }
325
326
  return (argPosition) => {
@@ -331,7 +332,7 @@
331
332
  //------------------------------------------------------------------------------
332
333
  const META_TYPES = ["META", "RANGE<META>"];
333
334
  function validateArguments(descr) {
334
- if (descr.nbrArgRepeating && descr.nbrArgOptional >= descr.nbrArgRepeating) {
335
+ if (descr.nbrArgRepeating && descr.nbrOptionalNonRepeatingArgs >= descr.nbrArgRepeating) {
335
336
  throw new Error(`Function ${descr.name} has more optional arguments than repeatable ones.`);
336
337
  }
337
338
  let foundRepeating = false;
@@ -615,6 +616,7 @@
615
616
  ];
616
617
  const DEFAULT_CELL_WIDTH = 96;
617
618
  const DEFAULT_CELL_HEIGHT = 23;
619
+ const SCROLLBAR_WIDTH = 15;
618
620
  const MIN_CF_ICON_MARGIN = 4;
619
621
  const MIN_CELL_TEXT_MARGIN = 4;
620
622
  const PADDING_AUTORESIZE_VERTICAL = 3;
@@ -2857,7 +2859,7 @@
2857
2859
  const getArgToFocus = argTargeting(descr, args.length);
2858
2860
  //#region Compute vectorisation limits
2859
2861
  for (let i = 0; i < args.length; i++) {
2860
- const argIndex = getArgToFocus(i) ?? -1;
2862
+ const argIndex = getArgToFocus(i).index ?? -1;
2861
2863
  const argDefinition = descr.args[argIndex];
2862
2864
  const arg = args[i];
2863
2865
  if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
@@ -2871,7 +2873,7 @@
2871
2873
  for (let i = 0; i < args.length; i++) {
2872
2874
  const arg = args[i];
2873
2875
  const getArgToFocus = argTargeting(descr, args.length);
2874
- const argDefinition = descr.args[getArgToFocus(i) || i];
2876
+ const argDefinition = descr.args[getArgToFocus(i).index ?? i];
2875
2877
  // Early exit if the argument is an error and the function does not accept errors
2876
2878
  // We only check scalar arguments, not matrix arguments for performance reasons.
2877
2879
  // Casting helpers are responsible for handling errors in matrix arguments.
@@ -3139,8 +3141,7 @@
3139
3141
  description: _t("Creates a new array from the selected columns in the existing range."),
3140
3142
  args: [
3141
3143
  arg("array (any, range<any>)", _t("The array that contains the columns to be returned.")),
3142
- arg("col_num (number, range<number>)", _t("The first column index of the columns to be returned.")),
3143
- arg("col_num2 (number, range<number>, repeating)", _t("The columns indexes of the columns to be returned.")),
3144
+ arg("col_num (number, range<number>, repeating)", _t("The column index of the column to be returned.")),
3144
3145
  ],
3145
3146
  compute: function (array, ...columns) {
3146
3147
  const _array = toMatrix(array);
@@ -3169,8 +3170,7 @@
3169
3170
  description: _t("Creates a new array from the selected rows in the existing range."),
3170
3171
  args: [
3171
3172
  arg("array (any, range<any>)", _t("The array that contains the rows to be returned.")),
3172
- arg("row_num (number, range<number>)", _t("The first row index of the rows to be returned.")),
3173
- arg("row_num2 (number, range<number>, repeating)", _t("The rows indexes of the rows to be returned.")),
3173
+ arg("row_num (number, range<number>, repeating)", _t("The row index of the row to be returned.")),
3174
3174
  ],
3175
3175
  compute: function (array, ...rows) {
3176
3176
  const _array = toMatrix(array);
@@ -3220,10 +3220,7 @@
3220
3220
  // -----------------------------------------------------------------------------
3221
3221
  const FLATTEN = {
3222
3222
  description: _t("Flattens all the values from one or more ranges into a single column."),
3223
- args: [
3224
- arg("range (any, range<any>)", _t("The first range to flatten.")),
3225
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to flatten.")),
3226
- ],
3223
+ args: [arg("range (any, range<any>, repeating)", _t("The range to flatten."))],
3227
3224
  compute: function (...ranges) {
3228
3225
  return [flattenRowFirst(ranges, (val) => (val === undefined ? { value: "" } : val))];
3229
3226
  },
@@ -3281,10 +3278,7 @@
3281
3278
  // -----------------------------------------------------------------------------
3282
3279
  const HSTACK = {
3283
3280
  description: _t("Appends ranges horizontally and in sequence to return a larger array."),
3284
- args: [
3285
- arg("range1 (any, range<any>)", _t("The first range to be appended.")),
3286
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to add to range1.")),
3287
- ],
3281
+ args: [arg("range (any, range<any>, repeating)", _t("The range to be appended."))],
3288
3282
  compute: function (...ranges) {
3289
3283
  const nbRows = Math.max(...ranges.map((r) => r?.[0]?.length ?? 0));
3290
3284
  const result = [];
@@ -3370,8 +3364,7 @@
3370
3364
  const SUMPRODUCT = {
3371
3365
  description: _t("Calculates the sum of the products of corresponding entries in equal-sized ranges."),
3372
3366
  args: [
3373
- arg("range1 (number, range<number>)", _t("The first range whose entries will be multiplied with corresponding entries in the other ranges.")),
3374
- arg("range2 (number, range<number>, repeating)", _t("The other range whose entries will be multiplied with corresponding entries in the other ranges.")),
3367
+ arg("range (number, range<number>, repeating)", _t("The range whose entries will be multiplied with corresponding entries in the other range.")),
3375
3368
  ],
3376
3369
  compute: function (...args) {
3377
3370
  if (!areSameDimensions(...args)) {
@@ -3557,10 +3550,7 @@
3557
3550
  // -----------------------------------------------------------------------------
3558
3551
  const VSTACK = {
3559
3552
  description: _t("Appends ranges vertically and in sequence to return a larger array."),
3560
- args: [
3561
- arg("range1 (any, range<any>)", _t("The first range to be appended.")),
3562
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to add to range1.")),
3563
- ],
3553
+ args: [arg("range (any, range<any>, repeating)", _t("The range to be appended."))],
3564
3554
  compute: function (...ranges) {
3565
3555
  const nbColumns = Math.max(...ranges.map((range) => toMatrix(range).length));
3566
3556
  const nbRows = ranges.reduce((acc, range) => acc + toMatrix(range)[0].length, 0);
@@ -6155,6 +6145,7 @@
6155
6145
  "COPY",
6156
6146
  "RESIZE_SHEETVIEW",
6157
6147
  "SET_VIEWPORT_OFFSET",
6148
+ "SET_ZOOM",
6158
6149
  "EVALUATE_CELLS",
6159
6150
  "EVALUATE_CHARTS",
6160
6151
  "SET_FORMULA_VISIBILITY",
@@ -6870,8 +6861,7 @@
6870
6861
  const COUNTBLANK = {
6871
6862
  description: _t("Number of empty values."),
6872
6863
  args: [
6873
- arg("value1 (any, range)", _t("The first value or range in which to count the number of blanks.")),
6874
- arg("value2 (any, range, repeating)", _t("Additional values or ranges in which to count the number of blanks.")),
6864
+ arg("value (any, range, repeating)", _t("Value or range in which to count the number of blanks.")),
6875
6865
  ],
6876
6866
  compute: function (...args) {
6877
6867
  return reduceAny(args, (acc, a) => {
@@ -6913,10 +6903,8 @@
6913
6903
  const COUNTIFS = {
6914
6904
  description: _t("Count values depending on multiple criteria."),
6915
6905
  args: [
6916
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
6917
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
6918
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.")),
6919
- arg("criterion2 (string, repeating)", _t("Additional criteria to check.")),
6906
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6907
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6920
6908
  ],
6921
6909
  compute: function (...args) {
6922
6910
  let count = 0;
@@ -6932,10 +6920,7 @@
6932
6920
  // -----------------------------------------------------------------------------
6933
6921
  const COUNTUNIQUE = {
6934
6922
  description: _t("Counts number of unique values in a range."),
6935
- args: [
6936
- arg("value1 (any, range)", _t("The first value or range to consider for uniqueness.")),
6937
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider for uniqueness.")),
6938
- ],
6923
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider for uniqueness."))],
6939
6924
  compute: function (...args) {
6940
6925
  return countUnique(args);
6941
6926
  },
@@ -6947,10 +6932,8 @@
6947
6932
  description: _t("Counts number of unique values in a range, filtered by a set of criteria."),
6948
6933
  args: [
6949
6934
  arg("range (range)", _t("The range of cells from which the number of unique values will be counted.")),
6950
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
6951
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.")),
6952
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.")),
6953
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
6935
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6936
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6954
6937
  ],
6955
6938
  compute: function (range, ...args) {
6956
6939
  const uniqueValues = new Set();
@@ -7306,8 +7289,7 @@
7306
7289
  const PRODUCT = {
7307
7290
  description: _t("Result of multiplying a series of numbers together."),
7308
7291
  args: [
7309
- arg("factor1 (number, range<number>)", _t("The first number or range to calculate for the product.")),
7310
- arg("factor2 (number, range<number>, repeating)", _t("More numbers or ranges to calculate for the product.")),
7292
+ arg("factor (number, range<number>, repeating)", _t("Number or range to calculate for the product.")),
7311
7293
  ],
7312
7294
  compute: function (...factors) {
7313
7295
  let count = 0;
@@ -7639,8 +7621,7 @@
7639
7621
  ...subtotalFunctionOptionsIncludeHiddenRows,
7640
7622
  ...subtotalFunctionOptionsExcludeHiddenRows,
7641
7623
  ]),
7642
- arg("ref1 (meta, range<meta>)", _t("The range or reference for which you want the subtotal.")),
7643
- arg("ref2 (meta, range<meta>, repeating)", _t("Additional ranges or references for which you want the subtotal.")),
7624
+ arg("ref (meta, range<meta>, repeating)", _t("Range or reference for which you want the subtotal.")),
7644
7625
  ],
7645
7626
  compute: function (functionCode, ...refs) {
7646
7627
  let code = toInteger(functionCode, this.locale);
@@ -7684,10 +7665,7 @@
7684
7665
  // -----------------------------------------------------------------------------
7685
7666
  const SUM = {
7686
7667
  description: _t("Sum of a series of numbers and/or cells."),
7687
- args: [
7688
- arg("value1 (number, range<number>)", _t("The first number or range to add together.")),
7689
- arg("value2 (number, range<number>, repeating)", _t("Additional numbers or ranges to add to value1.")),
7690
- ],
7668
+ args: [arg("value (number, range<number>, repeating)", _t("Number or range to add together."))],
7691
7669
  compute: function (...values) {
7692
7670
  const v1 = values[0];
7693
7671
  return {
@@ -7729,10 +7707,8 @@
7729
7707
  description: _t("Sums a range depending on multiple criteria."),
7730
7708
  args: [
7731
7709
  arg("sum_range (range)", _t("The range to sum.")),
7732
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
7733
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
7734
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges to check.")),
7735
- arg("criterion2 (string, repeating)", _t("Additional criteria to check.")),
7710
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
7711
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
7736
7712
  ],
7737
7713
  compute: function (sumRange, ...criters) {
7738
7714
  let sum = 0;
@@ -8199,8 +8175,7 @@
8199
8175
  const AVEDEV = {
8200
8176
  description: _t("Average magnitude of deviations from mean."),
8201
8177
  args: [
8202
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
8203
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
8178
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
8204
8179
  ],
8205
8180
  compute: function (...values) {
8206
8181
  let count = 0;
@@ -8222,8 +8197,7 @@
8222
8197
  const AVERAGE = {
8223
8198
  description: _t("Numerical average value in a dataset, ignoring text."),
8224
8199
  args: [
8225
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the average value.")),
8226
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the average value.")),
8200
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8227
8201
  ],
8228
8202
  compute: function (...values) {
8229
8203
  return {
@@ -8241,10 +8215,8 @@
8241
8215
  const AVERAGE_WEIGHTED = {
8242
8216
  description: _t("Weighted average."),
8243
8217
  args: [
8244
- arg("values (number, range<number>)", _t("Values to average.")),
8245
- arg("weights (number, range<number>)", _t("Weights for each corresponding value.")),
8246
- arg("additional_values (number, range<number>, repeating)", _t("Additional values to average.")),
8247
- arg("additional_weights (number, range<number>, repeating)", _t("Additional weights.")),
8218
+ arg("values (number, range<number>, repeating)", _t("Value to average.")),
8219
+ arg("weights (number, range<number>, repeating)", _t("Weight for each corresponding value.")),
8248
8220
  ],
8249
8221
  compute: function (...args) {
8250
8222
  let sum = 0;
@@ -8300,8 +8272,7 @@
8300
8272
  const AVERAGEA = {
8301
8273
  description: _t("Numerical average value in a dataset."),
8302
8274
  args: [
8303
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the average value.")),
8304
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the average value.")),
8275
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8305
8276
  ],
8306
8277
  compute: function (...args) {
8307
8278
  let count = 0;
@@ -8354,10 +8325,8 @@
8354
8325
  description: _t("Average of values depending on multiple criteria."),
8355
8326
  args: [
8356
8327
  arg("average_range (range)", _t("The range to average.")),
8357
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
8358
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
8359
- arg("criteria_range2 (any, range, repeating)", _t("Additional criteria_range and criterion to check.")),
8360
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8328
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
8329
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8361
8330
  ],
8362
8331
  compute: function (averageRange, ...args) {
8363
8332
  const _averageRange = toMatrix(averageRange);
@@ -8383,8 +8352,7 @@
8383
8352
  const COUNT = {
8384
8353
  description: _t("The number of numeric values in dataset."),
8385
8354
  args: [
8386
- arg("value1 (number, any, range<number>)", _t("The first value or range to consider when counting.")),
8387
- arg("value2 (number, any, range<number>, repeating)", _t("Additional values or ranges to consider when counting.")),
8355
+ arg("value (number, any, range<number>, repeating)", _t("Value or range to consider when counting.")),
8388
8356
  ],
8389
8357
  compute: function (...values) {
8390
8358
  return countNumbers(values, this.locale);
@@ -8396,10 +8364,7 @@
8396
8364
  // -----------------------------------------------------------------------------
8397
8365
  const COUNTA = {
8398
8366
  description: _t("The number of values in a dataset."),
8399
- args: [
8400
- arg("value1 (any, range)", _t("The first value or range to consider when counting.")),
8401
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when counting.")),
8402
- ],
8367
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider when counting."))],
8403
8368
  compute: function (...values) {
8404
8369
  return countAny(values);
8405
8370
  },
@@ -8632,8 +8597,7 @@
8632
8597
  const MAX = {
8633
8598
  description: _t("Maximum value in a numeric dataset."),
8634
8599
  args: [
8635
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the maximum value.")),
8636
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the maximum value.")),
8600
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8637
8601
  ],
8638
8602
  compute: function (...values) {
8639
8603
  return max(values, this.locale);
@@ -8646,8 +8610,7 @@
8646
8610
  const MAXA = {
8647
8611
  description: _t("Maximum numeric value in a dataset."),
8648
8612
  args: [
8649
- arg("value1 (any, range)", _t("The first value or range to consider when calculating the maximum value.")),
8650
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when calculating the maximum value.")),
8613
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8651
8614
  ],
8652
8615
  compute: function (...args) {
8653
8616
  const maxa = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8664,10 +8627,8 @@
8664
8627
  description: _t("Returns the maximum value in a range of cells, filtered by a set of criteria."),
8665
8628
  args: [
8666
8629
  arg("range (range)", _t("The range of cells from which the maximum will be determined.")),
8667
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
8668
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.")),
8669
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.")),
8670
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8630
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8631
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
8671
8632
  ],
8672
8633
  compute: function (range, ...args) {
8673
8634
  let result = -Infinity;
@@ -8687,8 +8648,7 @@
8687
8648
  const MEDIAN = {
8688
8649
  description: _t("Median value in a numeric dataset."),
8689
8650
  args: [
8690
- arg("value1 (any, range)", _t("The first value or range to consider when calculating the median value.")),
8691
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when calculating the median value.")),
8651
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the median value.")),
8692
8652
  ],
8693
8653
  compute: function (...values) {
8694
8654
  const data = [];
@@ -8708,8 +8668,7 @@
8708
8668
  const MIN = {
8709
8669
  description: _t("Minimum value in a numeric dataset."),
8710
8670
  args: [
8711
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the minimum value.")),
8712
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the minimum value.")),
8671
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8713
8672
  ],
8714
8673
  compute: function (...values) {
8715
8674
  return min(values, this.locale);
@@ -8722,8 +8681,7 @@
8722
8681
  const MINA = {
8723
8682
  description: _t("Minimum numeric value in a dataset."),
8724
8683
  args: [
8725
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the minimum value.")),
8726
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the minimum value.")),
8684
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8727
8685
  ],
8728
8686
  compute: function (...args) {
8729
8687
  const mina = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8740,10 +8698,8 @@
8740
8698
  description: _t("Returns the minimum value in a range of cells, filtered by a set of criteria."),
8741
8699
  args: [
8742
8700
  arg("range (range)", _t("The range of cells from which the minimum will be determined.")),
8743
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
8744
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1, such that each cell that evaluates to TRUE will be included in the filtered set.")),
8745
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges over which to evaluate the additional criteria. The filtered set will be the intersection of the sets produced by each criterion-range pair.")),
8746
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8701
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8702
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8747
8703
  ],
8748
8704
  compute: function (range, ...args) {
8749
8705
  let result = Infinity;
@@ -9084,8 +9040,7 @@
9084
9040
  const STDEV = {
9085
9041
  description: _t("Standard deviation."),
9086
9042
  args: [
9087
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9088
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9043
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9089
9044
  ],
9090
9045
  compute: function (...args) {
9091
9046
  return Math.sqrt(VAR.compute.bind(this)(...args));
@@ -9098,8 +9053,7 @@
9098
9053
  const STDEV_P = {
9099
9054
  description: _t("Standard deviation of entire population."),
9100
9055
  args: [
9101
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9102
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9056
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9103
9057
  ],
9104
9058
  compute: function (...args) {
9105
9059
  return Math.sqrt(VAR_P.compute.bind(this)(...args));
@@ -9112,8 +9066,7 @@
9112
9066
  const STDEV_S = {
9113
9067
  description: _t("Standard deviation."),
9114
9068
  args: [
9115
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9116
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9069
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9117
9070
  ],
9118
9071
  compute: function (...args) {
9119
9072
  return Math.sqrt(VAR_S.compute.bind(this)(...args));
@@ -9126,8 +9079,7 @@
9126
9079
  const STDEVA = {
9127
9080
  description: _t("Standard deviation of sample (text as 0)."),
9128
9081
  args: [
9129
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9130
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9082
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9131
9083
  ],
9132
9084
  compute: function (...args) {
9133
9085
  return Math.sqrt(VARA.compute.bind(this)(...args));
@@ -9140,8 +9092,7 @@
9140
9092
  const STDEVP = {
9141
9093
  description: _t("Standard deviation of entire population."),
9142
9094
  args: [
9143
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9144
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9095
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9145
9096
  ],
9146
9097
  compute: function (...args) {
9147
9098
  return Math.sqrt(VARP.compute.bind(this)(...args));
@@ -9154,8 +9105,7 @@
9154
9105
  const STDEVPA = {
9155
9106
  description: _t("Standard deviation of entire population (text as 0)."),
9156
9107
  args: [
9157
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9158
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9108
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9159
9109
  ],
9160
9110
  compute: function (...args) {
9161
9111
  return Math.sqrt(VARPA.compute.bind(this)(...args));
@@ -9205,8 +9155,7 @@
9205
9155
  const VAR = {
9206
9156
  description: _t("Variance."),
9207
9157
  args: [
9208
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9209
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9158
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9210
9159
  ],
9211
9160
  compute: function (...args) {
9212
9161
  return variance(args, true, false, this.locale);
@@ -9219,8 +9168,7 @@
9219
9168
  const VAR_P = {
9220
9169
  description: _t("Variance of entire population."),
9221
9170
  args: [
9222
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9223
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9171
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9224
9172
  ],
9225
9173
  compute: function (...args) {
9226
9174
  return variance(args, false, false, this.locale);
@@ -9233,8 +9181,7 @@
9233
9181
  const VAR_S = {
9234
9182
  description: _t("Variance."),
9235
9183
  args: [
9236
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9237
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9184
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9238
9185
  ],
9239
9186
  compute: function (...args) {
9240
9187
  return variance(args, true, false, this.locale);
@@ -9247,8 +9194,7 @@
9247
9194
  const VARA = {
9248
9195
  description: _t("Variance of sample (text as 0)."),
9249
9196
  args: [
9250
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9251
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9197
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9252
9198
  ],
9253
9199
  compute: function (...args) {
9254
9200
  return variance(args, true, true, this.locale);
@@ -9261,8 +9207,7 @@
9261
9207
  const VARP = {
9262
9208
  description: _t("Variance of entire population."),
9263
9209
  args: [
9264
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9265
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9210
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9266
9211
  ],
9267
9212
  compute: function (...args) {
9268
9213
  return variance(args, false, false, this.locale);
@@ -9275,8 +9220,7 @@
9275
9220
  const VARPA = {
9276
9221
  description: _t("Variance of entire population (text as 0)."),
9277
9222
  args: [
9278
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9279
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9223
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9280
9224
  ],
9281
9225
  compute: function (...args) {
9282
9226
  return variance(args, false, true, this.locale);
@@ -11079,8 +11023,7 @@
11079
11023
  // TODO modify args description when vectorization on formulas is available
11080
11024
  args: [
11081
11025
  arg("range (any, range<any>)", _t("The data to be filtered.")),
11082
- arg("condition1 (boolean, range<boolean>)", _t("A column or row containing true or false values corresponding to the first column or row of range.")),
11083
- arg("condition2 (boolean, range<boolean>, repeating)", _t("Additional column or row containing true or false values.")),
11026
+ arg("condition (boolean, range<boolean>, repeating)", _t("Column or row containing true or false values corresponding to the range.")),
11084
11027
  ],
11085
11028
  compute: function (range, ...conditions) {
11086
11029
  let _array = toMatrix(range);
@@ -11120,8 +11063,8 @@
11120
11063
  description: _t("Sorts the rows of a given array or range by the values in one or more columns."),
11121
11064
  args: [
11122
11065
  arg("range (range)", _t("The data to be sorted.")),
11123
- arg("sort_column (any, range<number>, repeating)", _t("The index of the column in range or a range outside of range containing the values by which to sort.")),
11124
- arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order."), [
11066
+ arg("sort_column (any, range<number>, repeating, optional)", _t("The index of the column in range or a range outside of range containing the value by which to sort.")),
11067
+ arg("is_ascending (boolean, repeating, optional)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order."), [
11125
11068
  { value: true, label: _t("Ascending") },
11126
11069
  { value: false, label: _t("Descending") },
11127
11070
  ]),
@@ -11141,8 +11084,8 @@
11141
11084
  arg("range (range)", _t("The data to be sorted.")),
11142
11085
  arg("n (number)", _t("The number of items to return.")),
11143
11086
  arg("display_ties_mode (number, default=0)", _t("A number representing the way to display ties.")),
11144
- arg("sort_column (number, range<number>, repeating)", _t("The index of the column in range or a range outside of range containing the values by which to sort.")),
11145
- arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order."), [
11087
+ arg("sort_column (number, range<number>, repeating, optional)", _t("The index of the column in range or a range outside of range containing the value by which to sort.")),
11088
+ arg("is_ascending (boolean, repeating, optional)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order."), [
11146
11089
  { value: true, label: _t("Ascending") },
11147
11090
  { value: false, label: _t("Descending") },
11148
11091
  ]),
@@ -12410,8 +12353,7 @@
12410
12353
  description: _t("The net present value of an investment based on a series of periodic cash flows and a discount rate."),
12411
12354
  args: [
12412
12355
  arg("discount (number)", _t("The discount rate of the investment over one period.")),
12413
- arg("cashflow1 (number, range<number>)", _t("The first future cash flow.")),
12414
- arg("cashflow2 (number, range<number>, repeating)", _t("Additional future cash flows.")),
12356
+ arg("cashflow (number, range<number>, repeating)", _t("The future cash flows.")),
12415
12357
  ],
12416
12358
  // to do: replace by dollar format
12417
12359
  compute: function (discount, ...values) {
@@ -13766,8 +13708,7 @@
13766
13708
  const AND = {
13767
13709
  description: _t("Logical `and` operator."),
13768
13710
  args: [
13769
- arg("logical_expression1 (boolean, range<boolean>)", _t("An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.")),
13770
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that represent logical values.")),
13711
+ arg("logical_expression (boolean, range<boolean>, repeating)", _t("Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.")),
13771
13712
  ],
13772
13713
  compute: function (...logicalExpressions) {
13773
13714
  const { result, foundBoolean } = boolAnd(logicalExpressions);
@@ -13850,10 +13791,8 @@
13850
13791
  const IFS = {
13851
13792
  description: _t("Returns a value depending on multiple logical expressions."),
13852
13793
  args: [
13853
- 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.")),
13854
- arg("value1 (any, range)", _t("The returned value if condition1 is TRUE.")),
13855
- arg("condition2 (boolean, any, range, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
13856
- arg("value2 (any, range, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
13794
+ arg("condition (any, range, repeating)", _t("The condition to be evaluated. It can be a boolean, a number, an array, or a reference to any of those.")),
13795
+ arg("value (any, range, repeating)", _t("The value to be returned if its corresponding condition is TRUE.")),
13857
13796
  ],
13858
13797
  compute: function (...values) {
13859
13798
  if (values.length % 2 !== 0) {
@@ -13892,8 +13831,7 @@
13892
13831
  const OR = {
13893
13832
  description: _t("Logical `or` operator."),
13894
13833
  args: [
13895
- arg("logical_expression1 (boolean, range<boolean>)", _t("An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.")),
13896
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that evaluate to logical values.")),
13834
+ arg("logical_expression (boolean, range<boolean>, repeating)", _t("Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.")),
13897
13835
  ],
13898
13836
  compute: function (...logicalExpressions) {
13899
13837
  const { result, foundBoolean } = boolOr(logicalExpressions);
@@ -13911,10 +13849,8 @@
13911
13849
  description: _t("Returns a value by comparing cases to an expression."),
13912
13850
  args: [
13913
13851
  arg("expression (number, boolean, string)", _t("The value to be checked.")),
13914
- arg("case1 (number, boolean, string)", _t("The first case to be checked against expression.")),
13915
- arg("value1 (any)", _t("The corresponding value to be returned if case1 matches expression.")),
13916
- arg("case2 (any, repeating)", _t("Additional cases to try if the previous ones don't match expression.")),
13917
- arg("value2 (any, repeating)", _t("Additional values to be returned if their corresponding cases match expression.")),
13852
+ arg("case (any, repeating)", _t("Case to be checked against expression.")),
13853
+ arg("value (any, repeating)", _t("Value to be returned if its corresponding case matches expression.")),
13918
13854
  arg(`default (any, default="empty")`, _t("An optional default value to be returned if none of the cases match expression.")),
13919
13855
  ],
13920
13856
  compute: function (expression, ...casesAndValues) {
@@ -13949,8 +13885,7 @@
13949
13885
  const XOR = {
13950
13886
  description: _t("Logical `xor` operator."),
13951
13887
  args: [
13952
- arg("logical_expression1 (boolean, range<boolean>)", _t("An expression or reference to a cell containing an expression that represents some logical value, i.e. TRUE or FALSE, or an expression that can be coerced to a logical value.")),
13953
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that evaluate to logical values.")),
13888
+ arg("logical_expression (boolean, range<boolean>, repeating)", _t("Expression or reference to a cell containing a logical value (TRUE/FALSE) or an expression that can be coerced to a logical value.")),
13954
13889
  ],
13955
13890
  compute: function (...logicalExpressions) {
13956
13891
  let foundBoolean = false;
@@ -15425,8 +15360,8 @@
15425
15360
  args: [
15426
15361
  arg("pivot_id (number,string)", _t("ID of the pivot.")),
15427
15362
  arg("measure_name (string)", _t("Name of the measure.")),
15428
- arg("domain_field_name (string,repeating)", _t("Field name.")),
15429
- arg("domain_value (number,string,boolean,repeating)", _t("Value.")),
15363
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15364
+ arg("domain_value (number,string,boolean,repeating,optional)", _t("Value.")),
15430
15365
  ],
15431
15366
  compute: function (formulaId, measureName, ...domainArgs) {
15432
15367
  const _pivotFormulaId = toString(formulaId);
@@ -15461,8 +15396,8 @@
15461
15396
  description: _t("Get the header of a pivot."),
15462
15397
  args: [
15463
15398
  arg("pivot_id (number,string)", _t("ID of the pivot.")),
15464
- arg("domain_field_name (string,repeating)", _t("Field name.")),
15465
- arg("domain_value (number,string,value,repeating)", _t("Value.")),
15399
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15400
+ arg("domain_value (number,string,value,repeating,optional)", _t("Value.")),
15466
15401
  ],
15467
15402
  compute: function (pivotId, ...domainArgs) {
15468
15403
  const _pivotFormulaId = toString(pivotId);
@@ -16333,10 +16268,7 @@
16333
16268
  // -----------------------------------------------------------------------------
16334
16269
  const CONCATENATE = {
16335
16270
  description: _t("Appends strings to one another."),
16336
- args: [
16337
- arg("string1 (string, range<string>)", _t("The initial string.")),
16338
- arg("string2 (string, range<string>, repeating)", _t("More strings to append in sequence.")),
16339
- ],
16271
+ args: [arg("string (string, range<string>, repeating)", _t("String to append in sequence."))],
16340
16272
  compute: function (...datas) {
16341
16273
  return reduceAny(datas, (acc, a) => acc + toString(a), "");
16342
16274
  },
@@ -16391,8 +16323,7 @@
16391
16323
  description: _t("Concatenates elements of arrays with delimiter."),
16392
16324
  args: [
16393
16325
  arg("delimiter (string)", _t("The character or string to place between each concatenated value.")),
16394
- arg("value_or_array1 (string, range<string>)", _t("The value or values to be appended using delimiter.")),
16395
- arg("value_or_array2 (string, range<string>, repeating)", _t("More values to be appended using delimiter.")),
16326
+ arg("value_or_array (string, range<string>, repeating)", _t("Value to be appended using delimiter.")),
16396
16327
  ],
16397
16328
  compute: function (delimiter, ...valuesOrArrays) {
16398
16329
  const _delimiter = toString(delimiter);
@@ -16683,13 +16614,12 @@
16683
16614
  const TEXTJOIN = {
16684
16615
  description: _t("Combines text from multiple strings and/or arrays."),
16685
16616
  args: [
16686
- arg("delimiter (string)", _t(" A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.")),
16617
+ arg("delimiter (string)", _t("A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.")),
16687
16618
  arg("ignore_empty (boolean)", _t("A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result."), [
16688
16619
  { value: true, label: _t("Ignore empty cells") },
16689
16620
  { value: false, label: _t("Include empty cells (default)") },
16690
16621
  ]),
16691
- arg("text1 (string, range<string>)", _t("Any text item. This could be a string, or an array of strings in a range.")),
16692
- arg("text2 (string, range<string>, repeating)", _t("Additional text item(s).")),
16622
+ arg("texts (string, range<string>, repeating)", _t("Text item to join.")),
16693
16623
  ],
16694
16624
  compute: function (delimiter, ignoreEmpty = { value: TEXTJOIN_DEFAULT_IGNORE_EMPTY }, ...textsOrArrays) {
16695
16625
  const _delimiter = toString(delimiter);
@@ -17562,7 +17492,7 @@
17562
17492
  const compiledArgs = [];
17563
17493
  const argToFocus = argTargeting(functionDefinition, args.length);
17564
17494
  for (let i = 0; i < args.length; i++) {
17565
- const argDefinition = functionDefinition.args[argToFocus(i) ?? -1];
17495
+ const argDefinition = functionDefinition.args[argToFocus(i).index ?? -1];
17566
17496
  const currentArg = args[i];
17567
17497
  const argTypes = argDefinition.type || [];
17568
17498
  // detect when an argument need to be evaluated as a meta argument
@@ -17741,12 +17671,15 @@
17741
17671
  }
17742
17672
  if (nbrArgRepeating > 1) {
17743
17673
  const nbrValueRepeating = nbrArgRepeating * Math.floor((nbrArgSupplied - minArgRequired) / nbrArgRepeating);
17744
- const nbrValueRemaining = nbrArgSupplied - minArgRequired - nbrValueRepeating - functionDefinition.nbrArgOptional;
17674
+ const nbrValueRemaining = nbrArgSupplied -
17675
+ minArgRequired -
17676
+ nbrValueRepeating -
17677
+ functionDefinition.nbrOptionalNonRepeatingArgs;
17745
17678
  if (nbrValueRemaining > 0) {
17746
17679
  throw new BadExpressionError(_t("Invalid number of arguments for the %(functionName)s function. Repeatable arguments should be supplied in groups of %(nbrArgRepeating)s, with up to %(nbrArgOptional)s optional. Got %(nbrValueRemaining)s too many.", {
17747
17680
  functionName,
17748
17681
  nbrArgRepeating,
17749
- nbrArgOptional: functionDefinition.nbrArgOptional,
17682
+ nbrArgOptional: functionDefinition.nbrOptionalNonRepeatingArgs,
17750
17683
  nbrValueRemaining,
17751
17684
  }));
17752
17685
  }
@@ -40495,6 +40428,7 @@
40495
40428
  isMeasureCandidate: (field) => field.type !== "boolean",
40496
40429
  isGroupable: () => true,
40497
40430
  canHaveCustomGroup: (field) => field.type === "char" && !field.isCustomField,
40431
+ isPivotUnused: () => true,
40498
40432
  });
40499
40433
 
40500
40434
  const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
@@ -40513,7 +40447,7 @@
40513
40447
  "isSpillPivotFormula",
40514
40448
  ];
40515
40449
  pivots = {};
40516
- unusedPivots;
40450
+ unusedPivotsInFormulas;
40517
40451
  custom;
40518
40452
  constructor(config) {
40519
40453
  super(config);
@@ -40553,12 +40487,12 @@
40553
40487
  }
40554
40488
  case "DELETE_SHEET":
40555
40489
  case "UPDATE_CELL": {
40556
- this.unusedPivots = undefined;
40490
+ this.unusedPivotsInFormulas = undefined;
40557
40491
  break;
40558
40492
  }
40559
40493
  case "UNDO":
40560
40494
  case "REDO": {
40561
- this.unusedPivots = undefined;
40495
+ this.unusedPivotsInFormulas = undefined;
40562
40496
  const pivotCommands = cmd.commands.filter(isPivotCommand);
40563
40497
  for (const cmd of pivotCommands) {
40564
40498
  const pivotId = cmd.pivotId;
@@ -40717,7 +40651,9 @@
40717
40651
  return this.pivots[pivotId];
40718
40652
  }
40719
40653
  isPivotUnused(pivotId) {
40720
- return this._getUnusedPivots().includes(pivotId);
40654
+ const { type } = this.getters.getPivot(pivotId);
40655
+ return (this._getUnusedPivotsInFormulas().includes(pivotId) &&
40656
+ pivotRegistry.get(type).isPivotUnused(this.getters, pivotId));
40721
40657
  }
40722
40658
  getPivotCellSortDirection(position) {
40723
40659
  const pivotId = this.getters.getPivotIdFromPosition(position);
@@ -40753,9 +40689,9 @@
40753
40689
  this.pivots[pivotId].onDefinitionChange(definition);
40754
40690
  }
40755
40691
  }
40756
- _getUnusedPivots() {
40757
- if (this.unusedPivots !== undefined) {
40758
- return this.unusedPivots;
40692
+ _getUnusedPivotsInFormulas() {
40693
+ if (this.unusedPivotsInFormulas !== undefined) {
40694
+ return this.unusedPivotsInFormulas;
40759
40695
  }
40760
40696
  const unusedPivots = new Set(this.getters.getPivotIds());
40761
40697
  for (const sheetId of this.getters.getSheetIds()) {
@@ -40765,14 +40701,14 @@
40765
40701
  if (pivotId) {
40766
40702
  unusedPivots.delete(pivotId);
40767
40703
  if (!unusedPivots.size) {
40768
- this.unusedPivots = [];
40704
+ this.unusedPivotsInFormulas = [];
40769
40705
  return [];
40770
40706
  }
40771
40707
  }
40772
40708
  }
40773
40709
  }
40774
- this.unusedPivots = [...unusedPivots];
40775
- return this.unusedPivots;
40710
+ this.unusedPivotsInFormulas = [...unusedPivots];
40711
+ return this.unusedPivotsInFormulas;
40776
40712
  }
40777
40713
  }
40778
40714
 
@@ -46178,6 +46114,7 @@
46178
46114
  "getVisibleFigures",
46179
46115
  "getVisibleRect",
46180
46116
  "getVisibleRectWithoutHeaders",
46117
+ "getVisibleRectWithZoom",
46181
46118
  "getVisibleCellPositions",
46182
46119
  "getColRowOffsetInViewport",
46183
46120
  "getMainViewportCoordinates",
@@ -46193,6 +46130,8 @@
46193
46130
  "getFigureUI",
46194
46131
  "getPositionAnchorOffset",
46195
46132
  "getGridOffset",
46133
+ "getViewportZoomLevel",
46134
+ "getScrollBarWidth",
46196
46135
  ];
46197
46136
  viewports = {};
46198
46137
  /**
@@ -46205,6 +46144,7 @@
46205
46144
  sheetViewHeight = getDefaultSheetViewSize();
46206
46145
  gridOffsetX = 0;
46207
46146
  gridOffsetY = 0;
46147
+ zoomLevel = 1;
46208
46148
  sheetsWithDirtyViewports = new Set();
46209
46149
  shouldAdjustViewports = false;
46210
46150
  // ---------------------------------------------------------------------------
@@ -46271,6 +46211,9 @@
46271
46211
  case "SET_VIEWPORT_OFFSET":
46272
46212
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
46273
46213
  break;
46214
+ case "SET_ZOOM":
46215
+ this.zoomLevel = cmd.zoom || 1;
46216
+ break;
46274
46217
  case "SHIFT_VIEWPORT_DOWN":
46275
46218
  const sheetId = this.getters.getActiveSheetId();
46276
46219
  const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
@@ -46474,7 +46417,7 @@
46474
46417
  for (const i of relevantIndexes) {
46475
46418
  offset += this.getters.getHeaderSize(sheetId, dimension, i);
46476
46419
  }
46477
- return offset;
46420
+ return offset * this.zoomLevel;
46478
46421
  }
46479
46422
  /**
46480
46423
  * Check if a given position is visible in the viewport.
@@ -46482,6 +46425,9 @@
46482
46425
  isVisibleInViewport({ sheetId, col, row }) {
46483
46426
  return this.getSubViewports(sheetId).some((pane) => pane.isVisible(col, row));
46484
46427
  }
46428
+ getScrollBarWidth() {
46429
+ return SCROLLBAR_WIDTH / this.zoomLevel;
46430
+ }
46485
46431
  // => returns the new offset
46486
46432
  getEdgeScrollCol(x, previousX, startingX) {
46487
46433
  let canEdgeScroll = false;
@@ -46560,6 +46506,18 @@
46560
46506
  const rect = this.getVisibleRectWithoutHeaders(zone);
46561
46507
  return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
46562
46508
  }
46509
+ /**
46510
+ * Computes the coordinates and size to draw the zone on the canvas after it has been zoomed
46511
+ */
46512
+ getVisibleRectWithZoom(zone) {
46513
+ const zoom = this.getViewportZoomLevel();
46514
+ const rect = this.getVisibleRectWithoutHeaders(zone);
46515
+ rect.width = rect.width * zoom;
46516
+ rect.height = rect.height * zoom;
46517
+ rect.x = rect.x * zoom + this.gridOffsetX * zoom;
46518
+ rect.y = rect.y * zoom + this.gridOffsetY * zoom;
46519
+ return rect;
46520
+ }
46563
46521
  /**
46564
46522
  * Computes the coordinates and size to draw the zone without taking the grid offset into account
46565
46523
  */
@@ -46641,6 +46599,9 @@
46641
46599
  };
46642
46600
  });
46643
46601
  }
46602
+ getViewportZoomLevel() {
46603
+ return this.zoomLevel;
46604
+ }
46644
46605
  // ---------------------------------------------------------------------------
46645
46606
  // Private
46646
46607
  // ---------------------------------------------------------------------------
@@ -50960,8 +50921,8 @@
50960
50921
 
50961
50922
 
50962
50923
  __info__.version = "19.1.0-alpha.3";
50963
- __info__.date = "2025-10-30T12:25:48.501Z";
50964
- __info__.hash = "d0b65e9";
50924
+ __info__.date = "2025-11-03T12:33:46.742Z";
50925
+ __info__.hash = "d9230f3";
50965
50926
 
50966
50927
 
50967
50928
  })(this.o_spreadsheet_engine = this.o_spreadsheet_engine || {});