@odoo/o-spreadsheet 17.2.32 → 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.
- package/dist/o-spreadsheet.cjs.js +108 -45
- package/dist/o-spreadsheet.d.ts +17 -4
- package/dist/o-spreadsheet.esm.js +108 -45
- package/dist/o-spreadsheet.iife.js +108 -45
- package/dist/o-spreadsheet.iife.min.js +124 -124
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -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.
|
|
7
|
-
* @date 2025-01-
|
|
8
|
-
* @hash
|
|
6
|
+
* @version 17.2.33
|
|
7
|
+
* @date 2025-01-27T10:02:54.985Z
|
|
8
|
+
* @hash 6ea43fb
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -2807,15 +2807,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2807
2807
|
let currentIndex;
|
|
2808
2808
|
let currentVal;
|
|
2809
2809
|
let currentType;
|
|
2810
|
+
const getValue = sortOrder === "desc"
|
|
2811
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
2812
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
2810
2813
|
while (indexRight - indexLeft >= 0) {
|
|
2811
2814
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
2812
2815
|
currentIndex = indexMedian;
|
|
2813
|
-
currentVal =
|
|
2816
|
+
currentVal = getValue(currentIndex);
|
|
2814
2817
|
currentType = typeof currentVal;
|
|
2815
2818
|
// 1 - linear search to find value with the same type
|
|
2816
2819
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
2817
2820
|
currentIndex--;
|
|
2818
|
-
currentVal =
|
|
2821
|
+
currentVal = getValue(currentIndex);
|
|
2819
2822
|
currentType = typeof currentVal;
|
|
2820
2823
|
}
|
|
2821
2824
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -2831,8 +2834,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2831
2834
|
if (matchVal === undefined ||
|
|
2832
2835
|
matchVal === null ||
|
|
2833
2836
|
matchVal < currentVal ||
|
|
2834
|
-
(matchVal === currentVal &&
|
|
2835
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2837
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2836
2838
|
matchVal = currentVal;
|
|
2837
2839
|
matchValIndex = currentIndex;
|
|
2838
2840
|
}
|
|
@@ -2840,15 +2842,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2840
2842
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
2841
2843
|
if (matchVal === undefined ||
|
|
2842
2844
|
matchVal > currentVal ||
|
|
2843
|
-
(matchVal === currentVal &&
|
|
2844
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2845
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2845
2846
|
matchVal = currentVal;
|
|
2846
2847
|
matchValIndex = currentIndex;
|
|
2847
2848
|
}
|
|
2848
2849
|
}
|
|
2849
2850
|
// 3 - give new indexes for the Binary search
|
|
2850
|
-
if ((
|
|
2851
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
2851
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
2852
2852
|
indexRight = currentIndex - 1;
|
|
2853
2853
|
}
|
|
2854
2854
|
else {
|
|
@@ -2856,7 +2856,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
2858
2858
|
// note that valMinIndex could be 0
|
|
2859
|
-
|
|
2859
|
+
if (matchValIndex === undefined) {
|
|
2860
|
+
return -1;
|
|
2861
|
+
}
|
|
2862
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
2860
2863
|
}
|
|
2861
2864
|
/**
|
|
2862
2865
|
* Perform a linear search and return the index of the match.
|
|
@@ -21877,6 +21880,10 @@ class Popover extends owl.Component {
|
|
|
21877
21880
|
this.currentDisplayValue = newDisplay;
|
|
21878
21881
|
if (!anchor)
|
|
21879
21882
|
return;
|
|
21883
|
+
el.style.top = "";
|
|
21884
|
+
el.style.left = "";
|
|
21885
|
+
el.style["max-height"] = "";
|
|
21886
|
+
el.style["max-width"] = "";
|
|
21880
21887
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
21881
21888
|
let elDims = {
|
|
21882
21889
|
width: el.getBoundingClientRect().width,
|
|
@@ -32943,7 +32950,7 @@ class GridComposer extends owl.Component {
|
|
|
32943
32950
|
return;
|
|
32944
32951
|
}
|
|
32945
32952
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
32946
|
-
const zone = this.env.model.getters.
|
|
32953
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
32947
32954
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
32948
32955
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
32949
32956
|
this.isCellReferenceVisible = true;
|
|
@@ -34689,13 +34696,23 @@ class GridRenderer {
|
|
|
34689
34696
|
drawLayer(renderingContext, layer) {
|
|
34690
34697
|
switch (layer) {
|
|
34691
34698
|
case "Background":
|
|
34692
|
-
|
|
34693
|
-
this.
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
34697
|
-
|
|
34698
|
-
|
|
34699
|
+
this.drawGlobalBackground(renderingContext);
|
|
34700
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
34701
|
+
const { ctx } = renderingContext;
|
|
34702
|
+
ctx.save();
|
|
34703
|
+
ctx.beginPath();
|
|
34704
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
34705
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
34706
|
+
ctx.clip();
|
|
34707
|
+
const boxes = this.getGridBoxes(zone);
|
|
34708
|
+
this.drawBackground(renderingContext, boxes);
|
|
34709
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
34710
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
34711
|
+
this.drawBorders(renderingContext, boxes);
|
|
34712
|
+
this.drawTexts(renderingContext, boxes);
|
|
34713
|
+
this.drawIcon(renderingContext, boxes);
|
|
34714
|
+
ctx.restore();
|
|
34715
|
+
}
|
|
34699
34716
|
this.drawFrozenPanes(renderingContext);
|
|
34700
34717
|
break;
|
|
34701
34718
|
case "Headers":
|
|
@@ -34706,12 +34723,15 @@ class GridRenderer {
|
|
|
34706
34723
|
break;
|
|
34707
34724
|
}
|
|
34708
34725
|
}
|
|
34709
|
-
|
|
34710
|
-
const { ctx
|
|
34726
|
+
drawGlobalBackground(renderingContext) {
|
|
34727
|
+
const { ctx } = renderingContext;
|
|
34711
34728
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
34712
34729
|
// white background
|
|
34713
34730
|
ctx.fillStyle = "#ffffff";
|
|
34714
34731
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
34732
|
+
}
|
|
34733
|
+
drawBackground(renderingContext, boxes) {
|
|
34734
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
34715
34735
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
34716
34736
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
34717
34737
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -35136,7 +35156,7 @@ class GridRenderer {
|
|
|
35136
35156
|
const position = { sheetId, col, row };
|
|
35137
35157
|
const cell = this.getters.getEvaluatedCell(position);
|
|
35138
35158
|
const showFormula = this.getters.shouldShowFormulas();
|
|
35139
|
-
const { x, y, width, height } = this.getters.
|
|
35159
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
35140
35160
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
35141
35161
|
const box = {
|
|
35142
35162
|
x,
|
|
@@ -35251,12 +35271,16 @@ class GridRenderer {
|
|
|
35251
35271
|
}
|
|
35252
35272
|
return box;
|
|
35253
35273
|
}
|
|
35254
|
-
getGridBoxes() {
|
|
35274
|
+
getGridBoxes(zone) {
|
|
35255
35275
|
const boxes = [];
|
|
35256
|
-
const visibleCols = this.getters
|
|
35276
|
+
const visibleCols = this.getters
|
|
35277
|
+
.getSheetViewVisibleCols()
|
|
35278
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
35257
35279
|
const left = visibleCols[0];
|
|
35258
35280
|
const right = visibleCols[visibleCols.length - 1];
|
|
35259
|
-
const visibleRows = this.getters
|
|
35281
|
+
const visibleRows = this.getters
|
|
35282
|
+
.getSheetViewVisibleRows()
|
|
35283
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
35260
35284
|
const top = visibleRows[0];
|
|
35261
35285
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
35262
35286
|
const viewport = { left, right, top, bottom };
|
|
@@ -53647,8 +53671,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
53647
53671
|
},
|
|
53648
53672
|
];
|
|
53649
53673
|
handler.paste({ zones: pasteTarget }, data, { isCutOperation: true });
|
|
53674
|
+
const selection = pasteTarget[0];
|
|
53675
|
+
const col = selection.left;
|
|
53676
|
+
const row = selection.top;
|
|
53677
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
53650
53678
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
53651
|
-
let currentIndex = cmd.base;
|
|
53679
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
53652
53680
|
for (const element of toRemove) {
|
|
53653
53681
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
53654
53682
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -53927,22 +53955,33 @@ class InternalViewport {
|
|
|
53927
53955
|
}
|
|
53928
53956
|
/**
|
|
53929
53957
|
*
|
|
53930
|
-
*
|
|
53931
|
-
*
|
|
53958
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
53959
|
+
*
|
|
53932
53960
|
*/
|
|
53933
|
-
|
|
53961
|
+
getVisibleRect(zone) {
|
|
53934
53962
|
const targetZone = intersection(zone, this);
|
|
53935
53963
|
if (targetZone) {
|
|
53936
53964
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
53937
53965
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
53938
53966
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
53939
53967
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
53940
|
-
return {
|
|
53941
|
-
|
|
53942
|
-
|
|
53943
|
-
|
|
53944
|
-
|
|
53945
|
-
|
|
53968
|
+
return { x, y, width, height };
|
|
53969
|
+
}
|
|
53970
|
+
return undefined;
|
|
53971
|
+
}
|
|
53972
|
+
/**
|
|
53973
|
+
*
|
|
53974
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
53975
|
+
*
|
|
53976
|
+
*/
|
|
53977
|
+
getFullRect(zone) {
|
|
53978
|
+
const targetZone = intersection(zone, this);
|
|
53979
|
+
if (targetZone) {
|
|
53980
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
53981
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
53982
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
53983
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
53984
|
+
return { x, y, width, height };
|
|
53946
53985
|
}
|
|
53947
53986
|
return undefined;
|
|
53948
53987
|
}
|
|
@@ -54112,6 +54151,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54112
54151
|
"isPositionVisible",
|
|
54113
54152
|
"getColDimensionsInViewport",
|
|
54114
54153
|
"getRowDimensionsInViewport",
|
|
54154
|
+
"getAllActiveViewportsZones",
|
|
54155
|
+
"getRect",
|
|
54115
54156
|
];
|
|
54116
54157
|
viewports = {};
|
|
54117
54158
|
/**
|
|
@@ -54499,16 +54540,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54499
54540
|
getVisibleRectWithoutHeaders(zone) {
|
|
54500
54541
|
const sheetId = this.getters.getActiveSheetId();
|
|
54501
54542
|
const viewportRects = this.getSubViewports(sheetId)
|
|
54502
|
-
.map((viewport) => viewport.
|
|
54543
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
54503
54544
|
.filter(isDefined$1);
|
|
54504
54545
|
if (viewportRects.length === 0) {
|
|
54505
54546
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
54506
54547
|
}
|
|
54507
|
-
|
|
54508
|
-
|
|
54509
|
-
|
|
54510
|
-
|
|
54511
|
-
|
|
54548
|
+
return this.recomposeRect(viewportRects);
|
|
54549
|
+
}
|
|
54550
|
+
/**
|
|
54551
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
54552
|
+
* regardless of the viewport dimensions.
|
|
54553
|
+
*/
|
|
54554
|
+
getRect(zone) {
|
|
54555
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
54556
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
54557
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
54558
|
+
.filter(isDefined$1);
|
|
54559
|
+
if (viewportRects.length === 0) {
|
|
54560
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
54561
|
+
}
|
|
54562
|
+
const rect = this.recomposeRect(viewportRects);
|
|
54563
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
54512
54564
|
}
|
|
54513
54565
|
/**
|
|
54514
54566
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -54552,6 +54604,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54552
54604
|
end: start + (isRowHidden ? 0 : size),
|
|
54553
54605
|
};
|
|
54554
54606
|
}
|
|
54607
|
+
getAllActiveViewportsZones() {
|
|
54608
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
54609
|
+
return this.getSubViewports(sheetId);
|
|
54610
|
+
}
|
|
54555
54611
|
// ---------------------------------------------------------------------------
|
|
54556
54612
|
// Private
|
|
54557
54613
|
// ---------------------------------------------------------------------------
|
|
@@ -54736,6 +54792,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54736
54792
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
54737
54793
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
54738
54794
|
}
|
|
54795
|
+
recomposeRect(viewportRects) {
|
|
54796
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
54797
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
54798
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
54799
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
54800
|
+
return { x, y, width, height };
|
|
54801
|
+
}
|
|
54739
54802
|
}
|
|
54740
54803
|
|
|
54741
54804
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -61073,6 +61136,6 @@ exports.tokenColors = tokenColors;
|
|
|
61073
61136
|
exports.tokenize = tokenize;
|
|
61074
61137
|
|
|
61075
61138
|
|
|
61076
|
-
__info__.version = "17.2.
|
|
61077
|
-
__info__.date = "2025-01-
|
|
61078
|
-
__info__.hash = "
|
|
61139
|
+
__info__.version = "17.2.33";
|
|
61140
|
+
__info__.date = "2025-01-27T10:02:54.985Z";
|
|
61141
|
+
__info__.hash = "6ea43fb";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4342,10 +4342,16 @@ declare class InternalViewport {
|
|
|
4342
4342
|
adjustViewportZone(): void;
|
|
4343
4343
|
/**
|
|
4344
4344
|
*
|
|
4345
|
-
*
|
|
4346
|
-
*
|
|
4345
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
4346
|
+
*
|
|
4347
4347
|
*/
|
|
4348
|
-
|
|
4348
|
+
getVisibleRect(zone: Zone): Rect | undefined;
|
|
4349
|
+
/**
|
|
4350
|
+
*
|
|
4351
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
4352
|
+
*
|
|
4353
|
+
*/
|
|
4354
|
+
getFullRect(zone: Zone): Rect | undefined;
|
|
4349
4355
|
isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
|
|
4350
4356
|
private searchHeaderIndex;
|
|
4351
4357
|
private setViewportOffsetX;
|
|
@@ -4414,7 +4420,7 @@ type SheetViewports = {
|
|
|
4414
4420
|
*
|
|
4415
4421
|
*/
|
|
4416
4422
|
declare class SheetViewPlugin extends UIPlugin {
|
|
4417
|
-
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport"];
|
|
4423
|
+
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport", "getAllActiveViewportsZones", "getRect"];
|
|
4418
4424
|
readonly viewports: Record<UID, SheetViewports | undefined>;
|
|
4419
4425
|
/**
|
|
4420
4426
|
* The viewport dimensions are usually set by one of the components
|
|
@@ -4485,6 +4491,11 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4485
4491
|
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
4486
4492
|
*/
|
|
4487
4493
|
getVisibleRectWithoutHeaders(zone: Zone): Rect;
|
|
4494
|
+
/**
|
|
4495
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
4496
|
+
* regardless of the viewport dimensions.
|
|
4497
|
+
*/
|
|
4498
|
+
getRect(zone: Zone): Rect;
|
|
4488
4499
|
/**
|
|
4489
4500
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
4490
4501
|
* It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
|
|
@@ -4501,6 +4512,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4501
4512
|
* of the current viewport
|
|
4502
4513
|
*/
|
|
4503
4514
|
getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
|
|
4515
|
+
getAllActiveViewportsZones(): Zone[];
|
|
4504
4516
|
private ensureMainViewportExist;
|
|
4505
4517
|
private getSubViewports;
|
|
4506
4518
|
private checkPositiveDimension;
|
|
@@ -4531,6 +4543,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
4531
4543
|
xRatio: number;
|
|
4532
4544
|
yRatio: number;
|
|
4533
4545
|
};
|
|
4546
|
+
private recomposeRect;
|
|
4534
4547
|
}
|
|
4535
4548
|
|
|
4536
4549
|
/**
|
|
@@ -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.
|
|
7
|
-
* @date 2025-01-
|
|
8
|
-
* @hash
|
|
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 =
|
|
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 =
|
|
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 &&
|
|
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 &&
|
|
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 ((
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
34691
|
-
this.
|
|
34692
|
-
|
|
34693
|
-
|
|
34694
|
-
|
|
34695
|
-
|
|
34696
|
-
|
|
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
|
-
|
|
34708
|
-
const { ctx
|
|
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.
|
|
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
|
|
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
|
|
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 };
|
|
@@ -53645,8 +53669,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
53645
53669
|
},
|
|
53646
53670
|
];
|
|
53647
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]);
|
|
53648
53676
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
53649
|
-
let currentIndex = cmd.base;
|
|
53677
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
53650
53678
|
for (const element of toRemove) {
|
|
53651
53679
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
53652
53680
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -53925,22 +53953,33 @@ class InternalViewport {
|
|
|
53925
53953
|
}
|
|
53926
53954
|
/**
|
|
53927
53955
|
*
|
|
53928
|
-
*
|
|
53929
|
-
*
|
|
53956
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
53957
|
+
*
|
|
53930
53958
|
*/
|
|
53931
|
-
|
|
53959
|
+
getVisibleRect(zone) {
|
|
53932
53960
|
const targetZone = intersection(zone, this);
|
|
53933
53961
|
if (targetZone) {
|
|
53934
53962
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
53935
53963
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
53936
53964
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
53937
53965
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
53938
|
-
return {
|
|
53939
|
-
|
|
53940
|
-
|
|
53941
|
-
|
|
53942
|
-
|
|
53943
|
-
|
|
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 };
|
|
53944
53983
|
}
|
|
53945
53984
|
return undefined;
|
|
53946
53985
|
}
|
|
@@ -54110,6 +54149,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54110
54149
|
"isPositionVisible",
|
|
54111
54150
|
"getColDimensionsInViewport",
|
|
54112
54151
|
"getRowDimensionsInViewport",
|
|
54152
|
+
"getAllActiveViewportsZones",
|
|
54153
|
+
"getRect",
|
|
54113
54154
|
];
|
|
54114
54155
|
viewports = {};
|
|
54115
54156
|
/**
|
|
@@ -54497,16 +54538,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54497
54538
|
getVisibleRectWithoutHeaders(zone) {
|
|
54498
54539
|
const sheetId = this.getters.getActiveSheetId();
|
|
54499
54540
|
const viewportRects = this.getSubViewports(sheetId)
|
|
54500
|
-
.map((viewport) => viewport.
|
|
54541
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
54501
54542
|
.filter(isDefined$1);
|
|
54502
54543
|
if (viewportRects.length === 0) {
|
|
54503
54544
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
54504
54545
|
}
|
|
54505
|
-
|
|
54506
|
-
|
|
54507
|
-
|
|
54508
|
-
|
|
54509
|
-
|
|
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 };
|
|
54510
54562
|
}
|
|
54511
54563
|
/**
|
|
54512
54564
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -54550,6 +54602,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54550
54602
|
end: start + (isRowHidden ? 0 : size),
|
|
54551
54603
|
};
|
|
54552
54604
|
}
|
|
54605
|
+
getAllActiveViewportsZones() {
|
|
54606
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
54607
|
+
return this.getSubViewports(sheetId);
|
|
54608
|
+
}
|
|
54553
54609
|
// ---------------------------------------------------------------------------
|
|
54554
54610
|
// Private
|
|
54555
54611
|
// ---------------------------------------------------------------------------
|
|
@@ -54734,6 +54790,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
54734
54790
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
54735
54791
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
54736
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
|
+
}
|
|
54737
54800
|
}
|
|
54738
54801
|
|
|
54739
54802
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -61030,6 +61093,6 @@ const constants = {
|
|
|
61030
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 };
|
|
61031
61094
|
|
|
61032
61095
|
|
|
61033
|
-
__info__.version = "17.2.
|
|
61034
|
-
__info__.date = "2025-01-
|
|
61035
|
-
__info__.hash = "
|
|
61096
|
+
__info__.version = "17.2.33";
|
|
61097
|
+
__info__.date = "2025-01-27T10:02:54.985Z";
|
|
61098
|
+
__info__.hash = "6ea43fb";
|