@odoo/o-spreadsheet 18.4.6 → 18.4.7

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.4.6
6
- * @date 2025-08-18T08:16:33.453Z
7
- * @hash 9c7c143
5
+ * @version 18.4.7
6
+ * @date 2025-08-21T06:42:12.438Z
7
+ * @hash d5eb3a6
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2781,6 +2781,7 @@ exports.CommandResult = void 0;
2781
2781
  CommandResult["Success"] = "Success";
2782
2782
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
2783
2783
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
2784
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
2784
2785
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
2785
2786
  CommandResult["CellIsMerged"] = "CellIsMerged";
2786
2787
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7256,15 +7257,18 @@ function parseOSClipboardContent(content, clipboardId) {
7256
7257
  ?.getAttribute("data-osheet-clipboard");
7257
7258
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7258
7259
  }
7260
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7259
7261
  let imageBlob = undefined;
7260
- for (const type of AllowedImageMimeTypes) {
7261
- if (content[type]) {
7262
- imageBlob = content[type];
7263
- break;
7262
+ if (!textContent.trim()) {
7263
+ for (const type of AllowedImageMimeTypes) {
7264
+ if (content[type]) {
7265
+ imageBlob = content[type];
7266
+ break;
7267
+ }
7264
7268
  }
7265
7269
  }
7266
7270
  const osClipboardContent = {
7267
- text: content[ClipboardMIMEType.PlainText],
7271
+ text: textContent,
7268
7272
  data: spreadsheetContent,
7269
7273
  imageBlob,
7270
7274
  };
@@ -24286,6 +24290,7 @@ const CustomCurrencyTerms = {
24286
24290
  Custom: _t("Custom"),
24287
24291
  };
24288
24292
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24293
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24289
24294
  const SplitToColumnsTerms = {
24290
24295
  Errors: {
24291
24296
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28183,9 +28188,6 @@ class RadarChart extends AbstractChart {
28183
28188
  };
28184
28189
  }
28185
28190
  getDefinitionForExcel() {
28186
- if (this.aggregated) {
28187
- return undefined;
28188
- }
28189
28191
  const dataSets = this.dataSets
28190
28192
  .map((ds) => toExcelDataset(this.getters, ds))
28191
28193
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -47707,8 +47709,13 @@ class RowResizer extends AbstractResizer {
47707
47709
  elements,
47708
47710
  position: this.state.position,
47709
47711
  });
47710
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47711
- this.env.raiseError(MergeErrorMessage);
47712
+ if (!result.isSuccessful) {
47713
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47714
+ this.env.raiseError(MergeErrorMessage);
47715
+ }
47716
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
47717
+ this.env.raiseError(TableHeaderMoveErrorMessage);
47718
+ }
47712
47719
  }
47713
47720
  }
47714
47721
  _selectElement(index, addDistinctHeader) {
@@ -68387,7 +68394,7 @@ function withPivotPresentationLayer (PivotClass) {
68387
68394
  return PivotPresentationLayer;
68388
68395
  }
68389
68396
 
68390
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
68397
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
68391
68398
  function isPivotCommand(cmd) {
68392
68399
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
68393
68400
  }
@@ -74355,8 +74362,33 @@ class GridSelectionPlugin extends UIPlugin {
74355
74362
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
74356
74363
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
74357
74364
  }
74365
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
74366
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
74367
+ }
74358
74368
  return "Success" /* CommandResult.Success */;
74359
74369
  }
