@odoo/o-spreadsheet 19.1.20 → 19.1.22

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.1.20
6
- * @date 2026-05-15T07:06:03.182Z
7
- * @hash b6a68b8
5
+ * @version 19.1.22
6
+ * @date 2026-06-06T06:23:19.222Z
7
+ * @hash 97a02db
8
8
  */
9
9
 
10
10
  (function(exports, _odoo_owl) {
@@ -4304,6 +4304,7 @@ stores.inject(MyMetaStore, storeInstance);
4304
4304
  //#endregion
4305
4305
  //#region src/helpers/format/format_tokenizer.ts
4306
4306
  function tokenizeFormat(str) {
4307
+ str = str.replace(/\s/g, " ");
4307
4308
  const chars = new TokenizingChars(str);
4308
4309
  const result = [];
4309
4310
  let currentFormatPart = [];
@@ -6429,8 +6430,13 @@ stores.inject(MyMetaStore, storeInstance);
6429
6430
  changeType: "NONE",
6430
6431
  range
6431
6432
  };
6433
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
6434
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
6435
+ changeType: "RESIZE",
6436
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6437
+ };
6432
6438
  if (cmd.position === "after") {
6433
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
6439
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
6434
6440
  changeType: "RESIZE",
6435
6441
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6436
6442
  };
@@ -7023,40 +7029,9 @@ stores.inject(MyMetaStore, storeInstance);
7023
7029
  }
7024
7030
  };
7025
7031
 
7026
- //#endregion
7027
- //#region src/registry.ts
7028
- var Registry$1 = class {
7029
- content = {};
7030
- add(key, value) {
7031
- if (key in this.content) throw new Error(`${key} is already present in this registry!`);
7032
- return this.replace(key, value);
7033
- }
7034
- replace(key, value) {
7035
- this.content[key] = value;
7036
- return this;
7037
- }
7038
- get(key) {
7039
- const content = this.content[key];
7040
- if (!content && !(key in this.content)) throw new Error(`Cannot find ${key} in this registry!`);
7041
- return content;
7042
- }
7043
- contains(key) {
7044
- return key in this.content;
7045
- }
7046
- getAll() {
7047
- return Object.values(this.content);
7048
- }
7049
- getKeys() {
7050
- return Object.keys(this.content);
7051
- }
7052
- remove(key) {
7053
- delete this.content[key];
7054
- }
7055
- };
7056
-
7057
7032
  //#endregion
7058
7033
  //#region src/helpers/figures/charts/chart_js_extension.ts
7059
- const chartJsExtensionRegistry = new Registry$1();
7034
+ const chartJsExtensionRegistry = new Registry();
7060
7035
  function areChartJSExtensionsLoaded() {
7061
7036
  return globalThis.Chart ? !!globalThis.Chart.registry.plugins.get("chartShowValuesPlugin") : true;
7062
7037
  }
@@ -7359,6 +7334,10 @@ stores.inject(MyMetaStore, storeInstance);
7359
7334
  ROUNDDOWN: [{
7360
7335
  type: "NUMBER",
7361
7336
  value: 0
7337
+ }],
7338
+ IFERROR: [{
7339
+ type: "NUMBER",
7340
+ value: 0
7362
7341
  }]
7363
7342
  };
