@odoo/o-spreadsheet 18.1.1 → 18.1.3

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.1.1
6
- * @date 2025-01-14T11:43:19.116Z
7
- * @hash d0fa5de
5
+ * @version 18.1.3
6
+ * @date 2025-01-27T10:50:23.000Z
7
+ * @hash 7ffac1e
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';
@@ -4378,15 +4378,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
4378
4378
  let currentIndex;
4379
4379
  let currentVal;
4380
4380
  let currentType;
4381
+ const getValue = sortOrder === "desc"
4382
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
4383
+ : (i) => normalizeValue(getValueInData(data, i));
4381
4384
  while (indexRight - indexLeft >= 0) {
4382
4385
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
4383
4386
  currentIndex = indexMedian;
4384
- currentVal = normalizeValue(getValueInData(data, currentIndex));
4387
+ currentVal = getValue(currentIndex);
4385
4388
  currentType = typeof currentVal;
4386
4389
  // 1 - linear search to find value with the same type
4387
4390
  while (indexLeft < currentIndex && targetType !== currentType) {
4388
4391
  currentIndex--;
4389
- currentVal = normalizeValue(getValueInData(data, currentIndex));
4392
+ currentVal = getValue(currentIndex);
4390
4393
  currentType = typeof currentVal;
4391
4394
  }
4392
4395
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -4402,8 +4405,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
4402
4405
  if (matchVal === undefined ||
4403
4406
  matchVal === null ||
4404
4407
  matchVal < currentVal ||
4405
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
4406
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
4408
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
4407
4409
  matchVal = currentVal;
4408
4410
  matchValIndex = currentIndex;
4409
4411
  }
@@ -4411,15 +4413,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
4411
4413
  else if (mode === "nextGreater" && currentVal >= _target) {
4412
4414
  if (matchVal === undefined ||
4413
4415
  matchVal > currentVal ||
4414
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
4415
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
4416
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
4416
4417
  matchVal = currentVal;
4417
4418
  matchValIndex = currentIndex;
4418
4419
  }
4419
4420
  }
4420
4421
  // 3 - give new indexes for the Binary search
4421
- if ((sortOrder === "asc" && currentVal > _target) ||
4422
- (sortOrder === "desc" && currentVal <= _target)) {
4422
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
4423
4423
  indexRight = currentIndex - 1;
4424
4424
  }
4425
4425
  else {
@@ -4427,7 +4427,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
4427
4427
  }
4428
4428
  }
4429
4429
  // note that valMinIndex could be 0
4430
- return matchValIndex !== undefined ? matchValIndex : -1;
4430
+ if (matchValIndex === undefined) {
4431
+ return -1;
4432
+ }
4433
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
4431
4434
  }
