@odoo/o-spreadsheet 17.4.18 → 17.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +6 -6
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.4.
|
|
6
|
-
* @date 2025-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.19
|
|
6
|
+
* @date 2025-01-27T10:04:10.249Z
|
|
7
|
+
* @hash f2a7840
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -3015,15 +3015,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3015
3015
|
let currentIndex;
|
|
3016
3016
|
let currentVal;
|
|
3017
3017
|
let currentType;
|
|
3018
|
+
const getValue = sortOrder === "desc"
|
|
3019
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
3020
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
3018
3021
|
while (indexRight - indexLeft >= 0) {
|
|
3019
3022
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
3020
3023
|
currentIndex = indexMedian;
|
|
3021
|
-
currentVal =
|
|
3024
|
+
currentVal = getValue(currentIndex);
|
|
3022
3025
|
currentType = typeof currentVal;
|
|
3023
3026
|
// 1 - linear search to find value with the same type
|
|
3024
3027
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
3025
3028
|
currentIndex--;
|
|
3026
|
-
currentVal =
|
|
3029
|
+
currentVal = getValue(currentIndex);
|
|
3027
3030
|
currentType = typeof currentVal;
|
|
3028
3031
|
}
|
|
3029
3032
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -3039,8 +3042,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3039
3042
|
if (matchVal === undefined ||
|
|
3040
3043
|
matchVal === null ||
|
|
3041
3044
|
matchVal < currentVal ||
|
|
3042
|
-
(matchVal === currentVal &&
|
|
3043
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3045
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3044
3046
|
matchVal = currentVal;
|
|
3045
3047
|
matchValIndex = currentIndex;
|
|
3046
3048
|
}
|
|
@@ -3048,15 +3050,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3048
3050
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
3049
3051
|
if (matchVal === undefined ||
|
|
3050
3052
|
matchVal > currentVal ||
|
|
3051
|
-
(matchVal === currentVal &&
|
|
3052
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3053
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3053
3054
|
matchVal = currentVal;
|
|
3054
3055
|
matchValIndex = currentIndex;
|
|
3055
3056
|
}
|
|
3056
3057
|
}
|
|
3057
3058
|
// 3 - give new indexes for the Binary search
|
|
3058
|
-
if ((
|
|
3059
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
3059
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
3060
3060
|
indexRight = currentIndex - 1;
|
|
3061
3061
|
}
|
|
3062
3062
|
else {
|
|
@@ -3064,7 +3064,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3064
3064
|
}
|
|
3065
3065
|
}
|
|
3066
3066
|
// note that valMinIndex could be 0
|
|
3067
|
-
|
|
3067
|
+
if (matchValIndex === undefined) {
|
|
3068
|
+
return -1;
|
|
3069
|
+
}
|
|
3070
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
3068
3071
|
}
|
|
3069
3072
|
/**
|
|
3070
3073
|
* Perform a linear search and return the index of the match.
|
|
@@ -26459,6 +26462,10 @@ class Popover extends owl.Component {
|
|
|
26459
26462
|
this.currentDisplayValue = newDisplay;
|
|
26460
26463
|
if (!anchor)
|
|
26461
26464
|
return;
|
|
26465
|
+
el.style.top = "";
|
|
26466
|
+
el.style.left = "";
|
|
26467
|
+
el.style["max-height"] = "";
|
|
26468
|
+
el.style["max-width"] = "";
|
|
26462
26469
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
26463
26470
|
let elDims = {
|
|
26464
26471
|
width: el.getBoundingClientRect().width,
|
|
@@ -39451,7 +39458,7 @@ class GridComposer extends owl.Component {
|
|
|
39451
39458
|
return;
|
|
39452
39459
|
}
|
|
39453
39460
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
39454
|
-
const zone = this.env.model.getters.
|
|
39461
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
39455
39462
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
39456
39463
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
39457
39464
|
this.isCellReferenceVisible = true;
|
|
@@ -41206,13 +41213,23 @@ class GridRenderer {
|
|
|
41206
41213
|
drawLayer(renderingContext, layer) {
|
|
41207
41214
|
switch (layer) {
|
|
41208
41215
|
case "Background":
|
|
41209
|
-
|
|
41210
|
-
this.
|
|
41211
|
-
|
|
41212
|
-
|
|
41213
|
-
|
|
41214
|
-
|
|
41215
|
-
|
|
41216
|
+
this.drawGlobalBackground(renderingContext);
|
|
41217
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
41218
|
+
const { ctx } = renderingContext;
|
|
41219
|
+
ctx.save();
|
|
41220
|
+
ctx.beginPath();
|
|
41221
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
41222
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
41223
|
+
ctx.clip();
|
|
41224
|
+
const boxes = this.getGridBoxes(zone);
|
|
41225
|
+
this.drawBackground(renderingContext, boxes);
|
|
41226
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
41227
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
41228
|
+
this.drawBorders(renderingContext, boxes);
|
|
41229
|
+
this.drawTexts(renderingContext, boxes);
|
|
41230
|
+
this.drawIcon(renderingContext, boxes);
|
|
41231
|
+
ctx.restore();
|
|
41232
|
+
}
|
|
41216
41233
|
this.drawFrozenPanes(renderingContext);
|
|
41217
41234
|
break;
|
|
41218
41235
|
case "Headers":
|
|
@@ -41223,12 +41240,15 @@ class GridRenderer {
|
|
|
41223
41240
|
break;
|
|
41224
41241
|
}
|
|
41225
41242
|
}
|
|
41226
|
-
|
|
41227
|
-
const { ctx
|
|
41243
|
+
drawGlobalBackground(renderingContext) {
|
|
41244
|
+
const { ctx } = renderingContext;
|
|
41228
41245
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
41229
41246
|
// white background
|
|
41230
41247
|
ctx.fillStyle = "#ffffff";
|
|
41231
41248
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
41249
|
+
}
|
|
41250
|
+
drawBackground(renderingContext, boxes) {
|
|
41251
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
41232
41252
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
41233
41253
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
41234
41254
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -41653,7 +41673,7 @@ class GridRenderer {
|
|
|
41653
41673
|
const position = { sheetId, col, row };
|
|
41654
41674
|
const cell = this.getters.getEvaluatedCell(position);
|
|
41655
41675
|
const showFormula = this.getters.shouldShowFormulas();
|
|
41656
|
-
const { x, y, width, height } = this.getters.
|
|
41676
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
41657
41677
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
41658
41678
|
const box = {
|
|
41659
41679
|
x,
|
|
@@ -41769,12 +41789,16 @@ class GridRenderer {
|
|
|
41769
41789
|
}
|
|
41770
41790
|
return box;
|
|
41771
41791
|
}
|
|
41772
|
-
getGridBoxes() {
|
|
41792
|
+
getGridBoxes(zone) {
|
|
41773
41793
|
const boxes = [];
|
|
41774
|
-
const visibleCols = this.getters
|
|
41794
|
+
const visibleCols = this.getters
|
|
41795
|
+
.getSheetViewVisibleCols()
|
|
41796
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
41775
41797
|
const left = visibleCols[0];
|
|
41776
41798
|
const right = visibleCols[visibleCols.length - 1];
|
|
41777
|
-
const visibleRows = this.getters
|
|
41799
|
+
const visibleRows = this.getters
|
|
41800
|
+
.getSheetViewVisibleRows()
|
|
41801
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
41778
41802
|
const top = visibleRows[0];
|
|
41779
41803
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
41780
41804
|
const viewport = { left, right, top, bottom };
|
|
@@ -60777,8 +60801,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
60777
60801
|
},
|
|
60778
60802
|
];
|
|
60779
60803
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
60804
|
+
const selection = pasteTarget[0];
|
|
60805
|
+
const col = selection.left;
|
|
60806
|
+
const row = selection.top;
|
|
60807
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
60780
60808
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
60781
|
-
let currentIndex = cmd.base;
|
|
60809
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
60782
60810
|
for (const element of toRemove) {
|
|
60783
60811
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
60784
60812
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -61061,22 +61089,33 @@ class InternalViewport {
|
|
|
61061
61089
|
}
|
|
61062
61090
|
/**
|
|
61063
61091
|
*
|
|
61064
|
-
*
|
|
61065
|
-
*
|
|
61092
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
61093
|
+
*
|
|
61066
61094
|
*/
|
|
61067
|
-
|
|
61095
|
+
getVisibleRect(zone) {
|
|
61068
61096
|
const targetZone = intersection(zone, this);
|
|
61069
61097
|
if (targetZone) {
|
|
61070
61098
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
61071
61099
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
61072
61100
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
61073
61101
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
61074
|
-
return {
|
|
61075
|
-
|
|
61076
|
-
|
|
61077
|
-
|
|
61078
|
-
|
|
61079
|
-
|
|
61102
|
+
return { x, y, width, height };
|
|
61103
|
+
}
|
|
61104
|
+
return undefined;
|
|
61105
|
+
}
|
|
61106
|
+
/**
|
|
61107
|
+
*
|
|
61108
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
61109
|
+
*
|
|
61110
|
+
*/
|
|
61111
|
+
getFullRect(zone) {
|
|
61112
|
+
const targetZone = intersection(zone, this);
|
|
61113
|
+
if (targetZone) {
|
|
61114
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
61115
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
61116
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
61117
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
61118
|
+
return { x, y, width, height };
|
|
61080
61119
|
}
|
|
61081
61120
|
return undefined;
|
|
61082
61121
|
}
|
|
@@ -61246,6 +61285,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61246
61285
|
"isPositionVisible",
|
|
61247
61286
|
"getColDimensionsInViewport",
|
|
61248
61287
|
"getRowDimensionsInViewport",
|
|
61288
|
+
"getAllActiveViewportsZones",
|
|
61289
|
+
"getRect",
|
|
61249
61290
|
];
|
|
61250
61291
|
viewports = {};
|
|
61251
61292
|
/**
|
|
@@ -61632,16 +61673,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61632
61673
|
getVisibleRectWithoutHeaders(zone) {
|
|
61633
61674
|
const sheetId = this.getters.getActiveSheetId();
|
|
61634
61675
|
const viewportRects = this.getSubViewports(sheetId)
|
|
61635
|
-
.map((viewport) => viewport.
|
|
61676
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
61636
61677
|
.filter(isDefined);
|
|
61637
61678
|
if (viewportRects.length === 0) {
|
|
61638
61679
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61639
61680
|
}
|
|
61640
|
-
|
|
61641
|
-
|
|
61642
|
-
|
|
61643
|
-
|
|
61644
|
-
|
|
61681
|
+
return this.recomposeRect(viewportRects);
|
|
61682
|
+
}
|
|
61683
|
+
/**
|
|
61684
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
61685
|
+
* regardless of the viewport dimensions.
|
|
61686
|
+
*/
|
|
61687
|
+
getRect(zone) {
|
|
61688
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61689
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
61690
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
61691
|
+
.filter(isDefined);
|
|
61692
|
+
if (viewportRects.length === 0) {
|
|
61693
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61694
|
+
}
|
|
61695
|
+
const rect = this.recomposeRect(viewportRects);
|
|
61696
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
61645
61697
|
}
|
|
61646
61698
|
/**
|
|
61647
61699
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -61685,6 +61737,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61685
61737
|
end: start + (isRowHidden ? 0 : size),
|
|
61686
61738
|
};
|
|
61687
61739
|
}
|
|
61740
|
+
getAllActiveViewportsZones() {
|
|
61741
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61742
|
+
return this.getSubViewports(sheetId);
|
|
61743
|
+
}
|
|
61688
61744
|
// ---------------------------------------------------------------------------
|
|
61689
61745
|
// Private
|
|
61690
61746
|
// ---------------------------------------------------------------------------
|
|
@@ -61875,6 +61931,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61875
61931
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
61876
61932
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
61877
61933
|
}
|
|
61934
|
+
recomposeRect(viewportRects) {
|
|
61935
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
61936
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
61937
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
61938
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
61939
|
+
return { x, y, width, height };
|
|
61940
|
+
}
|
|
61878
61941
|
}
|
|
61879
61942
|
|
|
61880
61943
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -68800,6 +68863,6 @@ exports.tokenColors = tokenColors;
|
|
|
68800
68863
|
exports.tokenize = tokenize;
|
|
68801
68864
|
|
|
68802
68865
|
|
|
68803
|
-
__info__.version = "17.4.
|
|
68804
|
-
__info__.date = "2025-01-
|
|
68805
|
-
__info__.hash = "
|
|
68866
|
+
__info__.version = "17.4.19";
|
|
68867
|
+
__info__.date = "2025-01-27T10:04:10.249Z";
|
|
68868
|
+
__info__.hash = "f2a7840";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4942,10 +4942,16 @@ declare class InternalViewport {
|
|
|
4942
4942
|
adjustViewportZone(): void;
|
|
4943
4943
|
/**
|
|
4944
4944
|
*
|
|
4945
|
-
*
|
|
4946
|
-
*
|
|
4945
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
4946
|
+
*
|
|
4947
4947
|
*/
|
|
4948
|
-
|
|
4948
|
+
getVisibleRect(zone: Zone): Rect | undefined;
|
|
4949
|
+
/**
|
|
4950
|
+
*
|
|
4951
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
4952
|
+
*
|
|
4953
|
+
*/
|
|
4954
|
+
getFullRect(zone: Zone): Rect | undefined;
|
|
4949
4955
|
isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
|
|
4950
4956
|
private searchHeaderIndex;
|
|
4951
4957
|
private setViewportOffsetX;
|
|
@@ -5014,7 +5020,7 @@ type SheetViewports = {
|
|
|
5014
5020
|
*
|
|
5015
5021
|
*/
|
|
5016
5022
|
declare class SheetViewPlugin extends UIPlugin {
|
|
5017
|
-
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"];
|
|
5023
|
+
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"];
|
|
5018
5024
|
readonly viewports: Record<UID, SheetViewports | undefined>;
|
|
5019
5025
|
/**
|
|
5020
5026
|
* The viewport dimensions are usually set by one of the components
|
|
@@ -5085,6 +5091,11 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5085
5091
|
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
5086
5092
|
*/
|
|
5087
5093
|
getVisibleRectWithoutHeaders(zone: Zone): Rect;
|
|
5094
|
+
/**
|
|
5095
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
5096
|
+
* regardless of the viewport dimensions.
|
|
5097
|
+
*/
|
|
5098
|
+
getRect(zone: Zone): Rect;
|
|
5088
5099
|
/**
|
|
5089
5100
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
5090
5101
|
* It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
|
|
@@ -5101,6 +5112,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5101
5112
|
* of the current viewport
|
|
5102
5113
|
*/
|
|
5103
5114
|
getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
|
|
5115
|
+
getAllActiveViewportsZones(): Zone[];
|
|
5104
5116
|
private ensureMainViewportExist;
|
|
5105
5117
|
private getSubViewports;
|
|
5106
5118
|
private checkPositiveDimension;
|
|
@@ -5132,6 +5144,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5132
5144
|
xRatio: number;
|
|
5133
5145
|
yRatio: number;
|
|
5134
5146
|
};
|
|
5147
|
+
private recomposeRect;
|
|
5135
5148
|
}
|
|
5136
5149
|
|
|
5137
5150
|
/**
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.4.
|
|
6
|
-
* @date 2025-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.19
|
|
6
|
+
* @date 2025-01-27T10:04:10.249Z
|
|
7
|
+
* @hash f2a7840
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -3013,15 +3013,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3013
3013
|
let currentIndex;
|
|
3014
3014
|
let currentVal;
|
|
3015
3015
|
let currentType;
|
|
3016
|
+
const getValue = sortOrder === "desc"
|
|
3017
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
3018
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
3016
3019
|
while (indexRight - indexLeft >= 0) {
|
|
3017
3020
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
3018
3021
|
currentIndex = indexMedian;
|
|
3019
|
-
currentVal =
|
|
3022
|
+
currentVal = getValue(currentIndex);
|
|
3020
3023
|
currentType = typeof currentVal;
|
|
3021
3024
|
// 1 - linear search to find value with the same type
|
|
3022
3025
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
3023
3026
|
currentIndex--;
|
|
3024
|
-
currentVal =
|
|
3027
|
+
currentVal = getValue(currentIndex);
|
|
3025
3028
|
currentType = typeof currentVal;
|
|
3026
3029
|
}
|
|
3027
3030
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -3037,8 +3040,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3037
3040
|
if (matchVal === undefined ||
|
|
3038
3041
|
matchVal === null ||
|
|
3039
3042
|
matchVal < currentVal ||
|
|
3040
|
-
(matchVal === currentVal &&
|
|
3041
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3043
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3042
3044
|
matchVal = currentVal;
|
|
3043
3045
|
matchValIndex = currentIndex;
|
|
3044
3046
|
}
|
|
@@ -3046,15 +3048,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3046
3048
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
3047
3049
|
if (matchVal === undefined ||
|
|
3048
3050
|
matchVal > currentVal ||
|
|
3049
|
-
(matchVal === currentVal &&
|
|
3050
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
3051
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
3051
3052
|
matchVal = currentVal;
|
|
3052
3053
|
matchValIndex = currentIndex;
|
|
3053
3054
|
}
|
|
3054
3055
|
}
|
|
3055
3056
|
// 3 - give new indexes for the Binary search
|
|
3056
|
-
if ((
|
|
3057
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
3057
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
3058
3058
|
indexRight = currentIndex - 1;
|
|
3059
3059
|
}
|
|
3060
3060
|
else {
|
|
@@ -3062,7 +3062,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
3062
3062
|
}
|
|
3063
3063
|
}
|
|
3064
3064
|
// note that valMinIndex could be 0
|
|
3065
|
-
|
|
3065
|
+
if (matchValIndex === undefined) {
|
|
3066
|
+
return -1;
|
|
3067
|
+
}
|
|
3068
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
3066
3069
|
}
|
|
3067
3070
|
/**
|
|
3068
3071
|
* Perform a linear search and return the index of the match.
|
|
@@ -26457,6 +26460,10 @@ class Popover extends Component {
|
|
|
26457
26460
|
this.currentDisplayValue = newDisplay;
|
|
26458
26461
|
if (!anchor)
|
|
26459
26462
|
return;
|
|
26463
|
+
el.style.top = "";
|
|
26464
|
+
el.style.left = "";
|
|
26465
|
+
el.style["max-height"] = "";
|
|
26466
|
+
el.style["max-width"] = "";
|
|
26460
26467
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
26461
26468
|
let elDims = {
|
|
26462
26469
|
width: el.getBoundingClientRect().width,
|
|
@@ -39449,7 +39456,7 @@ class GridComposer extends Component {
|
|
|
39449
39456
|
return;
|
|
39450
39457
|
}
|
|
39451
39458
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
39452
|
-
const zone = this.env.model.getters.
|
|
39459
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
39453
39460
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
39454
39461
|
if (!deepEquals(rect, this.rect) || sheetId !== this.composerStore.currentEditedCell.sheetId) {
|
|
39455
39462
|
this.isCellReferenceVisible = true;
|
|
@@ -41204,13 +41211,23 @@ class GridRenderer {
|
|
|
41204
41211
|
drawLayer(renderingContext, layer) {
|
|
41205
41212
|
switch (layer) {
|
|
41206
41213
|
case "Background":
|
|
41207
|
-
|
|
41208
|
-
this.
|
|
41209
|
-
|
|
41210
|
-
|
|
41211
|
-
|
|
41212
|
-
|
|
41213
|
-
|
|
41214
|
+
this.drawGlobalBackground(renderingContext);
|
|
41215
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
41216
|
+
const { ctx } = renderingContext;
|
|
41217
|
+
ctx.save();
|
|
41218
|
+
ctx.beginPath();
|
|
41219
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
41220
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
41221
|
+
ctx.clip();
|
|
41222
|
+
const boxes = this.getGridBoxes(zone);
|
|
41223
|
+
this.drawBackground(renderingContext, boxes);
|
|
41224
|
+
this.drawOverflowingCellBackground(renderingContext, boxes);
|
|
41225
|
+
this.drawCellBackground(renderingContext, boxes);
|
|
41226
|
+
this.drawBorders(renderingContext, boxes);
|
|
41227
|
+
this.drawTexts(renderingContext, boxes);
|
|
41228
|
+
this.drawIcon(renderingContext, boxes);
|
|
41229
|
+
ctx.restore();
|
|
41230
|
+
}
|
|
41214
41231
|
this.drawFrozenPanes(renderingContext);
|
|
41215
41232
|
break;
|
|
41216
41233
|
case "Headers":
|
|
@@ -41221,12 +41238,15 @@ class GridRenderer {
|
|
|
41221
41238
|
break;
|
|
41222
41239
|
}
|
|
41223
41240
|
}
|
|
41224
|
-
|
|
41225
|
-
const { ctx
|
|
41241
|
+
drawGlobalBackground(renderingContext) {
|
|
41242
|
+
const { ctx } = renderingContext;
|
|
41226
41243
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
41227
41244
|
// white background
|
|
41228
41245
|
ctx.fillStyle = "#ffffff";
|
|
41229
41246
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
41247
|
+
}
|
|
41248
|
+
drawBackground(renderingContext, boxes) {
|
|
41249
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
41230
41250
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
41231
41251
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
41232
41252
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -41651,7 +41671,7 @@ class GridRenderer {
|
|
|
41651
41671
|
const position = { sheetId, col, row };
|
|
41652
41672
|
const cell = this.getters.getEvaluatedCell(position);
|
|
41653
41673
|
const showFormula = this.getters.shouldShowFormulas();
|
|
41654
|
-
const { x, y, width, height } = this.getters.
|
|
41674
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
41655
41675
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
41656
41676
|
const box = {
|
|
41657
41677
|
x,
|
|
@@ -41767,12 +41787,16 @@ class GridRenderer {
|
|
|
41767
41787
|
}
|
|
41768
41788
|
return box;
|
|
41769
41789
|
}
|
|
41770
|
-
getGridBoxes() {
|
|
41790
|
+
getGridBoxes(zone) {
|
|
41771
41791
|
const boxes = [];
|
|
41772
|
-
const visibleCols = this.getters
|
|
41792
|
+
const visibleCols = this.getters
|
|
41793
|
+
.getSheetViewVisibleCols()
|
|
41794
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
41773
41795
|
const left = visibleCols[0];
|
|
41774
41796
|
const right = visibleCols[visibleCols.length - 1];
|
|
41775
|
-
const visibleRows = this.getters
|
|
41797
|
+
const visibleRows = this.getters
|
|
41798
|
+
.getSheetViewVisibleRows()
|
|
41799
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
41776
41800
|
const top = visibleRows[0];
|
|
41777
41801
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
41778
41802
|
const viewport = { left, right, top, bottom };
|
|
@@ -60775,8 +60799,12 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
60775
60799
|
},
|
|
60776
60800
|
];
|
|
60777
60801
|
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
60802
|
+
const selection = pasteTarget[0];
|
|
60803
|
+
const col = selection.left;
|
|
60804
|
+
const row = selection.top;
|
|
60805
|
+
this.setSelectionMixin({ zone: selection, cell: { col, row } }, [selection]);
|
|
60778
60806
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
60779
|
-
let currentIndex = cmd.base;
|
|
60807
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
60780
60808
|
for (const element of toRemove) {
|
|
60781
60809
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
60782
60810
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -61059,22 +61087,33 @@ class InternalViewport {
|
|
|
61059
61087
|
}
|
|
61060
61088
|
/**
|
|
61061
61089
|
*
|
|
61062
|
-
*
|
|
61063
|
-
*
|
|
61090
|
+
* Computes the visible coordinates & dimensions of a given zone inside the viewport
|
|
61091
|
+
*
|
|
61064
61092
|
*/
|
|
61065
|
-
|
|
61093
|
+
getVisibleRect(zone) {
|
|
61066
61094
|
const targetZone = intersection(zone, this);
|
|
61067
61095
|
if (targetZone) {
|
|
61068
61096
|
const x = this.getters.getColRowOffset("COL", this.left, targetZone.left) + this.offsetCorrectionX;
|
|
61069
61097
|
const y = this.getters.getColRowOffset("ROW", this.top, targetZone.top) + this.offsetCorrectionY;
|
|
61070
61098
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
61071
61099
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
61072
|
-
return {
|
|
61073
|
-
|
|
61074
|
-
|
|
61075
|
-
|
|
61076
|
-
|
|
61077
|
-
|
|
61100
|
+
return { x, y, width, height };
|
|
61101
|
+
}
|
|
61102
|
+
return undefined;
|
|
61103
|
+
}
|
|
61104
|
+
/**
|
|
61105
|
+
*
|
|
61106
|
+
* @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
|
|
61107
|
+
*
|
|
61108
|
+
*/
|
|
61109
|
+
getFullRect(zone) {
|
|
61110
|
+
const targetZone = intersection(zone, this);
|
|
61111
|
+
if (targetZone) {
|
|
61112
|
+
const x = this.getters.getColRowOffset("COL", this.left, zone.left) + this.offsetCorrectionX;
|
|
61113
|
+
const y = this.getters.getColRowOffset("ROW", this.top, zone.top) + this.offsetCorrectionY;
|
|
61114
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
61115
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
61116
|
+
return { x, y, width, height };
|
|
61078
61117
|
}
|
|
61079
61118
|
return undefined;
|
|
61080
61119
|
}
|
|
@@ -61244,6 +61283,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61244
61283
|
"isPositionVisible",
|
|
61245
61284
|
"getColDimensionsInViewport",
|
|
61246
61285
|
"getRowDimensionsInViewport",
|
|
61286
|
+
"getAllActiveViewportsZones",
|
|
61287
|
+
"getRect",
|
|
61247
61288
|
];
|
|
61248
61289
|
viewports = {};
|
|
61249
61290
|
/**
|
|
@@ -61630,16 +61671,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61630
61671
|
getVisibleRectWithoutHeaders(zone) {
|
|
61631
61672
|
const sheetId = this.getters.getActiveSheetId();
|
|
61632
61673
|
const viewportRects = this.getSubViewports(sheetId)
|
|
61633
|
-
.map((viewport) => viewport.
|
|
61674
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
61634
61675
|
.filter(isDefined);
|
|
61635
61676
|
if (viewportRects.length === 0) {
|
|
61636
61677
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61637
61678
|
}
|
|
61638
|
-
|
|
61639
|
-
|
|
61640
|
-
|
|
61641
|
-
|
|
61642
|
-
|
|
61679
|
+
return this.recomposeRect(viewportRects);
|
|
61680
|
+
}
|
|
61681
|
+
/**
|
|
61682
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
61683
|
+
* regardless of the viewport dimensions.
|
|
61684
|
+
*/
|
|
61685
|
+
getRect(zone) {
|
|
61686
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61687
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
61688
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
61689
|
+
.filter(isDefined);
|
|
61690
|
+
if (viewportRects.length === 0) {
|
|
61691
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
61692
|
+
}
|
|
61693
|
+
const rect = this.recomposeRect(viewportRects);
|
|
61694
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
61643
61695
|
}
|
|
61644
61696
|
/**
|
|
61645
61697
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -61683,6 +61735,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61683
61735
|
end: start + (isRowHidden ? 0 : size),
|
|
61684
61736
|
};
|
|
61685
61737
|
}
|
|
61738
|
+
getAllActiveViewportsZones() {
|
|
61739
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
61740
|
+
return this.getSubViewports(sheetId);
|
|
61741
|
+
}
|
|
61686
61742
|
// ---------------------------------------------------------------------------
|
|
61687
61743
|
// Private
|
|
61688
61744
|
// ---------------------------------------------------------------------------
|
|
@@ -61873,6 +61929,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
61873
61929
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
61874
61930
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
61875
61931
|
}
|
|
61932
|
+
recomposeRect(viewportRects) {
|
|
61933
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
61934
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
61935
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
61936
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
61937
|
+
return { x, y, width, height };
|
|
61938
|
+
}
|
|
61876
61939
|
}
|
|
61877
61940
|
|
|
61878
61941
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -68755,6 +68818,6 @@ const constants = {
|
|
|
68755
68818
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
68756
68819
|
|
|
68757
68820
|
|
|
68758
|
-
__info__.version = "17.4.
|
|
68759
|
-
__info__.date = "2025-01-
|
|
68760
|
-
__info__.hash = "
|
|
68821
|
+
__info__.version = "17.4.19";
|
|
68822
|
+
__info__.date = "2025-01-27T10:04:10.249Z";
|
|
68823
|
+
__info__.hash = "f2a7840";
|