@odoo/o-spreadsheet 17.4.17 → 17.4.19

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 17.4.17
6
- * @date 2025-01-14T11:34:44.930Z
7
- * @hash fd2a7ab
5
+ * @version 17.4.19
6
+ * @date 2025-01-27T10:04:10.249Z
7
+ * @hash f2a7840
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';
@@ -3013,15 +3013,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
3013
3013
  let currentIndex;
3014
3014
  let currentVal;
3015
3015
  let currentType;
3016
+ const getValue = sortOrder === "desc"
3017
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
3018
+ : (i) => normalizeValue(getValueInData(data, i));
3016
3019
  while (indexRight - indexLeft >= 0) {
3017
3020
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
3018
3021
  currentIndex = indexMedian;
3019
- currentVal = normalizeValue(getValueInData(data, currentIndex));
3022
+ currentVal = getValue(currentIndex);
3020
3023
  currentType = typeof currentVal;
3021
3024
  // 1 - linear search to find value with the same type
3022
3025
  while (indexLeft < currentIndex && targetType !== currentType) {
3023
3026
  currentIndex--;
3024
- currentVal = normalizeValue(getValueInData(data, currentIndex));
3027
+ currentVal = getValue(currentIndex);
3025
3028
  currentType = typeof currentVal;
3026
3029
  }
3027
3030
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -3037,8 +3040,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
3037
3040
  if (matchVal === undefined ||
3038
3041
  matchVal === null ||
3039
3042
  matchVal < currentVal ||
3040
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
3041
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
3043
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
3042
3044
  matchVal = currentVal;
3043
3045
  matchValIndex = currentIndex;
3044
3046
  }
@@ -3046,15 +3048,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
3046
3048
  else if (mode === "nextGreater" && currentVal >= _target) {
3047
3049
  if (matchVal === undefined ||
3048
3050
  matchVal > currentVal ||
3049
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
3050
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
3051
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
3051
3052
  matchVal = currentVal;
3052
3053
  matchValIndex = currentIndex;
3053
3054
  }
3054
3055
  }
3055
3056
  // 3 - give new indexes for the Binary search
3056
- if ((sortOrder === "asc" && currentVal > _target) ||
3057
- (sortOrder === "desc" && currentVal <= _target)) {
3057
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
3058
3058
  indexRight = currentIndex - 1;
3059
3059
  }
3060
3060
  else {
@@ -3062,7 +3062,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
3062
3062
  }
3063
3063
  }
3064
3064
  // note that valMinIndex could be 0
3065
- return matchValIndex !== undefined ? matchValIndex : -1;
3065
+ if (matchValIndex === undefined) {
3066
+ return -1;
3067
+ }
3068
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
3066
3069
  }
