@odoo/o-spreadsheet 16.0.58 → 16.0.60
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.
- package/dist/o-spreadsheet.cjs.js +101 -81
- package/dist/o-spreadsheet.d.ts +6 -12
- package/dist/o-spreadsheet.esm.js +101 -81
- package/dist/o-spreadsheet.iife.js +101 -81
- package/dist/o-spreadsheet.iife.min.js +3 -3
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -22431,6 +22431,9 @@ function useGridDrawing(refName, model, canvasSize) {
|
|
|
22431
22431
|
canvas.width = width * dpr;
|
|
22432
22432
|
canvas.height = height * dpr;
|
|
22433
22433
|
canvas.setAttribute("style", `width:${width}px;height:${height}px;`);
|
|
22434
|
+
if (width === 0 || height === 0) {
|
|
22435
|
+
return;
|
|
22436
|
+
}
|
|
22434
22437
|
// Imagine each pixel as a large square. The whole-number coordinates (0, 1, 2…)
|
|
22435
22438
|
// are the edges of the squares. If you draw a one-unit-wide line between whole-number
|
|
22436
22439
|
// coordinates, it will overlap opposite sides of the pixel square, and the resulting
|
|
@@ -34634,10 +34637,8 @@ class RendererPlugin extends UIPlugin {
|
|
|
34634
34637
|
const { ctx, thinLineWidth } = renderingContext;
|
|
34635
34638
|
const visibleCols = this.getters.getSheetViewVisibleCols();
|
|
34636
34639
|
const left = visibleCols[0];
|
|
34637
|
-
const right = visibleCols[visibleCols.length - 1];
|
|
34638
34640
|
const visibleRows = this.getters.getSheetViewVisibleRows();
|
|
34639
34641
|
const top = visibleRows[0];
|
|
34640
|
-
const bottom = visibleRows[visibleRows.length - 1];
|
|
34641
34642
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
34642
34643
|
const selection = this.getters.getSelectedZones();
|
|
34643
34644
|
const selectedCols = getZonesCols(selection);
|
|
@@ -34653,7 +34654,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
34653
34654
|
ctx.lineWidth = thinLineWidth;
|
|
34654
34655
|
ctx.strokeStyle = "#333";
|
|
34655
34656
|
// Columns headers background
|
|
34656
|
-
for (
|
|
34657
|
+
for (const col of visibleCols) {
|
|
34657
34658
|
const colZone = { left: col, right: col, top: 0, bottom: numberOfRows - 1 };
|
|
34658
34659
|
const { x, width } = this.getters.getVisibleRect(colZone);
|
|
34659
34660
|
const colHasFilter = this.getters.doesZonesContainFilter(sheetId, [colZone]);
|
|
@@ -34673,7 +34674,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
34673
34674
|
ctx.fillRect(x, 0, width, HEADER_HEIGHT);
|
|
34674
34675
|
}
|
|
34675
34676
|
// Rows headers background
|
|
34676
|
-
for (
|
|
34677
|
+
for (const row of visibleRows) {
|
|
34677
34678
|
const rowZone = { top: row, bottom: row, left: 0, right: numberOfCols - 1 };
|
|
34678
34679
|
const { y, height } = this.getters.getVisibleRect(rowZone);
|
|
34679
34680
|
const rowHasFilter = this.getters.doesZonesContainFilter(sheetId, [rowZone]);
|
|
@@ -34702,21 +34703,21 @@ class RendererPlugin extends UIPlugin {
|
|
|
34702
34703
|
ctx.stroke();
|
|
34703
34704
|
ctx.beginPath();
|
|
34704
34705
|
// column text + separator
|
|
34705
|
-
for (const
|
|
34706
|
-
const colSize = this.getters.getColSize(sheetId,
|
|
34707
|
-
const colName = numberToLetters(
|
|
34708
|
-
ctx.fillStyle = activeCols.has(
|
|
34709
|
-
let colStart = this.getHeaderOffset("COL", left,
|
|
34706
|
+
for (const col of visibleCols) {
|
|
34707
|
+
const colSize = this.getters.getColSize(sheetId, col);
|
|
34708
|
+
const colName = numberToLetters(col);
|
|
34709
|
+
ctx.fillStyle = activeCols.has(col) ? "#fff" : TEXT_HEADER_COLOR;
|
|
34710
|
+
let colStart = this.getHeaderOffset("COL", left, col);
|
|
34710
34711
|
ctx.fillText(colName, colStart + colSize / 2, HEADER_HEIGHT / 2);
|
|
34711
34712
|
ctx.moveTo(colStart + colSize, 0);
|
|
34712
34713
|
ctx.lineTo(colStart + colSize, HEADER_HEIGHT);
|
|
34713
34714
|
}
|
|
34714
34715
|
// row text + separator
|
|
34715
|
-
for (const
|
|
34716
|
-
const rowSize = this.getters.getRowSize(sheetId,
|
|
34717
|
-
ctx.fillStyle = activeRows.has(
|
|
34718
|
-
let rowStart = this.getHeaderOffset("ROW", top,
|
|
34719
|
-
ctx.fillText(String(
|
|
34716
|
+
for (const row of visibleRows) {
|
|
34717
|
+
const rowSize = this.getters.getRowSize(sheetId, row);
|
|
34718
|
+
ctx.fillStyle = activeRows.has(row) ? "#fff" : TEXT_HEADER_COLOR;
|
|
34719
|
+
let rowStart = this.getHeaderOffset("ROW", top, row);
|
|
34720
|
+
ctx.fillText(String(row + 1), HEADER_WIDTH / 2, rowStart + rowSize / 2);
|
|
34720
34721
|
ctx.moveTo(0, rowStart + rowSize);
|
|
34721
34722
|
ctx.lineTo(HEADER_WIDTH, rowStart + rowSize);
|
|
34722
34723
|
}
|
|
@@ -36804,8 +36805,17 @@ class InternalViewport {
|
|
|
36804
36805
|
this.getters = getters;
|
|
36805
36806
|
this.sheetId = sheetId;
|
|
36806
36807
|
this.boundaries = boundaries;
|
|
36807
|
-
|
|
36808
|
-
|
|
36808
|
+
if (sizeInGrid.width < 0 || sizeInGrid.height < 0) {
|
|
36809
|
+
throw new Error("Viewport size cannot be negative");
|
|
36810
|
+
}
|
|
36811
|
+
this.viewportWidth = sizeInGrid.height && sizeInGrid.width;
|
|
36812
|
+
this.viewportHeight = sizeInGrid.width && sizeInGrid.height;
|
|
36813
|
+
this.top = boundaries.top;
|
|
36814
|
+
this.bottom = boundaries.bottom;
|
|
36815
|
+
this.left = boundaries.left;
|
|
36816
|
+
this.right = boundaries.right;
|
|
36817
|
+
this.offsetX = offsets.x;
|
|
36818
|
+
this.offsetY = offsets.y;
|
|
36809
36819
|
this.offsetScrollbarX = offsets.x;
|
|
36810
36820
|
this.offsetScrollbarY = offsets.y;
|
|
36811
36821
|
this.canScrollVertically = options.canScrollVertically;
|
|
@@ -36994,6 +37004,9 @@ class InternalViewport {
|
|
|
36994
37004
|
}
|
|
36995
37005
|
// PRIVATE
|
|
36996
37006
|
searchHeaderIndex(dimension, position, startIndex = 0, absolute = false) {
|
|
37007
|
+
if (this.viewportWidth <= 0 || this.viewportHeight <= 0) {
|
|
37008
|
+
return -1;
|
|
37009
|
+
}
|
|
36997
37010
|
let size = 0;
|
|
36998
37011
|
const sheetId = this.sheetId;
|
|
36999
37012
|
const headers = this.getters.getNumberHeaders(sheetId, dimension);
|
|
@@ -37032,7 +37045,7 @@ class InternalViewport {
|
|
|
37032
37045
|
this.adjustViewportZoneY();
|
|
37033
37046
|
}
|
|
37034
37047
|
/** Corrects the viewport's horizontal offset based on the current structure
|
|
37035
|
-
* To make sure that at least
|
|
37048
|
+
* To make sure that at least one column is visible inside the viewport.
|
|
37036
37049
|
*/
|
|
37037
37050
|
adjustViewportOffsetX() {
|
|
37038
37051
|
if (this.canScrollHorizontally) {
|
|
@@ -37049,7 +37062,7 @@ class InternalViewport {
|
|
|
37049
37062
|
this.adjustViewportZoneX();
|
|
37050
37063
|
}
|
|
37051
37064
|
/** Corrects the viewport's vertical offset based on the current structure
|
|
37052
|
-
* To make sure that at least
|
|
37065
|
+
* To make sure that at least one row is visible inside the viewport.
|
|
37053
37066
|
*/
|
|
37054
37067
|
adjustViewportOffsetY() {
|
|
37055
37068
|
if (this.canScrollVertically) {
|
|
@@ -37071,11 +37084,14 @@ class InternalViewport {
|
|
|
37071
37084
|
const sheetId = this.sheetId;
|
|
37072
37085
|
this.left = this.searchHeaderIndex("COL", this.offsetScrollbarX, this.boundaries.left);
|
|
37073
37086
|
this.right = Math.min(this.boundaries.right, this.searchHeaderIndex("COL", this.viewportWidth, this.left));
|
|
37087
|
+
if (!this.viewportWidth) {
|
|
37088
|
+
return;
|
|
37089
|
+
}
|
|
37074
37090
|
if (this.left === -1) {
|
|
37075
37091
|
this.left = this.boundaries.left;
|
|
37076
37092
|
}
|
|
37077
37093
|
if (this.right === -1) {
|
|
37078
|
-
this.right = this.
|
|
37094
|
+
this.right = this.boundaries.right;
|
|
37079
37095
|
}
|
|
37080
37096
|
this.offsetX =
|
|
37081
37097
|
this.getters.getColDimensions(sheetId, this.left).start -
|
|
@@ -37087,11 +37103,14 @@ class InternalViewport {
|
|
|
37087
37103
|
const sheetId = this.sheetId;
|
|
37088
37104
|
this.top = this.searchHeaderIndex("ROW", this.offsetScrollbarY, this.boundaries.top);
|
|
37089
37105
|
this.bottom = Math.min(this.boundaries.bottom, this.searchHeaderIndex("ROW", this.viewportHeight, this.top));
|
|
37106
|
+
if (!this.viewportHeight) {
|
|
37107
|
+
return;
|
|
37108
|
+
}
|
|
37090
37109
|
if (this.top === -1) {
|
|
37091
37110
|
this.top = this.boundaries.top;
|
|
37092
37111
|
}
|
|
37093
37112
|
if (this.bottom === -1) {
|
|
37094
|
-
this.bottom = this.
|
|
37113
|
+
this.bottom = this.boundaries.bottom;
|
|
37095
37114
|
}
|
|
37096
37115
|
this.offsetY =
|
|
37097
37116
|
this.getters.getRowDimensions(sheetId, this.top).start -
|
|
@@ -37343,12 +37362,12 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37343
37362
|
getSheetViewVisibleCols() {
|
|
37344
37363
|
const sheetId = this.getters.getActiveSheetId();
|
|
37345
37364
|
const viewports = this.getSubViewports(sheetId);
|
|
37346
|
-
return [...new Set(viewports.map((v) => range(v.left, v.right + 1)).flat())].filter((col) => !this.getters.isHeaderHidden(sheetId, "COL", col));
|
|
37365
|
+
return [...new Set(viewports.map((v) => range(v.left, v.right + 1)).flat())].filter((col) => col >= 0 && !this.getters.isHeaderHidden(sheetId, "COL", col));
|
|
37347
37366
|
}
|
|
37348
37367
|
getSheetViewVisibleRows() {
|
|
37349
37368
|
const sheetId = this.getters.getActiveSheetId();
|
|
37350
37369
|
const viewports = this.getSubViewports(sheetId);
|
|
37351
|
-
return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => !this.getters.isHeaderHidden(sheetId, "ROW", row));
|
|
37370
|
+
return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => row >= 0 && !this.getters.isHeaderHidden(sheetId, "ROW", row));
|
|
37352
37371
|
}
|
|
37353
37372
|
/**
|
|
37354
37373
|
* Return the main viewport maximum size relative to the client size.
|
|
@@ -37371,19 +37390,19 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37371
37390
|
maxOffsetY: Math.max(0, height - viewport.viewportHeight + 1),
|
|
37372
37391
|
};
|
|
37373
37392
|
}
|
|
37374
|
-
getColRowOffsetInViewport(dimension,
|
|
37375
|
-
|
|
37376
|
-
|
|
37377
|
-
const visibleRows = this.getters.getSheetViewVisibleRows();
|
|
37378
|
-
if (index < referenceIndex) {
|
|
37379
|
-
return -this.getColRowOffsetInViewport(dimension, index, referenceIndex);
|
|
37393
|
+
getColRowOffsetInViewport(dimension, referenceHeaderIndex, targetHeaderIndex) {
|
|
37394
|
+
if (targetHeaderIndex < referenceHeaderIndex) {
|
|
37395
|
+
return -this.getColRowOffsetInViewport(dimension, targetHeaderIndex, referenceHeaderIndex);
|
|
37380
37396
|
}
|
|
37397
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
37398
|
+
const visibleHeaders = dimension === "COL"
|
|
37399
|
+
? this.getters.getSheetViewVisibleCols()
|
|
37400
|
+
: this.getters.getSheetViewVisibleRows();
|
|
37401
|
+
const startIndex = visibleHeaders.findIndex((header) => referenceHeaderIndex >= header);
|
|
37402
|
+
const endIndex = visibleHeaders.findIndex((header) => targetHeaderIndex <= header);
|
|
37403
|
+
const relevantIndexes = visibleHeaders.slice(startIndex, endIndex);
|
|
37381
37404
|
let offset = 0;
|
|
37382
|
-
const
|
|
37383
|
-
for (let i = referenceIndex; i < index; i++) {
|
|
37384
|
-
if (!visibleIndexes.includes(i)) {
|
|
37385
|
-
continue;
|
|
37386
|
-
}
|
|
37405
|
+
for (const i of relevantIndexes) {
|
|
37387
37406
|
offset +=
|
|
37388
37407
|
dimension === "COL"
|
|
37389
37408
|
? this.getters.getColSize(sheetId, i)
|
|
@@ -37433,7 +37452,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37433
37452
|
}
|
|
37434
37453
|
return { canEdgeScroll, direction, delay };
|
|
37435
37454
|
}
|
|
37436
|
-
getEdgeScrollRow(y, previousY,
|
|
37455
|
+
getEdgeScrollRow(y, previousY, startingY) {
|
|
37437
37456
|
let canEdgeScroll = false;
|
|
37438
37457
|
let direction = 0;
|
|
37439
37458
|
let delay = 0;
|
|
@@ -37454,7 +37473,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37454
37473
|
delay = scrollDelay(y - height);
|
|
37455
37474
|
direction = 1;
|
|
37456
37475
|
}
|
|
37457
|
-
else if (y < offsetCorrectionY &&
|
|
37476
|
+
else if (y < offsetCorrectionY && startingY >= offsetCorrectionY && currentOffsetY > 0) {
|
|
37458
37477
|
// 2
|
|
37459
37478
|
canEdgeScroll = true;
|
|
37460
37479
|
delay = scrollDelay(offsetCorrectionY - y);
|
|
@@ -37473,13 +37492,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37473
37492
|
*/
|
|
37474
37493
|
getVisibleRect(zone) {
|
|
37475
37494
|
const sheetId = this.getters.getActiveSheetId();
|
|
37476
|
-
|
|
37477
|
-
.map((viewport) => viewport.getVisibleRect(zone))
|
|
37478
|
-
.filter(isDefined$1);
|
|
37479
|
-
if (viewportRects.length === 0) {
|
|
37480
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37481
|
-
}
|
|
37482
|
-
return this.recomposeRect(viewportRects);
|
|
37495
|
+
return this.mapViewportsToRect(sheetId, (viewport) => viewport.getVisibleRect(zone));
|
|
37483
37496
|
}
|
|
37484
37497
|
/**
|
|
37485
37498
|
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
@@ -37487,13 +37500,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37487
37500
|
*/
|
|
37488
37501
|
getRect(zone) {
|
|
37489
37502
|
const sheetId = this.getters.getActiveSheetId();
|
|
37490
|
-
|
|
37491
|
-
.map((viewport) => viewport.getFullRect(zone))
|
|
37492
|
-
.filter(isDefined$1);
|
|
37493
|
-
if (viewportRects.length === 0) {
|
|
37494
|
-
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37495
|
-
}
|
|
37496
|
-
return this.recomposeRect(viewportRects);
|
|
37503
|
+
return this.mapViewportsToRect(sheetId, (viewport) => viewport.getFullRect(zone));
|
|
37497
37504
|
}
|
|
37498
37505
|
/**
|
|
37499
37506
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -37562,12 +37569,11 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37562
37569
|
}
|
|
37563
37570
|
/** gets rid of deprecated sheetIds */
|
|
37564
37571
|
cleanViewports() {
|
|
37565
|
-
const
|
|
37566
|
-
for (
|
|
37567
|
-
|
|
37568
|
-
delete this.viewports[sheetId];
|
|
37569
|
-
}
|
|
37572
|
+
const newViewport = {};
|
|
37573
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
37574
|
+
newViewport[sheetId] = this.viewports[sheetId];
|
|
37570
37575
|
}
|
|
37576
|
+
this.viewports = newViewport;
|
|
37571
37577
|
}
|
|
37572
37578
|
resetSheetViews() {
|
|
37573
37579
|
this.cleanViewports();
|
|
@@ -37588,14 +37594,14 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37588
37594
|
this.recomputeViewports();
|
|
37589
37595
|
}
|
|
37590
37596
|
recomputeViewports() {
|
|
37591
|
-
for (
|
|
37597
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
37592
37598
|
this.resetViewports(sheetId);
|
|
37593
37599
|
}
|
|
37594
37600
|
}
|
|
37595
37601
|
setSheetViewOffset(offsetX, offsetY) {
|
|
37596
37602
|
const sheetId = this.getters.getActiveSheetId();
|
|
37597
37603
|
const { maxOffsetX, maxOffsetY } = this.getMaximumSheetOffset();
|
|
37598
|
-
|
|
37604
|
+
this.getSubViewports(sheetId).forEach((viewport) => viewport.setViewportOffset(clip(offsetX, 0, maxOffsetX), clip(offsetY, 0, maxOffsetY)));
|
|
37599
37605
|
}
|
|
37600
37606
|
getViewportOffset(sheetId) {
|
|
37601
37607
|
var _a, _b;
|
|
@@ -37611,8 +37617,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37611
37617
|
const { xSplit, ySplit } = this.getters.getPaneDivisions(sheetId);
|
|
37612
37618
|
const nCols = this.getters.getNumberCols(sheetId);
|
|
37613
37619
|
const nRows = this.getters.getNumberRows(sheetId);
|
|
37614
|
-
const colOffset = this.getters.getColRowOffset("COL", 0, xSplit, sheetId);
|
|
37615
|
-
const rowOffset = this.getters.getColRowOffset("ROW", 0, ySplit, sheetId);
|
|
37620
|
+
const colOffset = Math.min(this.getters.getColRowOffset("COL", 0, xSplit, sheetId), this.sheetViewWidth);
|
|
37621
|
+
const rowOffset = Math.min(this.getters.getColRowOffset("ROW", 0, ySplit, sheetId), this.sheetViewHeight);
|
|
37622
|
+
const unfrozenWidth = Math.max(this.sheetViewWidth - colOffset, 0);
|
|
37623
|
+
const unfrozenHeight = Math.max(this.sheetViewHeight - rowOffset, 0);
|
|
37616
37624
|
const { xRatio, yRatio } = this.getFrozenSheetViewRatio(sheetId);
|
|
37617
37625
|
const canScrollHorizontally = xRatio < 1.0;
|
|
37618
37626
|
const canScrollVertically = yRatio < 1.0;
|
|
@@ -37623,14 +37631,14 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37623
37631
|
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: 0, bottom: ySplit - 1 }, { width: colOffset, height: rowOffset }, { canScrollHorizontally: false, canScrollVertically: false }, { x: 0, y: 0 })) ||
|
|
37624
37632
|
undefined,
|
|
37625
37633
|
topRight: (ySplit &&
|
|
37626
|
-
new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: 0, bottom: ySplit - 1 }, { width:
|
|
37634
|
+
new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: 0, bottom: ySplit - 1 }, { width: unfrozenWidth, height: rowOffset }, { canScrollHorizontally, canScrollVertically: false }, { x: canScrollHorizontally ? previousOffset.x : 0, y: 0 })) ||
|
|
37627
37635
|
undefined,
|
|
37628
37636
|
bottomLeft: (xSplit &&
|
|
37629
|
-
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: ySplit, bottom: nRows - 1 }, { width: colOffset, height:
|
|
37637
|
+
new InternalViewport(this.getters, sheetId, { left: 0, right: xSplit - 1, top: ySplit, bottom: nRows - 1 }, { width: colOffset, height: unfrozenHeight }, { canScrollHorizontally: false, canScrollVertically }, { x: 0, y: canScrollVertically ? previousOffset.y : 0 })) ||
|
|
37630
37638
|
undefined,
|
|
37631
37639
|
bottomRight: new InternalViewport(this.getters, sheetId, { left: xSplit, right: nCols - 1, top: ySplit, bottom: nRows - 1 }, {
|
|
37632
|
-
width:
|
|
37633
|
-
height:
|
|
37640
|
+
width: unfrozenWidth,
|
|
37641
|
+
height: unfrozenHeight,
|
|
37634
37642
|
}, { canScrollHorizontally, canScrollVertically }, {
|
|
37635
37643
|
x: canScrollHorizontally ? previousOffset.x : 0,
|
|
37636
37644
|
y: canScrollVertically ? previousOffset.y : 0,
|
|
@@ -37642,7 +37650,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37642
37650
|
* Adjust the viewport such that the anchor position is visible
|
|
37643
37651
|
*/
|
|
37644
37652
|
refreshViewport(sheetId, anchorPosition) {
|
|
37645
|
-
|
|
37653
|
+
this.getSubViewports(sheetId).forEach((viewport) => {
|
|
37646
37654
|
viewport.adjustViewportZone();
|
|
37647
37655
|
viewport.adjustPosition(anchorPosition);
|
|
37648
37656
|
});
|
|
@@ -37693,16 +37701,30 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
37693
37701
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
37694
37702
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
37695
37703
|
}
|
|
37696
|
-
|
|
37697
|
-
|
|
37698
|
-
|
|
37699
|
-
|
|
37700
|
-
|
|
37704
|
+
mapViewportsToRect(sheetId, rectCallBack) {
|
|
37705
|
+
let x = Infinity;
|
|
37706
|
+
let y = Infinity;
|
|
37707
|
+
let width = 0;
|
|
37708
|
+
let height = 0;
|
|
37709
|
+
let hasViewports = false;
|
|
37710
|
+
for (const viewport of this.getSubViewports(sheetId)) {
|
|
37711
|
+
const rect = rectCallBack(viewport);
|
|
37712
|
+
if (rect) {
|
|
37713
|
+
hasViewports = true;
|
|
37714
|
+
x = Math.min(x, rect.x);
|
|
37715
|
+
y = Math.min(y, rect.y);
|
|
37716
|
+
width = Math.max(width, rect.x + rect.width);
|
|
37717
|
+
height = Math.max(height, rect.y + rect.height);
|
|
37718
|
+
}
|
|
37719
|
+
}
|
|
37720
|
+
if (!hasViewports) {
|
|
37721
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
37722
|
+
}
|
|
37701
37723
|
return {
|
|
37702
37724
|
x: x + this.gridOffsetX,
|
|
37703
37725
|
y: y + this.gridOffsetY,
|
|
37704
|
-
width,
|
|
37705
|
-
height,
|
|
37726
|
+
width: width - x,
|
|
37727
|
+
height: height - y,
|
|
37706
37728
|
};
|
|
37707
37729
|
}
|
|
37708
37730
|
}
|
|
@@ -38082,14 +38104,12 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
38082
38104
|
}
|
|
38083
38105
|
break;
|
|
38084
38106
|
case "AUTORESIZE_ROWS":
|
|
38085
|
-
|
|
38086
|
-
|
|
38087
|
-
|
|
38088
|
-
|
|
38089
|
-
|
|
38090
|
-
|
|
38091
|
-
});
|
|
38092
|
-
}
|
|
38107
|
+
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
38108
|
+
elements: cmd.rows,
|
|
38109
|
+
dimension: "ROW",
|
|
38110
|
+
size: null,
|
|
38111
|
+
sheetId: cmd.sheetId,
|
|
38112
|
+
});
|
|
38093
38113
|
break;
|
|
38094
38114
|
}
|
|
38095
38115
|
}
|
|
@@ -43570,6 +43590,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
43570
43590
|
exports.tokenize = tokenize;
|
|
43571
43591
|
|
|
43572
43592
|
|
|
43573
|
-
__info__.version = '16.0.
|
|
43574
|
-
__info__.date = '2025-
|
|
43575
|
-
__info__.hash = '
|
|
43593
|
+
__info__.version = '16.0.60';
|
|
43594
|
+
__info__.date = '2025-02-05T06:44:04.651Z';
|
|
43595
|
+
__info__.hash = 'd098699';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4354,11 +4354,11 @@ declare class InternalViewport {
|
|
|
4354
4354
|
private setViewportOffsetX;
|
|
4355
4355
|
private setViewportOffsetY;
|
|
4356
4356
|
/** Corrects the viewport's horizontal offset based on the current structure
|
|
4357
|
-
* To make sure that at least
|
|
4357
|
+
* To make sure that at least one column is visible inside the viewport.
|
|
4358
4358
|
*/
|
|
4359
4359
|
private adjustViewportOffsetX;
|
|
4360
4360
|
/** Corrects the viewport's vertical offset based on the current structure
|
|
4361
|
-
* To make sure that at least
|
|
4361
|
+
* To make sure that at least one row is visible inside the viewport.
|
|
4362
4362
|
*/
|
|
4363
4363
|
private adjustViewportOffsetY;
|
|
4364
4364
|
/** Updates the pane zone and snapped offset based on its horizontal
|
|
@@ -4369,12 +4369,6 @@ declare class InternalViewport {
|
|
|
4369
4369
|
private adjustViewportZoneY;
|
|
4370
4370
|
}
|
|
4371
4371
|
|
|
4372
|
-
type SheetViewports = {
|
|
4373
|
-
topLeft: InternalViewport | undefined;
|
|
4374
|
-
bottomLeft: InternalViewport | undefined;
|
|
4375
|
-
topRight: InternalViewport | undefined;
|
|
4376
|
-
bottomRight: InternalViewport;
|
|
4377
|
-
};
|
|
4378
4372
|
/**
|
|
4379
4373
|
* EdgeScrollCases Schema
|
|
4380
4374
|
*
|
|
@@ -4418,7 +4412,7 @@ type SheetViewports = {
|
|
|
4418
4412
|
*/
|
|
4419
4413
|
declare class SheetViewPlugin extends UIPlugin {
|
|
4420
4414
|
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "getAllActiveViewportsZones", "getRect"];
|
|
4421
|
-
|
|
4415
|
+
private viewports;
|
|
4422
4416
|
/**
|
|
4423
4417
|
* The viewport dimensions are usually set by one of the components
|
|
4424
4418
|
* (i.e. when grid component is mounted) to properly reflect its state in the DOM.
|
|
@@ -4468,13 +4462,13 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4468
4462
|
*/
|
|
4469
4463
|
getMainViewportRect(): Rect;
|
|
4470
4464
|
private getMaximumSheetOffset;
|
|
4471
|
-
getColRowOffsetInViewport(dimension: Dimension,
|
|
4465
|
+
getColRowOffsetInViewport(dimension: Dimension, referenceHeaderIndex: HeaderIndex, targetHeaderIndex: HeaderIndex): Pixel;
|
|
4472
4466
|
/**
|
|
4473
4467
|
* Check if a given position is visible in the viewport.
|
|
4474
4468
|
*/
|
|
4475
4469
|
isVisibleInViewport(sheetId: UID, col: number, row: number): boolean;
|
|
4476
4470
|
getEdgeScrollCol(x: number, previousX: number, startingX: number): EdgeScrollInfo;
|
|
4477
|
-
getEdgeScrollRow(y: number, previousY: number,
|
|
4471
|
+
getEdgeScrollRow(y: number, previousY: number, startingY: number): EdgeScrollInfo;
|
|
4478
4472
|
/**
|
|
4479
4473
|
* Computes the coordinates and size to draw the zone on the canvas
|
|
4480
4474
|
*/
|
|
@@ -4521,7 +4515,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4521
4515
|
xRatio: number;
|
|
4522
4516
|
yRatio: number;
|
|
4523
4517
|
};
|
|
4524
|
-
|
|
4518
|
+
mapViewportsToRect(sheetId: UID, rectCallBack: (viewport: InternalViewport) => Rect | undefined): Rect;
|
|
4525
4519
|
}
|
|
4526
4520
|
|
|
4527
4521
|
declare class SortPlugin extends UIPlugin {
|