@odoo/o-spreadsheet 19.0.35 → 19.0.37

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.
@@ -2,9 +2,9 @@
2
2
  /**
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
- * @version 19.0.35
6
- * @date 2026-05-15T07:06:09.392Z
7
- * @hash 5de341b
5
+ * @version 19.0.37
6
+ * @date 2026-06-06T06:22:21.404Z
7
+ * @hash 41aace0
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -3474,6 +3474,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3474
3474
  //#endregion
3475
3475
  //#region src/helpers/format/format_tokenizer.ts
3476
3476
  function tokenizeFormat(str) {
3477
+ str = str.replace(/\s/g, " ");
3477
3478
  const chars = new TokenizingChars(str);
3478
3479
  const result = [];
3479
3480
  let currentFormatPart = [];
@@ -5822,8 +5823,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
5822
5823
  changeType: "NONE",
5823
5824
  range
5824
5825
  };
5826
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
5827
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
5828
+ changeType: "RESIZE",
5829
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5830
+ };
5825
5831
  if (cmd.position === "after") {
5826
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
5832
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
5827
5833
  changeType: "RESIZE",
5828
5834
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
5829
5835
  };
@@ -9522,6 +9528,10 @@ stores.inject(MyMetaStore, storeInstance);
9522
9528
  ROUNDDOWN: [{
9523
9529
  type: "NUMBER",
9524
9530
  value: 0
9531
+ }],
9532
+ IFERROR: [{
9533
+ type: "NUMBER",
9534
+ value: 0
9525
9535
  }]
9526
9536
  };
9527
9537
  /**
@@ -39282,11 +39292,10 @@ stores.inject(MyMetaStore, storeInstance);
39282
39292
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
39283
39293
  };
39284
39294
  const DELETE_SELECTED_TABLE = (env) => {
39285
- const position = env.model.getters.getActivePosition();
39286
- const table = env.model.getters.getTable(position);
39295
+ const table = env.model.getters.getFirstTableInSelection();
39287
39296
  if (!table) return;
39288
39297
  env.model.dispatch("REMOVE_TABLE", {
39289
- sheetId: position.sheetId,
39298
+ sheetId: env.model.getters.getActiveSheetId(),
39290
39299
  target: [table.range.zone]
39291
39300
  });
39292
39301
  };
@@ -52127,7 +52136,7 @@ stores.inject(MyMetaStore, storeInstance);
52127
52136
  col,
52128
52137
  row
52129
52138
  };
52130
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
52139
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
52131
52140
  }
52132
52141
  return positions;
52133
52142
  }
@@ -53013,6 +53022,9 @@ stores.inject(MyMetaStore, storeInstance);
53013
53022
  function getFirstPivotFunction(tokens) {
53014
53023
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
53015
53024
  }
53025
+ function getPivotFunctions(tokens) {
53026
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
53027
+ }
53016
53028
  /**
53017
53029
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
53018
53030
  * present in the given formula.
@@ -63828,6 +63840,7 @@ stores.inject(MyMetaStore, storeInstance);
63828
63840
  "getFirstPivotFunction",
63829
63841
  "getPivotCellSortDirection",
63830
63842
  "getPivotIdFromPosition",
63843
+ "getPivotIdsFromPosition",
63831
63844
  "getPivotCellFromPosition",
63832
63845
  "generateNewCalculatedMeasureName",
63833
63846
  "isPivotUnused",
@@ -63852,9 +63865,11 @@ stores.inject(MyMetaStore, storeInstance);
63852
63865
  this.refreshPivot(cmd.id);
63853
63866
  break;
63854
63867
  case "ADD_PIVOT":
63868
+ this.unusedPivots?.push(cmd.pivotId);
63855
63869
  this.setupPivot(cmd.pivotId);
63856
63870
  break;
63857
63871
  case "DUPLICATE_PIVOT":
63872
+ this.unusedPivots?.push(cmd.newPivotId);
63858
63873
  this.setupPivot(cmd.newPivotId);
63859
63874
  break;
63860
63875
  case "UPDATE_PIVOT":
@@ -63885,37 +63900,52 @@ stores.inject(MyMetaStore, storeInstance);
63885
63900
  }
63886
63901
  }
63887
63902
  /**
63888
- * Get the id of the pivot at the given position. Returns undefined if there
63903
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
63889
63904
  * is no pivot at this position
63890
63905
  */
63891
63906
  getPivotIdFromPosition(position) {
63907
+ return this.getPivotIdsFromPosition(position)[0];
63908
+ }
63909
+ /**
63910
+ * Get all of the ids of the pivot present in the formula at the given position.
63911
+ */
63912
+ getPivotIdsFromPosition(position) {
63892
63913
  const cell = this.getters.getCorrespondingFormulaCell(position);
63893
- if (cell && cell.isFormula) {
63894
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
63895
- if (pivotFunction) {
63896
- const pivotId = pivotFunction.args[0]?.toString();
63897
- return pivotId && this.getters.getPivotId(pivotId);
63898
- }
63899
- }
63914
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
63915
+ return [];
63916
+ }
63917
+ getPivotIdsFromFormula(sheetId, formula) {
63918
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
63919
+ const pivotId = pivotFunction.args[0]?.toString();
63920
+ return pivotId && this.getters.getPivotId(pivotId);
63921
+ }).filter(isDefined);
63900
63922
  }
63901
63923
  isSpillPivotFormula(position) {
63902
63924
  const cell = this.getters.getCorrespondingFormulaCell(position);
63903
63925
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
63904
63926
  return false;
63905
63927
  }
