@odoo/o-spreadsheet 18.0.40 → 18.0.42

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.0.40
6
- * @date 2025-08-18T08:15:29.422Z
7
- * @hash ec79db4
5
+ * @version 18.0.42
6
+ * @date 2025-08-26T10:07:59.958Z
7
+ * @hash 7ad0e33
8
8
  */
9
9
 
10
10
  'use strict';
@@ -3435,6 +3435,7 @@ exports.CommandResult = void 0;
3435
3435
  CommandResult["Success"] = "Success";
3436
3436
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3437
3437
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3438
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3438
3439
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3439
3440
  CommandResult["CellIsMerged"] = "CellIsMerged";
3440
3441
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -6658,15 +6659,22 @@ function parseOSClipboardContent(content) {
6658
6659
  };
6659
6660
  }
6660
6661
  const htmlDocument = new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html");
6661
- const oSheetClipboardData = htmlDocument
6662
- .querySelector("div")
6663
- ?.getAttribute("data-osheet-clipboard");
6664
- const spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
6665
6662
  return {
6666
6663
  text: content[ClipboardMIMEType.PlainText],
6667
- data: spreadsheetContent,
6664
+ data: getOSheetDataFromHTML(htmlDocument),
6668
6665
  };
6669
6666
  }
6667
+ function getOSheetDataFromHTML(htmlDocument) {
6668
+ const attributes = [...htmlDocument.documentElement.attributes];
6669
+ // Check if it's a Microsoft Office clipboard data (it will have some namespaces defined in the root element)
6670
+ if (attributes.some((attr) => attr.value.includes("microsoft"))) {
6671
+ return undefined;
6672
+ }
6673
+ const oSheetClipboardData = htmlDocument
6674
+ .querySelector("div")
6675
+ ?.getAttribute("data-osheet-clipboard");
6676
+ return oSheetClipboardData && JSON.parse(oSheetClipboardData);
6677
+ }
6670
6678
  /**
6671
6679
  * Applies each clipboard handler to paste its corresponding data into the target.
6672
6680
  */
@@ -15901,6 +15909,7 @@ const CustomCurrencyTerms = {
15901
15909
  Custom: _t("Custom"),
15902
15910
  };
15903
15911
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
15912
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
15904
15913
  const SplitToColumnsTerms = {
15905
15914
  Errors: {
15906
15915
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -30158,10 +30167,6 @@ class ComboChart extends AbstractChart {
30158
30167
  };
30159
30168
  }
30160
30169
  getDefinitionForExcel() {
30161
- // Excel does not support aggregating labels
30162
- if (this.aggregated) {
30163
- return undefined;
30164
- }
30165
30170
  const dataSets = this.dataSets
30166
30171
  .map((ds) => toExcelDataset(this.getters, ds))
30167
30172
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -31175,10 +31180,6 @@ class ScatterChart extends AbstractChart {
31175
31180
  return new ScatterChart(definition, this.sheetId, this.getters);
31176
31181
  }
31177
31182
  getDefinitionForExcel() {
31178
- // Excel does not support aggregating labels
31179
- if (this.aggregated) {
31180
- return undefined;
31181
- }
31182
31183
  const dataSets = this.dataSets
31183
31184
  .map((ds) => toExcelDataset(this.getters, ds))
31184
31185
  .filter((ds) => ds.range !== "");
@@ -49130,8 +49131,13 @@ class RowResizer extends AbstractResizer {
49130
49131
  elements,
49131
49132
  position: this.state.position,
49132
49133
  });
49133
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49134
- this.env.raiseError(MergeErrorMessage);
49134
+ if (!result.isSuccessful) {
49135
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49136
+ this.env.raiseError(MergeErrorMessage);
49137
+ }
49138
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
49139
+ this.env.raiseError(TableHeaderMoveErrorMessage);
49140
+ }
49135
49141
  }
49136
49142
  }
49137
49143
  _selectElement(index, addDistinctHeader) {
@@ -61161,7 +61167,7 @@ function withPivotPresentationLayer (PivotClass) {
61161
61167
  return PivotPresentationLayer;
61162
61168
  }
61163
61169
 
61164
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
61170
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
61165
61171
  function isPivotCommand(cmd) {
61166
61172
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
61167
61173
  }
@@ -66266,8 +66272,33 @@ class GridSelectionPlugin extends UIPlugin {
66266
66272
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
66267
66273
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
66268
66274
  }
66275
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
66276
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
66277
+ }
66269
66278
  return "Success" /* CommandResult.Success */;
66270
66279
  }
