@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
  import { App, Component, blockDom, markRaw, onMounted, onPatched, onWillPatch, onWillStart, onWillUnmount, onWillUpdateProps, status, toRaw, useChildSubEnv, useComponent, useEffect, useEnv, useExternalListener, useRef, useState, useSubEnv, whenReady, xml } from "@odoo/owl";
@@ -4302,6 +4302,7 @@ const DEFAULT_LOCALE = DEFAULT_LOCALES[0];
4302
4302
  //#endregion
4303
4303
  //#region src/helpers/format/format_tokenizer.ts
4304
4304
  function tokenizeFormat(str) {
4305
+ str = str.replace(/\s/g, " ");
4305
4306
  const chars = new TokenizingChars(str);
4306
4307
  const result = [];
4307
4308
  let currentFormatPart = [];
@@ -6427,8 +6428,13 @@ function getApplyRangeChangeAddColRow(cmd) {
6427
6428
  changeType: "NONE",
6428
6429
  range
6429
6430
  };
6431
+ const isUnboundedAtEnd = range.unboundedZone[end] === void 0;
6432
+ if (isUnboundedAtEnd && !range.unboundedZone.hasHeader) return {
6433
+ changeType: "RESIZE",
6434
+ range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6435
+ };
6430
6436
  if (cmd.position === "after") {
6431
- if (range.zone[start] <= cmd.base && cmd.base < range.zone[end]) return {
6437
+ if (range.zone[start] <= cmd.base && (cmd.base < range.zone[end] || isUnboundedAtEnd)) return {
6432
6438
  changeType: "RESIZE",
6433
6439
  range: createAdaptedRange(range, dimension, "RESIZE", cmd.quantity)
6434
6440
  };
@@ -7021,40 +7027,9 @@ var UuidGenerator = class {
7021
7027
  }
7022
7028
  };
7023
7029
 
7024
- //#endregion
7025
- //#region src/registry.ts
7026
- var Registry$1 = class {
7027
- content = {};
7028
- add(key, value) {
7029
- if (key in this.content) throw new Error(`${key} is already present in this registry!`);
7030
- return this.replace(key, value);
7031
- }
7032
- replace(key, value) {
7033
- this.content[key] = value;
7034
- return this;
7035
- }
7036
- get(key) {
7037
- const content = this.content[key];
7038
- if (!content && !(key in this.content)) throw new Error(`Cannot find ${key} in this registry!`);
7039
- return content;
7040
- }
7041
- contains(key) {
7042
- return key in this.content;
7043
- }
7044
- getAll() {
7045
- return Object.values(this.content);
7046
- }
7047
- getKeys() {
7048
- return Object.keys(this.content);
7049
- }
7050
- remove(key) {
7051
- delete this.content[key];
7052
- }
7053
- };
7054
-
7055
7030
  //#endregion
7056
7031
  //#region src/helpers/figures/charts/chart_js_extension.ts
7057
- const chartJsExtensionRegistry = new Registry$1();
7032
+ const chartJsExtensionRegistry = new Registry();
7058
7033
  function areChartJSExtensionsLoaded() {
7059
7034
  return globalThis.Chart ? !!globalThis.Chart.registry.plugins.get("chartShowValuesPlugin") : true;
7060
7035
  }
@@ -7357,6 +7332,10 @@ const FORCE_DEFAULT_ARGS_FUNCTIONS = {
7357
7332
  ROUNDDOWN: [{
7358
7333
  type: "NUMBER",
7359
7334
  value: 0
7335
+ }],
7336
+ IFERROR: [{
7337
+ type: "NUMBER",
7338
+ value: 0
7360
7339
  }]
7361
7340
  };
7362
7341
  /**
@@ -26298,7 +26277,7 @@ const HYPERLINK = {
26298
26277
  //#endregion
26299
26278
  //#region src/functions/function_registry.ts
26300
26279
  const functionNameRegex = /^[A-Z0-9\_\.]+$/;
26301
- var FunctionRegistry = class extends Registry$1 {
26280
+ var FunctionRegistry = class extends Registry {
26302
26281
  mapping = {};
26303
26282
  add(name, addDescr) {
26304
26283
  name = name.toUpperCase();
@@ -35788,7 +35767,7 @@ const WEEK_START = {
35788
35767
 
35789
35768
  //#endregion
35790
35769
  //#region src/migrations/migration_steps.ts
35791
- const migrationStepRegistry = new Registry$1();
35770
+ const migrationStepRegistry = new Registry();
35792
35771
  migrationStepRegistry.add("0.1", { migrate(data) {
35793
35772
  if (data.sheets && data.sheets[0]) data.activeSheet = data.sheets[0].name;
35794
35773
  return data;
@@ -36950,11 +36929,10 @@ const INSERT_TABLE = (env) => {
36950
36929
  if (interactiveCreateTable(env, env.model.getters.getActiveSheetId()).isSuccessful) env.openSidePanel("TableSidePanel", {});
36951
36930
  };
36952
36931
  const DELETE_SELECTED_TABLE = (env) => {
36953
- const position = env.model.getters.getActivePosition();
36954
- const table = env.model.getters.getTable(position);
36932
+ const table = env.model.getters.getFirstTableInSelection();
36955
36933
  if (!table) return;
36956
36934
  env.model.dispatch("REMOVE_TABLE", {
36957
- sheetId: position.sheetId,
36935
+ sheetId: env.model.getters.getActiveSheetId(),
36958
36936
  target: [table.range.zone]
36959
36937
  });
36960
36938
  };
@@ -39323,7 +39301,7 @@ var SpreadsheetPivot = class {
39323
39301
 
39324
39302
  //#endregion
39325
39303
  //#region src/helpers/pivot/pivot_registry.ts
39326
- const pivotRegistry = new Registry$1();
39304
+ const pivotRegistry = new Registry();
39327
39305
  const dateGranularities = [
39328
39306
  "year",
39329
39307
  "quarter_number",
@@ -49476,7 +49454,7 @@ function getVisiblePivotCellPositions(getters, pivotId) {
49476
49454
  col,
49477
49455
  row
49478
49456
  };
49479
- if (pivotId === getters.getPivotIdFromPosition(position)) positions.push(position);
49457
+ if (getters.getPivotIdsFromPosition(position).includes(pivotId)) positions.push(position);
49480
49458
  }
49481
49459
  return positions;
49482
49460
  }
@@ -50576,6 +50554,9 @@ const PIVOT_FUNCTIONS = [
50576
50554
  function getFirstPivotFunction(tokens) {
50577
50555
  return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS)[0];
50578
50556
  }
50557
+ function getPivotFunctions(tokens) {
50558
+ return getFunctionsFromTokens(tokens, PIVOT_FUNCTIONS);
50559
+ }
50579
50560
  /**
50580
50561
  * Parse a spreadsheet formula and detect the number of PIVOT functions that are
50581
50562
  * present in the given formula.
@@ -61224,6 +61205,7 @@ var PivotUIPlugin = class extends CoreViewPlugin {
61224
61205
  "getFirstPivotFunction",
61225
61206
  "getPivotCellSortDirection",
61226
61207
  "getPivotIdFromPosition",
61208
+ "getPivotIdsFromPosition",
61227
61209
  "getPivotCellFromPosition",
61228
61210
  "generateNewCalculatedMeasureName",
61229
61211
  "isPivotUnused",
@@ -61248,9 +61230,11 @@ var PivotUIPlugin = class extends CoreViewPlugin {
61248
61230
  this.refreshPivot(cmd.id);
61249
61231
  break;
61250
61232
  case "ADD_PIVOT":
61233
+ this.unusedPivotsInFormulas?.push(cmd.pivotId);
61251
61234
  this.setupPivot(cmd.pivotId);
61252
61235
  break;
61253
61236
  case "DUPLICATE_PIVOT":
61237
+ this.unusedPivotsInFormulas?.push(cmd.newPivotId);
61254
61238
  this.setupPivot(cmd.newPivotId);
61255
61239
  break;
61256
61240
  case "UPDATE_PIVOT":
@@ -61281,37 +61265,52 @@ var PivotUIPlugin = class extends CoreViewPlugin {
61281
61265
  }
61282
61266
  }
61283
61267
  /**
61284
- * Get the id of the pivot at the given position. Returns undefined if there
61268
+ * Get the id of the first pivot in the formula at the given position. Returns undefined if there
61285
61269
  * is no pivot at this position
61286
61270
  */
61287
61271
  getPivotIdFromPosition(position) {
61272
+ return this.getPivotIdsFromPosition(position)[0];
61273
+ }
61274
+ /**
61275
+ * Get all of the ids of the pivot present in the formula at the given position.
61276
+ */
61277
+ getPivotIdsFromPosition(position) {
61288
61278
  const cell = this.getters.getCorrespondingFormulaCell(position);
61289
- if (cell && cell.isFormula) {
61290
- const pivotFunction = this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens);
61291
- if (pivotFunction) {
61292
- const pivotId = pivotFunction.args[0]?.toString();
61293
- return pivotId && this.getters.getPivotId(pivotId);
61294
- }
61295
- }
61279
+ if (cell && cell.isFormula) return this.getPivotIdsFromFormula(position.sheetId, cell.compiledFormula);
61280
+ return [];
61281
+ }
61282
+ getPivotIdsFromFormula(sheetId, formula) {
61283
+ return this.getPivotFunctions(sheetId, formula.tokens).map((pivotFunction) => {
61284
+ const pivotId = pivotFunction.args[0]?.toString();
61285
+ return pivotId && this.getters.getPivotId(pivotId);
61286
+ }).filter(isDefined);
61296
61287
  }
61297
61288
  isSpillPivotFormula(position) {
61298
61289
  const cell = this.getters.getCorrespondingFormulaCell(position);
61299
61290
  if (cell && cell.isFormula) return this.getFirstPivotFunction(position.sheetId, cell.compiledFormula.tokens)?.functionName === "PIVOT";
61300
61291
  return false;
61301
61292
  }
61302
- getFirstPivotFunction(sheetId, tokens) {
61303
- const pivotFunction = getFirstPivotFunction(tokens);
61304
- if (!pivotFunction) return;
61305
- const { functionName, args } = pivotFunction;
61306
- return {
61307
- functionName,
61308
- args: args.map((argAst) => {
61293
+ getPivotFunctions(sheetId, tokens) {
61294
+ const pivotFunctions = getPivotFunctions(tokens);
61295
+ if (!pivotFunctions.length) return [];
61296
+ const evaluatedPivotFunctions = [];
61297
+ for (const pivotFunction of pivotFunctions) {
61298
+ const { functionName, args } = pivotFunction;
61299
+ const evaluatedArgs = args.map((argAst) => {
61309
61300
  if (argAst.type === "EMPTY") return;
61310
61301
  else if (argAst.type === "STRING" || argAst.type === "BOOLEAN" || argAst.type === "NUMBER") return argAst.value;
61311
61302
  const argsString = astToFormula(argAst);
61312
61303
  return this.getters.evaluateFormula(sheetId, argsString);
61313
- })
61314
- };
61304
+ });
61305
+ evaluatedPivotFunctions.push({
61306
+ functionName,
61307
+ args: evaluatedArgs
61308
+ });
61309
+ }
61310
+ return evaluatedPivotFunctions;
61311
+ }
61312
+ getFirstPivotFunction(sheetId, tokens) {
61313
+ return this.getPivotFunctions(sheetId, tokens)[0];
61315
61314
  }
61316
61315
  /**
61317
61316
  * Returns the domain args of a pivot formula from a position.
@@ -61417,8 +61416,8 @@ var PivotUIPlugin = class extends CoreViewPlugin {
61417
61416
  const unusedPivots = new Set(this.getters.getPivotIds());
61418
61417
  for (const sheetId of this.getters.getSheetIds()) for (const cellId in this.getters.getCells(sheetId)) {
61419
61418
  const position = this.getters.getCellPosition(cellId);
61420
- const pivotId = this.getPivotIdFromPosition(position);
61421
- if (pivotId) {
61419
+ const pivotIds = this.getPivotIdsFromPosition(position);
61420
+ for (const pivotId of pivotIds) {
61422
61421
  unusedPivots.delete(pivotId);
61423
61422
  if (!unusedPivots.size) {
61424
61423
  this.unusedPivotsInFormulas = [];
@@ -61426,6 +61425,21 @@ var PivotUIPlugin = class extends CoreViewPlugin {
61426
61425
  }
61427
61426
  }
61428
61427
  }
61428
+ for (const pivotId of this.getters.getPivotIds()) {
61429
+ const pivot = this.getters.getPivotCoreDefinition(pivotId);
61430
+ for (const measure of pivot.measures) if (measure.computedBy) {
61431
+ const { sheetId } = measure.computedBy;
61432
+ const formula = this.getters.getMeasureCompiledFormula(pivotId, measure);
61433
+ const relatedPivotIds = this.getPivotIdsFromFormula(sheetId, formula);
61434
+ for (const relatedPivotId of relatedPivotIds) {
61435
+ unusedPivots.delete(relatedPivotId);
61436
+ if (!unusedPivots.size) {
61437
+ this.unusedPivotsInFormulas = [];
61438
+ return [];
61439
+ }
61440
+ }
61441
+ }
61442
+ }
61429
61443
  this.unusedPivotsInFormulas = [...unusedPivots];
61430
61444
  return this.unusedPivotsInFormulas;
61431
61445
  }
@@ -63093,7 +63107,8 @@ const invalidateTableStyleCommandsSet = new Set([
63093
63107
  "REMOVE_TABLE",
63094
63108
  "RESIZE_TABLE",
63095
63109
  "CREATE_TABLE_STYLE",
63096
- "REMOVE_TABLE_STYLE"
63110
+ "REMOVE_TABLE_STYLE",
63111
+ "DELETE_CONTENT"
63097
63112
  ]);
63098
63113
  function doesCommandInvalidatesTableStyle(cmd) {
63099
63114
  return invalidateTableStyleCommandsSet.has(cmd.type);
@@ -68301,10 +68316,10 @@ var SheetViewPlugin = class extends UIPlugin {
68301
68316
 
68302
68317
  //#endregion
68303
68318
  //#region src/plugins/index.ts
68304
- 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);
68305
- 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);
68306
- 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);
68307
- 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);
68319
+ 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);
68320
+ 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);
68321
+ 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);
68322
+ 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);
68308
68323
 
68309
68324
  //#endregion
68310
68325
  //#region src/registries/auto_completes/data_validation_auto_complete.ts
@@ -74073,6 +74088,11 @@ function lineAttributes(params) {
74073
74088
  `;
74074
74089
  }
74075
74090
  function insertText(text, fontColor = "000000", fontsize = 16, style = {}) {
74091
+ const textProperties = [
74092
+ ["b", style.bold ? "1" : "0"],
74093
+ ["i", style.italic ? "1" : "0"],
74094
+ ["sz", fontsize * 100]
74095
+ ];
74076
74096
  return escapeXml`
74077
74097
  <c:tx>
74078
74098
  <c:rich>
@@ -74080,13 +74100,13 @@ function insertText(text, fontColor = "000000", fontsize = 16, style = {}) {
74080
74100
  <a:lstStyle />
74081
74101
  <a:p>
74082
74102
  <a:pPr lvl="0">
74083
- <a:defRPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}">
74103
+ <a:defRPr ${formatAttributes(textProperties)}>
74084
74104
  ${solidFill(fontColor)}
74085
74105
  <a:latin typeface="+mn-lt"/>
74086
74106
  </a:defRPr>
74087
74107
  </a:pPr>
74088
74108
  <a:r> <!-- Runs -->
74089
- <a:rPr b="${style?.bold ? 1 : 0}" i="${style?.italic ? 1 : 0}" sz="${fontsize * 100}"/>
74109
+ <a:rPr ${formatAttributes(textProperties)}/>
74090
74110
  <a:t>${text}</a:t>
74091
74111
  </a:r>
74092
74112
  </a:p>
@@ -79046,6 +79066,6 @@ const chartHelpers = {
79046
79066
  //#endregion
79047
79067
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, categories, chartHelpers, components, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
79048
79068
 
79049
- __info__.version = "19.1.20";
79050
- __info__.date = "2026-05-15T07:06:03.182Z";
79051
- __info__.hash = "b6a68b8";
79069
+ __info__.version = "19.1.22";
79070
+ __info__.date = "2026-06-06T06:23:19.222Z";
79071
+ __info__.hash = "97a02db";