@odoo/o-spreadsheet 17.2.31 → 17.2.33

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.31
7
- * @date 2025-01-14T11:31:09.035Z
8
- * @hash 306dbf7
6
+ * @version 17.2.33
7
+ * @date 2025-01-27T10:02:54.985Z
8
+ * @hash 6ea43fb
9
9
  */
10
10
 
11
11
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw } from '@odoo/owl';
@@ -2805,15 +2805,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
2805
2805
  let currentIndex;
2806
2806
  let currentVal;
2807
2807
  let currentType;
2808
+ const getValue = sortOrder === "desc"
2809
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
2810
+ : (i) => normalizeValue(getValueInData(data, i));
2808
2811
  while (indexRight - indexLeft >= 0) {
2809
2812
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
2810
2813
  currentIndex = indexMedian;
2811
- currentVal = normalizeValue(getValueInData(data, currentIndex));
2814
+ currentVal = getValue(currentIndex);
2812
2815
  currentType = typeof currentVal;
2813
2816
  // 1 - linear search to find value with the same type
2814
2817
  while (indexLeft < currentIndex && targetType !== currentType) {
2815
2818
  currentIndex--;
2816
- currentVal = normalizeValue(getValueInData(data, currentIndex));
2819
+ currentVal = getValue(currentIndex);
2817
2820
  currentType = typeof currentVal;
2818
2821
  }
2819
2822
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -2829,8 +2832,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
2829
2832
  if (matchVal === undefined ||
2830
2833
  matchVal === null ||
2831
2834
  matchVal < currentVal ||
2832
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
2833
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
2835
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
2834
2836
  matchVal = currentVal;
2835
2837
  matchValIndex = currentIndex;
2836
2838
  }
@@ -2838,15 +2840,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
2838
2840
  else if (mode === "nextGreater" && currentVal >= _target) {
2839
2841
  if (matchVal === undefined ||
2840
2842
  matchVal > currentVal ||
2841
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
2842
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
2843
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
2843
2844
  matchVal = currentVal;
2844
2845
  matchValIndex = currentIndex;
2845
2846
  }
2846
2847
  }
2847
2848
  // 3 - give new indexes for the Binary search
2848
- if ((sortOrder === "asc" && currentVal > _target) ||
2849
- (sortOrder === "desc" && currentVal <= _target)) {
2849
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
2850
2850
  indexRight = currentIndex - 1;
2851
2851
  }
2852
2852
  else {
@@ -2854,7 +2854,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
2854
2854
  }
2855
2855
  }
2856
2856
  // note that valMinIndex could be 0
2857
- return matchValIndex !== undefined ? matchValIndex : -1;
2857
+ if (matchValIndex === undefined) {
2858
+ return -1;
2859
+ }
2860
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
2858
2861
  }