66280
+ isTableRowMoveAllowed(sheetId, selectedRows) {
66281
+ const tables = this.getters.getCoreTables(sheetId);
66282
+ if (tables.length === 0) {
66283
+ return true;
66284
+ }
66285
+ const selectedRowSet = new Set(selectedRows);
66286
+ return tables.every(({ range: { zone }, config }) => {
66287
+ const { top, bottom } = zone;
66288
+ if (config.numberOfHeaders === 0) {
66289
+ return true;
66290
+ }
66291
+ const headerRowEnd = top + config.numberOfHeaders - 1;
66292
+ // Moving the table is allowed if table header rows are not part of the selection
66293
+ // Or if the entire table (including header) is selected
66294
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
66295
+ if (!isHeaderSelected) {
66296
+ return true;
66297
+ }
66298
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
66299
+ return isWholeTableSelected;
66300
+ });
66301
+ }
66271
66302
  fallbackToVisibleSheet() {
66272
66303
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
66273
66304
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -74649,6 +74680,6 @@ exports.tokenColors = tokenColors;
74649
74680
  exports.tokenize = tokenize;
74650
74681
 
74651
74682
 
74652
- __info__.version = "18.0.40";
74653
- __info__.date = "2025-08-18T08:15:29.422Z";
74654
- __info__.hash = "ec79db4";
74683
+ __info__.version = "18.0.42";
74684
+ __info__.date = "2025-08-26T10:07:59.958Z";
74685
+ __info__.hash = "7ad0e33";
@@ -1591,6 +1591,7 @@ declare class GridSelectionPlugin extends UIPlugin {
1591
1591
  private onAddElements;
1592
1592
  private onMoveElements;
1593
1593
  private isMoveElementAllowed;
1594
+ private isTableRowMoveAllowed;
1594
1595
  private fallbackToVisibleSheet;
1595
1596
  /**
1596
1597
  * Clip the selection if it spans outside the sheet
@@ -2578,6 +2579,7 @@ declare const enum CommandResult {
2578
2579
  Success = "Success",
2579
2580
  CancelledForUnknownReason = "CancelledForUnknownReason",
2580
2581
  WillRemoveExistingMerge = "WillRemoveExistingMerge",
2582
+ CannotMoveTableHeader = "CannotMoveTableHeader",
2581
2583
  MergeIsDestructive = "MergeIsDestructive",
2582
2584
  CellIsMerged = "CellIsMerged",
2583
2585
  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.0.40
6
- * @date 2025-08-18T08:15:29.422Z
7
- * @hash ec79db4
5
+ * @version 18.0.42
6
+ * @date 2025-08-26T10:07:59.958Z
7
+ * @hash 7ad0e33
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -3433,6 +3433,7 @@ var CommandResult;
3433
3433
  CommandResult["Success"] = "Success";
3434
3434
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3435
3435
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3436
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3436
3437
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3437
3438
  CommandResult["CellIsMerged"] = "CellIsMerged";
3438
3439
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -6656,15 +6657,22 @@ function parseOSClipboardContent(content) {
6656
6657
  };
6657
6658
  }
6658
6659
  const htmlDocument = new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html");
6659
- const oSheetClipboardData = htmlDocument
6660
- .querySelector("div")
6661
- ?.getAttribute("data-osheet-clipboard");
6662
- const spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
6663
6660
  return {
6664
6661
  text: content[ClipboardMIMEType.PlainText],
6665
- data: spreadsheetContent,
6662
+ data: getOSheetDataFromHTML(htmlDocument),
6666
6663
  };
6667
6664
  }
6665
+ function getOSheetDataFromHTML(htmlDocument) {
6666
+ const attributes = [...htmlDocument.documentElement.attributes];
6667
+ // Check if it's a Microsoft Office clipboard data (it will have some namespaces defined in the root element)
6668
+ if (attributes.some((attr) => attr.value.includes("microsoft"))) {
6669
+ return undefined;
6670
+ }
6671
+ const oSheetClipboardData = htmlDocument
6672
+ .querySelector("div")
6673
+ ?.getAttribute("data-osheet-clipboard");
6674
+ return oSheetClipboardData && JSON.parse(oSheetClipboardData);
6675
+ }
6668
6676
  /**
6669
6677
  * Applies each clipboard handler to paste its corresponding data into the target.
6670
6678
  */
@@ -15899,6 +15907,7 @@ const CustomCurrencyTerms = {
15899
15907
  Custom: _t("Custom"),
15900
15908
  };
15901
15909
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
15910
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
15902
15911
  const SplitToColumnsTerms = {
15903
15912
  Errors: {
15904
15913
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -30156,10 +30165,6 @@ class ComboChart extends AbstractChart {
30156
30165
  };
30157
30166
  }
30158
30167
  getDefinitionForExcel() {
30159
- // Excel does not support aggregating labels
30160
- if (this.aggregated) {
30161
- return undefined;
30162
- }
30163
30168
  const dataSets = this.dataSets
30164
30169
  .map((ds) => toExcelDataset(this.getters, ds))
30165
30170
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -31173,10 +31178,6 @@ class ScatterChart extends AbstractChart {
31173
31178
  return new ScatterChart(definition, this.sheetId, this.getters);
31174
31179
  }
31175
31180
  getDefinitionForExcel() {
31176
- // Excel does not support aggregating labels
31177
- if (this.aggregated) {
31178
- return undefined;
31179
- }
31180
31181
  const dataSets = this.dataSets
31181
31182
  .map((ds) => toExcelDataset(this.getters, ds))
31182
31183
  .filter((ds) => ds.range !== "");
@@ -49128,8 +49129,13 @@ class RowResizer extends AbstractResizer {
49128
49129
  elements,
49129
49130
  position: this.state.position,
49130
49131
  });
49131
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49132
- this.env.raiseError(MergeErrorMessage);
49132
+ if (!result.isSuccessful) {
49133
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49134
+ this.env.raiseError(MergeErrorMessage);
49135
+ }
49136
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
49137
+ this.env.raiseError(TableHeaderMoveErrorMessage);
49138
+ }
49133
49139
  }
49134
49140
  }
49135
49141
  _selectElement(index, addDistinctHeader) {
@@ -61159,7 +61165,7 @@ function withPivotPresentationLayer (PivotClass) {
61159
61165
  return PivotPresentationLayer;
61160
61166
  }
61161
61167
 
61162
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
61168
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
61163
61169
  function isPivotCommand(cmd) {
61164
61170
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
61165
61171
  }
@@ -66264,8 +66270,33 @@ class GridSelectionPlugin extends UIPlugin {
66264
66270
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
66265
66271
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
66266
66272
  }
66273
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
66274
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
66275
+ }
66267
66276
  return "Success" /* CommandResult.Success */;
66268
66277
  }