74370
+ isTableRowMoveAllowed(sheetId, selectedRows) {
74371
+ const tables = this.getters.getCoreTables(sheetId);
74372
+ if (tables.length === 0) {
74373
+ return true;
74374
+ }
74375
+ const selectedRowSet = new Set(selectedRows);
74376
+ return tables.every(({ range: { zone }, config }) => {
74377
+ const { top, bottom } = zone;
74378
+ if (config.numberOfHeaders === 0) {
74379
+ return true;
74380
+ }
74381
+ const headerRowEnd = top + config.numberOfHeaders - 1;
74382
+ // Moving the table is allowed if table header rows are not part of the selection
74383
+ // Or if the entire table (including header) is selected
74384
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
74385
+ if (!isHeaderSelected) {
74386
+ return true;
74387
+ }
74388
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
74389
+ return isWholeTableSelected;
74390
+ });
74391
+ }
74360
74392
  fallbackToVisibleSheet() {
74361
74393
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
74362
74394
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -84719,6 +84751,6 @@ exports.tokenColors = tokenColors;
84719
84751
  exports.tokenize = tokenize;
84720
84752
 
84721
84753
 
84722
- __info__.version = "18.4.6";
84723
- __info__.date = "2025-08-18T08:16:33.453Z";
84724
- __info__.hash = "9c7c143";
84754
+ __info__.version = "18.4.7";
84755
+ __info__.date = "2025-08-21T06:42:12.438Z";
84756
+ __info__.hash = "d5eb3a6";
@@ -2312,6 +2312,7 @@ declare class GridSelectionPlugin extends UIPlugin {
2312
2312
  private getFiguresUpdates;
2313
2313
  private applyFigureUpdates;
2314
2314
  private isMoveElementAllowed;
2315
+ private isTableRowMoveAllowed;
2315
2316
  private fallbackToVisibleSheet;
2316
2317
  /**
2317
2318
  * Clip the selection if it spans outside the sheet
@@ -3327,6 +3328,7 @@ declare const enum CommandResult {
3327
3328
  Success = "Success",
3328
3329
  CancelledForUnknownReason = "CancelledForUnknownReason",
3329
3330
  WillRemoveExistingMerge = "WillRemoveExistingMerge",
3331
+ CannotMoveTableHeader = "CannotMoveTableHeader",
3330
3332
  MergeIsDestructive = "MergeIsDestructive",
3331
3333
  CellIsMerged = "CellIsMerged",
3332
3334
  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.4.6
6
- * @date 2025-08-18T08:16:33.453Z
7
- * @hash 9c7c143
5
+ * @version 18.4.7
6
+ * @date 2025-08-21T06:42:12.438Z
7
+ * @hash d5eb3a6
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, useExternalListener, onWillUpdateProps, onWillStart, onWillPatch, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -2779,6 +2779,7 @@ var CommandResult;
2779
2779
  CommandResult["Success"] = "Success";
2780
2780
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
2781
2781
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
2782
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
2782
2783
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
2783
2784
  CommandResult["CellIsMerged"] = "CellIsMerged";
2784
2785
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7254,15 +7255,18 @@ function parseOSClipboardContent(content, clipboardId) {
7254
7255
  ?.getAttribute("data-osheet-clipboard");
7255
7256
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7256
7257
  }
7258
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7257
7259
  let imageBlob = undefined;
7258
- for (const type of AllowedImageMimeTypes) {
7259
- if (content[type]) {
7260
- imageBlob = content[type];
7261
- break;
7260
+ if (!textContent.trim()) {
7261
+ for (const type of AllowedImageMimeTypes) {
7262
+ if (content[type]) {
7263
+ imageBlob = content[type];
7264
+ break;
7265
+ }
7262
7266
  }
7263
7267
  }
7264
7268
  const osClipboardContent = {
7265
- text: content[ClipboardMIMEType.PlainText],
7269
+ text: textContent,
7266
7270
  data: spreadsheetContent,
7267
7271
  imageBlob,
7268
7272
  };
@@ -24284,6 +24288,7 @@ const CustomCurrencyTerms = {
24284
24288
  Custom: _t("Custom"),
24285
24289
  };
24286
24290
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24291
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24287
24292
  const SplitToColumnsTerms = {
24288
24293
  Errors: {
24289
24294
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28181,9 +28186,6 @@ class RadarChart extends AbstractChart {
28181
28186
  };
28182
28187
  }
28183
28188
  getDefinitionForExcel() {
28184
- if (this.aggregated) {
28185
- return undefined;
28186
- }
28187
28189
  const dataSets = this.dataSets
28188
28190
  .map((ds) => toExcelDataset(this.getters, ds))
28189
28191
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -47705,8 +47707,13 @@ class RowResizer extends AbstractResizer {
47705
47707
  elements,
47706
47708
  position: this.state.position,
47707
47709
  });
47708
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47709
- this.env.raiseError(MergeErrorMessage);
47710
+ if (!result.isSuccessful) {
47711
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47712
+ this.env.raiseError(MergeErrorMessage);
47713
+ }
47714
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
47715
+ this.env.raiseError(TableHeaderMoveErrorMessage);
47716
+ }
47710
47717
  }
47711
47718
  }
47712
47719
  _selectElement(index, addDistinctHeader) {
@@ -68385,7 +68392,7 @@ function withPivotPresentationLayer (PivotClass) {
68385
68392
  return PivotPresentationLayer;
68386
68393
  }
68387
68394
 
68388
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
68395
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
68389
68396
  function isPivotCommand(cmd) {
68390
68397
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
68391
68398
  }
@@ -74353,8 +74360,33 @@ class GridSelectionPlugin extends UIPlugin {
74353
74360
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
74354
74361
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
74355
74362
  }
74363
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
74364
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
74365
+ }
74356
74366
  return "Success" /* CommandResult.Success */;
74357
74367
  }
74368
+ isTableRowMoveAllowed(sheetId, selectedRows) {
74369
+ const tables = this.getters.getCoreTables(sheetId);
74370
+ if (tables.length === 0) {
74371
+ return true;
74372
+ }
74373
+ const selectedRowSet = new Set(selectedRows);
74374
+ return tables.every(({ range: { zone }, config }) => {
74375
+ const { top, bottom } = zone;
74376
+ if (config.numberOfHeaders === 0) {
74377
+ return true;
74378
+ }
74379
+ const headerRowEnd = top + config.numberOfHeaders - 1;
74380
+ // Moving the table is allowed if table header rows are not part of the selection
74381
+ // Or if the entire table (including header) is selected
74382
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
74383
+ if (!isHeaderSelected) {
74384
+ return true;
74385
+ }
74386
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
74387
+ return isWholeTableSelected;
74388
+ });
74389
+ }
74358
74390
  fallbackToVisibleSheet() {
74359
74391
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
74360
74392
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -84669,6 +84701,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
84669
84701
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, 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 };
84670
84702
 
84671
84703
 
84672
- __info__.version = "18.4.6";
84673
- __info__.date = "2025-08-18T08:16:33.453Z";
84674
- __info__.hash = "9c7c143";
84704
+ __info__.version = "18.4.7";
84705
+ __info__.date = "2025-08-21T06:42:12.438Z";
84706
+ __info__.hash = "d5eb3a6";
@@ -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.4.6
6
- * @date 2025-08-18T08:16:33.453Z
7
- * @hash 9c7c143
5
+ * @version 18.4.7
6
+ * @date 2025-08-21T06:42:12.438Z
7
+ * @hash d5eb3a6
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -2780,6 +2780,7 @@
2780
2780
  CommandResult["Success"] = "Success";
2781
2781
  CommandResult["CancelledForUnknownReason"] = "CancelledForUnknownReason";
2782
2782
  CommandResult["WillRemoveExistingMerge"] = "WillRemoveExistingMerge";
2783
+ CommandResult["CannotMoveTableHeader"] = "CannotMoveTableHeader";
2783
2784
  CommandResult["MergeIsDestructive"] = "MergeIsDestructive";
2784
2785
  CommandResult["CellIsMerged"] = "CellIsMerged";
2785
2786
  CommandResult["InvalidTarget"] = "InvalidTarget";
@@ -7255,15 +7256,18 @@
7255
7256
  ?.getAttribute("data-osheet-clipboard");
7256
7257
  spreadsheetContent = oSheetClipboardData && JSON.parse(oSheetClipboardData);
7257
7258
  }
