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

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-12T14:16:26.552Z
7
+ * @hash 6fefc9c
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);
@@ -5772,7 +5762,10 @@ function isInside(col, row, zone) {
5772
5762
  * Check if a zone is inside another
5773
5763
  */
5774
5764
  function isZoneInside(smallZone, biggerZone) {
5775
- return isEqual(union(biggerZone, smallZone), biggerZone);
5765
+ return (smallZone.left >= biggerZone.left &&
5766
+ smallZone.right <= biggerZone.right &&
5767
+ smallZone.top >= biggerZone.top &&
5768
+ smallZone.bottom <= biggerZone.bottom);
5776
5769
  }
5777
5770
  function zoneToDimension(zone) {
5778
5771
  return {
@@ -6152,6 +6145,7 @@ const readonlyAllowedCommands = new Set([
6152
6145
  "COPY",
6153
6146
  "RESIZE_SHEETVIEW",
6154
6147
  "SET_VIEWPORT_OFFSET",
6148
+ "SET_ZOOM",
6155
6149
  "EVALUATE_CELLS",
6156
6150
  "EVALUATE_CHARTS",
6157
6151
  "SET_FORMULA_VISIBILITY",
@@ -6867,8 +6861,7 @@ const COTH = {
6867
6861
  const COUNTBLANK = {
6868
6862
  description: _t("Number of empty values."),
6869
6863
  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.")),
6864
+ arg("value (any, range, repeating)", _t("Value or range in which to count the number of blanks.")),
6872
6865
  ],
6873
6866
  compute: function (...args) {
6874
6867
  return reduceAny(args, (acc, a) => {
@@ -6910,10 +6903,8 @@ const COUNTIF = {
6910
6903
  const COUNTIFS = {
6911
6904
  description: _t("Count values depending on multiple criteria."),
6912
6905
  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.")),
6906
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6907
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6917
6908
  ],
6918
6909
  compute: function (...args) {
6919
6910
  let count = 0;
@@ -6929,10 +6920,7 @@ const COUNTIFS = {
6929
6920
  // -----------------------------------------------------------------------------
6930
6921
  const COUNTUNIQUE = {
6931
6922
  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
- ],
6923
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider for uniqueness."))],
6936
6924
  compute: function (...args) {
6937
6925
  return countUnique(args);
6938
6926
  },
@@ -6944,10 +6932,8 @@ const COUNTUNIQUEIFS = {
6944
6932
  description: _t("Counts number of unique values in a range, filtered by a set of criteria."),
6945
6933
  args: [
6946
6934
  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.")),
6935
+ arg("criteria_range (any, range, repeating)", _t("Range over which to evaluate criteria.")),
6936
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
6951
6937
  ],
6952
6938
  compute: function (range, ...args) {
6953
6939
  const uniqueValues = new Set();
@@ -7303,8 +7289,7 @@ const POWER = {
7303
7289
  const PRODUCT = {
7304
7290
  description: _t("Result of multiplying a series of numbers together."),
7305
7291
  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.")),
7292
+ arg("factor (number, range<number>, repeating)", _t("Number or range to calculate for the product.")),
7308
7293
  ],
7309
7294
  compute: function (...factors) {
7310
7295
  let count = 0;
@@ -7636,8 +7621,7 @@ const SUBTOTAL = {
7636
7621
  ...subtotalFunctionOptionsIncludeHiddenRows,
7637
7622
  ...subtotalFunctionOptionsExcludeHiddenRows,
7638
7623
  ]),
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.")),
7624
+ arg("ref (meta, range<meta>, repeating)", _t("Range or reference for which you want the subtotal.")),
7641
7625
  ],
7642
7626
  compute: function (functionCode, ...refs) {
7643
7627
  let code = toInteger(functionCode, this.locale);
@@ -7681,10 +7665,7 @@ const SUBTOTAL = {
7681
7665
  // -----------------------------------------------------------------------------
7682
7666
  const SUM = {
7683
7667
  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
- ],
7668
+ args: [arg("value (number, range<number>, repeating)", _t("Number or range to add together."))],
7688
7669
  compute: function (...values) {
7689
7670
  const v1 = values[0];
7690
7671
  return {
@@ -7726,10 +7707,8 @@ const SUMIFS = {
7726
7707
  description: _t("Sums a range depending on multiple criteria."),
7727
7708
  args: [
7728
7709
  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.")),
7710
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
7711
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
7733
7712
  ],
7734
7713
  compute: function (sumRange, ...criters) {
7735
7714
  let sum = 0;
@@ -8196,8 +8175,7 @@ function centile(data, percent, isInclusive, locale) {
8196
8175
  const AVEDEV = {
8197
8176
  description: _t("Average magnitude of deviations from mean."),
8198
8177
  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.")),
8178
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
8201
8179
  ],
8202
8180
  compute: function (...values) {
8203
8181
  let count = 0;
@@ -8219,8 +8197,7 @@ const AVEDEV = {
8219
8197
  const AVERAGE = {
8220
8198
  description: _t("Numerical average value in a dataset, ignoring text."),
8221
8199
  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.")),
8200
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8224
8201
  ],
8225
8202
  compute: function (...values) {
8226
8203
  return {
@@ -8238,10 +8215,8 @@ const negativeWeightError = _t("[[FUNCTION_NAME]] expects the weight to be posit
8238
8215
  const AVERAGE_WEIGHTED = {
8239
8216
  description: _t("Weighted average."),
8240
8217
  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.")),
8218
+ arg("values (number, range<number>, repeating)", _t("Value to average.")),
8219
+ arg("weights (number, range<number>, repeating)", _t("Weight for each corresponding value.")),
8245
8220
  ],
8246
8221
  compute: function (...args) {
8247
8222
  let sum = 0;
@@ -8297,8 +8272,7 @@ const AVERAGE_WEIGHTED = {
8297
8272
  const AVERAGEA = {
8298
8273
  description: _t("Numerical average value in a dataset."),
8299
8274
  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.")),
8275
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the average value.")),
8302
8276
  ],
8303
8277
  compute: function (...args) {
8304
8278
  let count = 0;
@@ -8351,10 +8325,8 @@ const AVERAGEIFS = {
8351
8325
  description: _t("Average of values depending on multiple criteria."),
8352
8326
  args: [
8353
8327
  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.")),
8328
+ arg("criteria_range (any, range, repeating)", _t("Range to check.")),
8329
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8358
8330
  ],
8359
8331
  compute: function (averageRange, ...args) {
8360
8332
  const _averageRange = toMatrix(averageRange);
@@ -8380,8 +8352,7 @@ const AVERAGEIFS = {
8380
8352
  const COUNT = {
8381
8353
  description: _t("The number of numeric values in dataset."),
8382
8354
  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.")),
8355
+ arg("value (number, any, range<number>, repeating)", _t("Value or range to consider when counting.")),
8385
8356
  ],
8386
8357
  compute: function (...values) {
8387
8358
  return countNumbers(values, this.locale);
@@ -8393,10 +8364,7 @@ const COUNT = {
8393
8364
  // -----------------------------------------------------------------------------
8394
8365
  const COUNTA = {
8395
8366
  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
- ],
8367
+ args: [arg("value (any, range, repeating)", _t("Value or range to consider when counting."))],
8400
8368
  compute: function (...values) {
8401
8369
  return countAny(values);
8402
8370
  },
@@ -8629,8 +8597,7 @@ const MATTHEWS = {
8629
8597
  const MAX = {
8630
8598
  description: _t("Maximum value in a numeric dataset."),
8631
8599
  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.")),
8600
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8634
8601
  ],
8635
8602
  compute: function (...values) {
8636
8603
  return max(values, this.locale);
@@ -8643,8 +8610,7 @@ const MAX = {
8643
8610
  const MAXA = {
8644
8611
  description: _t("Maximum numeric value in a dataset."),
8645
8612
  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.")),
8613
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the maximum value.")),
8648
8614
  ],
8649
8615
  compute: function (...args) {
8650
8616
  const maxa = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8661,10 +8627,8 @@ const MAXIFS = {
8661
8627
  description: _t("Returns the maximum value in a range of cells, filtered by a set of criteria."),
8662
8628
  args: [
8663
8629
  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.")),
8630
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8631
+ arg("criterion (string, repeating)", _t("Criteria to check.")),
8668
8632
  ],
8669
8633
  compute: function (range, ...args) {
8670
8634
  let result = -Infinity;
@@ -8684,8 +8648,7 @@ const MAXIFS = {
8684
8648
  const MEDIAN = {
8685
8649
  description: _t("Median value in a numeric dataset."),
8686
8650
  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.")),
8651
+ arg("value (any, range, repeating)", _t("Value or range to consider when calculating the median value.")),
8689
8652
  ],
8690
8653
  compute: function (...values) {
8691
8654
  const data = [];
@@ -8705,8 +8668,7 @@ const MEDIAN = {
8705
8668
  const MIN = {
8706
8669
  description: _t("Minimum value in a numeric dataset."),
8707
8670
  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.")),
8671
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8710
8672
  ],
8711
8673
  compute: function (...values) {
8712
8674
  return min(values, this.locale);
@@ -8719,8 +8681,7 @@ const MIN = {
8719
8681
  const MINA = {
8720
8682
  description: _t("Minimum numeric value in a dataset."),
8721
8683
  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.")),
8684
+ arg("value (number, range<number>, repeating)", _t("Value or range to consider when calculating the minimum value.")),
8724
8685
  ],
8725
8686
  compute: function (...args) {
8726
8687
  const mina = reduceNumbersTextAs0(args, (acc, a) => {
@@ -8737,10 +8698,8 @@ const MINIFS = {
8737
8698
  description: _t("Returns the minimum value in a range of cells, filtered by a set of criteria."),
8738
8699
  args: [
8739
8700
  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.")),
8701
+ arg("criteria_range (any, range, repeating)", _t("Range to evaluate criteria.")),
8702
+ arg("criterion (string, repeating)", _t("Criterion to check.")),
8744
8703
  ],
8745
8704
  compute: function (range, ...args) {
8746
8705
  let result = Infinity;
@@ -9081,8 +9040,7 @@ const SPEARMAN = {
9081
9040
  const STDEV = {
9082
9041
  description: _t("Standard deviation."),
9083
9042
  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.")),
9043
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9086
9044
  ],
9087
9045
  compute: function (...args) {
9088
9046
  return Math.sqrt(VAR.compute.bind(this)(...args));
@@ -9095,8 +9053,7 @@ const STDEV = {
9095
9053
  const STDEV_P = {
9096
9054
  description: _t("Standard deviation of entire population."),
9097
9055
  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.")),
9056
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9100
9057
  ],
9101
9058
  compute: function (...args) {
9102
9059
  return Math.sqrt(VAR_P.compute.bind(this)(...args));
@@ -9109,8 +9066,7 @@ const STDEV_P = {
9109
9066
  const STDEV_S = {
9110
9067
  description: _t("Standard deviation."),
9111
9068
  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.")),
9069
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9114
9070
  ],
9115
9071
  compute: function (...args) {
9116
9072
  return Math.sqrt(VAR_S.compute.bind(this)(...args));
@@ -9123,8 +9079,7 @@ const STDEV_S = {
9123
9079
  const STDEVA = {
9124
9080
  description: _t("Standard deviation of sample (text as 0)."),
9125
9081
  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.")),
9082
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9128
9083
  ],
9129
9084
  compute: function (...args) {
9130
9085
  return Math.sqrt(VARA.compute.bind(this)(...args));
@@ -9137,8 +9092,7 @@ const STDEVA = {
9137
9092
  const STDEVP = {
9138
9093
  description: _t("Standard deviation of entire population."),
9139
9094
  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.")),
9095
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9142
9096
  ],
9143
9097
  compute: function (...args) {
9144
9098
  return Math.sqrt(VARP.compute.bind(this)(...args));
@@ -9151,8 +9105,7 @@ const STDEVP = {
9151
9105
  const STDEVPA = {
9152
9106
  description: _t("Standard deviation of entire population (text as 0)."),
9153
9107
  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.")),
9108
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9156
9109
  ],
9157
9110
  compute: function (...args) {
9158
9111
  return Math.sqrt(VARPA.compute.bind(this)(...args));
@@ -9202,8 +9155,7 @@ const TREND = {
9202
9155
  const VAR = {
9203
9156
  description: _t("Variance."),
9204
9157
  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.")),
9158
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9207
9159
  ],
9208
9160
  compute: function (...args) {
9209
9161
  return variance(args, true, false, this.locale);
@@ -9216,8 +9168,7 @@ const VAR = {
9216
9168
  const VAR_P = {
9217
9169
  description: _t("Variance of entire population."),
9218
9170
  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.")),
9171
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9221
9172
  ],
9222
9173
  compute: function (...args) {
9223
9174
  return variance(args, false, false, this.locale);
@@ -9230,8 +9181,7 @@ const VAR_P = {
9230
9181
  const VAR_S = {
9231
9182
  description: _t("Variance."),
9232
9183
  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.")),
9184
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9235
9185
  ],
9236
9186
  compute: function (...args) {
9237
9187
  return variance(args, true, false, this.locale);
@@ -9244,8 +9194,7 @@ const VAR_S = {
9244
9194
  const VARA = {
9245
9195
  description: _t("Variance of sample (text as 0)."),
9246
9196
  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.")),
9197
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the sample.")),
9249
9198
  ],
9250
9199
  compute: function (...args) {
9251
9200
  return variance(args, true, true, this.locale);
@@ -9258,8 +9207,7 @@ const VARA = {
9258
9207
  const VARP = {
9259
9208
  description: _t("Variance of entire population."),
9260
9209
  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.")),
9210
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9263
9211
  ],
9264
9212
  compute: function (...args) {
9265
9213
  return variance(args, false, false, this.locale);
@@ -9272,8 +9220,7 @@ const VARP = {
9272
9220
  const VARPA = {
9273
9221
  description: _t("Variance of entire population (text as 0)."),
9274
9222
  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.")),
9223
+ arg("value (number, range<number>, repeating)", _t("Value or range to include in the population.")),
9277
9224
  ],
9278
9225
  compute: function (...args) {
9279
9226
  return variance(args, false, true, this.locale);
@@ -11076,8 +11023,7 @@ const FILTER = {
11076
11023
  // TODO modify args description when vectorization on formulas is available
11077
11024
  args: [
11078
11025
  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.")),
11026
+ arg("condition (boolean, range<boolean>, repeating)", _t("Column or row containing true or false values corresponding to the range.")),
11081
11027
  ],
11082
11028
  compute: function (range, ...conditions) {
11083
11029
  let _array = toMatrix(range);
@@ -11117,8 +11063,8 @@ const SORT = {
11117
11063
  description: _t("Sorts the rows of a given array or range by the values in one or more columns."),
11118
11064
  args: [
11119
11065
  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."), [
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."), [
11122
11068
  { value: true, label: _t("Ascending") },
11123
11069
  { value: false, label: _t("Descending") },
11124
11070
  ]),
@@ -11138,8 +11084,8 @@ const SORTN = {
11138
11084
  arg("range (range)", _t("The data to be sorted.")),
11139
11085
  arg("n (number)", _t("The number of items to return.")),
11140
11086
  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."), [
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."), [
11143
11089
  { value: true, label: _t("Ascending") },
11144
11090
  { value: false, label: _t("Descending") },
11145
11091
  ]),
@@ -12407,8 +12353,7 @@ const NPV = {
12407
12353
  description: _t("The net present value of an investment based on a series of periodic cash flows and a discount rate."),
12408
12354
  args: [
12409
12355
  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.")),
12356
+ arg("cashflow (number, range<number>, repeating)", _t("The future cash flows.")),
12412
12357
  ],
12413
12358
  // to do: replace by dollar format
12414
12359
  compute: function (discount, ...values) {
@@ -13763,8 +13708,7 @@ function boolOr(args) {
13763
13708
  const AND = {
13764
13709
  description: _t("Logical `and` operator."),
13765
13710
  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.")),
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.")),
13768
13712
  ],
13769
13713
  compute: function (...logicalExpressions) {
13770
13714
  const { result, foundBoolean } = boolAnd(logicalExpressions);
@@ -13847,10 +13791,8 @@ const IFNA = {
13847
13791
  const IFS = {
13848
13792
  description: _t("Returns a value depending on multiple logical expressions."),
13849
13793
  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.")),
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.")),
13854
13796
  ],
13855
13797
  compute: function (...values) {
13856
13798
  if (values.length % 2 !== 0) {
@@ -13889,8 +13831,7 @@ const NOT = {
13889
13831
  const OR = {
13890
13832
  description: _t("Logical `or` operator."),
13891
13833
  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.")),
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.")),
13894
13835
  ],
13895
13836
  compute: function (...logicalExpressions) {
13896
13837
  const { result, foundBoolean } = boolOr(logicalExpressions);
@@ -13908,10 +13849,8 @@ const SWITCH = {
13908
13849
  description: _t("Returns a value by comparing cases to an expression."),
13909
13850
  args: [
13910
13851
  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.")),
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.")),
13915
13854
  arg(`default (any, default="empty")`, _t("An optional default value to be returned if none of the cases match expression.")),
13916
13855
  ],
13917
13856
  compute: function (expression, ...casesAndValues) {
@@ -13946,8 +13885,7 @@ const TRUE = {
13946
13885
  const XOR = {
13947
13886
  description: _t("Logical `xor` operator."),
13948
13887
  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.")),
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.")),
13951
13889
  ],
13952
13890
  compute: function (...logicalExpressions) {
13953
13891
  let foundBoolean = false;
@@ -15422,8 +15360,8 @@ const PIVOT_VALUE = {
15422
15360
  args: [
15423
15361
  arg("pivot_id (number,string)", _t("ID of the pivot.")),
15424
15362
  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.")),
15363
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15364
+ arg("domain_value (number,string,boolean,repeating,optional)", _t("Value.")),
15427
15365
  ],
15428
15366
  compute: function (formulaId, measureName, ...domainArgs) {
15429
15367
  const _pivotFormulaId = toString(formulaId);
@@ -15458,8 +15396,8 @@ const PIVOT_HEADER = {
15458
15396
  description: _t("Get the header of a pivot."),
15459
15397
  args: [
15460
15398
  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.")),
15399
+ arg("domain_field_name (string,repeating,optional)", _t("Field name.")),
15400
+ arg("domain_value (number,string,value,repeating,optional)", _t("Value.")),
15463
15401
  ],
15464
15402
  compute: function (pivotId, ...domainArgs) {
15465
15403
  const _pivotFormulaId = toString(pivotId);
@@ -16330,10 +16268,7 @@ const CLEAN = {
16330
16268
  // -----------------------------------------------------------------------------
16331
16269
  const CONCATENATE = {
16332
16270
  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
- ],
16271
+ args: [arg("string (string, range<string>, repeating)", _t("String to append in sequence."))],
16337
16272
  compute: function (...datas) {
16338
16273
  return reduceAny(datas, (acc, a) => acc + toString(a), "");
16339
16274
  },
@@ -16388,8 +16323,7 @@ const JOIN = {
16388
16323
  description: _t("Concatenates elements of arrays with delimiter."),
16389
16324
  args: [
16390
16325
  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.")),
16326
+ arg("value_or_array (string, range<string>, repeating)", _t("Value to be appended using delimiter.")),
16393
16327
  ],
16394
16328
  compute: function (delimiter, ...valuesOrArrays) {
16395
16329
  const _delimiter = toString(delimiter);
@@ -16680,13 +16614,12 @@ const TEXTJOIN_DEFAULT_IGNORE_EMPTY = true;
16680
16614
  const TEXTJOIN = {
16681
16615
  description: _t("Combines text from multiple strings and/or arrays."),
16682
16616
  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.")),
16617
+ arg("delimiter (string)", _t("A string, possible empty, or a reference to a valid string. If empty, the text will be simply concatenated.")),
16684
16618
  arg("ignore_empty (boolean)", _t("A boolean; if TRUE, empty cells selected in the text arguments won't be included in the result."), [
16685
16619
  { value: true, label: _t("Ignore empty cells") },
16686
16620
  { value: false, label: _t("Include empty cells (default)") },
16687
16621
  ]),
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).")),
16622
+ arg("texts (string, range<string>, repeating)", _t("Text item to join.")),
16690
16623
  ],
16691
16624
  compute: function (delimiter, ignoreEmpty = { value: TEXTJOIN_DEFAULT_IGNORE_EMPTY }, ...textsOrArrays) {
16692
16625
  const _delimiter = toString(delimiter);
@@ -17559,7 +17492,7 @@ function compileTokensOrThrow(tokens) {
17559
17492
  const compiledArgs = [];
17560
17493
  const argToFocus = argTargeting(functionDefinition, args.length);
17561
17494
  for (let i = 0; i < args.length; i++) {
17562
- const argDefinition = functionDefinition.args[argToFocus(i) ?? -1];
17495
+ const argDefinition = functionDefinition.args[argToFocus(i).index ?? -1];
17563
17496
  const currentArg = args[i];
17564
17497
  const argTypes = argDefinition.type || [];
17565
17498
  // detect when an argument need to be evaluated as a meta argument
@@ -17738,12 +17671,15 @@ function assertEnoughArgs(ast) {
17738
17671
  }
17739
17672
  if (nbrArgRepeating > 1) {
17740
17673
  const nbrValueRepeating = nbrArgRepeating * Math.floor((nbrArgSupplied - minArgRequired) / nbrArgRepeating);
17741
- const nbrValueRemaining = nbrArgSupplied - minArgRequired - nbrValueRepeating - functionDefinition.nbrArgOptional;
17674
+ const nbrValueRemaining = nbrArgSupplied -
17675
+ minArgRequired -
17676
+ nbrValueRepeating -
17677
+ functionDefinition.nbrOptionalNonRepeatingArgs;
17742
17678
  if (nbrValueRemaining > 0) {
17743
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.", {
17744
17680
  functionName,
17745
17681
  nbrArgRepeating,
17746
- nbrArgOptional: functionDefinition.nbrArgOptional,
17682
+ nbrArgOptional: functionDefinition.nbrOptionalNonRepeatingArgs,
17747
17683
  nbrValueRemaining,
17748
17684
  }));
17749
17685
  }
@@ -17973,7 +17909,7 @@ function getRangeString(range, forSheetId, getSheetName, options = { useBoundedR
17973
17909
  let sheetName = "";
17974
17910
  if (prefixSheet) {
17975
17911
  if (range.invalidSheetName) {
17976
- sheetName = range.invalidSheetName;
17912
+ sheetName = getCanonicalSymbolName(range.invalidSheetName);
17977
17913
  }
17978
17914
  else {
17979
17915
  sheetName = getCanonicalSymbolName(getSheetName(range.sheetId));
@@ -19799,8 +19735,7 @@ function generateMasterChartConfig(chartJsConfig) {
19799
19735
  .filter((ds) => !isTrendLineAxis(ds["xAxisID"]))
19800
19736
  .map((ds) => ({
19801
19737
  ...ds,
19802
- pointRadius: 0,
19803
- showLine: true,
19738
+ pointRadius: ds.showLine === false ? 2 : 0, // Show points only for scatter plots
19804
19739
  })),
19805
19740
  },
19806
19741
  options: {
@@ -38115,9 +38050,13 @@ async function canvasToObjectUrl(canvas) {
38115
38050
  if (!blob) {
38116
38051
  return undefined;
38117
38052
  }
38118
- if (!URL.createObjectURL)
38119
- throw new Error("URL.createObjectURL is not supported in this environment");
38120
- return URL.createObjectURL(blob);
38053
+ return new Promise((resolve) => {
38054
+ const f = new FileReader();
38055
+ f.addEventListener("load", () => {
38056
+ resolve(f.result);
38057
+ });
38058
+ f.readAsDataURL(blob);
38059
+ });
38121
38060
  }
38122
38061
 
38123
38062
  class EvaluationChartPlugin extends CoreViewPlugin {
@@ -40492,6 +40431,7 @@ pivotRegistry.add("SPREADSHEET", {
40492
40431
  isMeasureCandidate: (field) => field.type !== "boolean",
40493
40432
  isGroupable: () => true,
40494
40433
  canHaveCustomGroup: (field) => field.type === "char" && !field.isCustomField,
40434
+ isPivotUnused: () => true,
40495
40435
  });
40496
40436
 
40497
40437
  const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
@@ -40510,7 +40450,7 @@ class PivotUIPlugin extends CoreViewPlugin {
40510
40450
  "isSpillPivotFormula",
40511
40451
  ];
40512
40452
  pivots = {};
40513
- unusedPivots;
40453
+ unusedPivotsInFormulas;
40514
40454
  custom;
40515
40455
  constructor(config) {
40516
40456
  super(config);
@@ -40550,12 +40490,12 @@ class PivotUIPlugin extends CoreViewPlugin {
40550
40490
  }
40551
40491
  case "DELETE_SHEET":
40552
40492
  case "UPDATE_CELL": {
40553
- this.unusedPivots = undefined;
40493
+ this.unusedPivotsInFormulas = undefined;
40554
40494
  break;
40555
40495
  }
40556
40496
  case "UNDO":
40557
40497
  case "REDO": {
40558
- this.unusedPivots = undefined;
40498
+ this.unusedPivotsInFormulas = undefined;
40559
40499
  const pivotCommands = cmd.commands.filter(isPivotCommand);
40560
40500
  for (const cmd of pivotCommands) {
40561
40501
  const pivotId = cmd.pivotId;
@@ -40714,7 +40654,9 @@ class PivotUIPlugin extends CoreViewPlugin {
40714
40654
  return this.pivots[pivotId];
40715
40655
  }
40716
40656
  isPivotUnused(pivotId) {
40717
- return this._getUnusedPivots().includes(pivotId);
40657
+ const { type } = this.getters.getPivot(pivotId);
40658
+ return (this._getUnusedPivotsInFormulas().includes(pivotId) &&
40659
+ pivotRegistry.get(type).isPivotUnused(this.getters, pivotId));
40718
40660
  }
40719
40661
  getPivotCellSortDirection(position) {
40720
40662
  const pivotId = this.getters.getPivotIdFromPosition(position);
@@ -40750,9 +40692,9 @@ class PivotUIPlugin extends CoreViewPlugin {
40750
40692
  this.pivots[pivotId].onDefinitionChange(definition);
40751
40693
  }
40752
40694
  }
40753
- _getUnusedPivots() {
40754
- if (this.unusedPivots !== undefined) {
40755
- return this.unusedPivots;
40695
+ _getUnusedPivotsInFormulas() {
40696
+ if (this.unusedPivotsInFormulas !== undefined) {
40697
+ return this.unusedPivotsInFormulas;
40756
40698
  }
40757
40699
  const unusedPivots = new Set(this.getters.getPivotIds());
40758
40700
  for (const sheetId of this.getters.getSheetIds()) {
@@ -40762,14 +40704,14 @@ class PivotUIPlugin extends CoreViewPlugin {
40762
40704
  if (pivotId) {
40763
40705
  unusedPivots.delete(pivotId);
40764
40706
  if (!unusedPivots.size) {
40765
- this.unusedPivots = [];
40707
+ this.unusedPivotsInFormulas = [];
40766
40708
  return [];
40767
40709
  }
40768
40710
  }
40769
40711
  }
40770
40712
  }
40771
- this.unusedPivots = [...unusedPivots];
40772
- return this.unusedPivots;
40713
+ this.unusedPivotsInFormulas = [...unusedPivots];
40714
+ return this.unusedPivotsInFormulas;
40773
40715
  }
40774
40716
  }
40775
40717
 
@@ -46175,6 +46117,7 @@ class SheetViewPlugin extends UIPlugin {
46175
46117
  "getVisibleFigures",
46176
46118
  "getVisibleRect",
46177
46119
  "getVisibleRectWithoutHeaders",
46120
+ "getVisibleRectWithZoom",
46178
46121
  "getVisibleCellPositions",
46179
46122
  "getColRowOffsetInViewport",
46180
46123
  "getMainViewportCoordinates",
@@ -46190,6 +46133,8 @@ class SheetViewPlugin extends UIPlugin {
46190
46133
  "getFigureUI",
46191
46134
  "getPositionAnchorOffset",
46192
46135
  "getGridOffset",
46136
+ "getViewportZoomLevel",
46137
+ "getScrollBarWidth",
46193
46138
  ];
46194
46139
  viewports = {};
46195
46140
  /**
@@ -46202,6 +46147,7 @@ class SheetViewPlugin extends UIPlugin {
46202
46147
  sheetViewHeight = getDefaultSheetViewSize();
46203
46148
  gridOffsetX = 0;
46204
46149
  gridOffsetY = 0;
46150
+ zoomLevel = 1;
46205
46151
  sheetsWithDirtyViewports = new Set();
46206
46152
  shouldAdjustViewports = false;
46207
46153
  // ---------------------------------------------------------------------------
@@ -46268,6 +46214,9 @@ class SheetViewPlugin extends UIPlugin {
46268
46214
  case "SET_VIEWPORT_OFFSET":
46269
46215
  this.setSheetViewOffset(cmd.offsetX, cmd.offsetY);
46270
46216
  break;
46217
+ case "SET_ZOOM":
46218
+ this.zoomLevel = cmd.zoom || 1;
46219
+ break;
46271
46220
  case "SHIFT_VIEWPORT_DOWN":
46272
46221
  const sheetId = this.getters.getActiveSheetId();
46273
46222
  const { top, viewportHeight, offsetCorrectionY } = this.getMainInternalViewport(sheetId);
@@ -46471,7 +46420,7 @@ class SheetViewPlugin extends UIPlugin {
46471
46420
  for (const i of relevantIndexes) {
46472
46421
  offset += this.getters.getHeaderSize(sheetId, dimension, i);
46473
46422
  }
46474
- return offset;
46423
+ return offset * this.zoomLevel;
46475
46424
  }
46476
46425
  /**
46477
46426
  * Check if a given position is visible in the viewport.
@@ -46479,6 +46428,9 @@ class SheetViewPlugin extends UIPlugin {
46479
46428
  isVisibleInViewport({ sheetId, col, row }) {
46480
46429
  return this.getSubViewports(sheetId).some((pane) => pane.isVisible(col, row));
46481
46430
  }
46431
+ getScrollBarWidth() {
46432
+ return SCROLLBAR_WIDTH / this.zoomLevel;
46433
+ }
46482
46434
  // => returns the new offset
46483
46435
  getEdgeScrollCol(x, previousX, startingX) {
46484
46436
  let canEdgeScroll = false;
@@ -46557,6 +46509,18 @@ class SheetViewPlugin extends UIPlugin {
46557
46509
  const rect = this.getVisibleRectWithoutHeaders(zone);
46558
46510
  return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
46559
46511
  }
46512
+ /**
46513
+ * Computes the coordinates and size to draw the zone on the canvas after it has been zoomed
46514
+ */
46515
+ getVisibleRectWithZoom(zone) {
46516
+ const zoom = this.getViewportZoomLevel();
46517
+ const rect = this.getVisibleRectWithoutHeaders(zone);
46518
+ rect.width = rect.width * zoom;
46519
+ rect.height = rect.height * zoom;
46520
+ rect.x = rect.x * zoom + this.gridOffsetX * zoom;
46521
+ rect.y = rect.y * zoom + this.gridOffsetY * zoom;
46522
+ return rect;
46523
+ }
46560
46524
  /**
46561
46525
  * Computes the coordinates and size to draw the zone without taking the grid offset into account
46562
46526
  */
@@ -46638,6 +46602,9 @@ class SheetViewPlugin extends UIPlugin {
46638
46602
  };
46639
46603
  });
46640
46604
  }
46605
+ getViewportZoomLevel() {
46606
+ return this.zoomLevel;
46607
+ }
46641
46608
  // ---------------------------------------------------------------------------
46642
46609
  // Private
46643
46610
  // ---------------------------------------------------------------------------
@@ -50849,5 +50816,5 @@ export { BadExpressionError, BasePlugin, CellErrorType, CircularDependencyError,
50849
50816
 
50850
50817
 
50851
50818
  __info__.version = "19.1.0-alpha.3";
50852
- __info__.date = "2025-10-30T12:25:48.501Z";
50853
- __info__.hash = "d0b65e9";
50819
+ __info__.date = "2025-11-12T14:16:26.552Z";
50820
+ __info__.hash = "6fefc9c";