@odoo/o-spreadsheet 18.3.16 → 18.3.17

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 18.3.16
6
- * @date 2025-08-18T08:15:07.809Z
7
- * @hash 68ef497
5
+ * @version 18.3.17
6
+ * @date 2025-08-21T06:40:44.469Z
7
+ * @hash ab02b0c
8
8
  */
9
9
 
10
10
  'use strict';
@@ -3634,6 +3634,7 @@ exports.CommandResult = void 0;
3634
3634
  CommandResult["Success"] = "Success";
3635
3635
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3636
3636
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3637
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3637
3638
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3638
3639
  CommandResult["CellIsMerged"] = "CellIsMerged";
3639
3640
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7113,15 +7114,18 @@ function parseOSClipboardContent(content, clipboardId) {
7113
7114
  ?.getAttribute("data-osheet-clipboard");
7114
7115
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7115
7116
  }
7117
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7116
7118
  let imageBlob = undefined;
7117
- for (const type of AllowedImageMimeTypes) {
7118
- if (content[type]) {
7119
- imageBlob = content[type];
7120
- break;
7119
+ if (!textContent.trim()) {
7120
+ for (const type of AllowedImageMimeTypes) {
7121
+ if (content[type]) {
7122
+ imageBlob = content[type];
7123
+ break;
7124
+ }
7121
7125
  }
7122
7126
  }
7123
7127
  const osClipboardContent = {
7124
- text: content[ClipboardMIMEType.PlainText],
7128
+ text: textContent,
7125
7129
  data: spreadsheetContent,
7126
7130
  imageBlob,
7127
7131
  };
@@ -24952,6 +24956,7 @@ const CustomCurrencyTerms = {
24952
24956
  Custom: _t("Custom"),
24953
24957
  };
24954
24958
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24959
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24955
24960
  const SplitToColumnsTerms = {
24956
24961
  Errors: {
24957
24962
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28354,9 +28359,6 @@ class RadarChart extends AbstractChart {
28354
28359
  };
28355
28360
  }
28356
28361
  getDefinitionForExcel() {
28357
- if (this.aggregated) {
28358
- return undefined;
28359
- }
28360
28362
  const dataSets = this.dataSets
28361
28363
  .map((ds) => toExcelDataset(this.getters, ds))
28362
28364
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -54693,8 +54695,13 @@ class RowResizer extends AbstractResizer {
54693
54695
  elements,
54694
54696
  position: this.state.position,
54695
54697
  });
54696
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54697
- this.env.raiseError(MergeErrorMessage);
54698
+ if (!result.isSuccessful) {
54699
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54700
+ this.env.raiseError(MergeErrorMessage);
54701
+ }
54702
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
54703
+ this.env.raiseError(TableHeaderMoveErrorMessage);
54704
+ }
54698
54705
  }
54699
54706
  }
54700
54707
  _selectElement(index, addDistinctHeader) {
@@ -66668,7 +66675,7 @@ function withPivotPresentationLayer (PivotClass) {
66668
66675
  return PivotPresentationLayer;
66669
66676
  }
66670
66677
 
66671
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
66678
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
66672
66679
  function isPivotCommand(cmd) {
66673
66680
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
66674
66681
  }
@@ -72100,8 +72107,33 @@ class GridSelectionPlugin extends UIPlugin {
72100
72107
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
72101
72108
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
72102
72109
  }
72110
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
72111
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
72112
+ }
72103
72113
  return "Success" /* CommandResult.Success */;
72104
72114
  }