63906
- getFirstPivotFunction(sheetId, tokens) {
63907
- const pivotFunction = getFirstPivotFunction(tokens);
63908
- if (!pivotFunction) return;
63909
- const { functionName, args } = pivotFunction;
63910
- return {
63911
- functionName,
63912
- args: args.map((argAst) => {
63928
+ getPivotFunctions(sheetId, tokens) {
63929
+ const pivotFunctions = getPivotFunctions(tokens);
63930
+ if (!pivotFunctions.length) return [];
63931
+ const evaluatedPivotFunctions = [];
63932
+ for (const pivotFunction of pivotFunctions) {
63933
+ const { functionName, args } = pivotFunction;
63934
+ const evaluatedArgs = args.map((argAst) => {
63913
63935
  if (argAst.type === "EMPTY") return;
63914
63936
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
63915
63937
  const argsString = astToFormula(argAst);
63916
63938
  return this.getters.evaluateFormula(sheetId, argsString);
63917
- })
63918
- };
63939
+ });
63940
+ evaluatedPivotFunctions.push({
63941
+ functionName,
63942
+ args: evaluatedArgs
63943
+ });
63944
+ }
63945
+ return evaluatedPivotFunctions;
63946
+ }
63947
+ getFirstPivotFunction(sheetId, tokens) {
63948
+ return this.getPivotFunctions(sheetId, tokens)[0];
63919
63949
  }
63920
63950
  /**
63921
63951
  * Returns the domain args of a pivot formula from a position.
@@ -64029,8 +64059,8 @@ stores.inject(MyMetaStore, storeInstance);
64029
64059
  const unusedPivots = new Set(this.getters.getPivotIds());
64030
64060
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
64031
64061
  const position = this.getters.getCellPosition(cellId);
64032
- const pivotId = this.getPivotIdFromPosition(position);
64033
- if (pivotId) {
64062
+ const pivotIds = this.getPivotIdsFromPosition(position);
64063
+ for (const pivotId of pivotIds) {
64034
64064
  unusedPivots.delete(pivotId);
64035
64065
  if (!unusedPivots.size) {
64036
64066
  this.unusedPivots = [];
@@ -64038,6 +64068,21 @@ stores.inject(MyMetaStore, storeInstance);
64038
64068
  }
64039
64069
  }
64040
64070
  }
64071
+ for (const pivotId of this.getters.getPivotIds()) {
64072
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
64073
+ for (const measure of pivot.measures) if (measure.computedBy) {
64074
+ const { sheetId } = measure.computedBy;
64075
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
64076
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
64077
+ for (const relatedPivotId of relatedPivotIds) {
64078
+ unusedPivots.delete(relatedPivotId);
64079
+ if (!unusedPivots.size) {
64080
+ this.unusedPivots = [];
64081
+ return [];
64082
+ }
64083
+ }
64084
+ }
64085
+ }
64041
64086
  this.unusedPivots = [...unusedPivots];
64042
64087
  return this.unusedPivots;
64043
64088
  }
@@ -67233,7 +67278,8 @@ stores.inject(MyMetaStore, storeInstance);
67233
67278
  "REMOVE_TABLE",
67234
67279
  "RESIZE_TABLE",
67235
67280
  "CREATE_TABLE_STYLE",
67236
- "REMOVE_TABLE_STYLE"
67281
+ "REMOVE_TABLE_STYLE",
67282
+ "DELETE_CONTENT"
67237
67283
  ]);
67238
67284
  function doesCommandInvalidatesTableStyle(cmd) {
67239
67285
  return invalidateTableStyleCommandsSet.has(cmd.type);
@@ -76623,6 +76669,11 @@ stores.inject(MyMetaStore, storeInstance);
76623
76669
  `;
76624
76670
  }
76625
76671
  function insertText(text, fontColor = "000000", fontsize = 16, style = {}) {
76672
+ const textProperties = [
76673
+ ["b", style.bold ? "1" : "0"],
76674
+ ["i", style.italic ? "1" : "0"],
76675
+ ["sz", fontsize * 100]
76676
+ ];
76626
76677
  return escapeXml`
76627
76678
  <c:tx>
76628
76679
  <c:rich>
@@ -76630,13 +76681,13 @@ stores.inject(MyMetaStore, storeInstance);
76630
76681
  <a:lstStyle />
76631
76682
  <a:p>
76632
76683
  <a:pPr lvl="0">
76633
- <a:defRPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}">
76684
+ <a:defRPr ${formatAttributes(textProperties)}>
76634
76685
  ${solidFill(fontColor)}
76635
76686
  <a:latin typeface="+mn-lt"/>
76636
76687
  </a:defRPr>
76637
76688
  </a:pPr>
76638
76689
  <a:r> <!-- Runs -->
76639
- <a:rPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}" sz="${fontsize * 100}"/>
76690
+ <a:rPr ${formatAttributes(textProperties)}/>
76640
76691
  <a:t>${text}</a:t>
76641
76692
  </a:r>
76642
76693
  </a:p>
@@ -79333,8 +79384,8 @@ exports.stores = stores;
79333
79384
  exports.tokenColors = tokenColors;
79334
79385
  exports.tokenize = tokenize;
79335
79386
 
79336
- __info__.version = "19.0.35";
79337
- __info__.date = "2026-05-15T07:06:09.392Z";
79338
- __info__.hash = "5de341b";
79387
+ __info__.version = "19.0.37";
79388
+ __info__.date = "2026-06-06T06:22:21.404Z";
79389
+ __info__.hash = "41aace0";
79339
79390
 
79340
79391
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);