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