2859
2862
  /**
2860
2863
  * Perform a linear search and return the index of the match.
@@ -21875,6 +21878,10 @@ class Popover extends Component {
21875
21878
  this.currentDisplayValue = newDisplay;
21876
21879
  if (!anchor)
21877
21880
  return;
21881
+ el.style.top = "";
21882
+ el.style.left = "";
21883
+ el.style["max-height"] = "";
21884
+ el.style["max-width"] = "";
21878
21885
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
21879
21886
  let elDims = {
21880
21887
  width: el.getBoundingClientRect().width,
@@ -32941,7 +32948,7 @@ class GridComposer extends Component {
32941
32948
  return;
32942
32949
  }
32943
32950
  const sheetId = this.env.model.getters.getActiveSheetId();
32944
- const zone = this.env.model.getters.getSelectedZone();
32951
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
32945
32952
  const rect = this.env.model.getters.getVisibleRect(zone);
32946
32953
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
32947
32954
  this.isCellReferenceVisible = true;
@@ -34687,13 +34694,23 @@ class GridRenderer {
34687
34694
  drawLayer(renderingContext, layer) {
34688
34695
  switch (layer) {
34689
34696
  case "Background":
34690
- const boxes = this.getGridBoxes();
34691
- this.drawBackground(renderingContext, boxes);
34692
- this.drawOverflowingCellBackground(renderingContext, boxes);
34693
- this.drawCellBackground(renderingContext, boxes);
34694
- this.drawBorders(renderingContext, boxes);
34695
- this.drawTexts(renderingContext, boxes);
34696
- this.drawIcon(renderingContext, boxes);
34697
+ this.drawGlobalBackground(renderingContext);
34698
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
34699
+ const { ctx } = renderingContext;
34700
+ ctx.save();
34701
+ ctx.beginPath();
34702
+ const rect = this.getters.getVisibleRect(zone);
34703
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
34704
+ ctx.clip();
34705
+ const boxes = this.getGridBoxes(zone);
34706
+ this.drawBackground(renderingContext, boxes);
34707
+ this.drawOverflowingCellBackground(renderingContext, boxes);
34708
+ this.drawCellBackground(renderingContext, boxes);
34709
+ this.drawBorders(renderingContext, boxes);
34710
+ this.drawTexts(renderingContext, boxes);
34711
+ this.drawIcon(renderingContext, boxes);
34712
+ ctx.restore();
34713
+ }
34697
34714
  this.drawFrozenPanes(renderingContext);
34698
34715
  break;
34699
34716
  case "Headers":
@@ -34704,12 +34721,15 @@ class GridRenderer {
34704
34721
  break;
34705
34722
  }
34706
34723
  }
34707
- drawBackground(renderingContext, boxes) {
34708
- const { ctx, thinLineWidth } = renderingContext;
34724
+ drawGlobalBackground(renderingContext) {
34725
+ const { ctx } = renderingContext;
34709
34726
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
34710
34727
  // white background
34711
34728
  ctx.fillStyle = "#ffffff";
34712
34729
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
34730
+ }
34731
+ drawBackground(renderingContext, boxes) {
34732
+ const { ctx, thinLineWidth } = renderingContext;
34713
34733
  const areGridLinesVisible = !this.getters.isDashboard() &&
34714
34734
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
34715
34735
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -35134,7 +35154,7 @@ class GridRenderer {
35134
35154
  const position = { sheetId, col, row };
35135
35155
  const cell = this.getters.getEvaluatedCell(position);
35136
35156
  const showFormula = this.getters.shouldShowFormulas();
35137
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
35157
+ const { x, y, width, height } = this.getters.getRect(zone);
35138
35158
  const { verticalAlign } = this.getters.getCellStyle(position);
35139
35159
  const box = {
35140
35160
  x,
@@ -35249,12 +35269,16 @@ class GridRenderer {
35249
35269
  }
35250
35270
  return box;
35251
35271
  }
35252
- getGridBoxes() {
35272
+ getGridBoxes(zone) {
35253
35273
  const boxes = [];
35254
- const visibleCols = this.getters.getSheetViewVisibleCols();
35274
+ const visibleCols = this.getters
35275
+ .getSheetViewVisibleCols()
35276
+ .filter((col) => col >= zone.left && col <= zone.right);
35255
35277
  const left = visibleCols[0];
35256
35278
  const right = visibleCols[visibleCols.length - 1];
35257
- const visibleRows = this.getters.getSheetViewVisibleRows();
35279
+ const visibleRows = this.getters
35280
+ .getSheetViewVisibleRows()
35281
+ .filter((row) => row >= zone.top && row <= zone.bottom);
35258
35282
  const top = visibleRows[0];
35259
35283
  const bottom = visibleRows[visibleRows.length - 1];
35260
35284
  const viewport = { left, right, top, bottom };
@@ -50630,9 +50654,6 @@ class Session extends EventBus {
50630
50654
  }
50631
50655
  }
50632
50656
  this.acknowledge(message);
50633
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
50634
- return;
50635
- }
50636
50657
  this.trigger("collaborative-event-received");
50637
50658
  }
50638
50659
  onClientMoved(message) {
@@ -53648,8 +53669,12 @@ class GridSelectionPlugin extends UIPlugin {
53648
53669
  },
53649
53670
  ];
53650
53671
  handler.paste({ zones: pasteTarget }, data, { isCutOperation: true });
53672
+ const selection = pasteTarget[0];
53673
+ const col = selection.left;
53674
+ const row = selection.top;
53675
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
53651
53676
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
53652
- let currentIndex = cmd.base;
53677
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
53653
53678
  for (const element of toRemove) {
53654
53679
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
53655
53680
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -53928,22 +53953,33 @@ class InternalViewport {
53928
53953
  }
53929
53954
  /**
53930
53955
  *
53931
- * @param zone
53932
- * @returns Computes the absolute coordinate of a given zone inside the viewport
53956
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
53957
+ *
53933
53958
  */