7364
7343
  /**
@@ -26300,7 +26279,7 @@ stores.inject(MyMetaStore, storeInstance);
26300
26279
  //#endregion
26301
26280
  //#region src/functions/function_registry.ts
26302
26281
  const functionNameRegex = /^[A-Z0-9\_\.]+$/;
26303
- var FunctionRegistry = class extends Registry$1 {
26282
+ var FunctionRegistry = class extends Registry {
26304
26283
  mapping = {};
26305
26284
  add(name, addDescr) {
26306
26285
  name = name.toUpperCase();
@@ -35790,7 +35769,7 @@ stores.inject(MyMetaStore, storeInstance);
35790
35769
 
35791
35770
  //#endregion
35792
35771
  //#region src/migrations/migration_steps.ts
35793
- const migrationStepRegistry = new Registry$1();
35772
+ const migrationStepRegistry = new Registry();
35794
35773
  migrationStepRegistry.add("0.1", { migrate(data) {
35795
35774
  if (data.sheets && data.sheets[0]) data.activeSheet = data.sheets[0].name;
35796
35775
  return data;
@@ -36952,11 +36931,10 @@ stores.inject(MyMetaStore, storeInstance);
36952
36931
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
36953
36932
  };
36954
36933
  const DELETE_SELECTED_TABLE = (env) => {
36955
- const position = env.model.getters.getActivePosition();
36956
- const table = env.model.getters.getTable(position);
36934
+ const table = env.model.getters.getFirstTableInSelection();
36957
36935
  if (!table) return;
36958
36936
  env.model.dispatch("REMOVE_TABLE", {
36959
- sheetId: position.sheetId,
36937
+ sheetId: env.model.getters.getActiveSheetId(),
36960
36938
  target: [table.range.zone]
36961
36939
  });
36962
36940
  };
@@ -39325,7 +39303,7 @@ stores.inject(MyMetaStore, storeInstance);
39325
39303
 
39326
39304
  //#endregion
39327
39305
  //#region src/helpers/pivot/pivot_registry.ts
39328
- const pivotRegistry = new Registry$1();
39306
+ const pivotRegistry = new Registry();
39329
39307
  const dateGranularities = [
39330
39308
  "year",
39331
39309
  "quarter_number",
@@ -49478,7 +49456,7 @@ stores.inject(MyMetaStore, storeInstance);
49478
49456
  col,
49479
49457
  row
49480
49458
  };
49481
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
49459
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
49482
49460
  }
49483
49461
  return positions;
49484
49462
  }
@@ -50578,6 +50556,9 @@ stores.inject(MyMetaStore, storeInstance);
50578
50556
  function getFirstPivotFunction(tokens) {
50579
50557
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
50580
50558
  }
50559
+ function getPivotFunctions(tokens) {
50560
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
50561
+ }
50581
50562
  /**
50582
50563
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
50583
50564
  * present in the given formula.
@@ -61226,6 +61207,7 @@ stores.inject(MyMetaStore, storeInstance);
61226
61207
  "getFirstPivotFunction",
61227
61208
  "getPivotCellSortDirection",
61228
61209
  "getPivotIdFromPosition",
61210
+ "getPivotIdsFromPosition",
61229
61211
  "getPivotCellFromPosition",
61230
61212
  "generateNewCalculatedMeasureName",
61231
61213
  "isPivotUnused",
@@ -61250,9 +61232,11 @@ stores.inject(MyMetaStore, storeInstance);
61250
61232
  this.refreshPivot(cmd.id);
61251
61233
  break;
61252
61234
  case "ADD_PIVOT":
61235
+ this.unusedPivotsInFormulas?.push(cmd.pivotId);
61253
61236
  this.setupPivot(cmd.pivotId);
61254
61237
  break;
61255
61238
  case "DUPLICATE_PIVOT":
61239
+ this.unusedPivotsInFormulas?.push(cmd.newPivotId);
61256
61240
  this.setupPivot(cmd.newPivotId);
61257
61241
  break;
61258
61242
  case "UPDATE_PIVOT":
@@ -61283,37 +61267,52 @@ stores.inject(MyMetaStore, storeInstance);
61283
61267
  }
61284
61268
  }
61285
61269
  /**
61286
- * Get the id of the pivot at the given position. Returns undefined if there
61270
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
61287
61271
  * is no pivot at this position
61288
61272
  */
61289
61273
  getPivotIdFromPosition(position) {
61274
+ return this.getPivotIdsFromPosition(position)[0];
61275
+ }
61276
+ /**
61277
+ * Get all of the ids of the pivot present in the formula at the given position.
61278
+ */
61279
+ getPivotIdsFromPosition(position) {
61290
61280
  const cell = this.getters.getCorrespondingFormulaCell(position);
61291
- if (cell && cell.isFormula) {
61292
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
61293
- if (pivotFunction) {
61294
- const pivotId = pivotFunction.args[0]?.toString();
61295
- return pivotId && this.getters.getPivotId(pivotId);
61296
- }
61297
- }
61281
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
61282
+ return [];
61283
+ }
61284
+ getPivotIdsFromFormula(sheetId, formula) {
61285
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
61286
+ const pivotId = pivotFunction.args[0]?.toString();
61287
+ return pivotId && this.getters.getPivotId(pivotId);
61288
+ }).filter(isDefined);
61298
61289
  }
