@odoo/o-spreadsheet 18.4.5 → 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.5
6
- * @date 2025-08-04T06:54:49.107Z
7
- * @hash 358931f
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
  };
@@ -19640,7 +19644,7 @@ stores.inject(MyMetaStore, storeInstance);
19640
19644
  right: startingCol + offsetWidth - 1,
19641
19645
  bottom: startingRow + offsetHeight - 1,
19642
19646
  };
19643
- const range = this.getters.getRangeFromZone(this.__originSheetId, dependencyZone);
19647
+ const range = this.getters.getRangeFromZone(sheetId, dependencyZone);
19644
19648
  if (range.invalidXc || range.invalidSheetName) {
19645
19649
  return new InvalidReferenceError();
19646
19650
  }
@@ -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);
@@ -43832,7 +43834,7 @@ stores.inject(MyMetaStore, storeInstance);
43832
43834
  env.openSidePanel("DataValidationEditor", {
43833
43835
  rule: localizeDataValidationRule(rule, env.model.getters.getLocale()),
43834
43836
  onExit: () => {
43835
- env.openSidePanel("DataValidation");
43837
+ env.replaceSidePanel("DataValidation", "DataValidationEditor");
43836
43838
  },
43837
43839
  });
43838
43840
  },
@@ -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) {
@@ -53652,11 +53659,15 @@ stores.inject(MyMetaStore, storeInstance);
53652
53659
  this.store = useLocalStore(PivotMeasureDisplayPanelStore, this.props.pivotId, this.props.measure);
53653
53660
  }
53654
53661
  onSave() {
53655
- this.env.openSidePanel("PivotSidePanel", { pivotId: this.props.pivotId });
53662
+ this.env.replaceSidePanel("PivotSidePanel", `pivot_measure_display_${this.props.pivotId}_${this.props.measure.id}`, {
53663
+ pivotId: this.props.pivotId,
53664
+ });
53656
53665
  }
53657
53666
  onCancel() {
53658
53667
  this.store.cancelMeasureDisplayEdition();
53659
- this.env.openSidePanel("PivotSidePanel", { pivotId: this.props.pivotId });
53668
+ this.env.replaceSidePanel("PivotSidePanel", `pivot_measure_display_${this.props.pivotId}_${this.props.measure.id}`, {
53669
+ pivotId: this.props.pivotId,
53670
+ });
53660
53671
  }