53934
- getRect(zone) {
53959
+ getVisibleRect(zone) {
53935
53960
  const targetZone = intersection(zone, this);
53936
53961
  if (targetZone) {
53937
53962
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
53938
53963
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
53939
53964
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
53940
53965
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
53941
- return {
53942
- x,
53943
- y,
53944
- width,
53945
- height,
53946
- };
53966
+ return { x, y, width, height };
53967
+ }
53968
+ return undefined;
53969
+ }
53970
+ /**
53971
+ *
53972
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
53973
+ *
53974
+ */
53975
+ getFullRect(zone) {
53976
+ const targetZone = intersection(zone, this);
53977
+ if (targetZone) {
53978
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
53979
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
53980
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
53981
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
53982
+ return { x, y, width, height };
53947
53983
  }
53948
53984
  return undefined;
53949
53985
  }
@@ -54113,6 +54149,8 @@ class SheetViewPlugin extends UIPlugin {
54113
54149
  "isPositionVisible",
54114
54150
  "getColDimensionsInViewport",
54115
54151
  "getRowDimensionsInViewport",
54152
+ "getAllActiveViewportsZones",
54153
+ "getRect",
54116
54154
  ];
54117
54155
  viewports = {};
54118
54156
  /**
@@ -54500,16 +54538,27 @@ class SheetViewPlugin extends UIPlugin {
54500
54538
  getVisibleRectWithoutHeaders(zone) {
54501
54539
  const sheetId = this.getters.getActiveSheetId();
54502
54540
  const viewportRects = this.getSubViewports(sheetId)
54503
- .map((viewport) => viewport.getRect(zone))
54541
+ .map((viewport) => viewport.getVisibleRect(zone))
54504
54542
  .filter(isDefined$1);
54505
54543
  if (viewportRects.length === 0) {
54506
54544
  return { x: 0, y: 0, width: 0, height: 0 };
54507
54545
  }
54508
- const x = Math.min(...viewportRects.map((rect) => rect.x));
54509
- const y = Math.min(...viewportRects.map((rect) => rect.y));
54510
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
54511
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
54512
- return { x, y, width, height };
54546
+ return this.recomposeRect(viewportRects);
54547
+ }
54548
+ /**
54549
+ * Computes the actual size and position (:Rect) of the zone on the canvas
54550
+ * regardless of the viewport dimensions.
54551
+ */
54552
+ getRect(zone) {
54553
+ const sheetId = this.getters.getActiveSheetId();
54554
+ const viewportRects = this.getSubViewports(sheetId)
54555
+ .map((viewport) => viewport.getFullRect(zone))
54556
+ .filter(isDefined$1);
54557
+ if (viewportRects.length === 0) {
54558
+ return { x: 0, y: 0, width: 0, height: 0 };
54559
+ }
54560
+ const rect = this.recomposeRect(viewportRects);
54561
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
54513
54562
  }
54514
54563
  /**
54515
54564
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -54553,6 +54602,10 @@ class SheetViewPlugin extends UIPlugin {
54553
54602
  end: start + (isRowHidden ? 0 : size),
54554
54603
  };
54555
54604
  }
54605
+ getAllActiveViewportsZones() {
54606
+ const sheetId = this.getters.getActiveSheetId();
54607
+ return this.getSubViewports(sheetId);
54608
+ }
54556
54609
  // ---------------------------------------------------------------------------
54557
54610
  // Private
54558
54611
  // ---------------------------------------------------------------------------
@@ -54737,6 +54790,13 @@ class SheetViewPlugin extends UIPlugin {
54737
54790
  const height = this.sheetViewHeight + this.gridOffsetY;
54738
54791
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
54739
54792
  }
54793
+ recomposeRect(viewportRects) {
54794
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
54795
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
54796
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
54797
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
54798
+ return { x, y, width, height };
54799
+ }
54740
54800
  }
54741
54801
 
54742
54802
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -61033,6 +61093,6 @@ const constants = {
61033
61093
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, 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 };
61034
61094
 
61035
61095
 
61036
- __info__.version = "17.2.31";
61037
- __info__.date = "2025-01-14T11:31:09.035Z";
61038
- __info__.hash = "306dbf7";
61096
+ __info__.version = "17.2.33";
61097
+ __info__.date = "2025-01-27T10:02:54.985Z";
61098
+ __info__.hash = "6ea43fb";
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.31
7
- * @date 2025-01-14T11:31:09.035Z
8
- * @hash 306dbf7
6
+ * @version 17.2.33
7
+ * @date 2025-01-27T10:02:54.985Z
8
+ * @hash 6ea43fb
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -2806,15 +2806,18 @@
2806
2806
  let currentIndex;
2807
2807
  let currentVal;
2808
2808
  let currentType;
2809
+ const getValue = sortOrder === "desc"
2810
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
2811
+ : (i) => normalizeValue(getValueInData(data, i));
2809
2812
  while (indexRight - indexLeft >= 0) {
2810
2813
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
2811
2814
  currentIndex = indexMedian;
2812
- currentVal = normalizeValue(getValueInData(data, currentIndex));
2815
+ currentVal = getValue(currentIndex);
2813
2816
  currentType = typeof currentVal;
2814
2817
  // 1 - linear search to find value with the same type
2815
2818
  while (indexLeft < currentIndex && targetType !== currentType) {
2816
2819
  currentIndex--;
2817
- currentVal = normalizeValue(getValueInData(data, currentIndex));
2820
+ currentVal = getValue(currentIndex);
2818
2821
  currentType = typeof currentVal;
2819
2822
  }
2820
2823
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -2830,8 +2833,7 @@
2830
2833
  if (matchVal === undefined ||
2831
2834
  matchVal === null ||
2832
2835
  matchVal < currentVal ||
2833
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
2834
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
2836
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
2835
2837
  matchVal = currentVal;
2836
2838
  matchValIndex = currentIndex;
2837
2839
  }
@@ -2839,15 +2841,13 @@
2839
2841
  else if (mode === "nextGreater" && currentVal >= _target) {
2840
2842
  if (matchVal === undefined ||
2841
2843
  matchVal > currentVal ||
2842
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
2843
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
2844
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
2844
2845
  matchVal = currentVal;
2845
2846
  matchValIndex = currentIndex;
2846
2847
  }
2847
2848
  }
2848
2849
  // 3 - give new indexes for the Binary search
2849
- if ((sortOrder === "asc" && currentVal > _target) ||
2850
- (sortOrder === "desc" && currentVal <= _target)) {
2850
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
2851
2851
  indexRight = currentIndex - 1;
2852
2852
  }
2853
2853
  else {
@@ -2855,7 +2855,10 @@
2855
2855
  }
2856
2856
  }
2857
2857
  // note that valMinIndex could be 0
2858
- return matchValIndex !== undefined ? matchValIndex : -1;
2858
+ if (matchValIndex === undefined) {
2859
+ return -1;
2860
+ }
2861
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
2859
2862
  }
2860
2863
  /**
2861
2864
  * Perform a linear search and return the index of the match.
@@ -21876,6 +21879,10 @@ stores.inject(MyMetaStore, storeInstance);
21876
21879
  this.currentDisplayValue = newDisplay;
21877
21880
  if (!anchor)
21878
21881
  return;
21882
+ el.style.top = "";
21883
+ el.style.left = "";
21884
+ el.style["max-height"] = "";
21885
+ el.style["max-width"] = "";
21879
21886
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
21880
21887
  let elDims = {
21881
21888
  width: el.getBoundingClientRect().width,
@@ -32942,7 +32949,7 @@ stores.inject(MyMetaStore, storeInstance);
32942
32949
  return;
32943
32950
  }
32944
32951
  const sheetId = this.env.model.getters.getActiveSheetId();
32945
- const zone = this.env.model.getters.getSelectedZone();
32952
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
32946
32953
  const rect = this.env.model.getters.getVisibleRect(zone);
32947
32954
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
32948
32955
  this.isCellReferenceVisible = true;
@@ -34688,13 +34695,23 @@ stores.inject(MyMetaStore, storeInstance);
34688
34695
  drawLayer(renderingContext, layer) {
34689
34696
  switch (layer) {
34690
34697
  case "Background":
34691
- const boxes = this.getGridBoxes();
34692
- this.drawBackground(renderingContext, boxes);
34693
- this.drawOverflowingCellBackground(renderingContext, boxes);
34694
- this.drawCellBackground(renderingContext, boxes);
34695
- this.drawBorders(renderingContext, boxes);
34696
- this.drawTexts(renderingContext, boxes);
34697
- this.drawIcon(renderingContext, boxes);
34698
+ this.drawGlobalBackground(renderingContext);
34699
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
34700
+ const { ctx } = renderingContext;
34701
+ ctx.save();
34702
+ ctx.beginPath();
34703
+ const rect = this.getters.getVisibleRect(zone);
34704
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
34705
+ ctx.clip();
34706
+ const boxes = this.getGridBoxes(zone);
34707
+ this.drawBackground(renderingContext, boxes);
34708
+ this.drawOverflowingCellBackground(renderingContext, boxes);
34709
+ this.drawCellBackground(renderingContext, boxes);
34710
+ this.drawBorders(renderingContext, boxes);
34711
+ this.drawTexts(renderingContext, boxes);
34712
+ this.drawIcon(renderingContext, boxes);
34713
+ ctx.restore();
34714
+ }
34698
34715
  this.drawFrozenPanes(renderingContext);
34699
34716
  break;
34700
34717
  case "Headers":
@@ -34705,12 +34722,15 @@ stores.inject(MyMetaStore, storeInstance);
34705
34722
  break;
34706
34723
  }
34707
34724
  }
34708
- drawBackground(renderingContext, boxes) {
34709
- const { ctx, thinLineWidth } = renderingContext;
34725
+ drawGlobalBackground(renderingContext) {
34726
+ const { ctx } = renderingContext;
34710
34727
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
34711
34728
  // white background
34712
34729
  ctx.fillStyle = "#ffffff";
34713
34730
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
34731
+ }
34732
+ drawBackground(renderingContext, boxes) {
34733
+ const { ctx, thinLineWidth } = renderingContext;
34714
34734
  const areGridLinesVisible = !this.getters.isDashboard() &&
34715
34735
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
34716
34736
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -35135,7 +35155,7 @@ stores.inject(MyMetaStore, storeInstance);
35135
35155
  const position = { sheetId, col, row };
35136
35156
  const cell = this.getters.getEvaluatedCell(position);
35137
35157
  const showFormula = this.getters.shouldShowFormulas();
35138
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
35158
+ const { x, y, width, height } = this.getters.getRect(zone);
35139
35159
  const { verticalAlign } = this.getters.getCellStyle(position);
35140
35160
  const box = {
35141
35161
  x,
@@ -35250,12 +35270,16 @@ stores.inject(MyMetaStore, storeInstance);
35250
35270
  }
35251
35271
  return box;
35252
35272
  }
35253
- getGridBoxes() {
35273
+ getGridBoxes(zone) {
35254
35274
  const boxes = [];
35255
- const visibleCols = this.getters.getSheetViewVisibleCols();
35275
+ const visibleCols = this.getters
35276
+ .getSheetViewVisibleCols()
35277
+ .filter((col) => col >= zone.left && col <= zone.right);
35256
35278
  const left = visibleCols[0];
35257
35279
  const right = visibleCols[visibleCols.length - 1];
35258
- const visibleRows = this.getters.getSheetViewVisibleRows();
35280
+ const visibleRows = this.getters
35281
+ .getSheetViewVisibleRows()
35282
+ .filter((row) => row >= zone.top && row <= zone.bottom);
35259
35283
  const top = visibleRows[0];
35260
35284
  const bottom = visibleRows[visibleRows.length - 1];
35261
35285
  const viewport = { left, right, top, bottom };
@@ -50631,9 +50655,6 @@ stores.inject(MyMetaStore, storeInstance);
50631
50655
  }
50632
50656
  }
50633
50657
  this.acknowledge(message);
50634
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
50635
- return;
50636
- }
50637
50658
  this.trigger("collaborative-event-received");
50638
50659
  }
50639
50660
  onClientMoved(message) {
@@ -53649,8 +53670,12 @@ stores.inject(MyMetaStore, storeInstance);
53649
53670
  },
53650
53671
  ];
53651
53672
  handler.paste({ zones: pasteTarget }, data, { isCutOperation: true });
53673
+ const selection = pasteTarget[0];
53674
+ const col = selection.left;
53675
+ const row = selection.top;
53676
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
53652
53677
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
53653
- let currentIndex = cmd.base;
53678
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
53654
53679
  for (const element of toRemove) {
53655
53680
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
53656
53681
  this.dispatch("RESIZE_COLUMNS_ROWS", {
@@ -53929,22 +53954,33 @@ stores.inject(MyMetaStore, storeInstance);
53929
53954
  }
53930
53955
  /**
53931
53956
  *
53932
- * @param zone
53933
- * @returns Computes the absolute coordinate of a given zone inside the viewport
53957
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
53958
+ *
53934
53959
  */
53935
- getRect(zone) {
53960
+ getVisibleRect(zone) {
53936
53961
  const targetZone = intersection(zone, this);
53937
53962
  if (targetZone) {
53938
53963
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
53939
53964
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
53940
53965
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
53941
53966
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
53942
- return {
53943
- x,
53944
- y,
53945
- width,
53946
- height,
53947
- };
53967
+ return { x, y, width, height };
53968
+ }
53969
+ return undefined;
53970
+ }
53971
+ /**
53972
+ *
53973
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
53974
+ *
53975
+ */
53976
+ getFullRect(zone) {
53977
+ const targetZone = intersection(zone, this);
53978
+ if (targetZone) {
53979
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
53980
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
53981
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
53982
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
53983
+ return { x, y, width, height };
53948
53984
  }
53949
53985
  return undefined;
53950
53986
  }
@@ -54114,6 +54150,8 @@ stores.inject(MyMetaStore, storeInstance);
54114
54150
  "isPositionVisible",
54115
54151
  "getColDimensionsInViewport",
54116
54152
  "getRowDimensionsInViewport",
54153
+ "getAllActiveViewportsZones",
54154
+ "getRect",
54117
54155
  ];
54118
54156
  viewports = {};
54119
54157
  /**
@@ -54501,16 +54539,27 @@ stores.inject(MyMetaStore, storeInstance);
54501
54539
  getVisibleRectWithoutHeaders(zone) {
54502
54540
  const sheetId = this.getters.getActiveSheetId();
54503
54541
  const viewportRects = this.getSubViewports(sheetId)
54504
- .map((viewport) => viewport.getRect(zone))
54542
+ .map((viewport) => viewport.getVisibleRect(zone))
54505
54543
  .filter(isDefined$1);
54506
54544
  if (viewportRects.length === 0) {
54507
54545
  return { x: 0, y: 0, width: 0, height: 0 };
54508
54546
  }
54509
- const x = Math.min(...viewportRects.map((rect) => rect.x));
54510
- const y = Math.min(...viewportRects.map((rect) => rect.y));
54511
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
54512
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
54513
- return { x, y, width, height };
54547
+ return this.recomposeRect(viewportRects);
54548
+ }
54549
+ /**
54550
+ * Computes the actual size and position (:Rect) of the zone on the canvas
54551
+ * regardless of the viewport dimensions.
54552
+ */
54553
+ getRect(zone) {
54554
+ const sheetId = this.getters.getActiveSheetId();
54555
+ const viewportRects = this.getSubViewports(sheetId)
54556
+ .map((viewport) => viewport.getFullRect(zone))
54557
+ .filter(isDefined$1);
54558
+ if (viewportRects.length === 0) {
54559
+ return { x: 0, y: 0, width: 0, height: 0 };
54560
+ }
54561
+ const rect = this.recomposeRect(viewportRects);
54562
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
54514
54563
  }
54515
54564
  /**
54516
54565
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -54554,6 +54603,10 @@ stores.inject(MyMetaStore, storeInstance);
54554
54603
  end: start + (isRowHidden ? 0 : size),
54555
54604
  };
54556
54605
  }
54606
+ getAllActiveViewportsZones() {
54607
+ const sheetId = this.getters.getActiveSheetId();
54608
+ return this.getSubViewports(sheetId);
54609
+ }
54557
54610
  // ---------------------------------------------------------------------------
54558
54611
  // Private
54559
54612
  // ---------------------------------------------------------------------------
@@ -54738,6 +54791,13 @@ stores.inject(MyMetaStore, storeInstance);
54738
54791
  const height = this.sheetViewHeight + this.gridOffsetY;
54739
54792
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
54740
54793
  }
54794
+ recomposeRect(viewportRects) {
54795
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
54796
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
54797
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
54798
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
54799
+ return { x, y, width, height };
54800
+ }
54741
54801
  }
54742
54802
 
54743
54803
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -61075,9 +61135,9 @@ stores.inject(MyMetaStore, storeInstance);
61075
61135
  exports.tokenize = tokenize;
61076
61136
 
61077
61137
 
61078
- __info__.version = "17.2.31";
61079
- __info__.date = "2025-01-14T11:31:09.035Z";
61080
- __info__.hash = "306dbf7";
61138
+ __info__.version = "17.2.33";
61139
+ __info__.date = "2025-01-27T10:02:54.985Z";
61140
+ __info__.hash = "6ea43fb";
61081
61141
 
61082
61142
 
61083
61143
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);