3067
3070
  /**
3068
3071
  * Perform a linear search and return the index of the match.
@@ -26457,6 +26460,10 @@ class Popover extends Component {
26457
26460
  this.currentDisplayValue = newDisplay;
26458
26461
  if (!anchor)
26459
26462
  return;
26463
+ el.style.top = "";
26464
+ el.style.left = "";
26465
+ el.style["max-height"] = "";
26466
+ el.style["max-width"] = "";
26460
26467
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
26461
26468
  let elDims = {
26462
26469
  width: el.getBoundingClientRect().width,
@@ -39449,7 +39456,7 @@ class GridComposer extends Component {
39449
39456
  return;
39450
39457
  }
39451
39458
  const sheetId = this.env.model.getters.getActiveSheetId();
39452
- const zone = this.env.model.getters.getSelectedZone();
39459
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
39453
39460
  const rect = this.env.model.getters.getVisibleRect(zone);
39454
39461
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
39455
39462
  this.isCellReferenceVisible = true;
@@ -41204,13 +41211,23 @@ class GridRenderer {
41204
41211
  drawLayer(renderingContext, layer) {
41205
41212
  switch (layer) {
41206
41213
  case "Background":
41207
- const boxes = this.getGridBoxes();
41208
- this.drawBackground(renderingContext, boxes);
41209
- this.drawOverflowingCellBackground(renderingContext, boxes);
41210
- this.drawCellBackground(renderingContext, boxes);
41211
- this.drawBorders(renderingContext, boxes);
41212
- this.drawTexts(renderingContext, boxes);
41213
- this.drawIcon(renderingContext, boxes);
41214
+ this.drawGlobalBackground(renderingContext);
41215
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
41216
+ const { ctx } = renderingContext;
41217
+ ctx.save();
41218
+ ctx.beginPath();
41219
+ const rect = this.getters.getVisibleRect(zone);
41220
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
41221
+ ctx.clip();
41222
+ const boxes = this.getGridBoxes(zone);
41223
+ this.drawBackground(renderingContext, boxes);
41224
+ this.drawOverflowingCellBackground(renderingContext, boxes);
41225
+ this.drawCellBackground(renderingContext, boxes);
41226
+ this.drawBorders(renderingContext, boxes);
41227
+ this.drawTexts(renderingContext, boxes);
41228
+ this.drawIcon(renderingContext, boxes);
41229
+ ctx.restore();
41230
+ }
41214
41231
  this.drawFrozenPanes(renderingContext);
41215
41232
  break;
41216
41233
  case "Headers":
@@ -41221,12 +41238,15 @@ class GridRenderer {
41221
41238
  break;
41222
41239
  }
41223
41240
  }
41224
- drawBackground(renderingContext, boxes) {
41225
- const { ctx, thinLineWidth } = renderingContext;
41241
+ drawGlobalBackground(renderingContext) {
41242
+ const { ctx } = renderingContext;
41226
41243
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
41227
41244
  // white background
41228
41245
  ctx.fillStyle = "#ffffff";
41229
41246
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
41247
+ }
41248
+ drawBackground(renderingContext, boxes) {
41249
+ const { ctx, thinLineWidth } = renderingContext;
41230
41250
  const areGridLinesVisible = !this.getters.isDashboard() &&
41231
41251
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
41232
41252
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -41651,7 +41671,7 @@ class GridRenderer {
41651
41671
  const position = { sheetId, col, row };
41652
41672
  const cell = this.getters.getEvaluatedCell(position);
41653
41673
  const showFormula = this.getters.shouldShowFormulas();
41654
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
41674
+ const { x, y, width, height } = this.getters.getRect(zone);
41655
41675
  const { verticalAlign } = this.getters.getCellStyle(position);
41656
41676
  const box = {
41657
41677
  x,
@@ -41767,12 +41787,16 @@ class GridRenderer {
41767
41787
  }
41768
41788
  return box;
41769
41789
  }
41770
- getGridBoxes() {
41790
+ getGridBoxes(zone) {
41771
41791
  const boxes = [];
41772
- const visibleCols = this.getters.getSheetViewVisibleCols();
41792
+ const visibleCols = this.getters
41793
+ .getSheetViewVisibleCols()
41794
+ .filter((col) => col >= zone.left && col <= zone.right);
41773
41795
  const left = visibleCols[0];
41774
41796
  const right = visibleCols[visibleCols.length - 1];
41775
- const visibleRows = this.getters.getSheetViewVisibleRows();
41797
+ const visibleRows = this.getters
41798
+ .getSheetViewVisibleRows()
41799
+ .filter((row) => row >= zone.top && row <= zone.bottom);
41776
41800
  const top = visibleRows[0];
41777
41801
  const bottom = visibleRows[visibleRows.length - 1];
41778
41802
  const viewport = { left, right, top, bottom };
@@ -57576,9 +57600,6 @@ class Session extends EventBus {
57576
57600
  }
57577
57601
  }
57578
57602
  this.acknowledge(message);
57579
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
57580
- return;
57581
- }
57582
57603
  this.trigger("collaborative-event-received");
57583
57604
  }
57584
57605
  onClientMoved(message) {
@@ -60778,8 +60799,12 @@ class GridSelectionPlugin extends UIPlugin {
60778
60799
  },
60779
60800
  ];
60780
60801
  handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
60802
+ const selection = pasteTarget[0];
60803
+ const col = selection.left;
60804
+ const row = selection.top;
60805
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
60781
60806
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
60782
- let currentIndex = cmd.base;
60807
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
60783
60808
  for (const element of toRemove) {
60784
60809
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
60785
60810
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -61062,22 +61087,33 @@ class InternalViewport {
61062
61087
  }
61063
61088
  /**
61064
61089
  *
61065
- * @param zone
61066
- * @returns Computes the absolute coordinate of a given zone inside the viewport
61090
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
61091
+ *
61067
61092
  */