72115
+ isTableRowMoveAllowed(sheetId, selectedRows) {
72116
+ const tables = this.getters.getCoreTables(sheetId);
72117
+ if (tables.length === 0) {
72118
+ return true;
72119
+ }
72120
+ const selectedRowSet = new Set(selectedRows);
72121
+ return tables.every(({ range: { zone }, config }) => {
72122
+ const { top, bottom } = zone;
72123
+ if (config.numberOfHeaders === 0) {
72124
+ return true;
72125
+ }
72126
+ const headerRowEnd = top + config.numberOfHeaders - 1;
72127
+ // Moving the table is allowed if table header rows are not part of the selection
72128
+ // Or if the entire table (including header) is selected
72129
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
72130
+ if (!isHeaderSelected) {
72131
+ return true;
72132
+ }
72133
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
72134
+ return isWholeTableSelected;
72135
+ });
72136
+ }
72105
72137
  fallbackToVisibleSheet() {
72106
72138
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
72107
72139
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -80920,6 +80952,6 @@ exports.tokenColors = tokenColors;
80920
80952
  exports.tokenize = tokenize;
80921
80953
 
80922
80954
 
80923
- __info__.version = "18.3.16";
80924
- __info__.date = "2025-08-18T08:15:07.809Z";
80925
- __info__.hash = "68ef497";
80955
+ __info__.version = "18.3.17";
80956
+ __info__.date = "2025-08-21T06:40:44.469Z";
80957
+ __info__.hash = "ab02b0c";
@@ -2254,6 +2254,7 @@ declare class GridSelectionPlugin extends UIPlugin {
2254
2254
  private getFiguresUpdates;
2255
2255
  private applyFigureUpdates;
2256
2256
  private isMoveElementAllowed;
2257
+ private isTableRowMoveAllowed;
2257
2258
  private fallbackToVisibleSheet;
2258
2259
  /**
2259
2260
  * Clip the selection if it spans outside the sheet
@@ -3265,6 +3266,7 @@ declare const enum CommandResult {
3265
3266
  Success = "Success",
3266
3267
  CancelledForUnknownReason = "CancelledForUnknownReason",
3267
3268
  WillRemoveExistingMerge = "WillRemoveExistingMerge",
3269
+ CannotMoveTableHeader = "CannotMoveTableHeader",
3268
3270
  MergeIsDestructive = "MergeIsDestructive",
3269
3271
  CellIsMerged = "CellIsMerged",
3270
3272
  InvalidTarget = "InvalidTarget",
@@ -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 18.3.16
6
- * @date 2025-08-18T08:15:07.809Z
7
- * @hash 68ef497
5
+ * @version 18.3.17
6
+ * @date 2025-08-21T06:40:44.469Z
7
+ * @hash ab02b0c
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -3632,6 +3632,7 @@ var CommandResult;
3632
3632
  CommandResult["Success"] = "Success";
3633
3633
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3634
3634
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3635
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3635
3636
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3636
3637
  CommandResult["CellIsMerged"] = "CellIsMerged";
3637
3638
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7111,15 +7112,18 @@ function parseOSClipboardContent(content, clipboardId) {
7111
7112
  ?.getAttribute("data-osheet-clipboard");
7112
7113
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7113
7114
  }
7115
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7114
7116
  let imageBlob = undefined;
7115
- for (const type of AllowedImageMimeTypes) {
7116
- if (content[type]) {
7117
- imageBlob = content[type];
7118
- break;
7117
+ if (!textContent.trim()) {
7118
+ for (const type of AllowedImageMimeTypes) {
7119
+ if (content[type]) {
7120
+ imageBlob = content[type];
7121
+ break;
7122
+ }
7119
7123
  }
7120
7124
  }
7121
7125
  const osClipboardContent = {
7122
- text: content[ClipboardMIMEType.PlainText],
7126
+ text: textContent,
7123
7127
  data: spreadsheetContent,
7124
7128
  imageBlob,
7125
7129
  };
@@ -24950,6 +24954,7 @@ const CustomCurrencyTerms = {
24950
24954
  Custom: _t("Custom"),
24951
24955
  };
24952
24956
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24957
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24953
24958
  const SplitToColumnsTerms = {
24954
24959
  Errors: {
24955
24960
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28352,9 +28357,6 @@ class RadarChart extends AbstractChart {
28352
28357
  };
28353
28358
  }
28354
28359
  getDefinitionForExcel() {
28355
- if (this.aggregated) {
28356
- return undefined;
28357
- }
28358
28360
  const dataSets = this.dataSets
28359
28361
  .map((ds) => toExcelDataset(this.getters, ds))
28360
28362
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -54691,8 +54693,13 @@ class RowResizer extends AbstractResizer {
54691
54693
  elements,
54692
54694
  position: this.state.position,
54693
54695
  });
54694
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54695
- this.env.raiseError(MergeErrorMessage);
54696
+ if (!result.isSuccessful) {
54697
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54698
+ this.env.raiseError(MergeErrorMessage);
54699
+ }
54700
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
54701
+ this.env.raiseError(TableHeaderMoveErrorMessage);
54702
+ }
54696
54703
  }
54697
54704
  }
54698
54705
  _selectElement(index, addDistinctHeader) {
@@ -66666,7 +66673,7 @@ function withPivotPresentationLayer (PivotClass) {
66666
66673
  return PivotPresentationLayer;
66667
66674
  }
66668
66675
 
66669
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
66676
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
66670
66677
  function isPivotCommand(cmd) {
66671
66678
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
66672
66679
  }
@@ -72098,8 +72105,33 @@ class GridSelectionPlugin extends UIPlugin {
72098
72105
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
72099
72106
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
72100
72107
  }
72108
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
72109
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
72110
+ }
72101
72111
  return "Success" /* CommandResult.Success */;
72102
72112
  }
72113
+ isTableRowMoveAllowed(sheetId, selectedRows) {
72114
+ const tables = this.getters.getCoreTables(sheetId);
72115
+ if (tables.length === 0) {
72116
+ return true;
72117
+ }
72118
+ const selectedRowSet = new Set(selectedRows);
72119
+ return tables.every(({ range: { zone }, config }) => {
72120
+ const { top, bottom } = zone;
72121
+ if (config.numberOfHeaders === 0) {
72122
+ return true;
72123
+ }
72124
+ const headerRowEnd = top + config.numberOfHeaders - 1;
72125
+ // Moving the table is allowed if table header rows are not part of the selection
72126
+ // Or if the entire table (including header) is selected
72127
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
72128
+ if (!isHeaderSelected) {
72129
+ return true;
72130
+ }
72131
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
72132
+ return isWholeTableSelected;
72133
+ });
72134
+ }
72103
72135
  fallbackToVisibleSheet() {
72104
72136
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
72105
72137
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -80872,6 +80904,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
80872
80904
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
80873
80905
 
80874
80906
 
80875
- __info__.version = "18.3.16";
80876
- __info__.date = "2025-08-18T08:15:07.809Z";
80877
- __info__.hash = "68ef497";
80907
+ __info__.version = "18.3.17";
80908
+ __info__.date = "2025-08-21T06:40:44.469Z";
80909
+ __info__.hash = "ab02b0c";
@@ -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 18.3.16
6
- * @date 2025-08-18T08:15:07.809Z
7
- * @hash 68ef497
5
+ * @version 18.3.17
6
+ * @date 2025-08-21T06:40:44.469Z
7
+ * @hash ab02b0c
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3633,6 +3633,7 @@
3633
3633
  CommandResult["Success"] = "Success";
3634
3634
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3635
3635
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3636
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3636
3637
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3637
3638
  CommandResult["CellIsMerged"] = "CellIsMerged";
3638
3639
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7112,15 +7113,18 @@
7112
7113
  ?.getAttribute("data-osheet-clipboard");
7113
7114
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7114
7115
  }
7116
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7115
7117
  let imageBlob = undefined;
7116
- for (const type of AllowedImageMimeTypes) {
7117
- if (content[type]) {
7118
- imageBlob = content[type];
7119
- break;
7118
+ if (!textContent.trim()) {
7119
+ for (const type of AllowedImageMimeTypes) {
7120
+ if (content[type]) {
7121
+ imageBlob = content[type];
7122
+ break;
7123
+ }
7120
7124
  }
7121
7125
  }
7122
7126
  const osClipboardContent = {
7123
- text: content[ClipboardMIMEType.PlainText],
7127
+ text: textContent,
7124
7128
  data: spreadsheetContent,
7125
7129
  imageBlob,
7126
7130
  };
@@ -24951,6 +24955,7 @@ stores.inject(MyMetaStore, storeInstance);
24951
24955
  Custom: _t("Custom"),
24952
24956
  };
24953
24957
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24958
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24954
24959
  const SplitToColumnsTerms = {
24955
24960
  Errors: {
24956
24961
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28353,9 +28358,6 @@ stores.inject(MyMetaStore, storeInstance);
28353
28358
  };
28354
28359
  }
28355
28360
  getDefinitionForExcel() {
28356
- if (this.aggregated) {
28357
- return undefined;
28358
- }
28359
28361
  const dataSets = this.dataSets
28360
28362
  .map((ds) => toExcelDataset(this.getters, ds))
28361
28363
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -54692,8 +54694,13 @@ stores.inject(MyMetaStore, storeInstance);
54692
54694
  elements,
54693
54695
  position: this.state.position,
54694
54696
  });
54695
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54696
- this.env.raiseError(MergeErrorMessage);
54697
+ if (!result.isSuccessful) {
54698
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
54699
+ this.env.raiseError(MergeErrorMessage);
54700
+ }
54701
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
54702
+ this.env.raiseError(TableHeaderMoveErrorMessage);
54703
+ }
54697
54704
  }
