@odoo/o-spreadsheet 16.0.45 → 16.0.47

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.
@@ -8247,15 +8247,6 @@ function createLineChartRuntime(chart, getters) {
8247
8247
  }
8248
8248
  const colors = new ChartColors();
8249
8249
  for (let [index, { label, data }] of dataSetsValues.entries()) {
8250
- if (["linear", "time"].includes(axisType)) {
8251
- // Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
8252
- data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
8253
- }
8254
- const color = colors.next();
8255
- let backgroundRGBA = colorToRGBA(color);
8256
- if (chart.stacked) {
8257
- backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
8258
- }
8259
8250
  if (chart.cumulative) {
8260
8251
  let accumulator = 0;
8261
8252
  data = data.map((value) => {
@@ -8266,6 +8257,15 @@ function createLineChartRuntime(chart, getters) {
8266
8257
  return value;
8267
8258
  });
8268
8259
  }
8260
+ if (["linear", "time"].includes(axisType)) {
8261
+ // Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
8262
+ data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
8263
+ }
8264
+ const color = colors.next();
8265
+ let backgroundRGBA = colorToRGBA(color);
8266
+ if (chart.stacked) {
8267
+ backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
8268
+ }
8269
8269
  const backgroundColor = rgbaToHex(backgroundRGBA);
8270
8270
  const dataset = {
8271
8271
  label,
@@ -11387,6 +11387,9 @@ function getPredicate(descr, isQuery) {
11387
11387
  return result;
11388
11388
  }
11389
11389
  function operandToRegExp(operand) {
11390
+ if (operand === "*") {
11391
+ return /.+/;
11392
+ }
11390
11393
  let exp = "";
11391
11394
  let predecessor = "";
11392
11395
  for (let char of operand) {
@@ -11410,9 +11413,9 @@ function operandToRegExp(operand) {
11410
11413
  }
11411
11414
  return new RegExp("^" + exp + "$", "i");
11412
11415
  }
11413
- function evaluatePredicate(value, criterion) {
11416
+ function evaluatePredicate(value = "", criterion) {
11414
11417
  const { operator, operand } = criterion;
11415
- if (value === undefined || operand === undefined) {
11418
+ if (operand === undefined) {
11416
11419
  return false;
11417
11420
  }
11418
11421
  if (typeof operand === "number" && operator === "=") {
@@ -18401,6 +18404,147 @@ function tokenizeInvalidRange(chars) {
18401
18404
  return null;
18402
18405
  }
18403
18406
 
18407
+ var State;
18408
+ (function (State) {
18409
+ /**
18410
+ * Initial state.
18411
+ * Expecting any reference for the left part of a range
18412
+ * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
18413
+ */
18414
+ State[State["LeftRef"] = 0] = "LeftRef";
18415
+ /**
18416
+ * Expecting any reference for the right part of a range
18417
+ * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
18418
+ */
18419
+ State[State["RightRef"] = 1] = "RightRef";
18420
+ /**
18421
+ * Expecting the separator without any constraint on the right part
18422
+ */
18423
+ State[State["Separator"] = 2] = "Separator";
18424
+ /**
18425
+ * Expecting the separator for a full column range
18426
+ */
18427
+ State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
18428
+ /**
18429
+ * Expecting the separator for a full row range
18430
+ */
18431
+ State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
18432
+ /**
18433
+ * Expecting the right part of a full column range
18434
+ * e.g. "1", "A1"
18435
+ */
18436
+ State[State["RightColumnRef"] = 5] = "RightColumnRef";
18437
+ /**
18438
+ * Expecting the right part of a full row range
18439
+ * e.g. "A", "A1"
18440
+ */
18441
+ State[State["RightRowRef"] = 6] = "RightRowRef";
18442
+ /**
18443
+ * Final state. A range has been matched
18444
+ */
18445
+ State[State["Found"] = 7] = "Found";
18446
+ })(State || (State = {}));
18447
+ const goTo = (state, guard = () => true) => [
18448
+ {
18449
+ goTo: state,
18450
+ guard,
18451
+ },
18452
+ ];
18453
+ const goToMulti = (state, guard = () => true) => ({
18454
+ goTo: state,
18455
+ guard,
18456
+ });
18457
+ const machine = {
18458
+ [State.LeftRef]: {
18459
+ REFERENCE: goTo(State.Separator),
18460
+ NUMBER: goTo(State.FullRowSeparator),
18461
+ SYMBOL: [
18462
+ goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)),
18463
+ goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value)),
18464
+ ],
18465
+ },
18466
+ [State.FullColumnSeparator]: {
18467
+ SPACE: goTo(State.FullColumnSeparator),
18468
+ OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":"),
18469
+ },
18470
+ [State.FullRowSeparator]: {
18471
+ SPACE: goTo(State.FullRowSeparator),
18472
+ OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":"),
18473
+ },
18474
+ [State.Separator]: {
18475
+ SPACE: goTo(State.Separator),
18476
+ OPERATOR: goTo(State.RightRef, (token) => token.value === ":"),
18477
+ },
18478
+ [State.RightRef]: {
18479
+ SPACE: goTo(State.RightRef),
18480
+ NUMBER: goTo(State.Found),
18481
+ REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18482
+ SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
18483
+ },
18484
+ [State.RightColumnRef]: {
18485
+ SPACE: goTo(State.RightColumnRef),
18486
+ SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
18487
+ REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18488
+ },
18489
+ [State.RightRowRef]: {
18490
+ SPACE: goTo(State.RightRowRef),
18491
+ NUMBER: goTo(State.Found),
18492
+ REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18493
+ SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
18494
+ },
18495
+ [State.Found]: {},
18496
+ };
18497
+ /**
18498
+ * Check if the list of tokens starts with a sequence of tokens representing
18499
+ * a range.
18500
+ * If a range is found, the sequence is removed from the list and is returned
18501
+ * as a single token.
18502
+ */
18503
+ function matchReference(tokens) {
18504
+ var _a;
18505
+ let head = 0;
18506
+ let transitions = machine[State.LeftRef];
18507
+ let matchedTokens = "";
18508
+ while (transitions !== undefined) {
18509
+ const token = tokens[head++];
18510
+ if (!token) {
18511
+ return null;
18512
+ }
18513
+ const transition = (_a = transitions[token.type]) === null || _a === void 0 ? void 0 : _a.find((transition) => transition.guard(token));
18514
+ const nextState = transition ? transition.goTo : undefined;
18515
+ switch (nextState) {
18516
+ case undefined:
18517
+ return null;
18518
+ case State.Found:
18519
+ matchedTokens += token.value;
18520
+ tokens.splice(0, head);
18521
+ return {
18522
+ type: "REFERENCE",
18523
+ value: matchedTokens,
18524
+ };
18525
+ default:
18526
+ transitions = machine[nextState];
18527
+ matchedTokens += token.value;
18528
+ break;
18529
+ }
18530
+ }
18531
+ return null;
18532
+ }
18533
+ /**
18534
+ * Take the result of the tokenizer and transform it to be usable in the
18535
+ * manipulations of range
18536
+ *
18537
+ * @param formula
18538
+ */
18539
+ function rangeTokenize(formula) {
18540
+ const tokens = tokenize(formula);
18541
+ const result = [];
18542
+ while (tokens.length) {
18543
+ result.push(matchReference(tokens) || tokens.shift());
18544
+ }
18545
+ return result;
18546
+ }
18547
+
18404
18548
  const functionRegex = /[a-zA-Z0-9\_]+(\.[a-zA-Z0-9\_]+)*/;
18405
18549
  const UNARY_OPERATORS_PREFIX = ["-", "+"];
18406
18550
  const UNARY_OPERATORS_POSTFIX = ["%"];
@@ -18567,7 +18711,7 @@ function parseExpression(tokens, bp) {
18567
18711
  * Parse an expression (as a string) into an AST.
18568
18712
  */
18569
18713
  function parse(str) {
18570
- return parseTokens(tokenize(str));
18714
+ return parseTokens(rangeTokenize(str));
18571
18715
  }
18572
18716
  function parseTokens(tokens) {
18573
18717
  tokens = tokens.filter((x) => x.type !== "SPACE");
@@ -18679,147 +18823,6 @@ function rightOperandToFormula(operationAST) {
18679
18823
  return needParenthesis ? `(${astToFormula(rightOperation)})` : astToFormula(rightOperation);
18680
18824
  }
18681
18825
 
18682
- var State;
18683
- (function (State) {
18684
- /**
18685
- * Initial state.
18686
- * Expecting any reference for the left part of a range
18687
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
18688
- */
18689
- State[State["LeftRef"] = 0] = "LeftRef";
18690
- /**
18691
- * Expecting any reference for the right part of a range
18692
- * e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
18693
- */
18694
- State[State["RightRef"] = 1] = "RightRef";
18695
- /**
18696
- * Expecting the separator without any constraint on the right part
18697
- */
18698
- State[State["Separator"] = 2] = "Separator";
18699
- /**
18700
- * Expecting the separator for a full column range
18701
- */
18702
- State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
18703
- /**
18704
- * Expecting the separator for a full row range
18705
- */
18706
- State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
18707
- /**
18708
- * Expecting the right part of a full column range
18709
- * e.g. "1", "A1"
18710
- */
18711
- State[State["RightColumnRef"] = 5] = "RightColumnRef";
18712
- /**
18713
- * Expecting the right part of a full row range
18714
- * e.g. "A", "A1"
18715
- */
18716
- State[State["RightRowRef"] = 6] = "RightRowRef";
18717
- /**
18718
- * Final state. A range has been matched
18719
- */
18720
- State[State["Found"] = 7] = "Found";
18721
- })(State || (State = {}));
18722
- const goTo = (state, guard = () => true) => [
18723
- {
18724
- goTo: state,
18725
- guard,
18726
- },
18727
- ];
18728
- const goToMulti = (state, guard = () => true) => ({
18729
- goTo: state,
18730
- guard,
18731
- });
18732
- const machine = {
18733
- [State.LeftRef]: {
18734
- REFERENCE: goTo(State.Separator),
18735
- NUMBER: goTo(State.FullRowSeparator),
18736
- SYMBOL: [
18737
- goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)),
18738
- goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value)),
18739
- ],
18740
- },
18741
- [State.FullColumnSeparator]: {
18742
- SPACE: goTo(State.FullColumnSeparator),
18743
- OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":"),
18744
- },
18745
- [State.FullRowSeparator]: {
18746
- SPACE: goTo(State.FullRowSeparator),
18747
- OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":"),
18748
- },
18749
- [State.Separator]: {
18750
- SPACE: goTo(State.Separator),
18751
- OPERATOR: goTo(State.RightRef, (token) => token.value === ":"),
18752
- },
18753
- [State.RightRef]: {
18754
- SPACE: goTo(State.RightRef),
18755
- NUMBER: goTo(State.Found),
18756
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18757
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
18758
- },
18759
- [State.RightColumnRef]: {
18760
- SPACE: goTo(State.RightColumnRef),
18761
- SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
18762
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18763
- },
18764
- [State.RightRowRef]: {
18765
- SPACE: goTo(State.RightRowRef),
18766
- NUMBER: goTo(State.Found),
18767
- REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
18768
- SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
18769
- },
18770
- [State.Found]: {},
18771
- };
18772
- /**
18773
- * Check if the list of tokens starts with a sequence of tokens representing
18774
- * a range.
18775
- * If a range is found, the sequence is removed from the list and is returned
18776
- * as a single token.
18777
- */
18778
- function matchReference(tokens) {
18779
- var _a;
18780
- let head = 0;
18781
- let transitions = machine[State.LeftRef];
18782
- let matchedTokens = "";
18783
- while (transitions !== undefined) {
18784
- const token = tokens[head++];
18785
- if (!token) {
18786
- return null;
18787
- }
18788
- const transition = (_a = transitions[token.type]) === null || _a === void 0 ? void 0 : _a.find((transition) => transition.guard(token));
18789
- const nextState = transition ? transition.goTo : undefined;
18790
- switch (nextState) {
18791
- case undefined:
18792
- return null;
18793
- case State.Found:
18794
- matchedTokens += token.value;
18795
- tokens.splice(0, head);
18796
- return {
18797
- type: "REFERENCE",
18798
- value: matchedTokens,
18799
- };
18800
- default:
18801
- transitions = machine[nextState];
18802
- matchedTokens += token.value;
18803
- break;
18804
- }
18805
- }
18806
- return null;
18807
- }
18808
- /**
18809
- * Take the result of the tokenizer and transform it to be usable in the
18810
- * manipulations of range
18811
- *
18812
- * @param formula
18813
- */
18814
- function rangeTokenize(formula) {
18815
- const tokens = tokenize(formula);
18816
- const result = [];
18817
- while (tokens.length) {
18818
- result.push(matchReference(tokens) || tokens.shift());
18819
- }
18820
- return result;
18821
- }
18822
-
18823
18826
  const functions$2 = functionRegistry.content;