53661
53672
  get fieldChoices() {
53662
53673
  return this.store.fields.map((field) => ({
@@ -54118,7 +54129,7 @@ stores.inject(MyMetaStore, storeInstance);
54118
54129
  });
54119
54130
  }
54120
54131
  openShowValuesAs() {
54121
- this.env.openSidePanel("PivotMeasureDisplayPanel", {
54132
+ this.env.replaceSidePanel("PivotMeasureDisplayPanel", `pivot_key_${this.props.pivotId}`, {
54122
54133
  pivotId: this.props.pivotId,
54123
54134
  measure: this.props.measure,
54124
54135
  });
@@ -54378,7 +54389,7 @@ stores.inject(MyMetaStore, storeInstance);
54378
54389
  this.props.onDimensionsUpdated(update);
54379
54390
  }
54380
54391
  getMeasureId(fieldName, aggregator) {
54381
- const baseId = fieldName + (aggregator ? `:${aggregator}` : "");
54392
+ const baseId = fieldName.replaceAll("'", "") + (aggregator ? `:${aggregator}` : "");
54382
54393
  let id = baseId;
54383
54394
  let i = 2;
54384
54395
  while (this.props.definition.measures.some((m) => m.id === id)) {
@@ -57217,7 +57228,11 @@ stores.inject(MyMetaStore, storeInstance);
57217
57228
  try {
57218
57229
  // This will throw if the pivot or measure does not exist
57219
57230
  getters.getPivot(props.pivotId).getMeasure(props.measure.id);
57220
- return { isOpen: true, props, key: "pivot_measure_display" };
57231
+ return {
57232
+ isOpen: true,
57233
+ props,
57234
+ key: `pivot_measure_display_${props.pivotId}_${props.measure.id}`,
57235
+ };
57221
57236
  }
57222
57237
  catch (e) {
57223
57238
  return { isOpen: false };
@@ -57242,6 +57257,7 @@ stores.inject(MyMetaStore, storeInstance);
57242
57257
  class SidePanelStore extends SpreadsheetStore {
57243
57258
  mutators = [
57244
57259
  "open",
57260
+ "replace",
57245
57261
  "toggle",
57246
57262
  "close",
57247
57263
  "changePanelSize",
@@ -57303,8 +57319,7 @@ stores.inject(MyMetaStore, storeInstance);
57303
57319
  if (!state.isOpen) {
57304
57320
  return;
57305
57321
  }
57306
- const mainPanelKey = this.mainPanel ? this.getPanelKey(this.mainPanel) : undefined;
57307
- if (!this.mainPanel || !this.mainPanel.isPinned || mainPanelKey === state.key) {
57322
+ if (!this.mainPanel || !this.mainPanel.isPinned || this.mainPanelKey === state.key) {
57308
57323
  this._openPanel("mainPanel", newPanelInfo, state);
57309
57324
  return;
57310
57325
  }
@@ -57323,6 +57338,34 @@ stores.inject(MyMetaStore, storeInstance);
57323
57338
  }
57324
57339
  this._openPanel("secondaryPanel", newPanelInfo, state);
57325
57340
  }
57341
+ replace(componentTag, currentPanelKey, initialPanelProps = {}) {
57342
+ const newPanelInfo = { initialPanelProps, componentTag, size: DEFAULT_SIDE_PANEL_SIZE };
57343
+ const state = this.computeState(newPanelInfo);
57344
+ if (!state.isOpen) {
57345
+ return;
57346
+ }
57347
+ const ensureMainPanelExpanded = () => {
57348
+ if (this.mainPanel?.isCollapsed) {
57349
+ this.toggleCollapsePanel("mainPanel");
57350
+ }
57351
+ };
57352
+ // Close the current panel if the target panel is already open
57353
+ const isMainPanel = this.mainPanelKey === state.key;
57354
+ const isSecondaryPanel = this.secondaryPanelKey === state.key;
57355
+ if (isMainPanel && this.secondaryPanel) {
57356
+ this.close();
57357
+ ensureMainPanelExpanded();
57358
+ return;
57359
+ }
57360
+ if (isSecondaryPanel) {
57361
+ this.closeMainPanel();
57362
+ this.togglePinPanel();
57363
+ ensureMainPanelExpanded();
57364
+ return;
57365
+ }
57366
+ const targetPanel = this.mainPanelKey === currentPanelKey ? "mainPanel" : "secondaryPanel";
57367
+ this._openPanel(targetPanel, newPanelInfo, state);
57368
+ }
57326
57369
  _openPanel(panel, newPanel, state) {
57327
57370
  const currentPanel = this[panel];
57328
57371
  if (currentPanel && newPanel.componentTag !== currentPanel.componentTag) {
@@ -57382,11 +57425,9 @@ stores.inject(MyMetaStore, storeInstance);
57382
57425
  panelInfo.size = size;
57383
57426
  }
57384
57427
  resetPanelSize(panel) {
57385
- const panelInfo = this[panel];
57386
- if (!panelInfo) {
57387
- return;
57428
+ if (this[panel]) {
57429
+ this[panel].size = DEFAULT_SIDE_PANEL_SIZE;
57388
57430
  }
57389
- panelInfo.size = DEFAULT_SIDE_PANEL_SIZE;
57390
57431
  }
57391
57432
  togglePinPanel() {
57392
57433
  if (!this.mainPanel) {
@@ -68352,7 +68393,7 @@ stores.inject(MyMetaStore, storeInstance);
68352
68393
  return PivotPresentationLayer;
68353
68394
  }
68354
68395
 
68355
- const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT"];
68396
+ const UNDO_REDO_PIVOT_COMMANDS = ["ADD_PIVOT", "UPDATE_PIVOT", "REMOVE_PIVOT"];
68356
68397
  function isPivotCommand(cmd) {
68357
68398
  return UNDO_REDO_PIVOT_COMMANDS.includes(cmd.type);
68358
68399
  }
@@ -74320,8 +74361,33 @@ stores.inject(MyMetaStore, storeInstance);
74320
74361
  if (headers.some((h) => h < 0 || h >= maxHeaderValue)) {
74321
74362
  return "InvalidHeaderIndex" /* CommandResult.InvalidHeaderIndex */;
74322
74363
  }
74364
+ if (!isCol && !this.isTableRowMoveAllowed(id, cmd.elements)) {
74365
+ return "CannotMoveTableHeader" /* CommandResult.CannotMoveTableHeader */;
74366
+ }
74323
74367
  return "Success" /* CommandResult.Success */;
74324
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
+ }
74325
74391
  fallbackToVisibleSheet() {
74326
74392
  if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
74327
74393
  const currentSheetIds = this.getters.getVisibleSheetIds();
@@ -77780,9 +77846,7 @@ stores.inject(MyMetaStore, storeInstance);
77780
77846
  }
77781
77847
  if (!(xc in clickableCells[sheetId])) {
77782
77848
  const clickableCell = this.findClickableItem(position);
77783
- if (clickableCell) {
77784
- clickableCells[sheetId][xc] = clickableCell;
77785
- }
77849
+ clickableCells[sheetId][xc] = clickableCell;
77786
77850
  }
77787
77851
  return clickableCells[sheetId][xc];
77788
77852
  }
@@ -80024,6 +80088,7 @@ stores.inject(MyMetaStore, storeInstance);
80024
80088
  loadLocales: this.model.config.external.loadLocales,
80025
80089
  isDashboard: () => this.model.getters.isDashboard(),
80026
80090
  openSidePanel: this.sidePanel.open.bind(this.sidePanel),
80091
+ replaceSidePanel: this.sidePanel.replace.bind(this.sidePanel),
80027
80092
  toggleSidePanel: this.sidePanel.toggle.bind(this.sidePanel),
80028
80093
  clipboard: this.env.clipboard || instantiateClipboard(),
80029
80094
  startCellEdition: (content) => this.composerFocusStore.focusActiveComposer({ content }),
@@ -84685,9 +84750,9 @@ stores.inject(MyMetaStore, storeInstance);
84685
84750
  exports.tokenize = tokenize;
84686
84751
 
84687
84752
 
84688
- __info__.version = "18.4.5";
84689
- __info__.date = "2025-08-04T06:54:49.107Z";
84690
- __info__.hash = "358931f";
84753
+ __info__.version = "18.4.7";
84754
+ __info__.date = "2025-08-21T06:42:12.438Z";
84755
+ __info__.hash = "d5eb3a6";
84691
84756
 
84692
84757
 
84693
84758
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);