@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
  class FunctionCodeBuilder {
@@ -177,13 +177,13 @@ function addMetaInfoFromArg(name, addDescr) {
177
177
  let optionalArg = 0;
178
178
  for (const arg of addDescr.args) {
179
179
  countArg++;
180
- if (!arg.optional && !arg.repeating && !arg.default) {
180
+ if (!arg.optional && !arg.default) {
181
181
  minArg++;
182
182
  }
183
183
  if (arg.repeating) {
184
184
  repeatingArg++;
185
185
  }
186
- if (arg.optional || arg.default) {
186
+ if ((arg.optional || arg.default) && !arg.repeating) {
187
187
  optionalArg++;
188
188
  }
189
189
  }
@@ -191,7 +191,7 @@ function addMetaInfoFromArg(name, addDescr) {
191
191
  descr.minArgRequired = minArg;
192
192
  descr.maxArgPossible = repeatingArg ? Infinity : countArg;
193
193
  descr.nbrArgRepeating = repeatingArg;
194
- descr.nbrArgOptional = optionalArg;
194
+ descr.nbrOptionalNonRepeatingArgs = optionalArg;
195
195
  descr.hidden = addDescr.hidden || false;
196
196
  descr.name = name;
197
197
  return descr;
@@ -219,9 +219,9 @@ const cacheArgTargeting = {};
219
219
  * and rows representing the correspondence with the argument index.
220
220
  *
221
221
  * The tables are built based on the following conventions:
222
- * - `m`: Mandatory argument
223
- * - `o`: Optional argument
224
- * - `r`: Repeating argument
222
+ * - `m`: Mandatory argument (count as one argument)
223
+ * - `o`: Optional argument (count as zero or one argument)
224
+ * - `r`: Repeating argument (count as one or more arguments)
225
225
  *
226
226
  *
227
227
  * Configuration 1: (m, o) like the CEILING function
@@ -234,39 +234,39 @@ const cacheArgTargeting = {};
234
234
  *
235
235
  * Configuration 2: (m, m, m, r, r) like the SUMIFS function
236
236
  *
237
- * | | 3 | 5 | 7 | 3 + 2n |
238
- * |---|---|---|------|------------|
239
- * | m | 0 | 0 | 0 | 0 |
240
- * | m | 1 | 1 | 1 | 1 |
241
- * | m | 2 | 2 | 2 | 2 |
242
- * | r | | 3 | 3, 5 | 3 + 2n |
243
- * | r | | 4 | 4, 6 | 3 + 2n + 1 |
237
+ * | | 5 | 7 | 3 + 2n |
238
+ * |---|---|------|------------|
239
+ * | m | 0 | 0 | 0 |
240
+ * | m | 1 | 1 | 1 |
241
+ * | m | 2 | 2 | 2 |
242
+ * | r | 3 | 3, 5 | 3 + 2n |
243
+ * | r | 4 | 4, 6 | 3 + 2n + 1 |
244
244
  *
245
245
  *
246
246
  * Configuration 3: (m, m, m, r, r, o) like the SWITCH function
247
247
  *
248
- * | | 3 | 4 | 5 | 6 | 7 | 8 | 3 + 2n | 3 + 2n + 1 |
249
- * |---|---|---|---|---|------|------|------------|----------------|
250
- * | m | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
251
- * | m | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
252
- * | m | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
253
- * | r | | | 3 | 3 | 3, 5 | 3, 5 | 3 + 2n | 3 + 2n |
254
- * | r | | | 4 | 4 | 4, 6 | 4, 6 | 3 + 2n + 1 | 3 + 2n + 1 |
255
- * | o | | 3 | | 5 | | 7 | | 3 + 2N + 2 |
248
+ * | | 5 | 6 | 7 | 8 | 3 + 2n | 3 + 2n + 1 |
249
+ * |---|---|---|------|------|------------|----------------|
250
+ * | m | 0 | 0 | 0 | 0 | 0 | 0 |
251
+ * | m | 1 | 1 | 1 | 1 | 1 | 1 |
252
+ * | m | 2 | 2 | 2 | 2 | 2 | 2 |
253
+ * | r | 3 | 3 | 3, 5 | 3, 5 | 3 + 2n | 3 + 2n |
254
+ * | r | 4 | 4 | 4, 6 | 4, 6 | 3 + 2n + 1 | 3 + 2n + 1 |
255
+ * | o | | 5 | | 7 | | 3 + 2N + 2 |
256
256
  *
257
257
  *
258
258
  * Configuration 4: (m, o, m, o, r, r, r, m) a complex case to understand subtleties
259
259
  *
260
- * | | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ... |
261
- * |---|---|---|---|---|---|---|------|------|------|-----|
262
- * | m | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ... |
263
- * | o | | 1 | 1 | | 1 | 1 | | 1 | 1 | ... |
264
- * | m | 1 | 2 | 2 | 1 | 2 | 2 | 1 | 2 | 2 | ... |
265
- * | o | | | 3 | | | 3 | | | 3 | ... |
266
- * | r | | | | 2 | 3 | 4 | 2, 5 | 3, 6 | 4, 7 | ... |
267
- * | r | | | | 3 | 4 | 5 | 3, 6 | 4, 7 | 5, 8 | ... |
268
- * | r | | | | 4 | 5 | 6 | 4, 7 | 5, 8 | 6, 9 | ... |
269
- * | m | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ... |
260
+ * | | 6 | 7 | 8 | 9 | 10 | 11 | ... |
261
+ * |---|---|---|---|------|------|------|-----|
262
+ * | m | 0 | 0 | 0 | 0 | 0 | 0 | ... |
263
+ * | o | | 1 | 1 | | 1 | 1 | ... |
264
+ * | m | 1 | 2 | 2 | 1 | 2 | 2 | ... |
265
+ * | o | | | 3 | | | 3 | ... |
266
+ * | r | 2 | 3 | 4 | 2, 5 | 3, 6 | 4, 7 | ... |
267
+ * | r | 3 | 4 | 5 | 3, 6 | 4, 7 | 5, 8 | ... |
268
+ * | r | 4 | 5 | 6 | 4, 7 | 5, 8 | 6, 9 | ... |
269
+ * | m | 5 | 6 | 7 | 8 | 9 | 10 | ... |
270
270
  *
271
271
  */
272
272
  function argTargeting(functionDescription, nbrArgSupplied) {
@@ -285,30 +285,31 @@ function argTargeting(functionDescription, nbrArgSupplied) {
285
285
  }
286
286
  function _argTargeting(functionDescription, nbrArgSupplied) {
287
287
  const valueIndexToArgPosition = {};
288
- const groupsOfRepeatingValues = functionDescription.nbrArgRepeating
288
+ const groupsOfOptionalRepeatingValues = functionDescription.nbrArgRepeating
289
289
  ? Math.floor((nbrArgSupplied - functionDescription.minArgRequired) / functionDescription.nbrArgRepeating)
290
290
  : 0;
291
- const nbrValueRepeating = functionDescription.nbrArgRepeating * groupsOfRepeatingValues;
292
- const nbrValueOptional = nbrArgSupplied - functionDescription.minArgRequired - nbrValueRepeating;
291
+ const nbrValueOptionalRepeating = functionDescription.nbrArgRepeating * groupsOfOptionalRepeatingValues;
292
+ const nbrValueOptional = nbrArgSupplied - functionDescription.minArgRequired - nbrValueOptionalRepeating;
293
293
  let countValueSupplied = 0;
294
294
  let countValueOptional = 0;
295
295
  for (let i = 0; i < functionDescription.args.length; i++) {
296
296
  const arg = functionDescription.args[i];
297
- if (arg.optional || arg.default) {
297
+ if ((arg.optional || arg.default) && !arg.repeating) {
298
298
  if (countValueOptional < nbrValueOptional) {
299
- valueIndexToArgPosition[countValueSupplied] = i;
299
+ valueIndexToArgPosition[countValueSupplied] = { index: i };
300
300
  countValueSupplied++;
301
301
  }
302
302
  countValueOptional++;
303
303
  continue;
304
304
  }
305
305
  if (arg.repeating) {
306
+ const groupOfMandatoryRepeatingValues = arg.optional ? 0 : 1;
306
307
  // As we know all repeating arguments are consecutive,
307
308
  // --> we will treat all repeating arguments in one go
308
309
  // --> the index i will be incremented by the number of repeating values at the end of the loop
309
- for (let j = 0; j < groupsOfRepeatingValues; j++) {
310
+ for (let j = 0; j < groupsOfOptionalRepeatingValues + groupOfMandatoryRepeatingValues; j++) {
310
311
  for (let k = 0; k < functionDescription.nbrArgRepeating; k++) {
311
- valueIndexToArgPosition[countValueSupplied] = i + k;
312
+ valueIndexToArgPosition[countValueSupplied] = { index: i + k, repeatingGroupIndex: j };
312
313
  countValueSupplied++;
313
314
  }
314
315
  }
@@ -316,7 +317,7 @@ function _argTargeting(functionDescription, nbrArgSupplied) {
316
317
  continue;
317
318
  }
318
319
  // End case: it's a required argument
319
- valueIndexToArgPosition[countValueSupplied] = i;
320
+ valueIndexToArgPosition[countValueSupplied] = { index: i };
320
321
  countValueSupplied++;
321
322
  }
322
323
  return (argPosition) => {
@@ -328,7 +329,7 @@ function _argTargeting(functionDescription, nbrArgSupplied) {
328
329
  //------------------------------------------------------------------------------
329
330
  const META_TYPES = ["META", "RANGE<META>"];
330
331
  function validateArguments(descr) {
331
- if (descr.nbrArgRepeating && descr.nbrArgOptional >= descr.nbrArgRepeating) {
332
+ if (descr.nbrArgRepeating && descr.nbrOptionalNonRepeatingArgs >= descr.nbrArgRepeating) {
332
333
  throw new Error(`Function ${descr.name} has more optional arguments than repeatable ones.`);
333
334
  }
334
335
  let foundRepeating = false;
@@ -612,6 +613,7 @@ const COLOR_PICKER_DEFAULTS = [
612
613
  ];
613
614
  const DEFAULT_CELL_WIDTH = 96;
614
615
  const DEFAULT_CELL_HEIGHT = 23;
616
+ const SCROLLBAR_WIDTH = 15;
615
617
  const MIN_CF_ICON_MARGIN = 4;
616
618
  const MIN_CELL_TEXT_MARGIN = 4;
617
619
  const PADDING_AUTORESIZE_VERTICAL = 3;
@@ -2854,7 +2856,7 @@ function createComputeFunction(descr) {
2854
2856
  const getArgToFocus = argTargeting(descr, args.length);
2855
2857
  //#region Compute vectorisation limits
2856
2858
  for (let i = 0; i < args.length; i++) {
2857
- const argIndex = getArgToFocus(i) ?? -1;
2859
+ const argIndex = getArgToFocus(i).index ?? -1;
2858
2860
  const argDefinition = descr.args[argIndex];
2859
2861
  const arg = args[i];
2860
2862
  if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
@@ -2868,7 +2870,7 @@ function createComputeFunction(descr) {
2868
2870
  for (let i = 0; i < args.length; i++) {
2869
2871
  const arg = args[i];
2870
2872
  const getArgToFocus = argTargeting(descr, args.length);
2871
- const argDefinition = descr.args[getArgToFocus(i) || i];
2873
+ const argDefinition = descr.args[getArgToFocus(i).index ?? i];
2872
2874
  // Early exit if the argument is an error and the function does not accept errors
2873
2875
  // We only check scalar arguments, not matrix arguments for performance reasons.
2874
2876
  // Casting helpers are responsible for handling errors in matrix arguments.
@@ -3136,8 +3138,7 @@ const CHOOSECOLS = {
3136
3138
  description: _t("Creates a new array from the selected columns in the existing range."),
3137
3139
  args: [
3138
3140
  arg("array (any, range<any>)", _t("The array that contains the columns to be returned.")),
3139
- arg("col_num (number, range<number>)", _t("The first column index of the columns to be returned.")),
3140
- arg("col_num2 (number, range<number>, repeating)", _t("The columns indexes of the columns to be returned.")),
3141
+ arg("col_num (number, range<number>, repeating)", _t("The column index of the column to be returned.")),
3141
3142
  ],
3142
3143
  compute: function (array, ...columns) {
3143
3144
  const _array = toMatrix(array);
@@ -3166,8 +3167,7 @@ const CHOOSEROWS = {
3166
3167
  description: _t("Creates a new array from the selected rows in the existing range."),
3167
3168
  args: [
3168
3169
  arg("array (any, range<any>)", _t("The array that contains the rows to be returned.")),
3169
- arg("row_num (number, range<number>)", _t("The first row index of the rows to be returned.")),
3170
- arg("row_num2 (number, range<number>, repeating)", _t("The rows indexes of the rows to be returned.")),
3170
+ arg("row_num (number, range<number>, repeating)", _t("The row index of the row to be returned.")),
3171
3171
  ],
3172
3172
  compute: function (array, ...rows) {
3173
3173
  const _array = toMatrix(array);
@@ -3217,10 +3217,7 @@ const EXPAND = {
3217
3217
  // -----------------------------------------------------------------------------
3218
3218
  const FLATTEN = {
3219
3219
  description: _t("Flattens all the values from one or more ranges into a single column."),
3220
- args: [
3221
- arg("range (any, range<any>)", _t("The first range to flatten.")),
3222
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to flatten.")),
3223
- ],
3220
+ args: [arg("range (any, range<any>, repeating)", _t("The range to flatten."))],
3224
3221
  compute: function (...ranges) {
3225
3222
  return [flattenRowFirst(ranges, (val) => (val === undefined ? { value: "" } : val))];
3226
3223
  },
@@ -3278,10 +3275,7 @@ const FREQUENCY = {
3278
3275
  // -----------------------------------------------------------------------------
3279
3276
  const HSTACK = {
3280
3277
  description: _t("Appends ranges horizontally and in sequence to return a larger array."),
3281
- args: [
3282
- arg("range1 (any, range<any>)", _t("The first range to be appended.")),
3283
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to add to range1.")),
3284
- ],
3278
+ args: [arg("range (any, range<any>, repeating)", _t("The range to be appended."))],
3285
3279
  compute: function (...ranges) {
3286
3280
  const nbRows = Math.max(...ranges.map((r) => r?.[0]?.length ?? 0));
3287
3281
  const result = [];
@@ -3367,8 +3361,7 @@ const MMULT = {
3367
3361
  const SUMPRODUCT = {
3368
3362
  description: _t("Calculates the sum of the products of corresponding entries in equal-sized ranges."),
3369
3363
  args: [
3370
- arg("range1 (number, range<number>)", _t("The first range whose entries will be multiplied with corresponding entries in the other ranges.")),
3371
- arg("range2 (number, range<number>, repeating)", _t("The other range whose entries will be multiplied with corresponding entries in the other ranges.")),
3364
+ arg("range (number, range<number>, repeating)", _t("The range whose entries will be multiplied with corresponding entries in the other range.")),
3372
3365
  ],
3373
3366
  compute: function (...args) {
3374
3367
  if (!areSameDimensions(...args)) {
@@ -3554,10 +3547,7 @@ const TRANSPOSE = {
3554
3547
  // -----------------------------------------------------------------------------
3555
3548
  const VSTACK = {
3556
3549
  description: _t("Appends ranges vertically and in sequence to return a larger array."),
3557
- args: [
3558
- arg("range1 (any, range<any>)", _t("The first range to be appended.")),
3559
- arg("range2 (any, range<any>, repeating)", _t("Additional ranges to add to range1.")),
3560
- ],
3550
+ args: [arg("range (any, range<any>, repeating)", _t("The range to be appended."))],
3561
3551
  compute: function (...ranges) {
3562
3552
  const nbColumns = Math.max(...ranges.map((range) => toMatrix(range).length));
3563
3553
  const nbRows = ranges.reduce((acc, range) => acc + toMatrix(range)[0].length, 0);
@@ -6152,6 +6142,7 @@ const readonlyAllowedCommands = new Set([
6152
6142
  "COPY",
6153
6143
  "RESIZE_SHEETVIEW",
6154
6144
  "SET_VIEWPORT_OFFSET",
6145
+ "SET_ZOOM",
6155
6146
  "EVALUATE_CELLS",
6156
6147
  "EVALUATE_CHARTS",
6157
6148
  "SET_FORMULA_VISIBILITY",
@@ -6867,8 +6858,7 @@ const COTH = {
6867
6858
  const COUNTBLANK = {
6868
6859
  description: _t("Number of empty values."),
6869
6860
  args: [
6870
- arg("value1 (any, range)", _t("The first value or range in which to count the number of blanks.")),
6871
- arg("value2 (any, range, repeating)", _t("Additional values or ranges in which to count the number of blanks.")),
6861
+ arg("value (any, range, repeating)", _t("Value or range in which to count the number of blanks.")),
6872
6862
  ],
6873
6863
  compute: function (...args) {
6874
6864
  return reduceAny(args, (acc, a) => {
@@ -6910,10 +6900,8 @@ const COUNTIF = {
6910
6900
  const COUNTIFS = {
6911
6901
  description: _t("Count values depending on multiple criteria."),
6912
6902
  args: [
6913
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
6914
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
6915
- 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.")),
6916
- arg("criterion2 (string, repeating)", _t("Additional criteria to check.")),
6903
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6904
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6917
6905
  ],
6918
6906
  compute: function (...args) {
6919
6907
  let count = 0;
@@ -6929,10 +6917,7 @@ const COUNTIFS = {
6929
6917
  // -----------------------------------------------------------------------------
6930
6918
  const COUNTUNIQUE = {
6931
6919
  description: _t("Counts number of unique values in a range."),
6932
- args: [
6933
- arg("value1 (any, range)", _t("The first value or range to consider for uniqueness.")),
6934
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider for uniqueness.")),
6935
- ],
6920
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider for uniqueness."))],
6936
6921
  compute: function (...args) {
6937
6922
  return countUnique(args);
6938
6923
  },
@@ -6944,10 +6929,8 @@ const COUNTUNIQUEIFS = {
6944
6929
  description: _t("Counts number of unique values in a range, filtered by a set of criteria."),
6945
6930
  args: [
6946
6931
  arg("range (range)", _t("The range of cells from which the number of unique values will be counted.")),
6947
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
6948
- 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.")),
6949
- 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.")),
6950
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
6932
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6933
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6951
6934
  ],
6952
6935
  compute: function (range, ...args) {
6953
6936
  const uniqueValues = new Set();
@@ -7303,8 +7286,7 @@ const POWER = {
7303
7286
  const PRODUCT = {
7304
7287
  description: _t("Result of multiplying a series of numbers together."),
7305
7288
  args: [
7306
- arg("factor1 (number, range<number>)", _t("The first number or range to calculate for the product.")),
7307
- arg("factor2 (number, range<number>, repeating)", _t("More numbers or ranges to calculate for the product.")),
7289
+ arg("factor (number, range<number>, repeating)", _t("Number or range to calculate for the product.")),
7308
7290
  ],
7309
7291
  compute: function (...factors) {
7310
7292
  let count = 0;
@@ -7636,8 +7618,7 @@ const SUBTOTAL = {
7636
7618
  ...subtotalFunctionOptionsIncludeHiddenRows,
7637
7619
  ...subtotalFunctionOptionsExcludeHiddenRows,
7638
7620
  ]),
7639
- arg("ref1 (meta, range<meta>)", _t("The range or reference for which you want the subtotal.")),
7640
- arg("ref2 (meta, range<meta>, repeating)", _t("Additional ranges or references for which you want the subtotal.")),
7621
+ arg("ref (meta, range<meta>, repeating)", _t("Range or reference for which you want the subtotal.")),
7641
7622
  ],
7642
7623
  compute: function (functionCode, ...refs) {
7643
7624
  let code = toInteger(functionCode, this.locale);
@@ -7681,10 +7662,7 @@ const SUBTOTAL = {
7681
7662
  // -----------------------------------------------------------------------------
7682
7663
  const SUM = {
7683
7664
  description: _t("Sum of a series of numbers and/or cells."),
7684
- args: [
7685
- arg("value1 (number, range<number>)", _t("The first number or range to add together.")),
7686
- arg("value2 (number, range<number>, repeating)", _t("Additional numbers or ranges to add to value1.")),
7687
- ],
7665
+ args: [arg("value (number, range<number>, repeating)", _t("Number or range to add together."))],
7688
7666
  compute: function (...values) {
7689
7667
  const v1 = values[0];
7690
7668
  return {
@@ -7726,10 +7704,8 @@ const SUMIFS = {
7726
7704
  description: _t("Sums a range depending on multiple criteria."),
7727
7705
  args: [
7728
7706
  arg("sum_range (range)", _t("The range to sum.")),
7729
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
7730
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
7731
- arg("criteria_range2 (any, range, repeating)", _t("Additional ranges to check.")),
7732
- arg("criterion2 (string, repeating)", _t("Additional criteria to check.")),
7707
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
7708
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
7733
7709
  ],
7734
7710
  compute: function (sumRange, ...criters) {
7735
7711
  let sum = 0;
@@ -8196,8 +8172,7 @@ function centile(data, percent, isInclusive, locale) {
8196
8172
  const AVEDEV = {
8197
8173
  description: _t("Average magnitude of deviations from mean."),
8198
8174
  args: [
8199
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
8200
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
8175
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
8201
8176
  ],
8202
8177
  compute: function (...values) {
8203
8178
  let count = 0;
@@ -8219,8 +8194,7 @@ const AVEDEV = {
8219
8194
  const AVERAGE = {
8220
8195
  description: _t("Numerical average value in a dataset, ignoring text."),
8221
8196
  args: [
8222
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the average value.")),
8223
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the average value.")),
8197
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8224
8198
  ],
8225
8199
  compute: function (...values) {
8226
8200
  return {
@@ -8238,10 +8212,8 @@ const negativeWeightError = _t("[[FUNCTION_NAME]] expects the weight to be posit
8238
8212
  const AVERAGE_WEIGHTED = {
8239
8213
  description: _t("Weighted average."),
8240
8214
  args: [
8241
- arg("values (number, range<number>)", _t("Values to average.")),
8242
- arg("weights (number, range<number>)", _t("Weights for each corresponding value.")),
8243
- arg("additional_values (number, range<number>, repeating)", _t("Additional values to average.")),
8244
- arg("additional_weights (number, range<number>, repeating)", _t("Additional weights.")),
8215
+ arg("values (number, range<number>, repeating)", _t("Value to average.")),
8216
+ arg("weights (number, range<number>, repeating)", _t("Weight for each corresponding value.")),
8245
8217
  ],
8246
8218
  compute: function (...args) {
8247
8219
  let sum = 0;
@@ -8297,8 +8269,7 @@ const AVERAGE_WEIGHTED = {
8297
8269
  const AVERAGEA = {
8298
8270
  description: _t("Numerical average value in a dataset."),
8299
8271
  args: [
8300
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the average value.")),
8301
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the average value.")),
8272
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8302
8273
  ],
8303
8274
  compute: function (...args) {
8304
8275
  let count = 0;
@@ -8351,10 +8322,8 @@ const AVERAGEIFS = {
8351
8322
  description: _t("Average of values depending on multiple criteria."),
8352
8323
  args: [
8353
8324
  arg("average_range (range)", _t("The range to average.")),
8354
- arg("criteria_range1 (range)", _t("The range to check against criterion1.")),
8355
- arg("criterion1 (string)", _t("The pattern or test to apply to criteria_range1.")),
8356
- arg("criteria_range2 (any, range, repeating)", _t("Additional criteria_range and criterion to check.")),
8357
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8325
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
8326
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8358
8327
  ],
8359
8328
  compute: function (averageRange, ...args) {
8360
8329
  const _averageRange = toMatrix(averageRange);
@@ -8380,8 +8349,7 @@ const AVERAGEIFS = {
8380
8349
  const COUNT = {
8381
8350
  description: _t("The number of numeric values in dataset."),
8382
8351
  args: [
8383
- arg("value1 (number, any, range<number>)", _t("The first value or range to consider when counting.")),
8384
- arg("value2 (number, any, range<number>, repeating)", _t("Additional values or ranges to consider when counting.")),
8352
+ arg("value (number, any, range<number>, repeating)", _t("Value or range to consider when counting.")),
8385
8353
  ],
8386
8354
  compute: function (...values) {
8387
8355
  return countNumbers(values, this.locale);
@@ -8393,10 +8361,7 @@ const COUNT = {
8393
8361
  // -----------------------------------------------------------------------------
8394
8362
  const COUNTA = {
8395
8363
  description: _t("The number of values in a dataset."),
8396
- args: [
8397
- arg("value1 (any, range)", _t("The first value or range to consider when counting.")),
8398
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when counting.")),
8399
- ],
8364
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider when counting."))],
8400
8365
  compute: function (...values) {
8401
8366
  return countAny(values);
8402
8367
  },
@@ -8629,8 +8594,7 @@ const MATTHEWS = {
8629
8594
  const MAX = {
8630
8595
  description: _t("Maximum value in a numeric dataset."),
8631
8596
  args: [
8632
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the maximum value.")),
8633
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the maximum value.")),
8597
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8634
8598
  ],
8635
8599
  compute: function (...values) {
8636
8600
  return max(values, this.locale);
@@ -8643,8 +8607,7 @@ const MAX = {
8643
8607
  const MAXA = {
8644
8608
  description: _t("Maximum numeric value in a dataset."),
8645
8609
  args: [
8646
- arg("value1 (any, range)", _t("The first value or range to consider when calculating the maximum value.")),
8647
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when calculating the maximum value.")),
8610
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8648
8611
  ],
8649
8612
  compute: function (...args) {
8650
8613
  const maxa = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8661,10 +8624,8 @@ const MAXIFS = {
8661
8624
  description: _t("Returns the maximum value in a range of cells, filtered by a set of criteria."),
8662
8625
  args: [
8663
8626
  arg("range (range)", _t("The range of cells from which the maximum will be determined.")),
8664
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
8665
- 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.")),
8666
- 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.")),
8667
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8627
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8628
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
8668
8629
  ],
8669
8630
  compute: function (range, ...args) {
8670
8631
  let result = -Infinity;
@@ -8684,8 +8645,7 @@ const MAXIFS = {
8684
8645
  const MEDIAN = {
8685
8646
  description: _t("Median value in a numeric dataset."),
8686
8647
  args: [
8687
- arg("value1 (any, range)", _t("The first value or range to consider when calculating the median value.")),
8688
- arg("value2 (any, range, repeating)", _t("Additional values or ranges to consider when calculating the median value.")),
8648
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the median value.")),
8689
8649
  ],
8690
8650
  compute: function (...values) {
8691
8651
  const data = [];
@@ -8705,8 +8665,7 @@ const MEDIAN = {
8705
8665
  const MIN = {
8706
8666
  description: _t("Minimum value in a numeric dataset."),
8707
8667
  args: [
8708
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the minimum value.")),
8709
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the minimum value.")),
8668
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8710
8669
  ],
8711
8670
  compute: function (...values) {
8712
8671
  return min(values, this.locale);
@@ -8719,8 +8678,7 @@ const MIN = {
8719
8678
  const MINA = {
8720
8679
  description: _t("Minimum numeric value in a dataset."),
8721
8680
  args: [
8722
- arg("value1 (number, range<number>)", _t("The first value or range to consider when calculating the minimum value.")),
8723
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to consider when calculating the minimum value.")),
8681
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8724
8682
  ],
8725
8683
  compute: function (...args) {
8726
8684
  const mina = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8737,10 +8695,8 @@ const MINIFS = {
8737
8695
  description: _t("Returns the minimum value in a range of cells, filtered by a set of criteria."),
8738
8696
  args: [
8739
8697
  arg("range (range)", _t("The range of cells from which the minimum will be determined.")),
8740
- arg("criteria_range1 (range)", _t("The range of cells over which to evaluate criterion1.")),
8741
- 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.")),
8742
- 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.")),
8743
- arg("criterion2 (string, repeating)", _t("The pattern or test to apply to criteria_range2.")),
8698
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8699
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8744
8700
  ],
8745
8701
  compute: function (range, ...args) {
8746
8702
  let result = Infinity;
@@ -9081,8 +9037,7 @@ const SPEARMAN = {
9081
9037
  const STDEV = {
9082
9038
  description: _t("Standard deviation."),
9083
9039
  args: [
9084
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9085
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9040
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9086
9041
  ],
9087
9042
  compute: function (...args) {
9088
9043
  return Math.sqrt(VAR.compute.bind(this)(...args));
@@ -9095,8 +9050,7 @@ const STDEV = {
9095
9050
  const STDEV_P = {
9096
9051
  description: _t("Standard deviation of entire population."),
9097
9052
  args: [
9098
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9099
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9053
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9100
9054
  ],
9101
9055
  compute: function (...args) {
9102
9056
  return Math.sqrt(VAR_P.compute.bind(this)(...args));
@@ -9109,8 +9063,7 @@ const STDEV_P = {
9109
9063
  const STDEV_S = {
9110
9064
  description: _t("Standard deviation."),
9111
9065
  args: [
9112
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9113
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9066
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9114
9067
  ],
9115
9068
  compute: function (...args) {
9116
9069
  return Math.sqrt(VAR_S.compute.bind(this)(...args));
@@ -9123,8 +9076,7 @@ const STDEV_S = {
9123
9076
  const STDEVA = {
9124
9077
  description: _t("Standard deviation of sample (text as 0)."),
9125
9078
  args: [
9126
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9127
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9079
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9128
9080
  ],
9129
9081
  compute: function (...args) {
9130
9082
  return Math.sqrt(VARA.compute.bind(this)(...args));
@@ -9137,8 +9089,7 @@ const STDEVA = {
9137
9089
  const STDEVP = {
9138
9090
  description: _t("Standard deviation of entire population."),
9139
9091
  args: [
9140
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9141
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9092
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9142
9093
  ],
9143
9094
  compute: function (...args) {
9144
9095
  return Math.sqrt(VARP.compute.bind(this)(...args));
@@ -9151,8 +9102,7 @@ const STDEVP = {
9151
9102
  const STDEVPA = {
9152
9103
  description: _t("Standard deviation of entire population (text as 0)."),
9153
9104
  args: [
9154
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9155
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9105
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9156
9106
  ],
9157
9107
  compute: function (...args) {
9158
9108
  return Math.sqrt(VARPA.compute.bind(this)(...args));
@@ -9202,8 +9152,7 @@ const TREND = {
9202
9152
  const VAR = {
9203
9153
  description: _t("Variance."),
9204
9154
  args: [
9205
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9206
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9155
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9207
9156
  ],
9208
9157
  compute: function (...args) {
9209
9158
  return variance(args, true, false, this.locale);
@@ -9216,8 +9165,7 @@ const VAR = {
9216
9165
  const VAR_P = {
9217
9166
  description: _t("Variance of entire population."),
9218
9167
  args: [
9219
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9220
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9168
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9221
9169
  ],
9222
9170
  compute: function (...args) {
9223
9171
  return variance(args, false, false, this.locale);
@@ -9230,8 +9178,7 @@ const VAR_P = {
9230
9178
  const VAR_S = {
9231
9179
  description: _t("Variance."),
9232
9180
  args: [
9233
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9234
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9181
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9235
9182
  ],
9236
9183
  compute: function (...args) {
9237
9184
  return variance(args, true, false, this.locale);
@@ -9244,8 +9191,7 @@ const VAR_S = {
9244
9191
  const VARA = {
9245
9192
  description: _t("Variance of sample (text as 0)."),
9246
9193
  args: [
9247
- arg("value1 (number, range<number>)", _t("The first value or range of the sample.")),
9248
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the sample.")),
9194
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9249
9195
  ],
9250
9196
  compute: function (...args) {
9251
9197
  return variance(args, true, true, this.locale);
@@ -9258,8 +9204,7 @@ const VARA = {
9258
9204
  const VARP = {
9259
9205
  description: _t("Variance of entire population."),
9260
9206
  args: [
9261
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9262
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9207
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9263
9208
  ],
9264
9209
  compute: function (...args) {
9265
9210
  return variance(args, false, false, this.locale);
@@ -9272,8 +9217,7 @@ const VARP = {
9272
9217
  const VARPA = {
9273
9218
  description: _t("Variance of entire population (text as 0)."),
9274
9219
  args: [
9275
- arg("value1 (number, range<number>)", _t("The first value or range of the population.")),
9276
- arg("value2 (number, range<number>, repeating)", _t("Additional values or ranges to include in the population.")),
9220
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9277
9221
  ],
9278
9222
  compute: function (...args) {
9279
9223
  return variance(args, false, true, this.locale);
@@ -11076,8 +11020,7 @@ const FILTER = {
11076
11020
  // TODO modify args description when vectorization on formulas is available
11077
11021
  args: [
11078
11022
  arg("range (any, range<any>)", _t("The data to be filtered.")),
11079
- arg("condition1 (boolean, range<boolean>)", _t("A column or row containing true or false values corresponding to the first column or row of range.")),
11080
- arg("condition2 (boolean, range<boolean>, repeating)", _t("Additional column or row containing true or false values.")),
11023
+ arg("condition (boolean, range<boolean>, repeating)", _t("Column or row containing true or false values corresponding to the range.")),
11081
11024
  ],
11082
11025
  compute: function (range, ...conditions) {
11083
11026
  let _array = toMatrix(range);
@@ -11117,8 +11060,8 @@ const SORT = {
11117
11060
  description: _t("Sorts the rows of a given array or range by the values in one or more columns."),
11118
11061
  args: [
11119
11062
  arg("range (range)", _t("The data to be sorted.")),
11120
- 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.")),
11121
- arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order."), [
11063
+ 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.")),
11064
+ arg("is_ascending (boolean, repeating, optional)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order."), [
11122
11065
  { value: true, label: _t("Ascending") },
11123
11066
  { value: false, label: _t("Descending") },
11124
11067
  ]),
@@ -11138,8 +11081,8 @@ const SORTN = {
11138
11081
  arg("range (range)", _t("The data to be sorted.")),
11139
11082
  arg("n (number)", _t("The number of items to return.")),
11140
11083
  arg("display_ties_mode (number, default=0)", _t("A number representing the way to display ties.")),
11141
- 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.")),
11142
- arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order."), [
11084
+ 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.")),
11085
+ arg("is_ascending (boolean, repeating, optional)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order."), [
11143
11086
  { value: true, label: _t("Ascending") },
11144
11087
  { value: false, label: _t("Descending") },
11145
11088
  ]),
@@ -12407,8 +12350,7 @@ const NPV = {
12407
12350
  description: _t("The net present value of an investment based on a series of periodic cash flows and a discount rate."),
12408
12351
  args: [
12409
12352
  arg("discount (number)", _t("The discount rate of the investment over one period.")),
12410
- arg("cashflow1 (number, range<number>)", _t("The first future cash flow.")),
12411
- arg("cashflow2 (number, range<number>, repeating)", _t("Additional future cash flows.")),
12353
+ arg("cashflow (number, range<number>, repeating)", _t("The future cash flows.")),
12412
12354
  ],
12413
12355
  // to do: replace by dollar format
12414
12356
  compute: function (discount, ...values) {
@@ -13763,8 +13705,7 @@ function boolOr(args) {
13763
13705
  const AND = {
13764
13706
  description: _t("Logical `and` operator."),
13765
13707
  args: [
13766
- 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.")),
13767
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that represent logical values.")),
13708
+ 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.")),
13768
13709
  ],
13769
13710
  compute: function (...logicalExpressions) {
13770
13711
  const { result, foundBoolean } = boolAnd(logicalExpressions);
@@ -13847,10 +13788,8 @@ const IFNA = {
13847
13788
  const IFS = {
13848
13789
  description: _t("Returns a value depending on multiple logical expressions."),
13849
13790
  args: [
13850
- 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.")),
13851
- arg("value1 (any, range)", _t("The returned value if condition1 is TRUE.")),
13852
- arg("condition2 (boolean, any, range, repeating)", _t("Additional conditions to be evaluated if the previous ones are FALSE.")),
13853
- arg("value2 (any, range, repeating)", _t("Additional values to be returned if their corresponding conditions are TRUE.")),
13791
+ 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.")),
13792
+ arg("value (any, range, repeating)", _t("The value to be returned if its corresponding condition is TRUE.")),
13854
13793
  ],
13855
13794
  compute: function (...values) {
13856
13795
  if (values.length % 2 !== 0) {
@@ -13889,8 +13828,7 @@ const NOT = {
13889
13828
  const OR = {
13890
13829
  description: _t("Logical `or` operator."),
13891
13830
  args: [
13892
- 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.")),
13893
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that evaluate to logical values.")),
13831
+ 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.")),
13894
13832
  ],
13895
13833
  compute: function (...logicalExpressions) {
13896
13834
  const { result, foundBoolean } = boolOr(logicalExpressions);
@@ -13908,10 +13846,8 @@ const SWITCH = {
13908
13846
  description: _t("Returns a value by comparing cases to an expression."),
13909
13847
  args: [
13910
13848
  arg("expression (number, boolean, string)", _t("The value to be checked.")),
13911
- arg("case1 (number, boolean, string)", _t("The first case to be checked against expression.")),
13912
- arg("value1 (any)", _t("The corresponding value to be returned if case1 matches expression.")),
13913
- arg("case2 (any, repeating)", _t("Additional cases to try if the previous ones don't match expression.")),
13914
- arg("value2 (any, repeating)", _t("Additional values to be returned if their corresponding cases match expression.")),
13849
+ arg("case (any, repeating)", _t("Case to be checked against expression.")),
13850
+ arg("value (any, repeating)", _t("Value to be returned if its corresponding case matches expression.")),
13915
13851
  arg(`default (any, default="empty")`, _t("An optional default value to be returned if none of the cases match expression.")),
13916
13852
  ],
13917
13853
  compute: function (expression, ...casesAndValues) {
@@ -13946,8 +13882,7 @@ const TRUE = {
13946
13882
  const XOR = {
13947
13883
  description: _t("Logical `xor` operator."),
13948
13884
  args: [
13949
- 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.")),
13950
- arg("logical_expression2 (boolean, range<boolean>, repeating)", _t("More expressions that evaluate to logical values.")),
13885
+ 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.")),
13951
13886
  ],
13952
13887
  compute: function (...logicalExpressions) {
13953
13888
  let foundBoolean = false;
@@ -15422,8 +15357,8 @@ const PIVOT_VALUE = {
15422
15357
  args: [
15423
15358
  arg("pivot_id (number,string)", _t("ID of the pivot.")),
15424
15359
  arg("measure_name (string)", _t("Name of the measure.")),
15425
- arg("domain_field_name (string,repeating)", _t("Field name.")),
15426
- arg("domain_value (number,string,boolean,repeating)", _t("Value.")),
15360
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15361
+ arg("domain_value (number,string,boolean,repeating,optional)", _t("Value.")),
15427
15362
  ],
15428
15363
  compute: function (formulaId, measureName, ...domainArgs) {
15429
15364
  const _pivotFormulaId = toString(formulaId);
@@ -15458,8 +15393,8 @@ const PIVOT_HEADER = {
15458
15393
  description: _t("Get the header of a pivot."),
15459
15394
  args: [
15460
15395
  arg("pivot_id (number,string)", _t("ID of the pivot.")),
15461
- arg("domain_field_name (string,repeating)", _t("Field name.")),
15462
- arg("domain_value (number,string,value,repeating)", _t("Value.")),
15396
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15397
+ arg("domain_value (number,string,value,repeating,optional)", _t("Value.")),
15463
15398
  ],
15464
15399
  compute: function (pivotId, ...domainArgs) {
15465
15400
  const _pivotFormulaId = toString(pivotId);
@@ -16330,10 +16265,7 @@ const CLEAN = {
16330
16265
  // -----------------------------------------------------------------------------
16331
16266
  const CONCATENATE = {
16332
16267
  description: _t("Appends strings to one another."),
16333
- args: [
16334
- arg("string1 (string, range<string>)", _t("The initial string.")),
16335
- arg("string2 (string, range<string>, repeating)", _t("More strings to append in sequence.")),
16336
- ],
16268
+ args: [arg("string (string, range<string>, repeating)", _t("String to append in sequence."))],
16337
16269
  compute: function (...datas) {
16338
16270
  return reduceAny(datas, (acc, a) => acc + toString(a), "");
16339
16271
  },
@@ -16388,8 +16320,7 @@ const JOIN = {
16388
16320
  description: _t("Concatenates elements of arrays with delimiter."),
16389
16321
  args: [
16390
16322
  arg("delimiter (string)", _t("The character or string to place between each concatenated value.")),
16391
- arg("value_or_array1 (string, range<string>)", _t("The value or values to be appended using delimiter.")),
16392
- arg("value_or_array2 (string, range<string>, repeating)", _t("More values to be appended using delimiter.")),
16323
+ arg("value_or_array (string, range<string>, repeating)", _t("Value to be appended using delimiter.")),
16393
16324
  ],
16394
16325
  compute: function (delimiter, ...valuesOrArrays) {
16395
16326
  const _delimiter = toString(delimiter);
@@ -16680,13 +16611,12 @@ const TEXTJOIN_DEFAULT_IGNORE_EMPTY = true;
16680
16611
  const TEXTJOIN = {
16681
16612
  description: _t("Combines text from multiple strings and/or arrays."),
16682
16613
  args: [
16683
- arg("delimiter (string)", _t(" A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.")),
16614
+ arg("delimiter (string)", _t("A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.")),
16684
16615
  arg("ignore_empty (boolean)", _t("A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result."), [
16685
16616
  { value: true, label: _t("Ignore empty cells") },
16686
16617
  { value: false, label: _t("Include empty cells (default)") },
16687
16618
  ]),
16688
- arg("text1 (string, range<string>)", _t("Any text item. This could be a string, or an array of strings in a range.")),
16689
- arg("text2 (string, range<string>, repeating)", _t("Additional text item(s).")),
16619
+ arg("texts (string, range<string>, repeating)", _t("Text item to join.")),
16690
16620
  ],
16691
16621
  compute: function (delimiter, ignoreEmpty = { value: TEXTJOIN_DEFAULT_IGNORE_EMPTY }, ...textsOrArrays) {
16692
16622
  const _delimiter = toString(delimiter);
@@ -17559,7 +17489,7 @@ function compileTokensOrThrow(tokens) {
17559
17489
  const compiledArgs = [];
17560
17490
  const argToFocus = argTargeting(functionDefinition, args.length);
17561
17491
  for (let i = 0; i < args.length; i++) {
17562
- const argDefinition = functionDefinition.args[argToFocus(i) ?? -1];
17492
+ const argDefinition = functionDefinition.args[argToFocus(i).index ?? -1];
17563
17493
  const currentArg = args[i];
17564
17494
  const argTypes = argDefinition.type || [];
17565
17495
  // detect when an argument need to be evaluated as a meta argument
@@ -17738,12 +17668,15 @@ function assertEnoughArgs(ast) {
17738
17668
  }
17739
17669
  if (nbrArgRepeating > 1) {
17740
17670
  const nbrValueRepeating = nbrArgRepeating * Math.floor((nbrArgSupplied - minArgRequired) / nbrArgRepeating);
17741
- const nbrValueRemaining = nbrArgSupplied - minArgRequired - nbrValueRepeating - functionDefinition.nbrArgOptional;
17671
+ const nbrValueRemaining = nbrArgSupplied -
17672
+ minArgRequired -
17673
+ nbrValueRepeating -
17674
+ functionDefinition.nbrOptionalNonRepeatingArgs;
17742
17675
  if (nbrValueRemaining > 0) {
17743
17676
  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.", {
17744
17677
  functionName,
17745
17678
  nbrArgRepeating,
17746
- nbrArgOptional: functionDefinition.nbrArgOptional,
17679
+ nbrArgOptional: functionDefinition.nbrOptionalNonRepeatingArgs,
17747
17680
  nbrValueRemaining,
17748
17681
  }));
17749
17682
  }
@@ -40492,6 +40425,7 @@ pivotRegistry.add("SPREADSHEET", {
40492
40425
  isMeasureCandidate: (field) => field.type !== "boolean",
40493
40426
  isGroupable: () => true,
40494
40427
  canHaveCustomGroup: (field) => field.type === "char" && !field.isCustomField,
40428
+ isPivotUnused: () => true,
40495
40429
  });
40496
40430
 
40497
40431
  const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
@@ -40510,7 +40444,7 @@ class PivotUIPlugin extends CoreViewPlugin {
40510
40444
  "isSpillPivotFormula",
40511
40445
  ];
40512
40446
  pivots = {};
40513
- unusedPivots;
40447
+ unusedPivotsInFormulas;
40514
40448
  custom;
40515
40449
  constructor(config) {
40516
40450
  super(config);
@@ -40550,12 +40484,12 @@ class PivotUIPlugin extends CoreViewPlugin {
40550
40484
  }
40551
40485
  case "DELETE_SHEET":
40552
40486
  case "UPDATE_CELL": {
40553
- this.unusedPivots = undefined;
40487
+ this.unusedPivotsInFormulas = undefined;
40554
40488
  break;
40555
40489
  }
40556
40490
  case "UNDO":
40557
40491
  case "REDO": {
40558
- this.unusedPivots = undefined;
40492
+ this.unusedPivotsInFormulas = undefined;
40559
40493
  const pivotCommands = cmd.commands.filter(isPivotCommand);
40560
40494
  for (const cmd of pivotCommands) {
40561
40495
  const pivotId = cmd.pivotId;
@@ -40714,7 +40648,9 @@ class PivotUIPlugin extends CoreViewPlugin {
40714
40648
  return this.pivots[pivotId];
40715
40649
  }
40716
40650
  isPivotUnused(pivotId) {
40717
- return this._getUnusedPivots().includes(pivotId);
40651
+ const { type } = this.getters.getPivot(pivotId);
40652
+ return (this._getUnusedPivotsInFormulas().includes(pivotId) &&
40653
+ pivotRegistry.get(type).isPivotUnused(this.getters, pivotId));
40718
40654
  }
40719
40655
  getPivotCellSortDirection(position) {
40720
40656
  const pivotId = this.getters.getPivotIdFromPosition(position);
@@ -40750,9 +40686,9 @@ class PivotUIPlugin extends CoreViewPlugin {
40750
40686
  this.pivots[pivotId].onDefinitionChange(definition);
40751
40687
  }
40752
40688
  }
40753
- _getUnusedPivots() {
40754
- if (this.unusedPivots !== undefined) {
40755
- return this.unusedPivots;
40689
+ _getUnusedPivotsInFormulas() {
40690
+ if (this.unusedPivotsInFormulas !== undefined) {
40691
+ return this.unusedPivotsInFormulas;
40756
40692
  }
40757
40693
  const unusedPivots = new Set(this.getters.getPivotIds());
40758
40694
  for (const sheetId of this.getters.getSheetIds()) {
@@ -40762,14 +40698,14 @@ class PivotUIPlugin extends CoreViewPlugin {
40762
40698
  if (pivotId) {
40763
40699
  unusedPivots.delete(pivotId);
40764
40700
  if (!unusedPivots.size) {
40765
- this.unusedPivots = [];
40701
+ this.unusedPivotsInFormulas = [];
40766
40702
  return [];
40767
40703
  }
40768
40704
  }
40769
40705
  }
40770
40706
  }
40771
- this.unusedPivots = [...unusedPivots];
40772
- return this.unusedPivots;
40707
+ this.unusedPivotsInFormulas = [...unusedPivots];
40708
+ return this.unusedPivotsInFormulas;
40773
40709
  }
40774
40710
  }
40775
40711
 
@@ -46175,6 +46111,7 @@ class SheetViewPlugin extends UIPlugin {
46175
46111
  "getVisibleFigures",
46176
46112
  "getVisibleRect",
46177
46113
  "getVisibleRectWithoutHeaders",
46114
+ "getVisibleRectWithZoom",
46178
46115
  "getVisibleCellPositions",
46179
46116
  "getColRowOffsetInViewport",
46180
46117
  "getMainViewportCoordinates",
@@ -46190,6 +46127,8 @@ class SheetViewPlugin extends UIPlugin {
46190
46127
  "getFigureUI",
46191
46128
  "getPositionAnchorOffset",
46192
46129
  "getGridOffset",
46130
+ "getViewportZoomLevel",
46131
+ "getScrollBarWidth",
46193
46132
  ];
46194
46133
  viewports = {};
46195
46134
  /**
@@ -46202,6 +46141,7 @@ class SheetViewPlugin extends UIPlugin {
46202
46141
  sheetViewHeight = getDefaultSheetViewSize();
46203
46142
  gridOffsetX = 0;
46204
46143
  gridOffsetY = 0;
46144
+ zoomLevel = 1;
46205
46145
  sheetsWithDirtyViewports = new Set();
46206
46146
  shouldAdjustViewports = false;
46207
46147
  // ---------------------------------------------------------------------------
@@ -46268,6 +46208,9 @@ class SheetViewPlugin extends UIPlugin {
46268
46208
  case "SET_VIEWPORT_OFFSET":
46269
46209
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
46270
46210
  break;
46211
+ case "SET_ZOOM":
46212
+ this.zoomLevel = cmd.zoom || 1;
46213
+ break;
46271
46214
  case "SHIFT_VIEWPORT_DOWN":
46272
46215
  const sheetId = this.getters.getActiveSheetId();
46273
46216
  const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
@@ -46471,7 +46414,7 @@ class SheetViewPlugin extends UIPlugin {
46471
46414
  for (const i of relevantIndexes) {
46472
46415
  offset += this.getters.getHeaderSize(sheetId, dimension, i);
46473
46416
  }
46474
- return offset;
46417
+ return offset * this.zoomLevel;
46475
46418
  }
46476
46419
  /**
46477
46420
  * Check if a given position is visible in the viewport.
@@ -46479,6 +46422,9 @@ class SheetViewPlugin extends UIPlugin {
46479
46422
  isVisibleInViewport({ sheetId, col, row }) {
46480
46423
  return this.getSubViewports(sheetId).some((pane) => pane.isVisible(col, row));
46481
46424
  }
46425
+ getScrollBarWidth() {
46426
+ return SCROLLBAR_WIDTH / this.zoomLevel;
46427
+ }
46482
46428
  // => returns the new offset
46483
46429
  getEdgeScrollCol(x, previousX, startingX) {
46484
46430
  let canEdgeScroll = false;
@@ -46557,6 +46503,18 @@ class SheetViewPlugin extends UIPlugin {
46557
46503
  const rect = this.getVisibleRectWithoutHeaders(zone);
46558
46504
  return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
46559
46505
  }
46506
+ /**
46507
+ * Computes the coordinates and size to draw the zone on the canvas after it has been zoomed
46508
+ */
46509
+ getVisibleRectWithZoom(zone) {
46510
+ const zoom = this.getViewportZoomLevel();
46511
+ const rect = this.getVisibleRectWithoutHeaders(zone);
46512
+ rect.width = rect.width * zoom;
46513
+ rect.height = rect.height * zoom;
46514
+ rect.x = rect.x * zoom + this.gridOffsetX * zoom;
46515
+ rect.y = rect.y * zoom + this.gridOffsetY * zoom;
46516
+ return rect;
46517
+ }
46560
46518
  /**
46561
46519
  * Computes the coordinates and size to draw the zone without taking the grid offset into account
46562
46520
  */
@@ -46638,6 +46596,9 @@ class SheetViewPlugin extends UIPlugin {
46638
46596
  };
46639
46597
  });
46640
46598
  }
46599
+ getViewportZoomLevel() {
46600
+ return this.zoomLevel;
46601
+ }
46641
46602
  // ---------------------------------------------------------------------------
46642
46603
  // Private
46643
46604
  // ---------------------------------------------------------------------------
@@ -50849,5 +50810,5 @@ export { BadExpressionError, BasePlugin, CellErrorType, CircularDependencyError,
50849
50810
 
50850
50811
 
50851
50812
  __info__.version = "19.1.0-alpha.3";
50852
- __info__.date = "2025-10-30T12:25:48.501Z";
50853
- __info__.hash = "d0b65e9";
50813
+ __info__.date = "2025-11-03T12:33:46.742Z";
50814
+ __info__.hash = "d9230f3";