18824
18827
  const OPERATOR_MAP = {
18825
18828
  "=": "EQ",
@@ -23681,6 +23684,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23681
23684
  "BITOR",
23682
23685
  "BITRSHIFT",
23683
23686
  "BITXOR",
23687
+ "BYCOL",
23688
+ "BYROW",
23684
23689
  "CEILING.MATH",
23685
23690
  "CEILING.PRECISE",
23686
23691
  "CHISQ.DIST",
@@ -23688,6 +23693,8 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23688
23693
  "CHISQ.INV",
23689
23694
  "CHISQ.INV.RT",
23690
23695
  "CHISQ.TEST",
23696
+ "CHOOSECOLS",
23697
+ "CHOOSEROWS",
23691
23698
  "COMBINA",
23692
23699
  "CONCAT",
23693
23700
  "CONFIDENCE.NORM",
@@ -23700,14 +23707,17 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23700
23707
  "CSCH",
23701
23708
  "DAYS",
23702
23709
  "DECIMAL",
23710
+ "DROP",
23703
23711
  "ERF.PRECISE",
23704
23712
  "ERFC.PRECISE",
23713
+ "EXPAND",
23705
23714
  "EXPON.DIST",
23706
23715
  "F.DIST",
23707
23716
  "F.DIST.RT",
23708
23717
  "F.INV",
23709
23718
  "F.INV.RT",
23710
23719
  "F.TEST",
23720
+ "FIELDVALUE",
23711
23721
  "FILTERXML",
23712
23722
  "FLOOR.MATH",
23713
23723
  "FLOOR.PRECISE",
@@ -23722,6 +23732,7 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23722
23732
  "GAMMA.INV",
23723
23733
  "GAMMALN.PRECISE",
23724
23734
  "GAUSS",
23735
+ "HSTACK",
23725
23736
  "HYPGEOM.DIST",
23726
23737
  "IFNA",
23727
23738
  "IFS",
@@ -23734,9 +23745,14 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23734
23745
  "IMSINH",
23735
23746
  "IMTAN",
23736
23747
  "ISFORMULA",
23748
+ "ISOMITTED",
23737
23749
  "ISOWEEKNUM",
23750
+ "LAMBDA",
23751
+ "LET",
23738
23752
  "LOGNORM.DIST",
23739
23753
  "LOGNORM.INV",
23754
+ "MAKEARRAY",
23755
+ "MAP",
23740
23756
  "MAXIFS",
23741
23757
  "MINIFS",
23742
23758
  "MODE.MULT",
@@ -23756,17 +23772,26 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23756
23772
  "PERMUTATIONA",
23757
23773
  "PHI",
23758
23774
  "POISSON.DIST",
23775
+ "PQSOURCE",
23776
+ "PYTHON_STR",
23777
+ "PYTHON_TYPE",
23778
+ "PYTHON_TYPENAME",
23759
23779
  "QUARTILE.EXC",
23760
23780
  "QUARTILE.INC",
23761
23781
  "QUERYSTRING",
23782
+ "RANDARRAY",
23762
23783
  "RANK.AVG",
23763
23784
  "RANK.EQ",
23785
+ "REDUCE",
23764
23786
  "RRI",
23787
+ "SCAN",
23765
23788
  "SEC",
23766
23789
  "SECH",
23790
+ "SEQUENCE",
23767
23791
  "SHEET",
23768
23792
  "SHEETS",
23769
23793
  "SKEW.P",
23794
+ "SORTBY",
23770
23795
  "STDEV.P",
23771
23796
  "STDEV.S",
23772
23797
  "SWITCH",
@@ -23776,13 +23801,24 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
23776
23801
  "T.INV",
23777
23802
  "T.INV.2T",
23778
23803
  "T.TEST",
23804
+ "TAKE",
23805
+ "TEXTAFTER",
23806
+ "TEXTBEFORE",
23779
23807
  "TEXTJOIN",
23808
+ "TEXTSPLIT",
23809
+ "TOCOL",
23810
+ "TOROW",
23780
23811
  "UNICHAR",
23781
23812
  "UNICODE",
23813
+ "UNIQUE",
23782
23814
  "VAR.P",
23783
23815
  "VAR.S",
23816
+ "VSTACK",
23784
23817
  "WEBSERVICE",
23785
23818
  "WEIBULL.DIST",
23819
+ "WRAPCOLS",
23820
+ "WRAPROWS",
23821
+ "XLOOKUP",
23786
23822
  "XOR",
23787
23823
  "Z.TEST",
23788
23824
  ];