61068
- getRect(zone) {
61093
+ getVisibleRect(zone) {
61069
61094
  const targetZone = intersection(zone, this);
61070
61095
  if (targetZone) {
61071
61096
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
61072
61097
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
61073
61098
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
61074
61099
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
61075
- return {
61076
- x,
61077
- y,
61078
- width,
61079
- height,
61080
- };
61100
+ return { x, y, width, height };
61101
+ }
61102
+ return undefined;
61103
+ }
61104
+ /**
61105
+ *
61106
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
61107
+ *
61108
+ */
61109
+ getFullRect(zone) {
61110
+ const targetZone = intersection(zone, this);
61111
+ if (targetZone) {
61112
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
61113
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
61114
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
61115
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
61116
+ return { x, y, width, height };
61081
61117
  }
61082
61118
  return undefined;
61083
61119
  }
@@ -61247,6 +61283,8 @@ class SheetViewPlugin extends UIPlugin {
61247
61283
  "isPositionVisible",
61248
61284
  "getColDimensionsInViewport",
61249
61285
  "getRowDimensionsInViewport",
61286
+ "getAllActiveViewportsZones",
61287
+ "getRect",
61250
61288
  ];
61251
61289
  viewports = {};
61252
61290
  /**
@@ -61633,16 +61671,27 @@ class SheetViewPlugin extends UIPlugin {
61633
61671
  getVisibleRectWithoutHeaders(zone) {
61634
61672
  const sheetId = this.getters.getActiveSheetId();
61635
61673
  const viewportRects = this.getSubViewports(sheetId)
61636
- .map((viewport) => viewport.getRect(zone))
61674
+ .map((viewport) => viewport.getVisibleRect(zone))
61637
61675
  .filter(isDefined);
61638
61676
  if (viewportRects.length === 0) {
61639
61677
  return { x: 0, y: 0, width: 0, height: 0 };
61640
61678
  }
61641
- const x = Math.min(...viewportRects.map((rect) => rect.x));
61642
- const y = Math.min(...viewportRects.map((rect) => rect.y));
61643
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
61644
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
61645
- return { x, y, width, height };
61679
+ return this.recomposeRect(viewportRects);
61680
+ }
61681
+ /**
61682
+ * Computes the actual size and position (:Rect) of the zone on the canvas
61683
+ * regardless of the viewport dimensions.
61684
+ */
61685
+ getRect(zone) {
61686
+ const sheetId = this.getters.getActiveSheetId();
61687
+ const viewportRects = this.getSubViewports(sheetId)
61688
+ .map((viewport) => viewport.getFullRect(zone))
61689
+ .filter(isDefined);
61690
+ if (viewportRects.length === 0) {
61691
+ return { x: 0, y: 0, width: 0, height: 0 };
61692
+ }
61693
+ const rect = this.recomposeRect(viewportRects);
61694
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
61646
61695
  }
61647
61696
  /**
61648
61697
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -61686,6 +61735,10 @@ class SheetViewPlugin extends UIPlugin {
61686
61735
  end: start + (isRowHidden ? 0 : size),
61687
61736
  };
61688
61737
  }
61738
+ getAllActiveViewportsZones() {
61739
+ const sheetId = this.getters.getActiveSheetId();
61740
+ return this.getSubViewports(sheetId);
61741
+ }
61689
61742
  // ---------------------------------------------------------------------------
61690
61743
  // Private
61691
61744
  // ---------------------------------------------------------------------------
@@ -61876,6 +61929,13 @@ class SheetViewPlugin extends UIPlugin {
61876
61929
  const height = this.sheetViewHeight + this.gridOffsetY;
61877
61930
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
61878
61931
  }
61932
+ recomposeRect(viewportRects) {
61933
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
61934
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
61935
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
61936
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
61937
+ return { x, y, width, height };
61938
+ }
61879
61939
  }
61880
61940
 
61881
61941
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -68758,6 +68818,6 @@ const constants = {
68758
68818
  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 };
68759
68819
 
68760
68820
 
68761
- __info__.version = "17.4.17";
68762
- __info__.date = "2025-01-14T11:34:44.930Z";
68763
- __info__.hash = "fd2a7ab";
68821
+ __info__.version = "17.4.19";
68822
+ __info__.date = "2025-01-27T10:04:10.249Z";
68823
+ __info__.hash = "f2a7840";
@@ -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 17.4.17
6
- * @date 2025-01-14T11:34:44.930Z
7
- * @hash fd2a7ab
5
+ * @version 17.4.19
6
+ * @date 2025-01-27T10:04:10.249Z
7
+ * @hash f2a7840
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3014,15 +3014,18 @@
3014
3014
  let currentIndex;
3015
3015
  let currentVal;
3016
3016
  let currentType;
3017
+ const getValue = sortOrder === "desc"
3018
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
3019
+ : (i) => normalizeValue(getValueInData(data, i));
3017
3020
  while (indexRight - indexLeft >= 0) {
3018
3021
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
3019
3022
  currentIndex = indexMedian;
3020
- currentVal = normalizeValue(getValueInData(data, currentIndex));
3023
+ currentVal = getValue(currentIndex);
3021
3024
  currentType = typeof currentVal;
3022
3025
  // 1 - linear search to find value with the same type
3023
3026
  while (indexLeft < currentIndex && targetType !== currentType) {
3024
3027
  currentIndex--;
3025
- currentVal = normalizeValue(getValueInData(data, currentIndex));
3028
+ currentVal = getValue(currentIndex);
3026
3029
  currentType = typeof currentVal;
3027
3030
  }
3028
3031
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -3038,8 +3041,7 @@
3038
3041
  if (matchVal === undefined ||
3039
3042
  matchVal === null ||
3040
3043
  matchVal < currentVal ||
3041
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
3042
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
3044
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
3043
3045
  matchVal = currentVal;
3044
3046
  matchValIndex = currentIndex;
3045
3047
  }
@@ -3047,15 +3049,13 @@
3047
3049
  else if (mode === "nextGreater" && currentVal >= _target) {
3048
3050
  if (matchVal === undefined ||
3049
3051
  matchVal > currentVal ||
3050
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
3051
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
3052
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
3052
3053
  matchVal = currentVal;
3053
3054
  matchValIndex = currentIndex;
3054
3055
  }
3055
3056
  }
3056
3057
  // 3 - give new indexes for the Binary search
3057
- if ((sortOrder === "asc" && currentVal > _target) ||
3058
- (sortOrder === "desc" && currentVal <= _target)) {
3058
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
3059
3059
  indexRight = currentIndex - 1;
3060
3060
  }
3061
3061
  else {
@@ -3063,7 +3063,10 @@
3063
3063
  }
3064
3064
  }
3065
3065
  // note that valMinIndex could be 0
3066
- return matchValIndex !== undefined ? matchValIndex : -1;
3066
+ if (matchValIndex === undefined) {
3067
+ return -1;
3068
+ }
3069
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
3067
3070
  }
3068
3071
  /**
3069
3072
  * Perform a linear search and return the index of the match.
@@ -26458,6 +26461,10 @@ stores.inject(MyMetaStore, storeInstance);
26458
26461
  this.currentDisplayValue = newDisplay;
26459
26462
  if (!anchor)
26460
26463
  return;
26464
+ el.style.top = "";
26465
+ el.style.left = "";
26466
+ el.style["max-height"] = "";
26467
+ el.style["max-width"] = "";
26461
26468
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
26462
26469
  let elDims = {
26463
26470
  width: el.getBoundingClientRect().width,
@@ -39450,7 +39457,7 @@ stores.inject(MyMetaStore, storeInstance);
39450
39457
  return;
39451
39458
  }
39452
39459
  const sheetId = this.env.model.getters.getActiveSheetId();
39453
- const zone = this.env.model.getters.getSelectedZone();
39460
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
39454
39461
  const rect = this.env.model.getters.getVisibleRect(zone);
39455
39462
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
39456
39463
  this.isCellReferenceVisible = true;
@@ -41205,13 +41212,23 @@ stores.inject(MyMetaStore, storeInstance);
41205
41212
  drawLayer(renderingContext, layer) {
41206
41213
  switch (layer) {
41207
41214
  case "Background":
41208
- const boxes = this.getGridBoxes();
41209
- this.drawBackground(renderingContext, boxes);
41210
- this.drawOverflowingCellBackground(renderingContext, boxes);
41211
- this.drawCellBackground(renderingContext, boxes);
41212
- this.drawBorders(renderingContext, boxes);
41213
- this.drawTexts(renderingContext, boxes);
41214
- this.drawIcon(renderingContext, boxes);
41215
+ this.drawGlobalBackground(renderingContext);
41216
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
41217
+ const { ctx } = renderingContext;
41218
+ ctx.save();
41219
+ ctx.beginPath();
41220
+ const rect = this.getters.getVisibleRect(zone);
41221
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
41222
+ ctx.clip();
41223
+ const boxes = this.getGridBoxes(zone);
41224
+ this.drawBackground(renderingContext, boxes);
41225
+ this.drawOverflowingCellBackground(renderingContext, boxes);
41226
+ this.drawCellBackground(renderingContext, boxes);
41227
+ this.drawBorders(renderingContext, boxes);
41228
+ this.drawTexts(renderingContext, boxes);
41229
+ this.drawIcon(renderingContext, boxes);
41230
+ ctx.restore();
41231
+ }
41215
41232
  this.drawFrozenPanes(renderingContext);
41216
41233
  break;
41217
41234
  case "Headers":
@@ -41222,12 +41239,15 @@ stores.inject(MyMetaStore, storeInstance);
41222
41239
  break;
41223
41240
  }
41224
41241
  }
41225
- drawBackground(renderingContext, boxes) {
41226
- const { ctx, thinLineWidth } = renderingContext;
41242
+ drawGlobalBackground(renderingContext) {
41243
+ const { ctx } = renderingContext;
41227
41244
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
41228
41245
  // white background
41229
41246
  ctx.fillStyle = "#ffffff";
41230
41247
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
41248
+ }
41249
+ drawBackground(renderingContext, boxes) {
41250
+ const { ctx, thinLineWidth } = renderingContext;
41231
41251
  const areGridLinesVisible = !this.getters.isDashboard() &&
41232
41252
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
41233
41253
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -41652,7 +41672,7 @@ stores.inject(MyMetaStore, storeInstance);
41652
41672
  const position = { sheetId, col, row };
41653
41673
  const cell = this.getters.getEvaluatedCell(position);
41654
41674
  const showFormula = this.getters.shouldShowFormulas();
41655
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
41675
+ const { x, y, width, height } = this.getters.getRect(zone);
41656
41676
  const { verticalAlign } = this.getters.getCellStyle(position);
41657
41677
  const box = {
41658
41678
  x,
@@ -41768,12 +41788,16 @@ stores.inject(MyMetaStore, storeInstance);
41768
41788
  }
41769
41789
  return box;
41770
41790
  }
41771
- getGridBoxes() {
41791
+ getGridBoxes(zone) {
41772
41792
  const boxes = [];
41773
- const visibleCols = this.getters.getSheetViewVisibleCols();
41793
+ const visibleCols = this.getters
41794
+ .getSheetViewVisibleCols()
41795
+ .filter((col) => col >= zone.left && col <= zone.right);
41774
41796
  const left = visibleCols[0];
41775
41797
  const right = visibleCols[visibleCols.length - 1];
41776
- const visibleRows = this.getters.getSheetViewVisibleRows();
41798
+ const visibleRows = this.getters
41799
+ .getSheetViewVisibleRows()
41800
+ .filter((row) => row >= zone.top && row <= zone.bottom);
41777
41801
  const top = visibleRows[0];
41778
41802
  const bottom = visibleRows[visibleRows.length - 1];
41779
41803
  const viewport = { left, right, top, bottom };
@@ -57577,9 +57601,6 @@ stores.inject(MyMetaStore, storeInstance);
57577
57601
  }
57578
57602
  }
57579
57603
  this.acknowledge(message);
57580
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
57581
- return;
57582
- }
57583
57604
  this.trigger("collaborative-event-received");
57584
57605
  }
57585
57606
  onClientMoved(message) {
@@ -60779,8 +60800,12 @@ stores.inject(MyMetaStore, storeInstance);
60779
60800
  },
60780
60801
  ];
60781
60802
  handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
60803
+ const selection = pasteTarget[0];
60804
+ const col = selection.left;
60805
+ const row = selection.top;
60806
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
60782
60807
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
60783
- let currentIndex = cmd.base;
60808
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
60784
60809
  for (const element of toRemove) {
60785
60810
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
60786
60811
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -61063,22 +61088,33 @@ stores.inject(MyMetaStore, storeInstance);
61063
61088
  }
61064
61089
  /**
61065
61090
  *
61066
- * @param zone
61067
- * @returns Computes the absolute coordinate of a given zone inside the viewport
61091
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
61092
+ *
61068
61093
  */
61069
- getRect(zone) {
61094
+ getVisibleRect(zone) {
61070
61095
  const targetZone = intersection(zone, this);
61071
61096
  if (targetZone) {
61072
61097
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
61073
61098
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
61074
61099
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
61075
61100
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
61076
- return {
61077
- x,
61078
- y,
61079
- width,
61080
- height,
61081
- };
61101
+ return { x, y, width, height };
61102
+ }
61103
+ return undefined;
61104
+ }
61105
+ /**
61106
+ *
61107
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
61108
+ *
61109
+ */
61110
+ getFullRect(zone) {
61111
+ const targetZone = intersection(zone, this);
61112
+ if (targetZone) {
61113
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
61114
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
61115
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
61116
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
61117
+ return { x, y, width, height };
61082
61118
  }
61083
61119
  return undefined;
61084
61120
  }
@@ -61248,6 +61284,8 @@ stores.inject(MyMetaStore, storeInstance);
61248
61284
  "isPositionVisible",
61249
61285
  "getColDimensionsInViewport",
61250
61286
  "getRowDimensionsInViewport",
61287
+ "getAllActiveViewportsZones",
61288
+ "getRect",
61251
61289
  ];
61252
61290
  viewports = {};
61253
61291
  /**
@@ -61634,16 +61672,27 @@ stores.inject(MyMetaStore, storeInstance);
61634
61672
  getVisibleRectWithoutHeaders(zone) {
61635
61673
  const sheetId = this.getters.getActiveSheetId();
61636
61674
  const viewportRects = this.getSubViewports(sheetId)
61637
- .map((viewport) => viewport.getRect(zone))
61675
+ .map((viewport) => viewport.getVisibleRect(zone))
61638
61676
  .filter(isDefined);
61639
61677
  if (viewportRects.length === 0) {
61640
61678
  return { x: 0, y: 0, width: 0, height: 0 };
61641
61679
  }
61642
- const x = Math.min(...viewportRects.map((rect) => rect.x));
61643
- const y = Math.min(...viewportRects.map((rect) => rect.y));
61644
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
61645
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
61646
- return { x, y, width, height };
61680
+ return this.recomposeRect(viewportRects);
61681
+ }
61682
+ /**
61683
+ * Computes the actual size and position (:Rect) of the zone on the canvas
61684
+ * regardless of the viewport dimensions.
61685
+ */
61686
+ getRect(zone) {
61687
+ const sheetId = this.getters.getActiveSheetId();
61688
+ const viewportRects = this.getSubViewports(sheetId)
61689
+ .map((viewport) => viewport.getFullRect(zone))
61690
+ .filter(isDefined);
61691
+ if (viewportRects.length === 0) {
61692
+ return { x: 0, y: 0, width: 0, height: 0 };
61693
+ }
61694
+ const rect = this.recomposeRect(viewportRects);
61695
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
61647
61696
  }
61648
61697
  /**
61649
61698
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -61687,6 +61736,10 @@ stores.inject(MyMetaStore, storeInstance);
61687
61736
  end: start + (isRowHidden ? 0 : size),
61688
61737
  };
61689
61738
  }
61739
+ getAllActiveViewportsZones() {
61740
+ const sheetId = this.getters.getActiveSheetId();
61741
+ return this.getSubViewports(sheetId);
61742
+ }
61690
61743
  // ---------------------------------------------------------------------------
61691
61744
  // Private
61692
61745
  // ---------------------------------------------------------------------------
@@ -61877,6 +61930,13 @@ stores.inject(MyMetaStore, storeInstance);
61877
61930
  const height = this.sheetViewHeight + this.gridOffsetY;
61878
61931
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
61879
61932
  }
61933
+ recomposeRect(viewportRects) {
61934
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
61935
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
61936
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
61937
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
61938
+ return { x, y, width, height };
61939
+ }
61880
61940
  }
61881
61941
 
61882
61942
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -68802,9 +68862,9 @@ stores.inject(MyMetaStore, storeInstance);
68802
68862
  exports.tokenize = tokenize;
68803
68863
 
68804
68864
 
68805
- __info__.version = "17.4.17";
68806
- __info__.date = "2025-01-14T11:34:44.930Z";
68807
- __info__.hash = "fd2a7ab";
68865
+ __info__.version = "17.4.19";
68866
+ __info__.date = "2025-01-27T10:04:10.249Z";
68867
+ __info__.hash = "f2a7840";
68808
68868
 
68809
68869
 
68810
68870
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);