61299
61290
  isSpillPivotFormula(position) {
61300
61291
  const cell = this.getters.getCorrespondingFormulaCell(position);
61301
61292
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
61302
61293
  return false;
61303
61294
  }
61304
- getFirstPivotFunction(sheetId, tokens) {
61305
- const pivotFunction = getFirstPivotFunction(tokens);
61306
- if (!pivotFunction) return;
61307
- const { functionName, args } = pivotFunction;
61308
- return {
61309
- functionName,
61310
- args: args.map((argAst) => {
61295
+ getPivotFunctions(sheetId, tokens) {
61296
+ const pivotFunctions = getPivotFunctions(tokens);
61297
+ if (!pivotFunctions.length) return [];
61298
+ const evaluatedPivotFunctions = [];
61299
+ for (const pivotFunction of pivotFunctions) {
61300
+ const { functionName, args } = pivotFunction;
61301
+ const evaluatedArgs = args.map((argAst) => {
61311
61302
  if (argAst.type === "EMPTY") return;
61312
61303
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
61313
61304
  const argsString = astToFormula(argAst);
61314
61305
  return this.getters.evaluateFormula(sheetId, argsString);
61315
- })
61316
- };
61306
+ });
61307
+ evaluatedPivotFunctions.push({
61308
+ functionName,
61309
+ args: evaluatedArgs
61310
+ });
61311
+ }
61312
+ return evaluatedPivotFunctions;
61313
+ }
61314
+ getFirstPivotFunction(sheetId, tokens) {
61315
+ return this.getPivotFunctions(sheetId, tokens)[0];
61317
61316
  }
61318
61317
  /**
61319
61318
  * Returns the domain args of a pivot formula from a position.
@@ -61419,8 +61418,8 @@ stores.inject(MyMetaStore, storeInstance);
61419
61418
  const unusedPivots = new Set(this.getters.getPivotIds());
61420
61419
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
61421
61420
  const position = this.getters.getCellPosition(cellId);
61422
- const pivotId = this.getPivotIdFromPosition(position);
61423
- if (pivotId) {
61421
+ const pivotIds = this.getPivotIdsFromPosition(position);
61422
+ for (const pivotId of pivotIds) {
61424
61423
  unusedPivots.delete(pivotId);
61425
61424
  if (!unusedPivots.size) {
61426
61425
  this.unusedPivotsInFormulas = [];
@@ -61428,6 +61427,21 @@ stores.inject(MyMetaStore, storeInstance);
61428
61427
  }
61429
61428
  }
61430
61429
  }
61430
+ for (const pivotId of this.getters.getPivotIds()) {
61431
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
61432
+ for (const measure of pivot.measures) if (measure.computedBy) {
61433
+ const { sheetId } = measure.computedBy;
61434
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
61435
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
61436
+ for (const relatedPivotId of relatedPivotIds) {
61437
+ unusedPivots.delete(relatedPivotId);
61438
+ if (!unusedPivots.size) {
61439
+ this.unusedPivotsInFormulas = [];
61440
+ return [];
61441
+ }
61442
+ }
61443
+ }
61444
+ }
61431
61445
  this.unusedPivotsInFormulas = [...unusedPivots];
61432
61446
  return this.unusedPivotsInFormulas;
61433
61447
  }
@@ -63095,7 +63109,8 @@ stores.inject(MyMetaStore, storeInstance);
63095
63109
  "REMOVE_TABLE",
63096
63110
  "RESIZE_TABLE",
63097
63111
  "CREATE_TABLE_STYLE",
63098
- "REMOVE_TABLE_STYLE"
63112
+ "REMOVE_TABLE_STYLE",
63113
+ "DELETE_CONTENT"
63099
63114
  ]);
63100
63115
  function doesCommandInvalidatesTableStyle(cmd) {
63101
63116
  return invalidateTableStyleCommandsSet.has(cmd.type);
@@ -68303,10 +68318,10 @@ stores.inject(MyMetaStore, storeInstance);
68303
68318
 
68304
68319
  //#endregion
68305
68320
  //#region src/plugins/index.ts
68306
- const corePluginRegistry = new Registry$1().add("settings", SettingsPlugin).add("sheet", SheetPlugin).add("header grouping", HeaderGroupingPlugin).add("header visibility", HeaderVisibilityPlugin).add("tables", TablePlugin).add("dataValidation", DataValidationPlugin).add("cell", CellPlugin).add("merge", MergePlugin).add("style", StylePlugin).add("headerSize", HeaderSizePlugin).add("borders", BordersPlugin).add("conditional formatting", ConditionalFormatPlugin).add("figures", FigurePlugin).add("chart", ChartPlugin).add("carousel", CarouselPlugin).add("image", ImagePlugin).add("pivot_core", PivotCorePlugin).add("spreadsheet_pivot_core", SpreadsheetPivotCorePlugin).add("tableStyle", TableStylePlugin);
68307
- const featurePluginRegistry = new Registry$1().add("ui_sheet", SheetUIPlugin).add("ui_options", UIOptionsPlugin).add("autofill", AutofillPlugin).add("sort", SortPlugin).add("automatic_sum", AutomaticSumPlugin).add("format", FormatPlugin).add("insert_pivot", InsertPivotPlugin).add("pivot_presence", PivotPresencePlugin).add("split_to_columns", SplitToColumnsPlugin).add("subtotal_evaluation", SubtotalEvaluationPlugin).add("collaborative", CollaborativePlugin).add("history", HistoryPlugin).add("table_autofill", TableAutofillPlugin).add("table_ui_resize", TableResizeUI).add("datavalidation_insert", DataValidationInsertionPlugin).add("checkbox_toggle", CheckboxTogglePlugin).add("dynamic_translate", DynamicTranslate).add("geo_features", GeoFeaturePlugin).add("data_cleanup", DataCleanupPlugin);
68308
- const statefulUIPluginRegistry = new Registry$1().add("selection", GridSelectionPlugin).add("evaluation_filter", FilterEvaluationPlugin).add("header_visibility_ui", HeaderVisibilityUIPlugin).add("cell_computed_style", CellComputedStylePlugin).add("table_computed_style", TableComputedStylePlugin).add("header_positions", HeaderPositionsUIPlugin).add("viewport", SheetViewPlugin).add("clipboard", ClipboardPlugin).add("carousel_ui", CarouselUIPlugin);
68309
- const coreViewsPluginRegistry = new Registry$1().add("evaluation", EvaluationPlugin).add("evaluation_chart", EvaluationChartPlugin).add("evaluation_cf", EvaluationConditionalFormatPlugin).add("row_size", HeaderSizeUIPlugin).add("data_validation_ui", EvaluationDataValidationPlugin).add("dynamic_tables", DynamicTablesPlugin).add("custom_colors", CustomColorsPlugin).add("pivot_ui", PivotUIPlugin).add("cell_icon", CellIconPlugin);
68321
+ const corePluginRegistry = new Registry().add("settings", SettingsPlugin).add("sheet", SheetPlugin).add("header grouping", HeaderGroupingPlugin).add("header visibility", HeaderVisibilityPlugin).add("tables", TablePlugin).add("dataValidation", DataValidationPlugin).add("cell", CellPlugin).add("merge", MergePlugin).add("style", StylePlugin).add("headerSize", HeaderSizePlugin).add("borders", BordersPlugin).add("conditional formatting", ConditionalFormatPlugin).add("figures", FigurePlugin).add("chart", ChartPlugin).add("carousel", CarouselPlugin).add("image", ImagePlugin).add("pivot_core", PivotCorePlugin).add("spreadsheet_pivot_core", SpreadsheetPivotCorePlugin).add("tableStyle", TableStylePlugin);
68322
+ const featurePluginRegistry = new Registry().add("ui_sheet", SheetUIPlugin).add("ui_options", UIOptionsPlugin).add("autofill", AutofillPlugin).add("sort", SortPlugin).add("automatic_sum", AutomaticSumPlugin).add("format", FormatPlugin).add("insert_pivot", InsertPivotPlugin).add("pivot_presence", PivotPresencePlugin).add("split_to_columns", SplitToColumnsPlugin).add("subtotal_evaluation", SubtotalEvaluationPlugin).add("collaborative", CollaborativePlugin).add("history", HistoryPlugin).add("table_autofill", TableAutofillPlugin).add("table_ui_resize", TableResizeUI).add("datavalidation_insert", DataValidationInsertionPlugin).add("checkbox_toggle", CheckboxTogglePlugin).add("dynamic_translate", DynamicTranslate).add("geo_features", GeoFeaturePlugin).add("data_cleanup", DataCleanupPlugin);
68323
+ const statefulUIPluginRegistry = new Registry().add("selection", GridSelectionPlugin).add("evaluation_filter", FilterEvaluationPlugin).add("header_visibility_ui", HeaderVisibilityUIPlugin).add("cell_computed_style", CellComputedStylePlugin).add("table_computed_style", TableComputedStylePlugin).add("header_positions", HeaderPositionsUIPlugin).add("viewport", SheetViewPlugin).add("clipboard", ClipboardPlugin).add("carousel_ui", CarouselUIPlugin);
68324
+ const coreViewsPluginRegistry = new Registry().add("evaluation", EvaluationPlugin).add("evaluation_chart", EvaluationChartPlugin).add("evaluation_cf", EvaluationConditionalFormatPlugin).add("row_size", HeaderSizeUIPlugin).add("data_validation_ui", EvaluationDataValidationPlugin).add("dynamic_tables", DynamicTablesPlugin).add("custom_colors", CustomColorsPlugin).add("pivot_ui", PivotUIPlugin).add("cell_icon", CellIconPlugin);
68310
68325
 
68311
68326
  //#endregion
68312
68327
  //#region src/registries/auto_completes/data_validation_auto_complete.ts
@@ -74075,6 +74090,11 @@ stores.inject(MyMetaStore, storeInstance);
74075
74090
  `;
74076
74091
  }
74077
74092
  function insertText(text, fontColor = "000000", fontsize = 16, style = {}) {
74093
+ const textProperties = [
74094
+ ["b", style.bold ? "1" : "0"],
74095
+ ["i", style.italic ? "1" : "0"],
74096
+ ["sz", fontsize * 100]
74097
+ ];
74078
74098
  return escapeXml`
74079
74099
  <c:tx>
74080
74100
  <c:rich>
@@ -74082,13 +74102,13 @@ stores.inject(MyMetaStore, storeInstance);
74082
74102
  <a:lstStyle />
74083
74103
  <a:p>
74084
74104
  <a:pPr lvl="0">
74085
- <a:defRPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}">
74105
+ <a:defRPr ${formatAttributes(textProperties)}>
74086
74106
  ${solidFill(fontColor)}
74087
74107
  <a:latin typeface="+mn-lt"/>
74088
74108
  </a:defRPr>
74089
74109
  </a:pPr>
74090
74110
  <a:r> <!-- Runs -->
74091
- <a:rPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}" sz="${fontsize * 100}"/>
74111
+ <a:rPr ${formatAttributes(textProperties)}/>
74092
74112
  <a:t>${text}</a:t>
74093
74113
  </a:r>
74094
74114
  </a:p>
@@ -79101,8 +79121,8 @@ exports.stores = stores;
79101
79121
  exports.tokenColors = tokenColors;
79102
79122
  exports.tokenize = tokenize;
79103
79123
 
79104
- __info__.version = "19.1.20";
79105
- __info__.date = "2026-05-15T07:06:03.182Z";
79106
- __info__.hash = "b6a68b8";
79124
+ __info__.version = "19.1.22";
79125
+ __info__.date = "2026-06-06T06:23:19.222Z";
79126
+ __info__.hash = "97a02db";
79107
79127
 
79108
79128
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);