7259
+ const textContent = content[ClipboardMIMEType.PlainText] || "";
7258
7260
  let imageBlob = undefined;
7259
- for (const type of AllowedImageMimeTypes) {
7260
- if (content[type]) {
7261
- imageBlob = content[type];
7262
- break;
7261
+ if (!textContent.trim()) {
7262
+ for (const type of AllowedImageMimeTypes) {
7263
+ if (content[type]) {
7264
+ imageBlob = content[type];
7265
+ break;
7266
+ }
7263
7267
  }
7264
7268
  }
7265
7269
  const osClipboardContent = {
7266
- text: content[ClipboardMIMEType.PlainText],
7270
+ text: textContent,
7267
7271
  data: spreadsheetContent,
7268
7272
  imageBlob,
7269
7273
  };
@@ -24285,6 +24289,7 @@ stores.inject(MyMetaStore, storeInstance);
24285
24289
  Custom: _t("Custom"),
24286
24290
  };
24287
24291
  const MergeErrorMessage = _t("Merged cells are preventing this operation. Unmerge those cells and try again.");
24292
+ const TableHeaderMoveErrorMessage = _t("The header row of a table can't be moved.");
24288
24293
  const SplitToColumnsTerms = {
24289
24294
  Errors: {
24290
24295
  Unexpected: _t("Cannot split the selection for an unknown reason"),
@@ -28182,9 +28187,6 @@ stores.inject(MyMetaStore, storeInstance);
28182
28187
  };
28183
28188
  }
28184
28189
  getDefinitionForExcel() {
28185
- if (this.aggregated) {
28186
- return undefined;
28187
- }
28188
28190
  const dataSets = this.dataSets
28189
28191
  .map((ds) => toExcelDataset(this.getters, ds))
28190
28192
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -47706,8 +47708,13 @@ stores.inject(MyMetaStore, storeInstance);
47706
47708
  elements,
47707
47709
  position: this.state.position,
47708
47710
  });