@@ -27569,6 +27605,22 @@ class BordersPlugin extends CorePlugin {
27569
27605
  return [];
27570
27606
  return Object.keys(sheetBorders).map((index) => parseInt(index, 10));
27571
27607
  }
27608
+ /**
27609
+ * Get all the rows which contains at least a border
27610
+ */
27611
+ getRowsWithBorders(sheetId) {
27612
+ var _a;
27613
+ const sheetBorders = (_a = this.borders[sheetId]) === null || _a === void 0 ? void 0 : _a.filter(isDefined$1);
27614
+ if (!sheetBorders)
27615
+ return [];
27616
+ const rowsWithBorders = new Set();
27617
+ for (const rowBorders of sheetBorders) {
27618
+ for (const rowBorder in rowBorders) {
27619
+ rowsWithBorders.add(parseInt(rowBorder, 10));
27620
+ }
27621
+ }
27622
+ return Array.from(rowsWithBorders);
27623
+ }
27572
27624
  /**
27573
27625
  * Get the range of all the rows in the sheet
27574
27626
  */
@@ -27618,7 +27670,7 @@ class BordersPlugin extends CorePlugin {
27618
27670
  destructive: false,
27619
27671
  });
27620
27672
  }
27621
- this.getRowsRange(sheetId)
27673
+ this.getRowsWithBorders(sheetId)
27622
27674
  .filter((row) => row >= start)
27623
27675
  .sort((a, b) => (delta < 0 ? a - b : b - a)) // start by the end when moving up
27624
27676
  .forEach((row) => {
@@ -43352,6 +43404,6 @@ function addFunction(functionName, functionDescription) {
43352
43404
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43353
43405
 
43354
43406
 
43355
- __info__.version = '16.0.45';
43356
- __info__.date = '2024-06-14T09:57:08.849Z';
43357
- __info__.hash = '5da9171';
43407
+ __info__.version = '16.0.47';
43408
+ __info__.date = '2024-07-08T05:37:37.541Z';
43409
+ __info__.hash = 'f52ca6f';