54698
54705
  }
54699
54706
  _selectElement(index, addDistinctHeader) {
@@ -66667,7 +66674,7 @@ stores.inject(MyMetaStore, storeInstance);
66667
66674
  return PivotPresentationLayer;
66668
66675
  }
66669
66676
 
66670
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
66677
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
66671
66678
  function isPivotCommand(cmd) {
66672
66679
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
66673
66680
  }
@@ -72099,8 +72106,33 @@ stores.inject(MyMetaStore, storeInstance);
72099
72106
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
72100
72107
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
72101
72108
  }
72109
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
72110
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
72111
+ }
72102
72112
  return "Success" /* CommandResult.Success */;
72103
72113
  }
72114
+ isTableRowMoveAllowed(sheetId, selectedRows) {
72115
+ const tables = this.getters.getCoreTables(sheetId);
72116
+ if (tables.length === 0) {
72117
+ return true;
72118
+ }
72119
+ const selectedRowSet = new Set(selectedRows);
72120
+ return tables.every(({ range: { zone }, config }) => {
72121
+ const { top, bottom } = zone;
72122
+ if (config.numberOfHeaders === 0) {
72123
+ return true;
72124
+ }
72125
+ const headerRowEnd = top + config.numberOfHeaders - 1;
72126
+ // Moving the table is allowed if table header rows are not part of the selection
72127
+ // Or if the entire table (including header) is selected
72128
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
72129
+ if (!isHeaderSelected) {
72130
+ return true;
72131
+ }
72132
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
72133
+ return isWholeTableSelected;
72134
+ });
72135
+ }
72104
72136
  fallbackToVisibleSheet() {
72105
72137
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
72106
72138
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -80919,9 +80951,9 @@ stores.inject(MyMetaStore, storeInstance);
80919
80951
  exports.tokenize = tokenize;
80920
80952
 
80921
80953
 
80922
- __info__.version = "18.3.16";
80923
- __info__.date = "2025-08-18T08:15:07.809Z";
80924
- __info__.hash = "68ef497";
80954
+ __info__.version = "18.3.17";
80955
+ __info__.date = "2025-08-21T06:40:44.469Z";
80956
+ __info__.hash = "ab02b0c";
80925
80957
 
80926
80958
 
80927
80959
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);