@odoo/o-spreadsheet 17.0.45 → 17.0.46
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 +99 -43
- package/dist/o-spreadsheet.d.ts +11 -2
- package/dist/o-spreadsheet.esm.js +99 -43
- package/dist/o-spreadsheet.iife.js +99 -43
- package/dist/o-spreadsheet.iife.min.js +5 -5
- package/dist/o_spreadsheet.xml +3 -3
- 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.0.
|
|
6
|
-
* @date 2025-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.46
|
|
6
|
+
* @date 2025-01-27T10:00:20.499Z
|
|
7
|
+
* @hash 1df062c
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -2697,15 +2697,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2697
2697
|
let currentIndex;
|
|
2698
2698
|
let currentVal;
|
|
2699
2699
|
let currentType;
|
|
2700
|
+
const getValue = sortOrder === "desc"
|
|
2701
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
2702
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
2700
2703
|
while (indexRight - indexLeft >= 0) {
|
|
2701
2704
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
2702
2705
|
currentIndex = indexMedian;
|
|
2703
|
-
currentVal =
|
|
2706
|
+
currentVal = getValue(currentIndex);
|
|
2704
2707
|
currentType = typeof currentVal;
|
|
2705
2708
|
// 1 - linear search to find value with the same type
|
|
2706
2709
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
2707
2710
|
currentIndex--;
|
|
2708
|
-
currentVal =
|
|
2711
|
+
currentVal = getValue(currentIndex);
|
|
2709
2712
|
currentType = typeof currentVal;
|
|
2710
2713
|
}
|
|
2711
2714
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -2721,8 +2724,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2721
2724
|
if (matchVal === undefined ||
|
|
2722
2725
|
matchVal === null ||
|
|
2723
2726
|
matchVal < currentVal ||
|
|
2724
|
-
(matchVal === currentVal &&
|
|
2725
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2727
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2726
2728
|
matchVal = currentVal;
|
|
2727
2729
|
matchValIndex = currentIndex;
|
|
2728
2730
|
}
|
|
@@ -2730,15 +2732,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2730
2732
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
2731
2733
|
if (matchVal === undefined ||
|
|
2732
2734
|
matchVal > currentVal ||
|
|
2733
|
-
(matchVal === currentVal &&
|
|
2734
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2735
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2735
2736
|
matchVal = currentVal;
|
|
2736
2737
|
matchValIndex = currentIndex;
|
|
2737
2738
|
}
|
|
2738
2739
|
}
|
|
2739
2740
|
// 3 - give new indexes for the Binary search
|
|
2740
|
-
if ((
|
|
2741
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
2741
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
2742
2742
|
indexRight = currentIndex - 1;
|
|
2743
2743
|
}
|
|
2744
2744
|
else {
|
|
@@ -2746,7 +2746,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
2748
|
// note that valMinIndex could be 0
|
|
2749
|
-
|
|
2749
|
+
if (matchValIndex === undefined) {
|
|
2750
|
+
return -1;
|
|
2751
|
+
}
|
|
2752
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
2750
2753
|
}
|
|
2751
2754
|
/**
|
|
2752
2755
|
* Perform a linear search and return the index of the match.
|
|
@@ -6940,6 +6943,10 @@ class Popover extends owl.Component {
|
|
|
6940
6943
|
this.currentDisplayValue = newDisplay;
|
|
6941
6944
|
if (!anchor)
|
|
6942
6945
|
return;
|
|
6946
|
+
el.style.top = "";
|
|
6947
|
+
el.style.left = "";
|
|
6948
|
+
el.style["max-height"] = "";
|
|
6949
|
+
el.style["max-width"] = "";
|
|
6943
6950
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
6944
6951
|
let elDims = {
|
|
6945
6952
|
width: el.getBoundingClientRect().width,
|
|
@@ -27454,7 +27461,7 @@ class GridComposer extends owl.Component {
|
|
|
27454
27461
|
return;
|
|
27455
27462
|
}
|
|
27456
27463
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
27457
|
-
const zone = this.env.model.getters.
|
|
27464
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
27458
27465
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
27459
27466
|
if (!deepEquals(rect, this.rect) ||
|
|
27460
27467
|
sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
|
|
@@ -46261,13 +46268,23 @@ class RendererPlugin extends UIPlugin {
|
|
|
46261
46268
|
drawGrid(renderingContext, layer) {
|
|
46262
46269
|
switch (layer) {
|
|
46263
46270
|
case 0 /* LAYERS.Background */:
|
|
46264
|
-
this.
|
|
46265
|
-
this.
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
-
|
|
46270
|
-
|
|
46271
|
+
this.drawGlobalBackground(renderingContext);
|
|
46272
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
46273
|
+
const { ctx } = renderingContext;
|
|
46274
|
+
ctx.save();
|
|
46275
|
+
ctx.beginPath();
|
|
46276
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
46277
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
46278
|
+
ctx.clip();
|
|
46279
|
+
this.boxes = this.getGridBoxes(zone);
|
|
46280
|
+
this.drawBackground(renderingContext);
|
|
46281
|
+
this.drawOverflowingCellBackground(renderingContext);
|
|
46282
|
+
this.drawCellBackground(renderingContext);
|
|
46283
|
+
this.drawBorders(renderingContext);
|
|
46284
|
+
this.drawTexts(renderingContext);
|
|
46285
|
+
this.drawIcon(renderingContext);
|
|
46286
|
+
ctx.restore();
|
|
46287
|
+
}
|
|
46271
46288
|
this.drawFrozenPanes(renderingContext);
|
|
46272
46289
|
break;
|
|
46273
46290
|
case 7 /* LAYERS.Headers */:
|
|
@@ -46278,12 +46295,15 @@ class RendererPlugin extends UIPlugin {
|
|
|
46278
46295
|
break;
|
|
46279
46296
|
}
|
|
46280
46297
|
}
|
|
46281
|
-
|
|
46282
|
-
const { ctx
|
|
46298
|
+
drawGlobalBackground(renderingContext) {
|
|
46299
|
+
const { ctx } = renderingContext;
|
|
46283
46300
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
46284
46301
|
// white background
|
|
46285
46302
|
ctx.fillStyle = "#ffffff";
|
|
46286
46303
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
46304
|
+
}
|
|
46305
|
+
drawBackground(renderingContext) {
|
|
46306
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
46287
46307
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
46288
46308
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
46289
46309
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -46714,7 +46734,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
46714
46734
|
const position = { sheetId, col, row };
|
|
46715
46735
|
const cell = this.getters.getEvaluatedCell(position);
|
|
46716
46736
|
const showFormula = this.getters.shouldShowFormulas();
|
|
46717
|
-
const { x, y, width, height } = this.getters.
|
|
46737
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
46718
46738
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
46719
46739
|
const box = {
|
|
46720
46740
|
x,
|
|
@@ -46829,12 +46849,16 @@ class RendererPlugin extends UIPlugin {
|
|
|
46829
46849
|
}
|
|
46830
46850
|
return box;
|
|
46831
46851
|
}
|
|
46832
|
-
getGridBoxes() {
|
|
46852
|
+
getGridBoxes(zone) {
|
|
46833
46853
|
const boxes = [];
|
|
46834
|
-
const visibleCols = this.getters
|
|
46854
|
+
const visibleCols = this.getters
|
|
46855
|
+
.getSheetViewVisibleCols()
|
|
46856
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
46835
46857
|
const left = visibleCols[0];
|
|
46836
46858
|
const right = visibleCols[visibleCols.length - 1];
|
|
46837
|
-
const visibleRows = this.getters
|
|
46859
|
+
const visibleRows = this.getters
|
|
46860
|
+
.getSheetViewVisibleRows()
|
|
46861
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
46838
46862
|
const top = visibleRows[0];
|
|
46839
46863
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
46840
46864
|
const viewport = { left, right, top, bottom };
|
|
@@ -50361,7 +50385,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50361
50385
|
];
|
|
50362
50386
|
state.paste(pasteTarget, { selectTarget: true });
|
|
50363
50387
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50364
|
-
let currentIndex = cmd.base;
|
|
50388
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
50365
50389
|
for (const element of toRemove) {
|
|
50366
50390
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
50367
50391
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -50652,7 +50676,7 @@ class InternalViewport {
|
|
|
50652
50676
|
* @param zone
|
|
50653
50677
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
50654
50678
|
*/
|
|
50655
|
-
|
|
50679
|
+
getVisibleRect(zone) {
|
|
50656
50680
|
const targetZone = intersection(zone, this.zone);
|
|
50657
50681
|
if (targetZone) {
|
|
50658
50682
|
const x = this.getters.getColRowOffset("COL", this.zone.left, targetZone.left) +
|
|
@@ -50660,12 +50684,20 @@ class InternalViewport {
|
|
|
50660
50684
|
const y = this.getters.getColRowOffset("ROW", this.zone.top, targetZone.top) + this.offsetCorrectionY;
|
|
50661
50685
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
50662
50686
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
50663
|
-
return {
|
|
50664
|
-
|
|
50665
|
-
|
|
50666
|
-
|
|
50667
|
-
|
|
50668
|
-
|
|
50687
|
+
return { x, y, width, height };
|
|
50688
|
+
}
|
|
50689
|
+
else {
|
|
50690
|
+
return undefined;
|
|
50691
|
+
}
|
|
50692
|
+
}
|
|
50693
|
+
getFullRect(zone) {
|
|
50694
|
+
const targetZone = intersection(zone, this.zone);
|
|
50695
|
+
if (targetZone) {
|
|
50696
|
+
const x = this.getters.getColRowOffset("COL", this.zone.left, zone.left) + this.offsetCorrectionX;
|
|
50697
|
+
const y = this.getters.getColRowOffset("ROW", this.zone.top, zone.top) + this.offsetCorrectionY;
|
|
50698
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
50699
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
50700
|
+
return { x, y, width, height };
|
|
50669
50701
|
}
|
|
50670
50702
|
else {
|
|
50671
50703
|
return undefined;
|
|
@@ -50849,6 +50881,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50849
50881
|
"getSheetViewVisibleRows",
|
|
50850
50882
|
"getFrozenSheetViewRatio",
|
|
50851
50883
|
"isPositionVisible",
|
|
50884
|
+
"getAllActiveViewportsZones",
|
|
50885
|
+
"getRect",
|
|
50852
50886
|
];
|
|
50853
50887
|
viewports = {};
|
|
50854
50888
|
/**
|
|
@@ -51236,16 +51270,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51236
51270
|
getVisibleRectWithoutHeaders(zone) {
|
|
51237
51271
|
const sheetId = this.getters.getActiveSheetId();
|
|
51238
51272
|
const viewportRects = this.getSubViewports(sheetId)
|
|
51239
|
-
.map((viewport) => viewport.
|
|
51273
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
51240
51274
|
.filter(isDefined$1);
|
|
51241
51275
|
if (viewportRects.length === 0) {
|
|
51242
51276
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
51243
51277
|
}
|
|
51244
|
-
|
|
51245
|
-
|
|
51246
|
-
|
|
51247
|
-
|
|
51248
|
-
|
|
51278
|
+
return this.recomposeRect(viewportRects);
|
|
51279
|
+
}
|
|
51280
|
+
/**
|
|
51281
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
51282
|
+
* regardless of the viewport dimensions.
|
|
51283
|
+
*/
|
|
51284
|
+
getRect(zone) {
|
|
51285
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
51286
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
51287
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
51288
|
+
.filter(isDefined$1);
|
|
51289
|
+
if (viewportRects.length === 0) {
|
|
51290
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
51291
|
+
}
|
|
51292
|
+
const rect = this.recomposeRect(viewportRects);
|
|
51293
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
51249
51294
|
}
|
|
51250
51295
|
/**
|
|
51251
51296
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -51259,6 +51304,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51259
51304
|
const y = this.getters.getRowDimensions(sheetId, ySplit).start;
|
|
51260
51305
|
return { x, y };
|
|
51261
51306
|
}
|
|
51307
|
+
getAllActiveViewportsZones() {
|
|
51308
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
51309
|
+
return this.getSubViewports(sheetId);
|
|
51310
|
+
}
|
|
51262
51311
|
// ---------------------------------------------------------------------------
|
|
51263
51312
|
// Private
|
|
51264
51313
|
// ---------------------------------------------------------------------------
|
|
@@ -51443,6 +51492,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51443
51492
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
51444
51493
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
51445
51494
|
}
|
|
51495
|
+
recomposeRect(viewportRects) {
|
|
51496
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
51497
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
51498
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
51499
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
51500
|
+
return { x, y, width, height };
|
|
51501
|
+
}
|
|
51446
51502
|
}
|
|
51447
51503
|
|
|
51448
51504
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -57750,6 +57806,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
57750
57806
|
exports.tokenize = tokenize;
|
|
57751
57807
|
|
|
57752
57808
|
|
|
57753
|
-
__info__.version = "17.0.
|
|
57754
|
-
__info__.date = "2025-01-
|
|
57755
|
-
__info__.hash = "
|
|
57809
|
+
__info__.version = "17.0.46";
|
|
57810
|
+
__info__.date = "2025-01-27T10:00:20.499Z";
|
|
57811
|
+
__info__.hash = "1df062c";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4610,6 +4610,7 @@ declare class RendererPlugin extends UIPlugin {
|
|
|
4610
4610
|
*/
|
|
4611
4611
|
private getHeaderOffset;
|
|
4612
4612
|
drawGrid(renderingContext: GridRenderingContext, layer: LAYERS): void;
|
|
4613
|
+
private drawGlobalBackground;
|
|
4613
4614
|
private drawBackground;
|
|
4614
4615
|
private drawCellBackground;
|
|
4615
4616
|
private drawOverflowingCellBackground;
|
|
@@ -5082,7 +5083,8 @@ declare class InternalViewport {
|
|
|
5082
5083
|
* @param zone
|
|
5083
5084
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
5084
5085
|
*/
|
|
5085
|
-
|
|
5086
|
+
getVisibleRect(zone: Zone): Rect | undefined;
|
|
5087
|
+
getFullRect(zone: Zone): Rect | undefined;
|
|
5086
5088
|
isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
|
|
5087
5089
|
private searchHeaderIndex;
|
|
5088
5090
|
private get zone();
|
|
@@ -5152,7 +5154,7 @@ type SheetViewports = {
|
|
|
5152
5154
|
*
|
|
5153
5155
|
*/
|
|
5154
5156
|
declare class SheetViewPlugin extends UIPlugin {
|
|
5155
|
-
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible"];
|
|
5157
|
+
static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getAllActiveViewportsZones", "getRect"];
|
|
5156
5158
|
readonly viewports: Record<UID, SheetViewports | undefined>;
|
|
5157
5159
|
/**
|
|
5158
5160
|
* The viewport dimensions are usually set by one of the components
|
|
@@ -5223,12 +5225,18 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5223
5225
|
* Computes the coordinates and size to draw the zone without taking the grid offset into account
|
|
5224
5226
|
*/
|
|
5225
5227
|
getVisibleRectWithoutHeaders(zone: Zone): Rect;
|
|
5228
|
+
/**
|
|
5229
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
5230
|
+
* regardless of the viewport dimensions.
|
|
5231
|
+
*/
|
|
5232
|
+
getRect(zone: Zone): Rect;
|
|
5226
5233
|
/**
|
|
5227
5234
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
5228
5235
|
* It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
|
|
5229
5236
|
* situated before the pane divisions.
|
|
5230
5237
|
*/
|
|
5231
5238
|
getMainViewportCoordinates(): DOMCoordinates;
|
|
5239
|
+
getAllActiveViewportsZones(): Zone[];
|
|
5232
5240
|
private ensureMainViewportExist;
|
|
5233
5241
|
private getSubViewports;
|
|
5234
5242
|
private checkPositiveDimension;
|
|
@@ -5259,6 +5267,7 @@ declare class SheetViewPlugin extends UIPlugin {
|
|
|
5259
5267
|
xRatio: number;
|
|
5260
5268
|
yRatio: number;
|
|
5261
5269
|
};
|
|
5270
|
+
private recomposeRect;
|
|
5262
5271
|
}
|
|
5263
5272
|
|
|
5264
5273
|
/**
|
|
@@ -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.0.
|
|
6
|
-
* @date 2025-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.46
|
|
6
|
+
* @date 2025-01-27T10:00:20.499Z
|
|
7
|
+
* @hash 1df062c
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -2695,15 +2695,18 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2695
2695
|
let currentIndex;
|
|
2696
2696
|
let currentVal;
|
|
2697
2697
|
let currentType;
|
|
2698
|
+
const getValue = sortOrder === "desc"
|
|
2699
|
+
? (i) => normalizeValue(getValueInData(data, rangeLength - i - 1))
|
|
2700
|
+
: (i) => normalizeValue(getValueInData(data, i));
|
|
2698
2701
|
while (indexRight - indexLeft >= 0) {
|
|
2699
2702
|
indexMedian = Math.floor((indexLeft + indexRight) / 2);
|
|
2700
2703
|
currentIndex = indexMedian;
|
|
2701
|
-
currentVal =
|
|
2704
|
+
currentVal = getValue(currentIndex);
|
|
2702
2705
|
currentType = typeof currentVal;
|
|
2703
2706
|
// 1 - linear search to find value with the same type
|
|
2704
2707
|
while (indexLeft < currentIndex && targetType !== currentType) {
|
|
2705
2708
|
currentIndex--;
|
|
2706
|
-
currentVal =
|
|
2709
|
+
currentVal = getValue(currentIndex);
|
|
2707
2710
|
currentType = typeof currentVal;
|
|
2708
2711
|
}
|
|
2709
2712
|
if (currentType !== targetType || currentVal === undefined || currentVal === null) {
|
|
@@ -2719,8 +2722,7 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2719
2722
|
if (matchVal === undefined ||
|
|
2720
2723
|
matchVal === null ||
|
|
2721
2724
|
matchVal < currentVal ||
|
|
2722
|
-
(matchVal === currentVal &&
|
|
2723
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2725
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2724
2726
|
matchVal = currentVal;
|
|
2725
2727
|
matchValIndex = currentIndex;
|
|
2726
2728
|
}
|
|
@@ -2728,15 +2730,13 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2728
2730
|
else if (mode === "nextGreater" && currentVal >= _target) {
|
|
2729
2731
|
if (matchVal === undefined ||
|
|
2730
2732
|
matchVal > currentVal ||
|
|
2731
|
-
(matchVal === currentVal &&
|
|
2732
|
-
(matchVal === currentVal && sortOrder === "desc" && matchValIndex > currentIndex)) {
|
|
2733
|
+
(matchVal === currentVal && matchValIndex < currentIndex)) {
|
|
2733
2734
|
matchVal = currentVal;
|
|
2734
2735
|
matchValIndex = currentIndex;
|
|
2735
2736
|
}
|
|
2736
2737
|
}
|
|
2737
2738
|
// 3 - give new indexes for the Binary search
|
|
2738
|
-
if ((
|
|
2739
|
-
(sortOrder === "desc" && currentVal <= _target)) {
|
|
2739
|
+
if (currentVal > _target || (mode === "strict" && currentVal === _target)) {
|
|
2740
2740
|
indexRight = currentIndex - 1;
|
|
2741
2741
|
}
|
|
2742
2742
|
else {
|
|
@@ -2744,7 +2744,10 @@ function dichotomicSearch(data, target, mode, sortOrder, rangeLength, getValueIn
|
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
2746
|
// note that valMinIndex could be 0
|
|
2747
|
-
|
|
2747
|
+
if (matchValIndex === undefined) {
|
|
2748
|
+
return -1;
|
|
2749
|
+
}
|
|
2750
|
+
return sortOrder === "desc" ? rangeLength - matchValIndex - 1 : matchValIndex;
|
|
2748
2751
|
}
|
|
2749
2752
|
/**
|
|
2750
2753
|
* Perform a linear search and return the index of the match.
|
|
@@ -6938,6 +6941,10 @@ class Popover extends Component {
|
|
|
6938
6941
|
this.currentDisplayValue = newDisplay;
|
|
6939
6942
|
if (!anchor)
|
|
6940
6943
|
return;
|
|
6944
|
+
el.style.top = "";
|
|
6945
|
+
el.style.left = "";
|
|
6946
|
+
el.style["max-height"] = "";
|
|
6947
|
+
el.style["max-width"] = "";
|
|
6941
6948
|
const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
|
|
6942
6949
|
let elDims = {
|
|
6943
6950
|
width: el.getBoundingClientRect().width,
|
|
@@ -27452,7 +27459,7 @@ class GridComposer extends Component {
|
|
|
27452
27459
|
return;
|
|
27453
27460
|
}
|
|
27454
27461
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
27455
|
-
const zone = this.env.model.getters.
|
|
27462
|
+
const zone = positionToZone(this.env.model.getters.getSelection().anchor.cell);
|
|
27456
27463
|
const rect = this.env.model.getters.getVisibleRect(zone);
|
|
27457
27464
|
if (!deepEquals(rect, this.rect) ||
|
|
27458
27465
|
sheetId !== this.env.model.getters.getCurrentEditedCell().sheetId) {
|
|
@@ -46259,13 +46266,23 @@ class RendererPlugin extends UIPlugin {
|
|
|
46259
46266
|
drawGrid(renderingContext, layer) {
|
|
46260
46267
|
switch (layer) {
|
|
46261
46268
|
case 0 /* LAYERS.Background */:
|
|
46262
|
-
this.
|
|
46263
|
-
this.
|
|
46264
|
-
|
|
46265
|
-
|
|
46266
|
-
|
|
46267
|
-
|
|
46268
|
-
|
|
46269
|
+
this.drawGlobalBackground(renderingContext);
|
|
46270
|
+
for (const zone of this.getters.getAllActiveViewportsZones()) {
|
|
46271
|
+
const { ctx } = renderingContext;
|
|
46272
|
+
ctx.save();
|
|
46273
|
+
ctx.beginPath();
|
|
46274
|
+
const rect = this.getters.getVisibleRect(zone);
|
|
46275
|
+
ctx.rect(rect.x, rect.y, rect.width, rect.height);
|
|
46276
|
+
ctx.clip();
|
|
46277
|
+
this.boxes = this.getGridBoxes(zone);
|
|
46278
|
+
this.drawBackground(renderingContext);
|
|
46279
|
+
this.drawOverflowingCellBackground(renderingContext);
|
|
46280
|
+
this.drawCellBackground(renderingContext);
|
|
46281
|
+
this.drawBorders(renderingContext);
|
|
46282
|
+
this.drawTexts(renderingContext);
|
|
46283
|
+
this.drawIcon(renderingContext);
|
|
46284
|
+
ctx.restore();
|
|
46285
|
+
}
|
|
46269
46286
|
this.drawFrozenPanes(renderingContext);
|
|
46270
46287
|
break;
|
|
46271
46288
|
case 7 /* LAYERS.Headers */:
|
|
@@ -46276,12 +46293,15 @@ class RendererPlugin extends UIPlugin {
|
|
|
46276
46293
|
break;
|
|
46277
46294
|
}
|
|
46278
46295
|
}
|
|
46279
|
-
|
|
46280
|
-
const { ctx
|
|
46296
|
+
drawGlobalBackground(renderingContext) {
|
|
46297
|
+
const { ctx } = renderingContext;
|
|
46281
46298
|
const { width, height } = this.getters.getSheetViewDimensionWithHeaders();
|
|
46282
46299
|
// white background
|
|
46283
46300
|
ctx.fillStyle = "#ffffff";
|
|
46284
46301
|
ctx.fillRect(0, 0, width + CANVAS_SHIFT, height + CANVAS_SHIFT);
|
|
46302
|
+
}
|
|
46303
|
+
drawBackground(renderingContext) {
|
|
46304
|
+
const { ctx, thinLineWidth } = renderingContext;
|
|
46285
46305
|
const areGridLinesVisible = !this.getters.isDashboard() &&
|
|
46286
46306
|
this.getters.getGridLinesVisibility(this.getters.getActiveSheetId());
|
|
46287
46307
|
const inset = areGridLinesVisible ? 0.1 * thinLineWidth : 0;
|
|
@@ -46712,7 +46732,7 @@ class RendererPlugin extends UIPlugin {
|
|
|
46712
46732
|
const position = { sheetId, col, row };
|
|
46713
46733
|
const cell = this.getters.getEvaluatedCell(position);
|
|
46714
46734
|
const showFormula = this.getters.shouldShowFormulas();
|
|
46715
|
-
const { x, y, width, height } = this.getters.
|
|
46735
|
+
const { x, y, width, height } = this.getters.getRect(zone);
|
|
46716
46736
|
const { verticalAlign } = this.getters.getCellStyle(position);
|
|
46717
46737
|
const box = {
|
|
46718
46738
|
x,
|
|
@@ -46827,12 +46847,16 @@ class RendererPlugin extends UIPlugin {
|
|
|
46827
46847
|
}
|
|
46828
46848
|
return box;
|
|
46829
46849
|
}
|
|
46830
|
-
getGridBoxes() {
|
|
46850
|
+
getGridBoxes(zone) {
|
|
46831
46851
|
const boxes = [];
|
|
46832
|
-
const visibleCols = this.getters
|
|
46852
|
+
const visibleCols = this.getters
|
|
46853
|
+
.getSheetViewVisibleCols()
|
|
46854
|
+
.filter((col) => col >= zone.left && col <= zone.right);
|
|
46833
46855
|
const left = visibleCols[0];
|
|
46834
46856
|
const right = visibleCols[visibleCols.length - 1];
|
|
46835
|
-
const visibleRows = this.getters
|
|
46857
|
+
const visibleRows = this.getters
|
|
46858
|
+
.getSheetViewVisibleRows()
|
|
46859
|
+
.filter((row) => row >= zone.top && row <= zone.bottom);
|
|
46836
46860
|
const top = visibleRows[0];
|
|
46837
46861
|
const bottom = visibleRows[visibleRows.length - 1];
|
|
46838
46862
|
const viewport = { left, right, top, bottom };
|
|
@@ -50359,7 +50383,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50359
50383
|
];
|
|
50360
50384
|
state.paste(pasteTarget, { selectTarget: true });
|
|
50361
50385
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
50362
|
-
let currentIndex = cmd.base;
|
|
50386
|
+
let currentIndex = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
50363
50387
|
for (const element of toRemove) {
|
|
50364
50388
|
const size = this.getters.getHeaderSize(cmd.sheetId, cmd.dimension, element);
|
|
50365
50389
|
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
@@ -50650,7 +50674,7 @@ class InternalViewport {
|
|
|
50650
50674
|
* @param zone
|
|
50651
50675
|
* @returns Computes the absolute coordinate of a given zone inside the viewport
|
|
50652
50676
|
*/
|
|
50653
|
-
|
|
50677
|
+
getVisibleRect(zone) {
|
|
50654
50678
|
const targetZone = intersection(zone, this.zone);
|
|
50655
50679
|
if (targetZone) {
|
|
50656
50680
|
const x = this.getters.getColRowOffset("COL", this.zone.left, targetZone.left) +
|
|
@@ -50658,12 +50682,20 @@ class InternalViewport {
|
|
|
50658
50682
|
const y = this.getters.getColRowOffset("ROW", this.zone.top, targetZone.top) + this.offsetCorrectionY;
|
|
50659
50683
|
const width = Math.min(this.getters.getColRowOffset("COL", targetZone.left, targetZone.right + 1), this.viewportWidth);
|
|
50660
50684
|
const height = Math.min(this.getters.getColRowOffset("ROW", targetZone.top, targetZone.bottom + 1), this.viewportHeight);
|
|
50661
|
-
return {
|
|
50662
|
-
|
|
50663
|
-
|
|
50664
|
-
|
|
50665
|
-
|
|
50666
|
-
|
|
50685
|
+
return { x, y, width, height };
|
|
50686
|
+
}
|
|
50687
|
+
else {
|
|
50688
|
+
return undefined;
|
|
50689
|
+
}
|
|
50690
|
+
}
|
|
50691
|
+
getFullRect(zone) {
|
|
50692
|
+
const targetZone = intersection(zone, this.zone);
|
|
50693
|
+
if (targetZone) {
|
|
50694
|
+
const x = this.getters.getColRowOffset("COL", this.zone.left, zone.left) + this.offsetCorrectionX;
|
|
50695
|
+
const y = this.getters.getColRowOffset("ROW", this.zone.top, zone.top) + this.offsetCorrectionY;
|
|
50696
|
+
const width = this.getters.getColRowOffset("COL", zone.left, zone.right + 1);
|
|
50697
|
+
const height = this.getters.getColRowOffset("ROW", zone.top, zone.bottom + 1);
|
|
50698
|
+
return { x, y, width, height };
|
|
50667
50699
|
}
|
|
50668
50700
|
else {
|
|
50669
50701
|
return undefined;
|
|
@@ -50847,6 +50879,8 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
50847
50879
|
"getSheetViewVisibleRows",
|
|
50848
50880
|
"getFrozenSheetViewRatio",
|
|
50849
50881
|
"isPositionVisible",
|
|
50882
|
+
"getAllActiveViewportsZones",
|
|
50883
|
+
"getRect",
|
|
50850
50884
|
];
|
|
50851
50885
|
viewports = {};
|
|
50852
50886
|
/**
|
|
@@ -51234,16 +51268,27 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51234
51268
|
getVisibleRectWithoutHeaders(zone) {
|
|
51235
51269
|
const sheetId = this.getters.getActiveSheetId();
|
|
51236
51270
|
const viewportRects = this.getSubViewports(sheetId)
|
|
51237
|
-
.map((viewport) => viewport.
|
|
51271
|
+
.map((viewport) => viewport.getVisibleRect(zone))
|
|
51238
51272
|
.filter(isDefined$1);
|
|
51239
51273
|
if (viewportRects.length === 0) {
|
|
51240
51274
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
51241
51275
|
}
|
|
51242
|
-
|
|
51243
|
-
|
|
51244
|
-
|
|
51245
|
-
|
|
51246
|
-
|
|
51276
|
+
return this.recomposeRect(viewportRects);
|
|
51277
|
+
}
|
|
51278
|
+
/**
|
|
51279
|
+
* Computes the actual size and position (:Rect) of the zone on the canvas
|
|
51280
|
+
* regardless of the viewport dimensions.
|
|
51281
|
+
*/
|
|
51282
|
+
getRect(zone) {
|
|
51283
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
51284
|
+
const viewportRects = this.getSubViewports(sheetId)
|
|
51285
|
+
.map((viewport) => viewport.getFullRect(zone))
|
|
51286
|
+
.filter(isDefined$1);
|
|
51287
|
+
if (viewportRects.length === 0) {
|
|
51288
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
51289
|
+
}
|
|
51290
|
+
const rect = this.recomposeRect(viewportRects);
|
|
51291
|
+
return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
|
|
51247
51292
|
}
|
|
51248
51293
|
/**
|
|
51249
51294
|
* Returns the position of the MainViewport relatively to the start of the grid (without headers)
|
|
@@ -51257,6 +51302,10 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51257
51302
|
const y = this.getters.getRowDimensions(sheetId, ySplit).start;
|
|
51258
51303
|
return { x, y };
|
|
51259
51304
|
}
|
|
51305
|
+
getAllActiveViewportsZones() {
|
|
51306
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
51307
|
+
return this.getSubViewports(sheetId);
|
|
51308
|
+
}
|
|
51260
51309
|
// ---------------------------------------------------------------------------
|
|
51261
51310
|
// Private
|
|
51262
51311
|
// ---------------------------------------------------------------------------
|
|
@@ -51441,6 +51490,13 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51441
51490
|
const height = this.sheetViewHeight + this.gridOffsetY;
|
|
51442
51491
|
return { xRatio: offsetCorrectionX / width, yRatio: offsetCorrectionY / height };
|
|
51443
51492
|
}
|
|
51493
|
+
recomposeRect(viewportRects) {
|
|
51494
|
+
const x = Math.min(...viewportRects.map((rect) => rect.x));
|
|
51495
|
+
const y = Math.min(...viewportRects.map((rect) => rect.y));
|
|
51496
|
+
const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
|
|
51497
|
+
const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
|
|
51498
|
+
return { x, y, width, height };
|
|
51499
|
+
}
|
|
51444
51500
|
}
|
|
51445
51501
|
|
|
51446
51502
|
class HeaderPositionsUIPlugin extends UIPlugin {
|
|
@@ -57713,6 +57769,6 @@ const constants = {
|
|
|
57713
57769
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
57714
57770
|
|
|
57715
57771
|
|
|
57716
|
-
__info__.version = "17.0.
|
|
57717
|
-
__info__.date = "2025-01-
|
|
57718
|
-
__info__.hash = "
|
|
57772
|
+
__info__.version = "17.0.46";
|
|
57773
|
+
__info__.date = "2025-01-27T10:00:20.499Z";
|
|
57774
|
+
__info__.hash = "1df062c";
|