4432
4435
  /**
4433
4436
  * Perform a linear search and return the index of the match.
@@ -32201,6 +32204,10 @@ class Popover extends Component {
32201
32204
  this.currentDisplayValue = newDisplay;
32202
32205
  if (!anchor)
32203
32206
  return;
32207
+ el.style.top = "";
32208
+ el.style.left = "";
32209
+ el.style["max-height"] = "";
32210
+ el.style["max-width"] = "";
32204
32211
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
32205
32212
  let elDims = {
32206
32213
  width: el.getBoundingClientRect().width,
@@ -48636,7 +48643,7 @@ class GridComposer extends Component {
48636
48643
  return;
48637
48644
  }
48638
48645
  const sheetId = this.env.model.getters.getActiveSheetId();
48639
- const zone = this.env.model.getters.getSelectedZone();
48646
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
48640
48647
  const rect = this.env.model.getters.getVisibleRect(zone);
48641
48648
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
48642
48649
  this.isCellReferenceVisible = true;
@@ -50472,13 +50479,23 @@ class GridRenderer {
50472
50479
  drawLayer(renderingContext, layer) {
50473
50480
  switch (layer) {
50474
50481
  case "Background":
50475
- const boxes = this.getGridBoxes();
50476
- this.drawBackground(renderingContext, boxes);
50477
- this.drawOverflowingCellBackground(renderingContext, boxes);
50478
- this.drawCellBackground(renderingContext, boxes);
50479
- this.drawBorders(renderingContext, boxes);
50480
- this.drawTexts(renderingContext, boxes);
50481
- this.drawIcon(renderingContext, boxes);
50482
+ this.drawGlobalBackground(renderingContext);
50483
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
50484
+ const { ctx } = renderingContext;
50485
+ ctx.save();
50486
+ ctx.beginPath();
50487
+ const rect = this.getters.getVisibleRect(zone);
50488
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
50489
+ ctx.clip();
50490
+ const boxes = this.getGridBoxes(zone);
50491
+ this.drawBackground(renderingContext, boxes);
50492
+ this.drawOverflowingCellBackground(renderingContext, boxes);
50493
+ this.drawCellBackground(renderingContext, boxes);
50494
+ this.drawBorders(renderingContext, boxes);
50495
+ this.drawTexts(renderingContext, boxes);
50496
+ this.drawIcon(renderingContext, boxes);
50497
+ ctx.restore();
50498
+ }
50482
50499
  this.drawFrozenPanes(renderingContext);
50483
50500
  break;
50484
50501
  case "Headers":
@@ -50489,12 +50506,15 @@ class GridRenderer {
50489
50506
  break;
50490
50507
  }
50491
50508
  }
50492
- drawBackground(renderingContext, boxes) {
50493
- const { ctx, thinLineWidth } = renderingContext;
50509
+ drawGlobalBackground(renderingContext) {
50510
+ const { ctx } = renderingContext;
50494
50511
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
50495
50512
  // white background
50496
50513
  ctx.fillStyle = "#ffffff";
50497
50514
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
50515
+ }
50516
+ drawBackground(renderingContext, boxes) {
50517
+ const { ctx, thinLineWidth } = renderingContext;
50498
50518
  const areGridLinesVisible = !this.getters.isDashboard() &&
50499
50519
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
50500
50520
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -50925,7 +50945,7 @@ class GridRenderer {
50925
50945
  const position = { sheetId, col, row };
50926
50946
  const cell = this.getters.getEvaluatedCell(position);
50927
50947
  const showFormula = this.getters.shouldShowFormulas();
50928
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
50948
+ const { x, y, width, height } = this.getters.getRect(zone);
50929
50949
  const { verticalAlign } = this.getters.getCellStyle(position);
50930
50950
  let style = this.getters.getCellComputedStyle(position);
50931
50951
  if (this.fingerprints.isEnabled) {
@@ -51050,12 +51070,16 @@ class GridRenderer {
51050
51070
  }
51051
51071
  return box;
51052
51072
  }
51053
- getGridBoxes() {
51073
+ getGridBoxes(zone) {
51054
51074
  const boxes = [];
51055
- const visibleCols = this.getters.getSheetViewVisibleCols();
51075
+ const visibleCols = this.getters
51076
+ .getSheetViewVisibleCols()
51077
+ .filter((col) => col >= zone.left && col <= zone.right);
51056
51078
  const left = visibleCols[0];
51057
51079
  const right = visibleCols[visibleCols.length - 1];
51058
- const visibleRows = this.getters.getSheetViewVisibleRows();
51080
+ const visibleRows = this.getters
51081
+ .getSheetViewVisibleRows()
51082
+ .filter((row) => row >= zone.top && row <= zone.bottom);
51059
51083
  const top = visibleRows[0];
51060
51084
  const bottom = visibleRows[visibleRows.length - 1];
51061
51085
  const viewport = { left, right, top, bottom };
@@ -63390,9 +63414,6 @@ class Session extends EventBus {
63390
63414
  }
63391
63415
  }
63392
63416
  this.acknowledge(message);
63393
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
63394
- return;
63395
- }
63396
63417
  this.trigger("collaborative-event-received");
63397
63418
  }
63398
63419
  onClientMoved(message) {
@@ -66724,8 +66745,12 @@ class GridSelectionPlugin extends UIPlugin {
66724
66745
  },
66725
66746
  ];
66726
66747
  handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
66748
+ const selection = pasteTarget[0];
66749
+ const col = selection.left;
66750
+ const row = selection.top;
66751
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
66727
66752
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
66728
- let currentIndex = cmd.base;
66753
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
66729
66754
  const resizingGroups = {};
66730
66755
  for (const element of toRemove) {
66731
66756
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
@@ -67016,22 +67041,33 @@ class InternalViewport {
67016
67041
  }
67017
67042
  /**
67018
67043
  *
67019
- * @param zone
67020
- * @returns Computes the absolute coordinate of a given zone inside the viewport
67044
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
67045
+ *
67021
67046
  */