47709
- if (!result.isSuccessful && result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47710
- this.env.raiseError(MergeErrorMessage);
47711
+ if (!result.isSuccessful) {
47712
+ if (result.reasons.includes("WillRemoveExistingMerge" /* CommandResult.WillRemoveExistingMerge */)) {
47713
+ this.env.raiseError(MergeErrorMessage);
47714
+ }
47715
+ else if (result.reasons.includes("CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */)) {
47716
+ this.env.raiseError(TableHeaderMoveErrorMessage);
47717
+ }
47711
47718
  }
47712
47719
  }
47713
47720
  _selectElement(index, addDistinctHeader) {
@@ -68386,7 +68393,7 @@ stores.inject(MyMetaStore, storeInstance);
68386
68393
  return PivotPresentationLayer;
68387
68394
  }
68388
68395
 
68389
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
68396
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
68390
68397
  function isPivotCommand(cmd) {
68391
68398
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
68392
68399
  }
@@ -74354,8 +74361,33 @@ stores.inject(MyMetaStore, storeInstance);
74354
74361
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
74355
74362
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
74356
74363
  }
74364
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
74365
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
74366
+ }
74357
74367
  return "Success" /* CommandResult.Success */;
74358
74368
  }
74369
+ isTableRowMoveAllowed(sheetId, selectedRows) {
74370
+ const tables = this.getters.getCoreTables(sheetId);
74371
+ if (tables.length === 0) {
74372
+ return true;
74373
+ }
74374
+ const selectedRowSet = new Set(selectedRows);
74375
+ return tables.every(({ range: { zone }, config }) => {
74376
+ const { top, bottom } = zone;
74377
+ if (config.numberOfHeaders === 0) {
74378
+ return true;
74379
+ }
74380
+ const headerRowEnd = top + config.numberOfHeaders - 1;
74381
+ // Moving the table is allowed if table header rows are not part of the selection
74382
+ // Or if the entire table (including header) is selected
74383
+ const isHeaderSelected = selectedRows.some((row) => row >= top && row <= headerRowEnd);
74384
+ if (!isHeaderSelected) {
74385
+ return true;
74386
+ }
74387
+ const isWholeTableSelected = range(top, bottom + 1).every((r) => selectedRowSet.has(r));
74388
+ return isWholeTableSelected;
74389
+ });
74390
+ }
74359
74391
  fallbackToVisibleSheet() {
74360
74392
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
74361
74393
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -84718,9 +84750,9 @@ stores.inject(MyMetaStore, storeInstance);
84718
84750
  exports.tokenize = tokenize;
84719
84751
 
84720
84752
 
84721
- __info__.version = "18.4.6";
84722
- __info__.date = "2025-08-18T08:16:33.453Z";
84723
- __info__.hash = "9c7c143";
84753
+ __info__.version = "18.4.7";
84754
+ __info__.date = "2025-08-21T06:42:12.438Z";
84755
+ __info__.hash = "d5eb3a6";
84724
84756
 
84725
84757
 
84726
84758
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);