66278
+ isTableRowMoveAllowed(sheetId, selectedRows) {
66279
+ const tables = this.getters.getCoreTables(sheetId);
66280
+ if (tables.length === 0) {
66281
+ return true;
66282
+ }
66283
+ const selectedRowSet = new Set(selectedRows);
66284
+ return tables.every(({ range: { zone }, config }) => {
66285
+ const { top, bottom } = zone;
66286
+ if (config.numberOfHeaders === 0) {
66287
+ return true;
66288
+ }
66289
+ const headerRowEnd = top + config.numberOfHeaders - 1;
66290
+ // Moving the table is allowed if table header rows are not part of the selection
66291
+ // Or if the entire table (including header) is selected
66292
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
66293
+ if (!isHeaderSelected) {
66294
+ return true;
66295
+ }
66296
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
66297
+ return isWholeTableSelected;
66298
+ });
66299
+ }
66269
66300
  fallbackToVisibleSheet() {
66270
66301
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
66271
66302
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -74604,6 +74635,6 @@ const constants = {
74604
74635
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
74605
74636
 
74606
74637
 
74607
- __info__.version = "18.0.40";
74608
- __info__.date = "2025-08-18T08:15:29.422Z";
74609
- __info__.hash = "ec79db4";
74638
+ __info__.version = "18.0.42";
74639
+ __info__.date = "2025-08-26T10:07:59.958Z";
74640
+ __info__.hash = "7ad0e33";
@@ -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.0.40
6
- * @date 2025-08-18T08:15:29.422Z
7
- * @hash ec79db4
5
+ * @version 18.0.42
6
+ * @date 2025-08-26T10:07:59.958Z
7
+ * @hash 7ad0e33
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3434,6 +3434,7 @@
3434
3434
  CommandResult["Success"] = "Success";
3435
3435
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
3436
3436
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
3437
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
3437
3438
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
3438
3439
  CommandResult["CellIsMerged"] = "CellIsMerged";
3439
3440
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -6657,15 +6658,22 @@
6657
6658
  };
6658
6659
  }
6659
6660
  const htmlDocument = new DOMParser().parseFromString(content[ClipboardMIMEType.Html], "text/html");
6660
- const oSheetClipboardData = htmlDocument
6661
- .querySelector("div")
6662
- ?.getAttribute("data-osheet-clipboard");
6663
- const spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
6664
6661
  return {
6665
6662
  text: content[ClipboardMIMEType.PlainText],
6666
- data: spreadsheetContent,
6663
+ data: getOSheetDataFromHTML(htmlDocument),
6667
6664
  };
6668
6665
  }