67022
- getRect(zone) {
67047
+ getVisibleRect(zone) {
67023
67048
  const targetZone = intersection(zone, this);
67024
67049
  if (targetZone) {
67025
67050
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
67026
67051
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
67027
67052
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
67028
67053
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
67029
- return {
67030
- x,
67031
- y,
67032
- width,
67033
- height,
67034
- };
67054
+ return { x, y, width, height };
67055
+ }
67056
+ return undefined;
67057
+ }
67058
+ /**
67059
+ *
67060
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
67061
+ *
67062
+ */
67063
+ getFullRect(zone) {
67064
+ const targetZone = intersection(zone, this);
67065
+ if (targetZone) {
67066
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
67067
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
67068
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
67069
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
67070
+ return { x, y, width, height };
67035
67071
  }
67036
67072
  return undefined;
67037
67073
  }
@@ -67201,6 +67237,8 @@ class SheetViewPlugin extends UIPlugin {
67201
67237
  "isPositionVisible",
67202
67238
  "getColDimensionsInViewport",
67203
67239
  "getRowDimensionsInViewport",
67240
+ "getAllActiveViewportsZones",
67241
+ "getRect",
67204
67242
  ];
67205
67243
  viewports = {};
67206
67244
  /**
@@ -67584,16 +67622,27 @@ class SheetViewPlugin extends UIPlugin {
67584
67622
  getVisibleRectWithoutHeaders(zone) {
67585
67623
  const sheetId = this.getters.getActiveSheetId();
67586
67624
  const viewportRects = this.getSubViewports(sheetId)
67587
- .map((viewport) => viewport.getRect(zone))
67625
+ .map((viewport) => viewport.getVisibleRect(zone))
67588
67626
  .filter(isDefined);
67589
67627
  if (viewportRects.length === 0) {
67590
67628
  return { x: 0, y: 0, width: 0, height: 0 };
67591
67629
  }
67592
- const x = Math.min(...viewportRects.map((rect) => rect.x));
67593
- const y = Math.min(...viewportRects.map((rect) => rect.y));
67594
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
67595
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
67596
- return { x, y, width, height };
67630
+ return this.recomposeRect(viewportRects);
67631
+ }
67632
+ /**
67633
+ * Computes the actual size and position (:Rect) of the zone on the canvas
67634
+ * regardless of the viewport dimensions.
67635
+ */
67636
+ getRect(zone) {
67637
+ const sheetId = this.getters.getActiveSheetId();
67638
+ const viewportRects = this.getSubViewports(sheetId)
67639
+ .map((viewport) => viewport.getFullRect(zone))
67640
+ .filter(isDefined);
67641
+ if (viewportRects.length === 0) {
67642
+ return { x: 0, y: 0, width: 0, height: 0 };
67643
+ }
67644
+ const rect = this.recomposeRect(viewportRects);
67645
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
67597
67646
  }
67598
67647
  /**
67599
67648
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -67637,6 +67686,10 @@ class SheetViewPlugin extends UIPlugin {
67637
67686
  end: start + (isRowHidden ? 0 : size),
67638
67687
  };
67639
67688
  }
67689
+ getAllActiveViewportsZones() {
67690
+ const sheetId = this.getters.getActiveSheetId();
67691
+ return this.getSubViewports(sheetId);
67692
+ }
67640
67693
  // ---------------------------------------------------------------------------
67641
67694
  // Private
67642
67695
  // ---------------------------------------------------------------------------
@@ -67827,6 +67880,13 @@ class SheetViewPlugin extends UIPlugin {
67827
67880
  const height = this.sheetViewHeight + this.gridOffsetY;
67828
67881
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
67829
67882
  }
67883
+ recomposeRect(viewportRects) {
67884
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
67885
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
67886
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
67887
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
67888
+ return { x, y, width, height };
67889
+ }
67830
67890
  }
67831
67891
 
67832
67892
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -74911,6 +74971,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
74911
74971
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, 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, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
74912
74972
 
74913
74973
 
74914
- __info__.version = "18.1.1";
74915
- __info__.date = "2025-01-14T11:43:19.116Z";
74916
- __info__.hash = "d0fa5de";
74974
+ __info__.version = "18.1.3";
74975
+ __info__.date = "2025-01-27T10:50:23.000Z";
74976
+ __info__.hash = "7ffac1e";
@@ -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.1.1
6
- * @date 2025-01-14T11:43:19.116Z
7
- * @hash d0fa5de
5
+ * @version 18.1.3
6
+ * @date 2025-01-27T10:50:23.000Z
7
+ * @hash 7ffac1e
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -4379,15 +4379,18 @@
4379
4379
  let currentIndex;
4380
4380
  let currentVal;
4381
4381
  let currentType;
4382
+ const getValue = sortOrder === "desc"
4383
+ ? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
4384
+ : (i) => normalizeValue(getValueInData(data, i));
4382
4385
  while (indexRight - indexLeft >= 0) {
4383
4386
  indexMedian = Math.floor((indexLeft + indexRight) / 2);
4384
4387
  currentIndex = indexMedian;
4385
- currentVal = normalizeValue(getValueInData(data, currentIndex));
4388
+ currentVal = getValue(currentIndex);
4386
4389
  currentType = typeof currentVal;
4387
4390
  // 1 - linear search to find value with the same type
4388
4391
  while (indexLeft < currentIndex && targetType !== currentType) {
4389
4392
  currentIndex--;
4390
- currentVal = normalizeValue(getValueInData(data, currentIndex));
4393
+ currentVal = getValue(currentIndex);
4391
4394
  currentType = typeof currentVal;
4392
4395
  }
4393
4396
  if (currentType !== targetType || currentVal === undefined || currentVal === null) {
@@ -4403,8 +4406,7 @@
4403
4406
  if (matchVal === undefined ||
4404
4407
  matchVal === null ||
4405
4408
  matchVal < currentVal ||
4406
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
4407
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
4409
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
4408
4410
  matchVal = currentVal;
4409
4411
  matchValIndex = currentIndex;
4410
4412
  }
@@ -4412,15 +4414,13 @@
4412
4414
  else if (mode === "nextGreater" && currentVal >= _target) {
4413
4415
  if (matchVal === undefined ||
4414
4416
  matchVal > currentVal ||
4415
- (matchVal === currentVal && sortOrder === "asc" && matchValIndex < currentIndex) ||
4416
- (matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
4417
+ (matchVal === currentVal && matchValIndex < currentIndex)) {
4417
4418
  matchVal = currentVal;
4418
4419
  matchValIndex = currentIndex;
4419
4420
  }
4420
4421
  }
4421
4422
  // 3 - give new indexes for the Binary search
4422
- if ((sortOrder === "asc" && currentVal > _target) ||
4423
- (sortOrder === "desc" && currentVal <= _target)) {
4423
+ if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
4424
4424
  indexRight = currentIndex - 1;
4425
4425
  }
4426
4426
  else {
@@ -4428,7 +4428,10 @@
4428
4428
  }
4429
4429
  }
4430
4430
  // note that valMinIndex could be 0
4431
- return matchValIndex !== undefined ? matchValIndex : -1;
4431
+ if (matchValIndex === undefined) {
4432
+ return -1;
4433
+ }
4434
+ return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
4432
4435
  }
4433
4436
  /**
4434
4437
  * Perform a linear search and return the index of the match.
@@ -32202,6 +32205,10 @@ stores.inject(MyMetaStore, storeInstance);
32202
32205
  this.currentDisplayValue = newDisplay;
32203
32206
  if (!anchor)
32204
32207
  return;
32208
+ el.style.top = "";
32209
+ el.style.left = "";
32210
+ el.style["max-height"] = "";
32211
+ el.style["max-width"] = "";
32205
32212
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
32206
32213
  let elDims = {
32207
32214
  width: el.getBoundingClientRect().width,
@@ -48637,7 +48644,7 @@ stores.inject(MyMetaStore, storeInstance);
48637
48644
  return;
48638
48645
  }
48639
48646
  const sheetId = this.env.model.getters.getActiveSheetId();
48640
- const zone = this.env.model.getters.getSelectedZone();
48647
+ const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
48641
48648
  const rect = this.env.model.getters.getVisibleRect(zone);
48642
48649
  if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
48643
48650
  this.isCellReferenceVisible = true;
@@ -50473,13 +50480,23 @@ stores.inject(MyMetaStore, storeInstance);
50473
50480
  drawLayer(renderingContext, layer) {
50474
50481
  switch (layer) {
50475
50482
  case "Background":
50476
- const boxes = this.getGridBoxes();
50477
- this.drawBackground(renderingContext, boxes);
50478
- this.drawOverflowingCellBackground(renderingContext, boxes);
50479
- this.drawCellBackground(renderingContext, boxes);
50480
- this.drawBorders(renderingContext, boxes);
50481
- this.drawTexts(renderingContext, boxes);
50482
- this.drawIcon(renderingContext, boxes);
50483
+ this.drawGlobalBackground(renderingContext);
50484
+ for (const zone of this.getters.getAllActiveViewportsZones()) {
50485
+ const { ctx } = renderingContext;
50486
+ ctx.save();
50487
+ ctx.beginPath();
50488
+ const rect = this.getters.getVisibleRect(zone);
50489
+ ctx.rect(rect.x, rect.y, rect.width, rect.height);
50490
+ ctx.clip();
50491
+ const boxes = this.getGridBoxes(zone);
50492
+ this.drawBackground(renderingContext, boxes);
50493
+ this.drawOverflowingCellBackground(renderingContext, boxes);
50494
+ this.drawCellBackground(renderingContext, boxes);
50495
+ this.drawBorders(renderingContext, boxes);
50496
+ this.drawTexts(renderingContext, boxes);
50497
+ this.drawIcon(renderingContext, boxes);
50498
+ ctx.restore();
50499
+ }
50483
50500
  this.drawFrozenPanes(renderingContext);
50484
50501
  break;
50485
50502
  case "Headers":
@@ -50490,12 +50507,15 @@ stores.inject(MyMetaStore, storeInstance);
50490
50507
  break;
50491
50508
  }
50492
50509
  }
50493
- drawBackground(renderingContext, boxes) {
50494
- const { ctx, thinLineWidth } = renderingContext;
50510
+ drawGlobalBackground(renderingContext) {
50511
+ const { ctx } = renderingContext;
50495
50512
  const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
50496
50513
  // white background
50497
50514
  ctx.fillStyle = "#ffffff";
50498
50515
  ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
50516
+ }
50517
+ drawBackground(renderingContext, boxes) {
50518
+ const { ctx, thinLineWidth } = renderingContext;
50499
50519
  const areGridLinesVisible = !this.getters.isDashboard() &&
50500
50520
  this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
50501
50521
  const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
@@ -50926,7 +50946,7 @@ stores.inject(MyMetaStore, storeInstance);
50926
50946
  const position = { sheetId, col, row };
50927
50947
  const cell = this.getters.getEvaluatedCell(position);
50928
50948
  const showFormula = this.getters.shouldShowFormulas();
50929
- const { x, y, width, height } = this.getters.getVisibleRect(zone);
50949
+ const { x, y, width, height } = this.getters.getRect(zone);
50930
50950
  const { verticalAlign } = this.getters.getCellStyle(position);
50931
50951
  let style = this.getters.getCellComputedStyle(position);
50932
50952
  if (this.fingerprints.isEnabled) {
@@ -51051,12 +51071,16 @@ stores.inject(MyMetaStore, storeInstance);
51051
51071
  }
51052
51072
  return box;
51053
51073
  }
51054
- getGridBoxes() {
51074
+ getGridBoxes(zone) {
51055
51075
  const boxes = [];
51056
- const visibleCols = this.getters.getSheetViewVisibleCols();
51076
+ const visibleCols = this.getters
51077
+ .getSheetViewVisibleCols()
51078
+ .filter((col) => col >= zone.left && col <= zone.right);
51057
51079
  const left = visibleCols[0];
51058
51080
  const right = visibleCols[visibleCols.length - 1];
51059
- const visibleRows = this.getters.getSheetViewVisibleRows();
51081
+ const visibleRows = this.getters
51082
+ .getSheetViewVisibleRows()
51083
+ .filter((row) => row >= zone.top && row <= zone.bottom);
51060
51084
  const top = visibleRows[0];
51061
51085
  const bottom = visibleRows[visibleRows.length - 1];
51062
51086
  const viewport = { left, right, top, bottom };
@@ -63391,9 +63415,6 @@ stores.inject(MyMetaStore, storeInstance);
63391
63415
  }
63392
63416
  }
63393
63417
  this.acknowledge(message);
63394
- if (message.type === "REMOTE_REVISION" && message.clientId === this.clientId) {
63395
- return;
63396
- }
63397
63418
  this.trigger("collaborative-event-received");
63398
63419
  }
63399
63420
  onClientMoved(message) {
@@ -66725,8 +66746,12 @@ stores.inject(MyMetaStore, storeInstance);
66725
66746
  },
66726
66747
  ];
66727
66748
  handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
66749
+ const selection = pasteTarget[0];
66750
+ const col = selection.left;
66751
+ const row = selection.top;
66752
+ this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
66728
66753
  const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
66729
- let currentIndex = cmd.base;
66754
+ let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
66730
66755
  const resizingGroups = {};
66731
66756
  for (const element of toRemove) {
66732
66757
  const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
@@ -67017,22 +67042,33 @@ stores.inject(MyMetaStore, storeInstance);
67017
67042
  }
67018
67043
  /**
67019
67044
  *
67020
- * @param zone
67021
- * @returns Computes the absolute coordinate of a given zone inside the viewport
67045
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
67046
+ *
67022
67047
  */
67023
- getRect(zone) {
67048
+ getVisibleRect(zone) {
67024
67049
  const targetZone = intersection(zone, this);
67025
67050
  if (targetZone) {
67026
67051
  const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
67027
67052
  const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
67028
67053
  const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
67029
67054
  const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
67030
- return {
67031
- x,
67032
- y,
67033
- width,
67034
- height,
67035
- };
67055
+ return { x, y, width, height };
67056
+ }
67057
+ return undefined;
67058
+ }
67059
+ /**
67060
+ *
67061
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
67062
+ *
67063
+ */
67064
+ getFullRect(zone) {
67065
+ const targetZone = intersection(zone, this);
67066
+ if (targetZone) {
67067
+ const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
67068
+ const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
67069
+ const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
67070
+ const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
67071
+ return { x, y, width, height };
67036
67072
  }
67037
67073
  return undefined;
67038
67074
  }
@@ -67202,6 +67238,8 @@ stores.inject(MyMetaStore, storeInstance);
67202
67238
  "isPositionVisible",
67203
67239
  "getColDimensionsInViewport",
67204
67240
  "getRowDimensionsInViewport",
67241
+ "getAllActiveViewportsZones",
67242
+ "getRect",
67205
67243
  ];
67206
67244
  viewports = {};
67207
67245
  /**
@@ -67585,16 +67623,27 @@ stores.inject(MyMetaStore, storeInstance);
67585
67623
  getVisibleRectWithoutHeaders(zone) {
67586
67624
  const sheetId = this.getters.getActiveSheetId();
67587
67625
  const viewportRects = this.getSubViewports(sheetId)
67588
- .map((viewport) => viewport.getRect(zone))
67626
+ .map((viewport) => viewport.getVisibleRect(zone))
67589
67627
  .filter(isDefined);
67590
67628
  if (viewportRects.length === 0) {
67591
67629
  return { x: 0, y: 0, width: 0, height: 0 };
67592
67630
  }
67593
- const x = Math.min(...viewportRects.map((rect) => rect.x));
67594
- const y = Math.min(...viewportRects.map((rect) => rect.y));
67595
- const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
67596
- const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
67597
- return { x, y, width, height };
67631
+ return this.recomposeRect(viewportRects);
67632
+ }
67633
+ /**
67634
+ * Computes the actual size and position (:Rect) of the zone on the canvas
67635
+ * regardless of the viewport dimensions.
67636
+ */
67637
+ getRect(zone) {
67638
+ const sheetId = this.getters.getActiveSheetId();
67639
+ const viewportRects = this.getSubViewports(sheetId)
67640
+ .map((viewport) => viewport.getFullRect(zone))
67641
+ .filter(isDefined);
67642
+ if (viewportRects.length === 0) {
67643
+ return { x: 0, y: 0, width: 0, height: 0 };
67644
+ }
67645
+ const rect = this.recomposeRect(viewportRects);
67646
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
67598
67647
  }
67599
67648
  /**
67600
67649
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -67638,6 +67687,10 @@ stores.inject(MyMetaStore, storeInstance);
67638
67687
  end: start + (isRowHidden ? 0 : size),
67639
67688
  };
67640
67689
  }
67690
+ getAllActiveViewportsZones() {
67691
+ const sheetId = this.getters.getActiveSheetId();
67692
+ return this.getSubViewports(sheetId);
67693
+ }
67641
67694
  // ---------------------------------------------------------------------------
67642
67695
  // Private
67643
67696
  // ---------------------------------------------------------------------------
@@ -67828,6 +67881,13 @@ stores.inject(MyMetaStore, storeInstance);
67828
67881
  const height = this.sheetViewHeight + this.gridOffsetY;
67829
67882
  return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
67830
67883
  }
67884
+ recomposeRect(viewportRects) {
67885
+ const x = Math.min(...viewportRects.map((rect) => rect.x));
67886
+ const y = Math.min(...viewportRects.map((rect) => rect.y));
67887
+ const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
67888
+ const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
67889
+ return { x, y, width, height };
67890
+ }
67831
67891
  }
67832
67892
 
67833
67893
  class HeaderPositionsUIPlugin extends UIPlugin {
@@ -74956,9 +75016,9 @@ stores.inject(MyMetaStore, storeInstance);
74956
75016
  exports.tokenize = tokenize;
74957
75017
 
74958
75018
 
74959
- __info__.version = "18.1.1";
74960
- __info__.date = "2025-01-14T11:43:19.116Z";
74961
- __info__.hash = "d0fa5de";
75019
+ __info__.version = "18.1.3";
75020
+ __info__.date = "2025-01-27T10:50:23.000Z";
75021
+ __info__.hash = "7ffac1e";
74962
75022
 
74963
75023
 
74964
75024
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);