6666
+ function getOSheetDataFromHTML(htmlDocument) {
6667
+ const attributes = [...htmlDocument.documentElement.attributes];
6668
+ // Check if it's a Microsoft Office clipboard data (it will have some namespaces defined in the root element)
6669
+ if (attributes.some((attr) => attr.value.includes("microsoft"))) {
6670
+ return undefined;
6671
+ }
6672
+ const oSheetClipboardData = htmlDocument
6673
+ .querySelector("div")
6674
+ ?.getAttribute("data-osheet-clipboard");
6675
+ return oSheetClipboardData && JSON.parse(oSheetClipboardData);
6676
+ }
6669
6677
  /**
6670
6678
  * Applies each clipboard handler to paste its corresponding data into the target.
6671
6679
  */
@@ -15900,6 +15908,7 @@ stores.inject(MyMetaStore, storeInstance);
15900
15908
  Custom: _t("Custom"),
15901
15909
  };
15902
15910
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
15911
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
15903
15912
  const SplitToColumnsTerms = {
15904
15913
  Errors: {
15905
15914
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -30157,10 +30166,6 @@ stores.inject(MyMetaStore, storeInstance);
30157
30166
  };
30158
30167
  }
30159
30168
  getDefinitionForExcel() {
30160
- // Excel does not support aggregating labels
30161
- if (this.aggregated) {
30162
- return undefined;
30163
- }
30164
30169
  const dataSets = this.dataSets
30165
30170
  .map((ds) => toExcelDataset(this.getters, ds))
30166
30171
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -31174,10 +31179,6 @@ stores.inject(MyMetaStore, storeInstance);
31174
31179
  return new ScatterChart(definition, this.sheetId, this.getters);
31175
31180
  }
31176
31181
  getDefinitionForExcel() {
31177
- // Excel does not support aggregating labels
31178
- if (this.aggregated) {
31179
- return undefined;
31180
- }
31181
31182
  const dataSets = this.dataSets
31182
31183
  .map((ds) => toExcelDataset(this.getters, ds))
31183
31184
  .filter((ds) => ds.range !== "");
@@ -49129,8 +49130,13 @@ stores.inject(MyMetaStore, storeInstance);
49129
49130
  elements,
49130
49131
  position: this.state.position,
49131
49132
  });
49132
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49133
- this.env.raiseError(MergeErrorMessage);
49133
+ if (!result.isSuccessful) {
49134
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
49135
+ this.env.raiseError(MergeErrorMessage);
49136
+ }
49137
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
49138
+ this.env.raiseError(TableHeaderMoveErrorMessage);
49139
+ }
49134
49140
  }
49135
49141
  }
49136
49142
  _selectElement(index, addDistinctHeader) {
@@ -61160,7 +61166,7 @@ stores.inject(MyMetaStore, storeInstance);
61160
61166
  return PivotPresentationLayer;
61161
61167
  }
61162
61168
 
61163
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
61169
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
61164
61170
  function isPivotCommand(cmd) {
61165
61171
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
61166
61172
  }
@@ -66265,8 +66271,33 @@ stores.inject(MyMetaStore, storeInstance);
66265
66271
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
66266
66272
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
66267
66273
  }
66274
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
66275
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
66276
+ }
66268
66277
  return "Success" /* CommandResult.Success */;
66269
66278
  }
66279
+ isTableRowMoveAllowed(sheetId, selectedRows) {
66280
+ const tables = this.getters.getCoreTables(sheetId);
66281
+ if (tables.length === 0) {
66282
+ return true;
66283
+ }
66284
+ const selectedRowSet = new Set(selectedRows);
66285
+ return tables.every(({ range: { zone }, config }) => {
66286
+ const { top, bottom } = zone;
66287
+ if (config.numberOfHeaders === 0) {
66288
+ return true;
66289
+ }
66290
+ const headerRowEnd = top + config.numberOfHeaders - 1;
66291
+ // Moving the table is allowed if table header rows are not part of the selection
66292
+ // Or if the entire table (including header) is selected
66293
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
66294
+ if (!isHeaderSelected) {
66295
+ return true;
66296
+ }
66297
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
66298
+ return isWholeTableSelected;
66299
+ });
66300
+ }
66270
66301
  fallbackToVisibleSheet() {
66271
66302
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
66272
66303
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -74648,9 +74679,9 @@ stores.inject(MyMetaStore, storeInstance);
74648
74679
  exports.tokenize = tokenize;
74649
74680
 
74650
74681
 
74651
- __info__.version = "18.0.40";
74652
- __info__.date = "2025-08-18T08:15:29.422Z";
74653
- __info__.hash = "ec79db4";
74682
+ __info__.version = "18.0.42";
74683
+ __info__.date = "2025-08-26T10:07:59.958Z";
74684
+ __info__.hash = "7ad0e33";
74654
74685
 
74655
74686
 
74656
74687
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);